kaven-utils
Version:
Utils for Node.js.
53 lines (52 loc) • 2.17 kB
TypeScript
/********************************************************************
* @author: Kaven
* @email: kaven@wuwenkai.com
* @website: http://blog.kaven.xyz
* @file: [Kaven-Utils] /src/net/sso/KavenSSOClient.ts
* @create: 2019-02-21 11:27:41.261
* @modify: 2024-11-01 10:48:07.307
* @version: 5.4.5
* @times: 79
* @lines: 215
* @copyright: Copyright © 2019-2024 Kaven. All Rights Reserved.
* @description: [description]
* @license: [license]
********************************************************************/
import { KavenSSO, ISSOClient, ISSOParameterName, SSOAction, ISSOVerifyResult, SSOVerifyError } from "./KavenSSO.js";
export interface ISSOClientOption {
serverLoginPath?: string;
serverSSOPath?: string;
appNotifyPath?: string;
/**
* name for url query parameters
*/
parameterName?: ISSOParameterName;
/**
* token name for cookie or http header
*/
tokenName?: string;
}
export declare class KavenSSOClient extends KavenSSO {
private readonly tokenSet;
readonly AppID: string;
readonly AppHost: string;
readonly AppNotifyPath: string;
readonly ServerHost: string;
readonly ServerLoginPath: string;
readonly ServerSSOPath: string;
get ServerLoginURL(): string;
get ServerSSOURL(): string;
get AppNotifyURL(): string;
constructor(appID: string, appHost: string, serverHost: string, secret: string, options?: ISSOClientOption);
MakeSSOURL(action: SSOAction, client: ISSOClient, data?: string): Promise<string>;
MakeRedirectURL(returnTo: string, sessionID?: string): Promise<string>;
RemoveSSOParametersFromURL(url: string, ...others: string[]): string;
GetRedirectToServerURL(originalUrl: string, sessionID?: string): Promise<string>;
Verify(originalUrl: string): Promise<ISSOVerifyResult | undefined>;
VerifyClient(client: ISSOClient): Promise<true | SSOVerifyError>;
GetDataFromSSOServer<T = unknown>(url: string): Promise<T | undefined>;
/**
* @note This method will not throw an exception
*/
Logout(client: ISSOClient, notifyServer?: boolean): Promise<void>;
}