UNPKG

@betha-plataforma/oauth

Version:

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

31 lines (30 loc) 1.05 kB
import { OAuthApplication } from './OAuthApplication'; export interface OAuthMonitorOptions { readonly app: OAuthApplication; readonly interval: number; } export interface OAuthMonitorEventHandlers { readonly onSessionChanged?: () => void; readonly onSessionEnded?: () => void; readonly onSessionRestablished?: () => void; } export declare class OAuthMonitor { private readonly app; private readonly interval; private readonly handlers; private session; private frame; private timer; private isRunning; private currentStat; private usersChanged; constructor({ app, interval }: OAuthMonitorOptions, { onSessionChanged, onSessionEnded, onSessionRestablished, }: OAuthMonitorEventHandlers); readonly start: () => Promise<void>; readonly stop: () => void; readonly checkSession: () => void; private readonly handleMessage; private readonly handleUnchanged; private readonly handleChangedSameStatus; private readonly handleChanged; private readonly isSameUser; }