export as namespace Oidc; export enum LogLevel { NONE = 0, ERROR = 1, WARN = 2, INFO = 3, DEBUG = 4 } export class Log { static readonly NONE: LogLevel; static readonly ERROR: LogLevel; static readonly WARN: LogLevel; static readonly INFO: LogLevel; static readonly DEBUG: LogLevel; static reset(): void; static level: LogLevel; static logger: any; static debug(...args: any[]): void; static info(...args: any[]): void; static warn(...args: any[]): void; static error(...args: any[]): void; } export default function random(): string; export class UrlUtility { static addQueryParam(url: string, name: string, value: string): string; static parseUrlFragment(value: any, delimiter?: string): any; } export interface ICheckSessionIFrame { load: () => Promise; start: (session_state: any) => void; stop: () => void; } export interface IEvent { addHandler: (cb: Function) => void; raise: (...params: any[]) => void; removeHandler: (cb: Function) => void; } export interface IJsonService { getJson: (url?: string, token?: string) => Promise; } export interface IMetadataService { metadataUrl: string; getMetadata(): Promise; getIssuer(): Promise; getAuthorizationEndpoint(): Promise; getUserInfoEndpoint(): Promise; getTokenEndpoint(): Promise; getCheckSessionIframe(): Promise; getEndSessionEndpoint(): Promise; getRevocationEndpoint(): Promise; getSigningKeys(): Promise; } export interface IWindow { close: () => void; navigate: (params: any) => Promise<{}>; promise: Promise<{}>; } export interface ITimer { clearInterval: (handle: number) => void; setInterval: (cb: Function, duration: number) => number; } export type TimerNowFunction = () => number; export interface ITimerEvent extends IEvent { cancel: () => void; expiration: number; init: (duration: number) => void; } export interface IAccessTokenEventsSettings { accessTokenExpiredTimer: ITimerEvent; accessTokenExpiringNotificationTime: number; accessTokenExpiringTimer: ITimerEvent; } export interface IAccessTokenEvents { addAccessTokenExpiring: (cb: Function) => void; removeAccessTokenExpiring: (cb: Function) => void; addAccessTokenExpired: (cb: Function) => void; removeAccessTokenExpired: (cb: Function) => void; load: (container: any) => void; unload: () => void; } export class ErrorResponse extends Error { constructor(thrown?: IResponseError); error: any; error_description: any; error_uri: any; state: any; } export interface INavigator { navigate?: (params: any) => Promise; prepare: (params: any) => Promise; } export type IOidcClientSettings = { authority?: string; metadataUrl?: string; metadata?: string; signingKeys?: string; client_id?: string; client_secret?: string; response_type: string; scope: string; redirect_uri?: string; post_logout_redirect_uri?: string; prompt?: string; display?: string; max_age?: number; ui_locales?: string; acr_values?: string; resource?: string; filterProtocolClaims: boolean; loadUserInfo: boolean; staleStateAge: number; clockSkew: number; stateStore: IStateStore; validator?: IResponseValidator; metadataService?: IMetadataService; extraQueryParams: any; }; export interface IResponseState { id?: string; authority?: string; client_id?: string; nonce?: string | boolean; data?: string; } export interface IResponseValidator { validateSigninResponse: (state: IResponseState, response: IResponse) => Promise; validateSignoutResponse: (state: IResponseState, response: IResponse | IResponseError) => Promise; } export interface ISilentRenewService { start: () => void; stop: () => void; } export interface IState { id: string; data?: any; created?: number; toStorageString?: () => string; } export interface IResponseError { error?: any; error_description?: any; error_uri?: any; state?: any; } export interface IResponse { expires_at: number | undefined; state: string | undefined; id_token: string; session_state: IState; access_token: string; token_type: string; scope: string; profile: any; isOpenIdConnect: boolean; } export interface IStateStore { set: (key: string, value: any) => void; remove: (key: string) => Promise; get: (key: string) => any; getAllKeys: () => Promise; } export interface IStateStoreSettings { prefix: string; store: IStorage; } export const IStateStoreSettingsLocalDefault: IStateStoreSettings; export const IStateStoreSettingsSessionDefault: IStateStoreSettings; export interface IStorage { readonly length: number; clear(): void; getItem(key: string): string | null; key(index: number): string | null; removeItem(key: string): void; setItem(key: string, value: string): void; [key: string]: any; } export interface ITokenRevocationClient { revoke: (accessToken?: string, required?: boolean) => Promise; } export const AllowedSigningAlgs: string[]; export const ProtocolClaims: string[]; export interface IClaim { alg: string; kid: string; kty: string; sub: string; } export interface IJwtTokenPayload { aud: string; exp: number; iat: string; iss: string; nbf: string; nonce?: string | boolean; sub: string; } export interface IJwtToken { header: IClaim; payload: IJwtTokenPayload; } export interface IUser { id_token: string; session_state: any; access_token: string; token_type: string; scope: string; profile: any; expires_at?: number; state: any; } export interface IUserInfoService { getClaims: (token: string) => Promise; } export interface IUserManagerEvents { load: (user: IUser, raiseEvent: boolean) => void; unload: () => void; addUserLoaded: (cb: Function) => void; removeUserLoaded: (cb: Function) => void; addUserUnloaded: (cb: Function) => void; removeUserUnloaded: (cb: Function) => void; addSilentRenewError: (cb: Function) => void; removeSilentRenewError: (cb: Function) => void; addUserSignedOut: (cb: Function) => void; removeUserSignedOut: (cb: Function) => void; addUserSessionChanged: (cb: Function) => void; removeUserSessionChanged: (cb: Function) => void; } export interface IUserManagerSettings extends IOidcClientSettings { popup_redirect_uri?: string; popup_post_logout_redirect_uri?: string; popupWindowFeatures?: string; popupWindowTarget?: string; silent_redirect_uri?: string; silentRequestTimeout?: number; automaticSilentRenew: boolean; includeIdTokenInSilentRenew: boolean; accessTokenExpiringNotificationTime: number; monitorSession: boolean; checkSessionInterval: number; stopCheckSessionOnError: boolean; revokeAccessTokenOnSignout: boolean; redirectNavigator: RedirectNavigator; popupNavigator: PopupNavigator; iframeNavigator: FrameNavigator; userStore: any; } export class Event implements IEvent { constructor(name: string); addHandler(cb: Function): void; removeHandler(cb: Function): void; raise(...params: any[]): void; } export class AccessTokenEvents implements IAccessTokenEvents { constructor(settings?: IAccessTokenEventsSettings); load(container: any): void; unload(): void; addAccessTokenExpiring(cb: Function): void; removeAccessTokenExpiring(cb: Function): void; addAccessTokenExpired(cb: Function): void; removeAccessTokenExpired(cb: Function): void; } export class UserManagerEvents extends AccessTokenEvents implements IUserManagerEvents { constructor(settings: any); load(user: IUser, raiseEvent?: boolean): void; unload(): void; addUserLoaded(cb: Function): void; removeUserLoaded(cb: Function): void; addUserUnloaded(cb: Function): void; removeUserUnloaded(cb: Function): void; addSilentRenewError(cb: Function): void; removeSilentRenewError(cb: Function): void; addUserSignedOut(cb: Function): void; removeUserSignedOut(cb: Function): void; addUserSessionChanged(cb: Function): void; removeUserSessionChanged(cb: Function): void; } export class JsonService implements IJsonService { constructor(additionalContentTypes?: string[]); getJson(url?: string, token?: string): Promise; } export class MetadataService implements IMetadataService { constructor(settings: any); readonly metadataUrl: string; getMetadata(): Promise; getIssuer(): Promise; getAuthorizationEndpoint(): Promise; getUserInfoEndpoint(): Promise; getTokenEndpoint(): Promise; getCheckSessionIframe(): Promise; getEndSessionEndpoint(): Promise; getRevocationEndpoint(): Promise; getSigningKeys(): Promise; } export class SilentRenewService implements ISilentRenewService { constructor(userManager: UserManager); start(): void; stop(): void; } export class UserInfoService implements IUserInfoService { constructor(settings: any); getClaims(token: string): Promise; } export const OidcMetadataUrlPath = '.well-known/openid-configuration'; export const DefaultResponseType = 'id_token'; export const DefaultScope = 'openid'; export const DefaultStaleStateAge: number; export const DefaultClockSkewInSeconds: number; export class OidcClientSettings implements IOidcClientSettings { constructor(settings?: IOidcClientSettings); client_id: string; readonly client_secret: string | undefined; readonly response_type: string; readonly scope: string; readonly redirect_uri: string | undefined; readonly post_logout_redirect_uri: string | undefined; readonly prompt: string | undefined; readonly display: string | undefined; readonly max_age: number | undefined; readonly ui_locales: string | undefined; readonly acr_values: string | undefined; readonly resource: string | undefined; authority: string; readonly metadataUrl: string; metadata: any; signingKeys: any; readonly filterProtocolClaims: boolean; readonly loadUserInfo: boolean; readonly staleStateAge: number; readonly clockSkew: number; readonly stateStore: IStateStore; readonly validator: IResponseValidator; readonly metadataService: IMetadataService; extraQueryParams: any; } export class UserManagerSettings extends OidcClientSettings implements IUserManagerSettings { constructor(settings?: IUserManagerSettings); readonly popup_redirect_uri: string | undefined; readonly popup_post_logout_redirect_uri: string | undefined; readonly popupWindowFeatures: string | undefined; readonly popupWindowTarget: string | undefined; readonly silent_redirect_uri: string | undefined; readonly silentRequestTimeout: number | undefined; readonly automaticSilentRenew: boolean; readonly includeIdTokenInSilentRenew: boolean; readonly accessTokenExpiringNotificationTime: number; readonly monitorSession: boolean; readonly checkSessionInterval: number; readonly stopCheckSessionOnError: boolean; readonly revokeAccessTokenOnSignout: boolean; readonly redirectNavigator: RedirectNavigator; readonly popupNavigator: PopupNavigator; readonly iframeNavigator: FrameNavigator; readonly userStore: any; } export class FrameNavigator implements INavigator { prepare(params: any): Promise; callback(url: string): Promise; } export class FrameWindow implements IWindow { constructor(params: any); static notifyParent(url: string): void; navigate(params: any): Promise<{}>; readonly promise: Promise<{}>; close(): void; } export class PopupNavigator implements INavigator { prepare(params: any[]): Promise; navigate(params: any): Promise; callback(url: string, keepOpen: boolean, delimiter: string): Promise; } export class PopupWindow implements IWindow { constructor(params: any); features: any; redirect_uri: any; target: any; static notifyOpener(url: string, keepOpen: boolean, delimiter: string): void; readonly promise: Promise<{}>; navigate(params: any): Promise<{}>; close(): void; } export class RedirectNavigator implements INavigator { prepare(): Promise; navigate(params: any): Promise; readonly url: string; } export class JoseUtil { static parseJwt(jwt: string): IJwtToken; static validateJwt( jwt: string, key: any, issuer: string, audience: string, clockSkew: number, now?: any ): Promise; static hashString(value: any, alg: any): any; static hexToBase64Url(value: any): any; } export class CheckSessionIFrame implements ICheckSessionIFrame { constructor(callback: Function, client_id: string, url: string, interval: number, stopOnError?: boolean); load(): Promise; start(session_state: any): void; stop(): void; } export class Global { static readonly location: Location; static readonly localStorage: IStorage; static readonly sessionStorage: IStorage; static readonly timer: ITimer; } export class InMemoryWebStorage implements Storage { [key: string]: any; constructor(); clear(): void; getItem(key: string): any; setItem(key: string, value: any): void; removeItem(key: string): void; readonly length: number; key(index: number): any; } export type SettingsType = OidcClientSettings | UserManagerSettings; export class OidcClient { constructor(settings: T | any); readonly _stateStore: IStateStore; readonly _validator: IResponseValidator; readonly _metadataService: IMetadataService; readonly settings: SettingsType; readonly metadataService: IMetadataService; createSigninRequest(signInRequest?: ISignInRequestMessage, stateStore?: any): Promise; processSigninResponse(url: string, stateStore?: IStateStore): Promise; createSignoutRequest(signout: any, stateStore?: IStateStore): Promise; processSignoutResponse(url: string, stateStore?: any): any; clearStaleState(stateStore: any): any; } export class ResponseValidator implements IResponseValidator { constructor(settings: any); validateSigninResponse(state: IResponseState, response: IResponse): Promise; validateSignoutResponse( state: IResponseState, response: IResponse | IResponseError ): Promise; } export class SessionMonitor { constructor(userManager: UserManager); } export interface ISignInRequestMessage { response_type?: any; scope?: any; redirect_uri?: any; data?: any; state?: any; prompt?: any; display?: any; max_age?: any; ui_locales?: any; id_token_hint?: any; login_hint?: any; acr_values?: any; resource?: any; request?: any; request_uri?: any; extraQueryParams?: any; } export class SigninRequest implements ISignInRequestMessage { constructor(inp: any); state: any; url: string; static isOidc(response_type: string): boolean; static isOAuth(response_type: string): boolean; } export class SigninResponse implements IResponse { constructor(url: string); error: string; error_description: string; error_uri: string; expires_at: number | undefined; state: string; id_token: string; session_state: IState; access_token: string; token_type: string; scope: string; profile: undefined; readonly expires_in: number | undefined; readonly expired: boolean; readonly scopes: string[]; readonly isOpenIdConnect: boolean; } export class SigninState extends State { constructor(state: IResponseState); static fromStorageString(storageString: string): SigninState; readonly nonce: any; readonly authority: any; readonly client_id: any; toStorageString(): string; } export class SignoutRequest { constructor(signout: any); state: IState; url?: string; } export class SignoutResponse implements IResponseError { constructor(url: string); error: string; error_description: string; error_uri: string; state: any; } export class State implements IState { constructor(state: IState); static fromStorageString(storageString: string): State; static clearStaleState(storage: any, age: number): any; readonly id: string; readonly data: any; readonly created: number; toStorageString(): string; } export const ITimerDefault: ITimer; export class Timer extends Event implements ITimerEvent { constructor(name: string, timer?: ITimer, nowFunc?: TimerNowFunction); readonly now: number; readonly expiration: number; init(duration: number): void; cancel(): void; } export class TokenRevocationClient implements ITokenRevocationClient { constructor(settings: any); revoke(accessToken?: string, required?: boolean): Promise; } export class User implements IUser { constructor(input: IUser); id_token: any; session_state: any; access_token: any; token_type: any; scope: any; profile: any; expires_at?: number; state: any; static fromStorageString(storageString: string): User; readonly expires_in: number | undefined; readonly expired: boolean | undefined; readonly scopes: any; toStorageString(): string; } export class UserManager extends OidcClient { constructor(settings?: any); readonly _redirectNavigator: RedirectNavigator; readonly _popupNavigator: PopupNavigator; readonly _iframeNavigator: FrameNavigator; readonly _userStore: any; readonly events: any; getUser(): any; removeUser(): any; signinRedirect(args?: any): any; signinRedirectCallback(url?: string): Promise; signinPopup(args?: any): any; signinPopupCallback(url: string): any; signinSilent(args?: any): any; signinSilentCallback(url?: string): any; querySessionStatus(args?: any): any; signoutRedirect(args?: any): any; signoutRedirectCallback(url: string): any; signoutPopup(args?: any): any; signoutPopupCallback(url: string, keepOpen: true): Promise; revokeAccessToken(): any; startSilentRenew(): void; stopSilentRenew(): void; readonly _userStoreKey: string; storeUser(user?: User): any; } export class WebStorageStateStore implements IStateStore { constructor(stateStoreSettings?: IStateStoreSettings); set(key: string, value: any): Promise; get(key: string): Promise; remove(key: string): Promise; getAllKeys(): Promise; }