|
| 1 | +/* Provides a namespace for when the library is loaded outside a module loader environment */ |
| 2 | +export as namespace Oidc; |
| 3 | + |
| 4 | +export interface Logger { |
| 5 | + error(message?: any, ...optionalParams: any[]): void; |
| 6 | + info(message?: any, ...optionalParams: any[]): void; |
| 7 | + debug(message?: any, ...optionalParams: any[]): void; |
| 8 | + warn(message?: any, ...optionalParams: any[]): void; |
| 9 | +} |
| 10 | + |
| 11 | +export interface AccessTokenEvents { |
| 12 | + |
| 13 | + load(container: User): void; |
| 14 | + |
| 15 | + unload(): void; |
| 16 | + |
| 17 | + addAccessTokenExpiring(callback: (...ev: any[]) => void): void; |
| 18 | + removeAccessTokenExpiring(callback: (...ev: any[]) => void): void; |
| 19 | + |
| 20 | + addAccessTokenExpired(callback: (...ev: any[]) => void): void; |
| 21 | + removeAccessTokenExpired(callback: (...ev: any[]) => void): void; |
| 22 | +} |
| 23 | + |
| 24 | +export class InMemoryWebStorage { |
| 25 | + getItem(key: string): any; |
| 26 | + |
| 27 | + setItem(key: string, value: any): any; |
| 28 | + |
| 29 | + removeItem(key: string): any; |
| 30 | + |
| 31 | + key(index: number): any; |
| 32 | + |
| 33 | + length?: number; |
| 34 | +} |
| 35 | + |
| 36 | +export class Log { |
| 37 | + static readonly NONE: number; |
| 38 | + static readonly ERROR: number; |
| 39 | + static readonly WARN: number; |
| 40 | + static readonly INFO: number; |
| 41 | + static readonly DEBUG: number; |
| 42 | + |
| 43 | + static reset(): void; |
| 44 | + |
| 45 | + static level: number; |
| 46 | + |
| 47 | + static logger: Logger; |
| 48 | + |
| 49 | + static debug(message?: any, ...optionalParams: any[]): void; |
| 50 | + static info(message?: any, ...optionalParams: any[]): void; |
| 51 | + static warn(message?: any, ...optionalParams: any[]): void; |
| 52 | + static error(message?: any, ...optionalParams: any[]): void; |
| 53 | +} |
| 54 | + |
| 55 | +export interface MetadataService { |
| 56 | + new (settings: OidcClientSettings): MetadataService; |
| 57 | + |
| 58 | + metadataUrl?: string; |
| 59 | + |
| 60 | + getMetadata(): Promise<any>; |
| 61 | + |
| 62 | + getIssuer(): Promise<string>; |
| 63 | + |
| 64 | + getAuthorizationEndpoint(): Promise<string>; |
| 65 | + |
| 66 | + getUserInfoEndpoint(): Promise<string>; |
| 67 | + |
| 68 | + getTokenEndpoint(): Promise<string | undefined>; |
| 69 | + |
| 70 | + getCheckSessionIframe(): Promise<string | undefined>; |
| 71 | + |
| 72 | + getEndSessionEndpoint(): Promise<string | undefined>; |
| 73 | + |
| 74 | + getRevocationEndpoint(): Promise<string | undefined>; |
| 75 | + |
| 76 | + getSigningKeys(): Promise<any[]>; |
| 77 | +} |
| 78 | + |
| 79 | +export interface MetadataServiceCtor { |
| 80 | + (settings: OidcClientSettings, jsonServiceCtor?: any): MetadataService; |
| 81 | +} |
| 82 | + |
| 83 | +export interface ResponseValidator { |
| 84 | + validateSigninResponse(state: any, response: any): Promise<any>; |
| 85 | + validateSignoutResponse(state: any, response: any): Promise<any>; |
| 86 | +} |
| 87 | + |
| 88 | +export interface ResponseValidatorCtor { |
| 89 | + (settings: OidcClientSettings, metadataServiceCtor?: MetadataServiceCtor, userInfoServiceCtor?: any): ResponseValidator; |
| 90 | +} |
| 91 | + |
| 92 | +export interface SigninRequest { |
| 93 | + url: string; |
| 94 | + state: any; |
| 95 | +} |
| 96 | + |
| 97 | +export interface SignoutRequest { |
| 98 | + url: string; |
| 99 | + state?: any; |
| 100 | +} |
| 101 | + |
| 102 | +export class OidcClient { |
| 103 | + constructor(settings: OidcClientSettings); |
| 104 | + |
| 105 | + createSigninRequest(args?: any): Promise<SigninRequest>; |
| 106 | + processSigninResponse(): Promise<any>; |
| 107 | + |
| 108 | + createSignoutRequest(args?: any): Promise<SignoutRequest>; |
| 109 | + processSignoutResponse(): Promise<any>; |
| 110 | + |
| 111 | + clearStaleState(stateStore: StateStore): Promise<any>; |
| 112 | +} |
| 113 | + |
| 114 | +export interface OidcClientSettings { |
| 115 | + authority?: string; |
| 116 | + metadataUrl?: string; |
| 117 | + metadata?: any; |
| 118 | + signingKeys?: any[]; |
| 119 | + client_id?: string; |
| 120 | + response_type?: string; |
| 121 | + scope?: string; |
| 122 | + redirect_uri?: string; |
| 123 | + post_logout_redirect_uri?: string; |
| 124 | + popup_post_logout_redirect_uri?: string; |
| 125 | + prompt?: string; |
| 126 | + display?: string; |
| 127 | + max_age?: number; |
| 128 | + ui_locales?: string; |
| 129 | + acr_values?: string; |
| 130 | + filterProtocolClaims?: boolean; |
| 131 | + loadUserInfo?: boolean; |
| 132 | + staleStateAge?: number; |
| 133 | + clockSkew?: number; |
| 134 | + stateStore?: StateStore; |
| 135 | + ResponseValidatorCtor?: ResponseValidatorCtor; |
| 136 | + MetadataServiceCtor?: MetadataServiceCtor; |
| 137 | +} |
| 138 | + |
| 139 | +export class UserManager extends OidcClient { |
| 140 | + constructor(settings: UserManagerSettings); |
| 141 | + |
| 142 | + clearStaleState(): Promise<void>; |
| 143 | + |
| 144 | + getUser(): Promise<User>; |
| 145 | + removeUser(): Promise<void>; |
| 146 | + |
| 147 | + signinPopup(args?: any): Promise<User>; |
| 148 | + signinPopupCallback(url?: string): Promise<any>; |
| 149 | + |
| 150 | + signinSilent(args?: any): Promise<User>; |
| 151 | + signinSilentCallback(url?: string): Promise<any>; |
| 152 | + |
| 153 | + signinRedirect(args?: any): Promise<any>; |
| 154 | + signinRedirectCallback(url?: string): Promise<User>; |
| 155 | + |
| 156 | + signoutRedirect(args?: any): Promise<any>; |
| 157 | + signoutRedirectCallback(url?: string): Promise<any>; |
| 158 | + |
| 159 | + signoutPopup(args?: any): Promise<any>; |
| 160 | + signoutPopupCallback(url?: string, keepOpen?: boolean): Promise<void>; |
| 161 | + signoutPopupCallback(keepOpen?: boolean): Promise<void>; |
| 162 | + |
| 163 | + querySessionStatus(args?: any): Promise<any>; |
| 164 | + |
| 165 | + events: UserManagerEvents; |
| 166 | +} |
| 167 | + |
| 168 | +export interface UserManagerEvents extends AccessTokenEvents { |
| 169 | + load(user: User): any; |
| 170 | + unload(): any; |
| 171 | + |
| 172 | + addUserLoaded(callback: (...ev: any[]) => void): void; |
| 173 | + removeUserLoaded(callback: (...ev: any[]) => void): void; |
| 174 | + |
| 175 | + addUserUnloaded(callback: (...ev: any[]) => void): void; |
| 176 | + removeUserUnloaded(callback: (...ev: any[]) => void): void; |
| 177 | + |
| 178 | + addSilentRenewError(callback: (...ev: any[]) => void): void; |
| 179 | + removeSilentRenewError(callback: (...ev: any[]) => void): void; |
| 180 | + |
| 181 | + addUserSignedOut(callback: (...ev: any[]) => void): void; |
| 182 | + removeUserSignedOut(callback: (...ev: any[]) => void): void; |
| 183 | +} |
| 184 | + |
| 185 | +export interface UserManagerSettings extends OidcClientSettings { |
| 186 | + popup_redirect_uri?: string; |
| 187 | + popupWindowFeatures?: string; |
| 188 | + popupWindowTarget?: any; |
| 189 | + silent_redirect_uri?: any; |
| 190 | + silentRequestTimeout?: any; |
| 191 | + automaticSilentRenew?: any; |
| 192 | + monitorSession?: any; |
| 193 | + checkSessionInterval?: any; |
| 194 | + revokeAccessTokenOnSignout?: any; |
| 195 | + accessTokenExpiringNotificationTime?: number; |
| 196 | + redirectNavigator?: any; |
| 197 | + popupNavigator?: any; |
| 198 | + iframeNavigator?: any; |
| 199 | + userStore?: any; |
| 200 | +} |
| 201 | + |
| 202 | +export interface WebStorageStateStoreSettings { |
| 203 | + prefix?: string; |
| 204 | + store?: any; |
| 205 | +} |
| 206 | + |
| 207 | +export interface StateStore { |
| 208 | + set(key: string, value: any): Promise<void>; |
| 209 | + |
| 210 | + get(key: string): Promise<any>; |
| 211 | + |
| 212 | + remove(key: string): Promise<any>; |
| 213 | + |
| 214 | + getAllKeys(): Promise<string[]>; |
| 215 | +} |
| 216 | + |
| 217 | +export class WebStorageStateStore implements StateStore { |
| 218 | + constructor(settings: WebStorageStateStoreSettings); |
| 219 | + |
| 220 | + set(key: string, value: any): Promise<void>; |
| 221 | + |
| 222 | + get(key: string): Promise<any>; |
| 223 | + |
| 224 | + remove(key: string): Promise<any>; |
| 225 | + |
| 226 | + getAllKeys(): Promise<string[]>; |
| 227 | +} |
| 228 | + |
| 229 | +export interface User { |
| 230 | + id_token: string; |
| 231 | + session_state: any; |
| 232 | + access_token: string; |
| 233 | + token_type: string; |
| 234 | + scope: string; |
| 235 | + profile: any; |
| 236 | + expires_at: number; |
| 237 | + state: any; |
| 238 | + toStorageString(): string; |
| 239 | + |
| 240 | + readonly expires_in: number | undefined; |
| 241 | + readonly expired: boolean | undefined; |
| 242 | + readonly scopes: string[]; |
| 243 | +} |
| 244 | + |
| 245 | +export class CordovaPopupWindow { |
| 246 | + constructor(params: any); |
| 247 | + navigate(params: any): Promise<any>; |
| 248 | + promise: Promise<any>; |
| 249 | +} |
| 250 | + |
| 251 | +export class CordovaPopupNavigator { |
| 252 | + prepare(params: any): Promise<CordovaPopupWindow>; |
| 253 | +} |
| 254 | + |
| 255 | +export class CordovaIFrameNavigator { |
| 256 | + prepare(params: any): Promise<CordovaPopupWindow>; |
| 257 | +} |
0 commit comments