New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

egg-kauth

Package Overview
Dependencies
Maintainers
3
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

egg-kauth - npm Package Compare versions

Comparing version 0.2.31 to 0.2.32

9

app/extend/context.d.ts
import { Context } from 'egg';
interface RawPermission {
name: string;
extendValue: string;
}
export interface KauthContext {
isPermitted: (value: string | RawPermission) => boolean;
}
declare const context: Partial<Context & KauthContext>;
declare const context: Partial<Context>;
export default context;

11

app/extend/context.js

@@ -5,3 +5,4 @@ "use strict";

const context = {
isPermitted(value) {
isPermitted(value, options) {
const checkOnly = options && options.checkOnly;
const target = new kauth_sdk_node_1.PermissionCore();

@@ -11,3 +12,5 @@ target.setParts(typeof value === 'string' ? value : value.name);

if (!permissions) {
invalid(this);
if (!checkOnly) {
invalid(this);
}
return false;

@@ -23,3 +26,5 @@ }

}
forbidden(this, JSON.stringify(value));
if (!checkOnly) {
forbidden(this, JSON.stringify(value));
}
return false;

@@ -26,0 +31,0 @@ },

@@ -6,5 +6,6 @@ "use strict";

const kauthProvider = new lib_1.KauthProvider(kauthConfig);
if (kauthConfig.mockHandler) {
const { mockHandler } = kauthConfig;
if (mockHandler) {
return async function middleware(ctx, next) {
await kauthConfig.mockHandler(ctx);
await mockHandler(ctx);
await next();

@@ -11,0 +12,0 @@ };

@@ -0,1 +1,16 @@

## [0.2.32](https://gitlab-ag.marmot-cloud.com/marmot/kauth-sdk-egg/compare/v0.2.31...v0.2.32) (2021-06-21)
### Bug Fixes
* typescript bugs ([702944a](https://gitlab-ag.marmot-cloud.com/marmot/kauth-sdk-egg/commit/702944a898fa4b484c051302500cd096a0ac4d3f))
### Features
* isPermitted 增加只校验权限,不设置 403 逻辑 ([149a866](https://gitlab-ag.marmot-cloud.com/marmot/kauth-sdk-egg/commit/149a866b01df7fd2a3fbae59ff38e4f5793ea514))
* 命名修改 ([b1f545b](https://gitlab-ag.marmot-cloud.com/marmot/kauth-sdk-egg/commit/b1f545bf1d1be818669cfe00b5f53d4d31786d8c))
## [0.2.31](https://gitlab-ag.marmot-cloud.com/marmot/kauth-sdk-egg/compare/v0.2.30...v0.2.31) (2021-06-07)

@@ -2,0 +17,0 @@

{
"name": "egg-kauth",
"version": "0.2.31",
"version": "0.2.32",
"description": "egg kauth plugin",

@@ -5,0 +5,0 @@ "eggPlugin": {

import { AuthenticationInformation } from 'kauth-sdk-node';
interface IsPermittedOptions {
checkOnly?: boolean;
}
interface RawPermission {
name: string;
extendValue: string;
}
declare module 'egg' {
interface Application {
kauth: {
isPermitted: (value: string) => (ctx: any, next: any) => Promise<void>;
isPermitted: (value: string | RawPermission) => (ctx: any, next: any) => Promise<void>;
};

@@ -12,3 +21,4 @@ }

authenticationInformation: AuthenticationInformation;
isPermitted: (value: string | RawPermission, options?: IsPermittedOptions) => boolean;
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc