forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoidc-token-manager.d.ts
129 lines (115 loc) · 4.29 KB
/
oidc-token-manager.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
// Type definitions for oidc-token-manager
// Project: https://github.com/IdentityModel/oidc-token-manager
// Definitions by: Sławomir Rosiek <https://github.com/rosieks>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace Oidc {
class DefaultHttpRequest {
getJSON(url: string, config: any): DefaultPromise;
}
class DefaultPromise {
constructor(promise: any);
then(successCallback: (value?: any) => void, errorCallback: (reason?: any) => void): DefaultPromise;
catch(errorCallback: () => void): DefaultPromise;
}
class DefaultPromiseFactory {
resolve(value: any): DefaultPromise;
reject(reason: any): DefaultPromise;
create(callback: any): DefaultPromise;
}
interface OidcClientSettings {
request_state_key?: string;
request_state_store?: any;
load_user_profile?: boolean;
filter_protocol_claims?: boolean;
authority?: string;
response_type?: string;
}
interface OidcClient_Static {
new (settings: OidcClientSettings): OidcTokenManager;
}
interface OidcClient {
isOidc: boolean;
isOAuth: boolean;
loadMetadataAsync(): DefaultPromise;
loadX509SigningKeyAsync(): DefaultPromise;
loadUserProfile(access_token: string): DefaultPromise;
loadAuthorizationEndpoint(): void;
createTokenRequestAsync(): DefaultPromise;
createLogoutRequestAsync(id_token_hint: string): DefaultPromise;
validateIdTokenAsync(id_token: string, nonce: string, access_token: string): DefaultPromise;
validateAccessTokenAsync(id_token_contents: string, access_token: string): DefaultPromise;
validateIdTokenAndAccessTokenAsync(id_token: string, nonce: string, access_token: string): DefaultPromise;
processResponseAsync(queryString: string): DefaultPromise;
}
interface OidcTokenManagerSettings {
load_user_profile?: boolean;
persist?: boolean;
store?: Storage;
persistKey?: string;
client_id?: string;
redirect_uri?: string;
post_logout_redirect_uri?: string;
response_type?: string;
scope?: string;
authority?: string;
popup_redirect_uri?: string;
silent_redirect_uri?: string;
silent_renew?: boolean;
request_state_store?: Storage;
request_state_key?: string;
metadata?: any;
authorization_endpoint?: string;
jwks_uri?: string;
jwks?: any;
userinfo_endpoint?: string;
end_session_endpoint?: string;
}
interface PopupSettings {
features?: string;
target?: string;
}
interface OidcTokenManager_Static {
new (settings?: OidcTokenManagerSettings): OidcTokenManager;
setPromiseFactory(promiseFactory: DefaultPromiseFactory): void;
setHttpRequest(httpRequest: DefaultHttpRequest): void;
}
interface OidcToken {
profile: string;
id_token: string;
access_token: string;
expires_at: number;
scope: string;
scopes: string[];
session_state: any;
expired: boolean;
expires_in: number;
toJSON(): string;
}
interface OidcTokenManager {
profile: any;
id_token: string;
access_token: string;
expired: boolean;
expires_in: number;
expires_at: number;
scope: string;
scopes: string[];
session_state: any;
saveToken(token: OidcToken): void;
addOnTokenRemoved(cb: () => void): void;
addOnTokenObtained(cb: () => void): void;
addOnTokenExpiring(cb: () => void): void;
addOnTokenExpired(cb: () => void): void;
addOnSilentTokenRenewFailed(cb: () => void): void;
removeToken(): void;
redirectForToken(): DefaultPromise;
redirectForLogout(): DefaultPromise;
processTokenCallbackAsync(queryString?: string): DefaultPromise;
renewTokenSilentAsync(): DefaultPromise;
processTokenCallbackSilent(hash?: string): void;
openPopupForTokenAsync(popupSettings?: PopupSettings): DefaultPromise;
processTokenPopup(hash?: string): void;
}
}
declare var OidcTokenManager: Oidc.OidcTokenManager_Static;
declare var OidcClient: Oidc.OidcClient_Static;