kauth-sdk-node
Advanced tools
Comparing version 2.0.12-alpha.1 to 2.0.12-alpha.2
@@ -11,3 +11,3 @@ import { KauthApi } from '../common/http/kauth'; | ||
constructor(kauthApi: KauthApi); | ||
authenticate(token: string, redirectUri: string, preAuthorizationToken?: string): Promise<AuthenticationInformation>; | ||
authenticate(token: string, redirectUri: string): Promise<AuthenticationInformation>; | ||
bind(userId: number, token: string, redirectUri: string): Promise<void>; | ||
@@ -19,3 +19,3 @@ authorizeURL(callback: string, state: string, prompt?: string): Promise<string>; | ||
constructor(kauthApi: KauthApi); | ||
authenticate(token: string, redirectUri: string, preAuthorizationToken?: string): Promise<AuthenticationInformation>; | ||
authenticate(token: string, redirectUri: string): Promise<AuthenticationInformation>; | ||
bind(userId: number, token: string, redirectUri: string): Promise<void>; | ||
@@ -27,3 +27,3 @@ authorizeURL(callback: string, state: string, prompt?: string): Promise<string>; | ||
constructor(kauthApi: KauthApi); | ||
authenticate(token: string, redirectUri: string, preAuthorizationToken?: string): Promise<AuthenticationInformation>; | ||
authenticate(token: string, redirectUri: string): Promise<AuthenticationInformation>; | ||
bind(userId: number, token: string, redirectUri: string): Promise<void>; | ||
@@ -30,0 +30,0 @@ authorizeURL(callback: string, state: string, prompt?: string): Promise<string>; |
@@ -11,7 +11,6 @@ "use strict"; | ||
} | ||
async authenticate(token, redirectUri, preAuthorizationToken) { | ||
async authenticate(token, redirectUri) { | ||
const request = { | ||
code: token, | ||
redirect_uri: redirectUri, | ||
pre_authorization_token: preAuthorizationToken, | ||
}; | ||
@@ -23,3 +22,2 @@ const result = await this.kauthApi.googleAuthenticate(request); | ||
authenticationInformation.credential = result.credential; | ||
authenticationInformation.preAuthorizationAllowed = result.preAuthorizationAllowed; | ||
return authenticationInformation; | ||
@@ -43,7 +41,6 @@ } | ||
} | ||
async authenticate(token, redirectUri, preAuthorizationToken) { | ||
async authenticate(token, redirectUri) { | ||
const request = { | ||
code: token, | ||
redirect_uri: redirectUri, | ||
pre_authorization_token: preAuthorizationToken, | ||
}; | ||
@@ -55,3 +52,2 @@ const result = await this.kauthApi.moziAuthenticate(request); | ||
authenticationInformation.credential = result.credential; | ||
authenticationInformation.preAuthorizationAllowed = result.preAuthorizationAllowed; | ||
return authenticationInformation; | ||
@@ -75,7 +71,6 @@ } | ||
} | ||
async authenticate(token, redirectUri, preAuthorizationToken) { | ||
async authenticate(token, redirectUri) { | ||
const request = { | ||
code: token, | ||
redirect_uri: redirectUri, | ||
pre_authorization_token: preAuthorizationToken, | ||
}; | ||
@@ -87,3 +82,2 @@ const result = await this.kauthApi.miniprogramAuthenticate(request); | ||
authenticationInformation.credential = result.credential; | ||
authenticationInformation.preAuthorizationAllowed = result.preAuthorizationAllowed; | ||
return authenticationInformation; | ||
@@ -90,0 +84,0 @@ } |
@@ -6,3 +6,3 @@ export declare enum UserAccountType { | ||
} | ||
export declare enum PreAuthorizationIsAllowedErrorCode { | ||
export declare enum PreAuthorizationAllowedErrorCode { | ||
UserNotFound = "userNotFound", | ||
@@ -35,3 +35,3 @@ UserNotInWhitelist = "userNotInWhitelist", | ||
} & { | ||
code: PreAuthorizationIsAllowedErrorCode; | ||
code: PreAuthorizationAllowedErrorCode; | ||
reason: string; | ||
@@ -47,3 +47,2 @@ }); | ||
credential: Credential; | ||
preAuthorizationAllowed?: PreAuthorizationAllowed; | ||
} | ||
@@ -50,0 +49,0 @@ export declare class PrimaryPrincipal implements Principal { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PrimaryPrincipal = exports.PreAuthorizationIsAllowedErrorCode = exports.UserAccountType = void 0; | ||
exports.PrimaryPrincipal = exports.PreAuthorizationAllowedErrorCode = exports.UserAccountType = void 0; | ||
var UserAccountType; | ||
@@ -10,12 +10,12 @@ (function (UserAccountType) { | ||
})(UserAccountType = exports.UserAccountType || (exports.UserAccountType = {})); | ||
var PreAuthorizationIsAllowedErrorCode; | ||
(function (PreAuthorizationIsAllowedErrorCode) { | ||
PreAuthorizationIsAllowedErrorCode["UserNotFound"] = "userNotFound"; | ||
PreAuthorizationIsAllowedErrorCode["UserNotInWhitelist"] = "userNotInWhitelist"; | ||
PreAuthorizationIsAllowedErrorCode["TokenExpired"] = "tokenExpired"; | ||
PreAuthorizationIsAllowedErrorCode["TokenNotExisted"] = "tokenNotExisted"; | ||
PreAuthorizationIsAllowedErrorCode["TokenUsedUp"] = "tokenUsedUp"; | ||
})(PreAuthorizationIsAllowedErrorCode = exports.PreAuthorizationIsAllowedErrorCode || (exports.PreAuthorizationIsAllowedErrorCode = {})); | ||
var PreAuthorizationAllowedErrorCode; | ||
(function (PreAuthorizationAllowedErrorCode) { | ||
PreAuthorizationAllowedErrorCode["UserNotFound"] = "userNotFound"; | ||
PreAuthorizationAllowedErrorCode["UserNotInWhitelist"] = "userNotInWhitelist"; | ||
PreAuthorizationAllowedErrorCode["TokenExpired"] = "tokenExpired"; | ||
PreAuthorizationAllowedErrorCode["TokenNotExisted"] = "tokenNotExisted"; | ||
PreAuthorizationAllowedErrorCode["TokenUsedUp"] = "tokenUsedUp"; | ||
})(PreAuthorizationAllowedErrorCode = exports.PreAuthorizationAllowedErrorCode || (exports.PreAuthorizationAllowedErrorCode = {})); | ||
class PrimaryPrincipal { | ||
} | ||
exports.PrimaryPrincipal = PrimaryPrincipal; |
@@ -1,2 +0,2 @@ | ||
import { Principal, PrimaryPrincipal, Credential, AuthenticationInformation, PreAuthorizationAllowed } from './base'; | ||
import { Principal, PrimaryPrincipal, Credential, AuthenticationInformation } from './base'; | ||
export declare class GooglePrincipal implements Principal { | ||
@@ -21,3 +21,2 @@ sub: string; | ||
credential: GoogleCredential; | ||
preAuthorizationAllowed?: PreAuthorizationAllowed; | ||
} |
@@ -1,2 +0,2 @@ | ||
import { Principal, PrimaryPrincipal, Credential, AuthenticationInformation, PreAuthorizationAllowed } from './base'; | ||
import { Principal, PrimaryPrincipal, Credential, AuthenticationInformation } from './base'; | ||
export declare class MiniprogramPrincipal implements Principal { | ||
@@ -15,3 +15,2 @@ trustLoginId: string; | ||
credential: MiniprogramCredential; | ||
preAuthorizationAllowed?: PreAuthorizationAllowed; | ||
} |
@@ -1,2 +0,2 @@ | ||
import { Principal, PrimaryPrincipal, Credential, AuthenticationInformation, PreAuthorizationAllowed } from './base'; | ||
import { Principal, PrimaryPrincipal, Credential, AuthenticationInformation } from './base'; | ||
export declare class MoziPrincipal implements Principal { | ||
@@ -21,3 +21,2 @@ account: string; | ||
credential: MoziCredential; | ||
preAuthorizationAllowed?: PreAuthorizationAllowed; | ||
} |
@@ -1,2 +0,1 @@ | ||
import { PreAuthorizationAllowed } from '../../authenticator/base'; | ||
import { AuthenticationInformation } from '../../authenticator'; | ||
@@ -27,3 +26,2 @@ export interface KauthConfig { | ||
authHandler?: (ctx: any, sub: number) => Promise<void>; | ||
preAuthorizationCallback?: string | ((ctx: any, preAuthorizationAllowed: PreAuthorizationAllowed) => Promise<string | undefined>); | ||
mockHandler?: (ctx: any) => Promise<void>; | ||
@@ -30,0 +28,0 @@ lruMaxAge?: number; |
@@ -60,2 +60,3 @@ import { KauthConfig } from '../config/config'; | ||
token: string; | ||
description: string; | ||
}>; | ||
@@ -62,0 +63,0 @@ processPreAuthorization(data: ProcessPreAuthorizatioRequest): Promise<PreAuthorizationAllowed>; |
@@ -114,2 +114,3 @@ /// <reference types="node" /> | ||
id: number; | ||
description?: string; | ||
} | ||
@@ -120,2 +121,3 @@ export interface GetPreAuthorizationRequest extends MarmotOptions { | ||
roleExtendValue?: string; | ||
token?: string; | ||
} | ||
@@ -122,0 +124,0 @@ export interface ProcessPreAuthorizatioRequest extends MarmotOptions { |
@@ -1,2 +0,2 @@ | ||
import { PreAuthorizationAllowed, PrimaryPrincipal } from '../../../authenticator/base'; | ||
import { PrimaryPrincipal } from '../../../authenticator/base'; | ||
import { MarmotPagination } from '../tool/marmot'; | ||
@@ -33,3 +33,2 @@ export declare enum KauthPrincipalStatus { | ||
credential: KauthMoziCredential; | ||
preAuthorizationAllowed?: PreAuthorizationAllowed; | ||
} | ||
@@ -55,3 +54,2 @@ export interface KauthGooglePrincipal { | ||
credential: KauthGoogleCredential; | ||
preAuthorizationAllowed?: PreAuthorizationAllowed; | ||
} | ||
@@ -71,3 +69,2 @@ export interface KauthMiniprogramPrincipal { | ||
credential: KauthMiniprogramCredential; | ||
preAuthorizationAllowed?: PreAuthorizationAllowed; | ||
} | ||
@@ -74,0 +71,0 @@ export interface KauthPermission { |
{ | ||
"name": "kauth-sdk-node", | ||
"version": "2.0.12-alpha.1", | ||
"version": "2.0.12-alpha.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
82978
1797