UNPKG

kaven-utils

Version:

Utils for Node.js.

55 lines (54 loc) 2.25 kB
/******************************************************************** * @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: 2025-10-14 22:58:04.828 * @version: 6.1.0 * @times: 82 * @lines: 215 * @copyright: Copyright © 2019-2025 Kaven. All Rights Reserved. * @description: [description] * @license: [license] ********************************************************************/ import { ILoggingAgent } from "kaven-basic"; import { ISSOClient, ISSOParameterName, ISSOVerifyResult, KavenSSO, SSOAction, 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; Logger?: ILoggingAgent; 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>; }