UNPKG

@asgardeo/express

Version:

Express.js implementation of Asgardeo JavaScript SDK.

46 lines (45 loc) 2.58 kB
/** * Copyright (c) 2022, WSO2 Inc. (http://www.wso2.com) All Rights Reserved. * * WSO2 Inc. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except * in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import { AuthClientConfig, TokenResponse, Storage, User, OIDCEndpoints, IdToken, TokenExchangeRequestConfig, AsgardeoAuthException } from '@asgardeo/node'; import { ExpressClientConfig, UnauthenticatedCallback } from './models'; import express from 'express'; export declare class AsgardeoExpressClient { private _authClient; private _storage?; private static _clientConfig; private static _instance; private constructor(); static getInstance(config: ExpressClientConfig, storage?: Storage): AsgardeoExpressClient; static getInstance(): AsgardeoExpressClient; signIn(req: express.Request, res: express.Response, next: express.nextFunction, signInConfig?: Record<string, string | boolean>): Promise<TokenResponse>; signOut(userId: string): Promise<string>; isSignedIn(userId: string): Promise<boolean>; getIdToken(userId: string): Promise<string>; getUser(userId: string): Promise<User>; getOpenIDProviderEndpoints(): Promise<OIDCEndpoints>; getDecodedIdToken(userId?: string): Promise<IdToken>; getAccessToken(userId?: string): Promise<string>; exchangeToken(config: TokenExchangeRequestConfig, userId?: string): Promise<TokenResponse | Response>; reInitialize(config: Partial<AuthClientConfig>): Promise<void>; revokeAccessToken(userId?: string): Promise<Response>; static didSignOutFail(afterSignOutUrl: string): boolean; static isSignOutSuccessful(afterSignOutUrl: string): boolean; static protectRoute(callback: UnauthenticatedCallback): (req: express.Request, res: express.Response, next: express.nextFunction) => Promise<void>; static asgardeoExpressAuth(onSignIn: (response: TokenResponse) => void, onSignOut: () => void, onError: (exception: AsgardeoAuthException) => void): any; getStorageManager(): Promise<import("@asgardeo/node").StorageManager<import("@asgardeo/node").StrictAuthClientConfig>>; }