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

kauth-sdk-node

Package Overview
Dependencies
Maintainers
3
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kauth-sdk-node - npm Package Compare versions

Comparing version 0.1.7 to 0.1.8

4

CHANGELOG.md

@@ -0,1 +1,5 @@

## [0.1.8](https://gitlab-ag.marmot-cloud.com/marmot/kauth-sdk-node/compare/v0.1.7...v0.1.8) (2021-01-08)
## [0.1.7](https://gitlab-ag.marmot-cloud.com/marmot/kauth-sdk-node/compare/v0.1.6...v0.1.7) (2020-12-29)

@@ -2,0 +6,0 @@

2

dist/authenticator/index.d.ts
export { GoogleAuthenticator, MoziAuthenticator, MiniprogramAuthenticator } from './authenticator';
export { AuthenticationInformation } from './base';
export { JsonWebTokenAuthenticationProvider } from './provider';
export { JsonWebTokenSubjectProvider, JsonWebTokenAuthenticationProvider } from './provider';

@@ -8,2 +8,3 @@ "use strict";

var provider_1 = require("./provider");
Object.defineProperty(exports, "JsonWebTokenSubjectProvider", { enumerable: true, get: function () { return provider_1.JsonWebTokenSubjectProvider; } });
Object.defineProperty(exports, "JsonWebTokenAuthenticationProvider", { enumerable: true, get: function () { return provider_1.JsonWebTokenAuthenticationProvider; } });

@@ -8,4 +8,4 @@ "use strict";

const miniprogram_1 = require("./miniprogram");
const Sub = "sub";
const Provider = "provider";
const Sub = 'sub';
const Provider = 'provider';
var ProviderType;

@@ -45,3 +45,3 @@ (function (ProviderType) {

}
throw new Error("unkown provider for jwt " + claims[Sub]);
throw new Error('unkown provider for jwt ' + claims[Sub]);
}

@@ -48,0 +48,0 @@ }

@@ -1,4 +0,7 @@

import { AuthenticationInformation } from "./base";
import { KauthApi } from "../common/http/kauth";
import { KauthConfig } from "../common/config/config";
import { AuthenticationInformation } from './base';
import { KauthApi } from '../common/http/kauth';
import { KauthConfig } from '../common/config/config';
export interface SubjectProvider {
verify(token: string): Promise<number>;
}
export interface AuthenticationProvider {

@@ -8,2 +11,7 @@ verify(token: string): Promise<AuthenticationInformation>;

}
export declare class JsonWebTokenSubjectProvider implements SubjectProvider {
private secret;
constructor(kauthConfig: KauthConfig);
verify(token: string): Promise<number>;
}
export declare class JsonWebTokenAuthenticationProvider implements AuthenticationProvider {

@@ -10,0 +18,0 @@ private authenticationInfoManager;

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.JsonWebTokenAuthenticationProvider = void 0;
exports.JsonWebTokenAuthenticationProvider = exports.JsonWebTokenSubjectProvider = void 0;
const dayjs_1 = __importDefault(require("dayjs"));

@@ -12,2 +12,18 @@ const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));

const Exp = 'exp';
const Sub = 'sub';
class JsonWebTokenSubjectProvider {
constructor(kauthConfig) {
this.secret = kauthConfig.jwtSecret;
}
async verify(token) {
try {
const claims = jsonwebtoken_1.default.verify(token, this.secret);
return parseInt(claims[Sub], 10);
}
catch (error) {
return null;
}
}
}
exports.JsonWebTokenSubjectProvider = JsonWebTokenSubjectProvider;
class JsonWebTokenAuthenticationProvider {

@@ -14,0 +30,0 @@ constructor(kauthApi, kauthConfig) {

@@ -21,3 +21,4 @@ import { AuthenticationInformation } from '../../authenticator';

logoutRedirectUri?: string;
authenticationInformationHandler?: (ctx: any, authInfo: AuthenticationInformation) => void;
loginHandler?: (ctx: any, authInfo: AuthenticationInformation) => void;
authHandler?: (ctx: any, sub: number) => void;
marmotTenantId?: number;

@@ -24,0 +25,0 @@ marmotAccessKeyId?: string;

export { KauthConfig } from './common/config/config';
export { KauthApi } from './common/http/kauth';
export { KflowApi } from './common/http/kflow';
export { GoogleAuthenticator, MoziAuthenticator, MiniprogramAuthenticator, AuthenticationInformation, JsonWebTokenAuthenticationProvider } from './authenticator';
export { GoogleAuthenticator, MoziAuthenticator, MiniprogramAuthenticator, AuthenticationInformation, JsonWebTokenSubjectProvider, JsonWebTokenAuthenticationProvider, } from './authenticator';
export { MoziAuthenticationInformation, MoziPrincipal } from './authenticator/mozi';

@@ -6,0 +6,0 @@ export { GoogleAuthenticationInformation, GooglePrincipal } from './authenticator/google';

@@ -11,2 +11,3 @@ "use strict";

Object.defineProperty(exports, "MiniprogramAuthenticator", { enumerable: true, get: function () { return authenticator_1.MiniprogramAuthenticator; } });
Object.defineProperty(exports, "JsonWebTokenSubjectProvider", { enumerable: true, get: function () { return authenticator_1.JsonWebTokenSubjectProvider; } });
Object.defineProperty(exports, "JsonWebTokenAuthenticationProvider", { enumerable: true, get: function () { return authenticator_1.JsonWebTokenAuthenticationProvider; } });

@@ -13,0 +14,0 @@ var mozi_1 = require("./authenticator/mozi");

{
"name": "kauth-sdk-node",
"version": "0.1.7",
"version": "0.1.8",
"description": "",

@@ -43,4 +43,8 @@ "main": "dist/index.js",

"eslint": "^7.5.0",
"eslint-config-prettier": "^7.1.0",
"eslint-plugin-prettier": "^3.3.1",
"lint-staged": "^10.5.3",
"mocha": "^8.0.1",
"nyc": "^15.1.0",
"prettier": "^2.2.1",
"sinon": "^9.0.2",

@@ -67,3 +71,14 @@ "ts-node": "^8.10.2",

"instrument": true
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.ts": [
"prettier --write",
"eslint --fix"
]
}
}
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