UNPKG

@betha-plataforma/oauth

Version:

Biblioteca JavaScript para lidar com o fluxo do OAuth 2.0 em aplicações Web, com suporte a TypeScript.

30 lines (29 loc) 1.12 kB
import { UserInfoResponse } from './Api'; import { AuthSession } from './Api/Session'; import { OAuthConfig } from './OAuthConfig'; export declare type ExtraConfigs = { 'redirect_uri'?: string; 'context_config'?: string; 'context_entity'?: string; 'sso'?: 'govbr'; }; export declare class OAuthApplication { readonly config: OAuthConfig; private readonly flow; private readonly api; private readonly storage; private readonly lastPageStore; private readonly sessionStore; private readonly userStore; constructor(config: OAuthConfig); readonly login: (anonymous?: boolean, configs?: ExtraConfigs) => Promise<void>; readonly logout: (end_session_endpoint?: string) => Promise<void>; readonly invalidateSession: () => void; readonly silentRefresh: (anonymous?: boolean) => Promise<UserInfoResponse>; readonly getUser: () => UserInfoResponse; readonly getSession: () => AuthSession; readonly handleCallback: () => Promise<void>; readonly hasActiveSession: () => boolean; private readonly establishUserSession; private readonly loadUser; }