@equinor/fusion-framework-module-msal 11.0.0 → 11.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +8 -5
- package/CHANGELOG.md +0 -1212
- package/docs/api-reference.md +0 -85
- package/docs/auth-code-flow.md +0 -86
- package/docs/migration-v2-to-v4.md +0 -115
- package/docs/testing.md +0 -191
- package/docs/troubleshooting.md +0 -17
- package/docs/version-management.md +0 -67
- package/src/MsalClient.interface.ts +0 -139
- package/src/MsalClient.ts +0 -326
- package/src/MsalConfigurator.ts +0 -486
- package/src/MsalProvider.interface.ts +0 -179
- package/src/MsalProvider.ts +0 -776
- package/src/MsalProxyProvider.interface.ts +0 -72
- package/src/__tests__/MsalConfigurator.test.ts +0 -222
- package/src/__tests__/MsalProvider.test.ts +0 -74
- package/src/__tests__/create-proxy-provider.test.ts +0 -77
- package/src/__tests__/mock/create-mock-user-from-token.test.ts +0 -46
- package/src/__tests__/mock/msal-mock.test.ts +0 -613
- package/src/__tests__/versioning/resolve-version.test.ts +0 -161
- package/src/create-client-log-callback.ts +0 -102
- package/src/create-proxy-provider.ts +0 -97
- package/src/index.ts +0 -48
- package/src/mock/MsalMockClient.ts +0 -618
- package/src/mock/MsalMockConfigurator.ts +0 -305
- package/src/mock/create-mock-token.ts +0 -92
- package/src/mock/create-mock-user-from-token.ts +0 -46
- package/src/mock/create-msal-mock-client.ts +0 -25
- package/src/mock/decode-jwt-segment.ts +0 -22
- package/src/mock/index.ts +0 -30
- package/src/mock/module.ts +0 -54
- package/src/module.ts +0 -142
- package/src/msal-config-schema.ts +0 -81
- package/src/static.ts +0 -38
- package/src/telemetry-config-schema.ts +0 -25
- package/src/types.ts +0 -16
- package/src/util/compare-origin.ts +0 -18
- package/src/util/normalize-uri.ts +0 -24
- package/src/util/redirect.ts +0 -19
- package/src/v2/IAuthClient.interface.ts +0 -114
- package/src/v2/Logger.ts +0 -204
- package/src/v2/MsalProvider.interface.ts +0 -102
- package/src/v2/create-proxy-client.ts +0 -195
- package/src/v2/create-proxy-provider.ts +0 -177
- package/src/v2/map-account-info.ts +0 -23
- package/src/v2/map-authentication-result.ts +0 -28
- package/src/v2/types.ts +0 -674
- package/src/v4/create-proxy-provider.ts +0 -75
- package/src/v4/index.ts +0 -13
- package/src/v4/types.ts +0 -727
- package/src/version.ts +0 -2
- package/src/versioning/VersionError.ts +0 -64
- package/src/versioning/index.ts +0 -29
- package/src/versioning/resolve-version.ts +0 -154
- package/src/versioning/types.ts +0 -60
- package/tsconfig.json +0 -18
- package/vitest.config.ts +0 -11
package/src/v2/types.ts
DELETED
|
@@ -1,674 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MSAL v2.38.4 compatible type definitions.
|
|
3
|
-
*
|
|
4
|
-
* This file contains all types required to type IPublicClientApplication
|
|
5
|
-
* from MSAL v2.38.4 to maintain backward compatibility while using MSAL v4 implementation.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import type { Logger } from './Logger.js';
|
|
9
|
-
|
|
10
|
-
// ============================================================================
|
|
11
|
-
// Basic Types
|
|
12
|
-
// ============================================================================
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Key-Value type to support queryParams, extraQueryParams and claims
|
|
16
|
-
*/
|
|
17
|
-
export type StringDict = { [key: string]: string };
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Response mode for authorization requests
|
|
21
|
-
*/
|
|
22
|
-
export type ResponseMode = 'query' | 'fragment' | 'form_post';
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Authentication scheme type
|
|
26
|
-
*/
|
|
27
|
-
export type AuthenticationScheme = 'Bearer' | 'pop' | 'ssh-cert';
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Azure Cloud Instance options
|
|
31
|
-
*/
|
|
32
|
-
export type AzureCloudInstance = 'none' | 'Public' | 'UsGov' | 'China' | 'Germany';
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Azure Cloud Options
|
|
36
|
-
*/
|
|
37
|
-
export type AzureCloudOptions = {
|
|
38
|
-
azureCloudInstance: AzureCloudInstance;
|
|
39
|
-
tenant?: string;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Store in cache options
|
|
44
|
-
*/
|
|
45
|
-
export type StoreInCache = {
|
|
46
|
-
/** Indicates whether or not the acquired accessToken will be stored in the cache */
|
|
47
|
-
accessToken?: boolean;
|
|
48
|
-
/** Indicates whether or not the acquired idToken will be stored in the cache */
|
|
49
|
-
idToken?: boolean;
|
|
50
|
-
/** Indicates whether or not the acquired refreshToken will be stored in the cache */
|
|
51
|
-
refreshToken?: boolean;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Signed HTTP Request options
|
|
56
|
-
*/
|
|
57
|
-
export type ShrOptions = {
|
|
58
|
-
header: {
|
|
59
|
-
typ?: string;
|
|
60
|
-
alg?: string;
|
|
61
|
-
kid?: string;
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
// ============================================================================
|
|
66
|
-
// Account Types
|
|
67
|
-
// ============================================================================
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* MSAL v2 compatible AccountInfo type.
|
|
71
|
-
*
|
|
72
|
-
* This type represents account information in MSAL v2 format
|
|
73
|
-
* to maintain backward compatibility while using MSAL v4 implementation.
|
|
74
|
-
*/
|
|
75
|
-
export type AccountInfo = {
|
|
76
|
-
homeAccountId: string;
|
|
77
|
-
environment: string;
|
|
78
|
-
tenantId: string;
|
|
79
|
-
username: string;
|
|
80
|
-
localAccountId: string;
|
|
81
|
-
name?: string;
|
|
82
|
-
idToken?: string;
|
|
83
|
-
idTokenClaims?: {
|
|
84
|
-
[key: string]: string | number | string[] | object | undefined | unknown;
|
|
85
|
-
};
|
|
86
|
-
nativeAccountId?: string;
|
|
87
|
-
authorityType?: string;
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
// ============================================================================
|
|
91
|
-
// Authentication Result Types
|
|
92
|
-
// ============================================================================
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* MSAL v2 compatible AuthenticationResult type.
|
|
96
|
-
*
|
|
97
|
-
* This type represents authentication results in MSAL v2 format
|
|
98
|
-
* to maintain backward compatibility while using MSAL v4 implementation.
|
|
99
|
-
*/
|
|
100
|
-
export type AuthenticationResult = {
|
|
101
|
-
authority: string;
|
|
102
|
-
uniqueId: string;
|
|
103
|
-
tenantId: string;
|
|
104
|
-
scopes: Array<string>;
|
|
105
|
-
account: AccountInfo | null;
|
|
106
|
-
idToken: string;
|
|
107
|
-
idTokenClaims: object;
|
|
108
|
-
accessToken: string;
|
|
109
|
-
fromCache: boolean;
|
|
110
|
-
expiresOn: Date | null;
|
|
111
|
-
extExpiresOn?: Date;
|
|
112
|
-
refreshOn?: Date;
|
|
113
|
-
tokenType: string;
|
|
114
|
-
correlationId: string;
|
|
115
|
-
requestId?: string;
|
|
116
|
-
state?: string;
|
|
117
|
-
familyId?: string;
|
|
118
|
-
cloudGraphHostName?: string;
|
|
119
|
-
msGraphHost?: string;
|
|
120
|
-
code?: string;
|
|
121
|
-
fromNativeBroker?: boolean;
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
// ============================================================================
|
|
125
|
-
// Request Base Types
|
|
126
|
-
// ============================================================================
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Base authentication request type
|
|
130
|
-
*/
|
|
131
|
-
export type BaseAuthRequest = {
|
|
132
|
-
authority: string;
|
|
133
|
-
correlationId: string;
|
|
134
|
-
scopes: Array<string>;
|
|
135
|
-
authenticationScheme?: AuthenticationScheme;
|
|
136
|
-
claims?: string;
|
|
137
|
-
shrClaims?: string;
|
|
138
|
-
shrNonce?: string;
|
|
139
|
-
shrOptions?: ShrOptions;
|
|
140
|
-
resourceRequestMethod?: string;
|
|
141
|
-
resourceRequestUri?: string;
|
|
142
|
-
sshJwk?: string;
|
|
143
|
-
sshKid?: string;
|
|
144
|
-
azureCloudOptions?: AzureCloudOptions;
|
|
145
|
-
requestedClaimsHash?: string;
|
|
146
|
-
maxAge?: number;
|
|
147
|
-
tokenQueryParameters?: StringDict;
|
|
148
|
-
storeInCache?: StoreInCache;
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Common authorization URL request type
|
|
153
|
-
*/
|
|
154
|
-
export type CommonAuthorizationUrlRequest = BaseAuthRequest & {
|
|
155
|
-
redirectUri: string;
|
|
156
|
-
responseMode: ResponseMode;
|
|
157
|
-
account?: AccountInfo;
|
|
158
|
-
codeChallenge?: string;
|
|
159
|
-
codeChallengeMethod?: string;
|
|
160
|
-
domainHint?: string;
|
|
161
|
-
extraQueryParameters?: StringDict;
|
|
162
|
-
extraScopesToConsent?: Array<string>;
|
|
163
|
-
loginHint?: string;
|
|
164
|
-
nonce?: string;
|
|
165
|
-
prompt?: string;
|
|
166
|
-
sid?: string;
|
|
167
|
-
state?: string;
|
|
168
|
-
nativeBroker?: boolean;
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Common silent flow request type
|
|
173
|
-
*/
|
|
174
|
-
export type CommonSilentFlowRequest = BaseAuthRequest & {
|
|
175
|
-
/** Account object to lookup the credentials */
|
|
176
|
-
account: AccountInfo;
|
|
177
|
-
/** Skip cache lookup and forces network call(s) to get fresh tokens */
|
|
178
|
-
forceRefresh: boolean;
|
|
179
|
-
/** RedirectUri registered on the app registration - only required in brokering scenarios */
|
|
180
|
-
redirectUri?: string;
|
|
181
|
-
/** Key value pairs to include on the POST body to the /token endpoint */
|
|
182
|
-
tokenBodyParameters?: StringDict;
|
|
183
|
-
/** If refresh token will expire within the configured value, consider it already expired. Used to pre-emptively invoke interaction when cached refresh token is close to expiry. */
|
|
184
|
-
refreshTokenExpirationOffsetSeconds?: number;
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Common end session request type
|
|
189
|
-
*/
|
|
190
|
-
export type CommonEndSessionRequest = {
|
|
191
|
-
correlationId: string;
|
|
192
|
-
account?: AccountInfo | null;
|
|
193
|
-
postLogoutRedirectUri?: string | null;
|
|
194
|
-
idTokenHint?: string;
|
|
195
|
-
state?: string;
|
|
196
|
-
logoutHint?: string;
|
|
197
|
-
extraQueryParameters?: StringDict;
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Common authorization code request type
|
|
202
|
-
*/
|
|
203
|
-
export type CommonAuthorizationCodeRequest = BaseAuthRequest & {
|
|
204
|
-
code: string;
|
|
205
|
-
redirectUri: string;
|
|
206
|
-
codeVerifier?: string;
|
|
207
|
-
tokenBodyParameters?: StringDict;
|
|
208
|
-
enableSpaAuthorizationCode?: boolean;
|
|
209
|
-
clientInfo?: string;
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
// ============================================================================
|
|
213
|
-
// Popup Window Types
|
|
214
|
-
// ============================================================================
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Popup window size configuration
|
|
218
|
-
*/
|
|
219
|
-
export type PopupSize = {
|
|
220
|
-
height: number;
|
|
221
|
-
width: number;
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* Popup window position configuration
|
|
226
|
-
*/
|
|
227
|
-
export type PopupPosition = {
|
|
228
|
-
top: number;
|
|
229
|
-
left: number;
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Popup configurations for setting dimensions and position of popup window
|
|
234
|
-
*/
|
|
235
|
-
export type PopupWindowAttributes = {
|
|
236
|
-
popupSize?: PopupSize;
|
|
237
|
-
popupPosition?: PopupPosition;
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
// ============================================================================
|
|
241
|
-
// Request Types
|
|
242
|
-
// ============================================================================
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Cache lookup policy for silent token requests
|
|
246
|
-
*/
|
|
247
|
-
export type CacheLookupPolicy =
|
|
248
|
-
| 0 // Default
|
|
249
|
-
| 1 // AccessToken
|
|
250
|
-
| 2 // AccessTokenAndRefreshToken
|
|
251
|
-
| 3 // RefreshToken
|
|
252
|
-
| 4 // RefreshTokenAndNetwork
|
|
253
|
-
| 5; // Skip
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* PopupRequest: Request object passed by user to retrieve a Code from the
|
|
257
|
-
* server (first leg of authorization code grant flow) with a popup window.
|
|
258
|
-
*/
|
|
259
|
-
export type PopupRequest = Partial<
|
|
260
|
-
Omit<
|
|
261
|
-
CommonAuthorizationUrlRequest,
|
|
262
|
-
| 'responseMode'
|
|
263
|
-
| 'scopes'
|
|
264
|
-
| 'codeChallenge'
|
|
265
|
-
| 'codeChallengeMethod'
|
|
266
|
-
| 'requestedClaimsHash'
|
|
267
|
-
| 'nativeBroker'
|
|
268
|
-
>
|
|
269
|
-
> & {
|
|
270
|
-
scopes: Array<string>;
|
|
271
|
-
popupWindowAttributes?: PopupWindowAttributes;
|
|
272
|
-
tokenBodyParameters?: StringDict;
|
|
273
|
-
};
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
* RedirectRequest: Request object passed by user to retrieve a Code from the
|
|
277
|
-
* server (first leg of authorization code grant flow) with a full page redirect.
|
|
278
|
-
*/
|
|
279
|
-
export type RedirectRequest = Partial<
|
|
280
|
-
Omit<
|
|
281
|
-
CommonAuthorizationUrlRequest,
|
|
282
|
-
| 'responseMode'
|
|
283
|
-
| 'scopes'
|
|
284
|
-
| 'codeChallenge'
|
|
285
|
-
| 'codeChallengeMethod'
|
|
286
|
-
| 'requestedClaimsHash'
|
|
287
|
-
| 'nativeBroker'
|
|
288
|
-
>
|
|
289
|
-
> & {
|
|
290
|
-
scopes: Array<string>;
|
|
291
|
-
redirectStartPage?: string;
|
|
292
|
-
// biome-ignore lint/suspicious/noConfusingVoidType: `void` here relies on TypeScript's special-cased "void-returning callback accepts any return value" behavior — `undefined` would break assignability of navigate functions that return a value/promise
|
|
293
|
-
onRedirectNavigate?: (url: string) => boolean | void;
|
|
294
|
-
tokenBodyParameters?: StringDict;
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* SilentRequest: Request object passed by user to retrieve tokens from the
|
|
299
|
-
* cache, renew an expired token with a refresh token, or retrieve a code (first leg of authorization code grant flow)
|
|
300
|
-
* in a hidden iframe.
|
|
301
|
-
*/
|
|
302
|
-
export type SilentRequest = Omit<
|
|
303
|
-
CommonSilentFlowRequest,
|
|
304
|
-
'authority' | 'correlationId' | 'forceRefresh' | 'account' | 'requestedClaimsHash'
|
|
305
|
-
> & {
|
|
306
|
-
redirectUri?: string;
|
|
307
|
-
extraQueryParameters?: StringDict;
|
|
308
|
-
authority?: string;
|
|
309
|
-
account?: AccountInfo;
|
|
310
|
-
correlationId?: string;
|
|
311
|
-
forceRefresh?: boolean;
|
|
312
|
-
cacheLookupPolicy?: CacheLookupPolicy;
|
|
313
|
-
prompt?: string;
|
|
314
|
-
state?: string;
|
|
315
|
-
tokenBodyParameters?: StringDict;
|
|
316
|
-
};
|
|
317
|
-
|
|
318
|
-
/**
|
|
319
|
-
* SsoSilentRequest: Request object passed by user to ssoSilent to retrieve a Code from the server
|
|
320
|
-
* (first leg of authorization code grant flow)
|
|
321
|
-
*/
|
|
322
|
-
export type SsoSilentRequest = Partial<
|
|
323
|
-
Omit<
|
|
324
|
-
CommonAuthorizationUrlRequest,
|
|
325
|
-
| 'responseMode'
|
|
326
|
-
| 'codeChallenge'
|
|
327
|
-
| 'codeChallengeMethod'
|
|
328
|
-
| 'requestedClaimsHash'
|
|
329
|
-
| 'nativeBroker'
|
|
330
|
-
>
|
|
331
|
-
> & {
|
|
332
|
-
tokenBodyParameters?: StringDict;
|
|
333
|
-
};
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* EndSessionRequest: Request object for logging out
|
|
337
|
-
*/
|
|
338
|
-
export type EndSessionRequest = Partial<Omit<CommonEndSessionRequest, 'tokenQueryParameters'>> & {
|
|
339
|
-
authority?: string;
|
|
340
|
-
// biome-ignore lint/suspicious/noConfusingVoidType: `void` here relies on TypeScript's special-cased "void-returning callback accepts any return value" behavior — `undefined` would break assignability of navigate functions that return a value/promise
|
|
341
|
-
onRedirectNavigate?: (url: string) => boolean | void;
|
|
342
|
-
};
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* EndSessionPopupRequest: Request object for logging out via popup
|
|
346
|
-
*/
|
|
347
|
-
export type EndSessionPopupRequest = Partial<
|
|
348
|
-
Omit<CommonEndSessionRequest, 'tokenQueryParameters'>
|
|
349
|
-
> & {
|
|
350
|
-
authority?: string;
|
|
351
|
-
mainWindowRedirectUri?: string;
|
|
352
|
-
popupWindowAttributes?: PopupWindowAttributes;
|
|
353
|
-
};
|
|
354
|
-
|
|
355
|
-
/**
|
|
356
|
-
* AuthorizationCodeRequest: Request object for acquiring token by code
|
|
357
|
-
*/
|
|
358
|
-
export type AuthorizationCodeRequest = Partial<
|
|
359
|
-
Omit<
|
|
360
|
-
CommonAuthorizationCodeRequest,
|
|
361
|
-
'code' | 'enableSpaAuthorizationCode' | 'requestedClaimsHash'
|
|
362
|
-
>
|
|
363
|
-
> & {
|
|
364
|
-
code?: string;
|
|
365
|
-
nativeAccountId?: string;
|
|
366
|
-
cloudGraphHostName?: string;
|
|
367
|
-
msGraphHost?: string;
|
|
368
|
-
cloudInstanceHostName?: string;
|
|
369
|
-
};
|
|
370
|
-
|
|
371
|
-
/**
|
|
372
|
-
* ClearCacheRequest: Request object for clearing cache
|
|
373
|
-
*/
|
|
374
|
-
export type ClearCacheRequest = {
|
|
375
|
-
correlationId?: string;
|
|
376
|
-
account?: AccountInfo | null;
|
|
377
|
-
};
|
|
378
|
-
|
|
379
|
-
// ============================================================================
|
|
380
|
-
// Logger Types
|
|
381
|
-
// ============================================================================
|
|
382
|
-
|
|
383
|
-
/**
|
|
384
|
-
* Log message level
|
|
385
|
-
*/
|
|
386
|
-
export enum LogLevel {
|
|
387
|
-
Error = 0,
|
|
388
|
-
Warning = 1,
|
|
389
|
-
Info = 2,
|
|
390
|
-
Verbose = 3,
|
|
391
|
-
Trace = 4,
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
/**
|
|
395
|
-
* Callback to send the messages to
|
|
396
|
-
*/
|
|
397
|
-
export type ILoggerCallback = (level: LogLevel, message: string, containsPii: boolean) => void;
|
|
398
|
-
|
|
399
|
-
/**
|
|
400
|
-
* Options for logger messages
|
|
401
|
-
*/
|
|
402
|
-
export type LoggerOptions = {
|
|
403
|
-
loggerCallback?: ILoggerCallback;
|
|
404
|
-
piiLoggingEnabled?: boolean;
|
|
405
|
-
logLevel?: LogLevel;
|
|
406
|
-
correlationId?: string;
|
|
407
|
-
};
|
|
408
|
-
|
|
409
|
-
// Re-exported from its own file to satisfy single-export-per-file while
|
|
410
|
-
// preserving this file's existing public export surface.
|
|
411
|
-
export { Logger } from './Logger.js';
|
|
412
|
-
|
|
413
|
-
// ============================================================================
|
|
414
|
-
// Performance Types
|
|
415
|
-
// ============================================================================
|
|
416
|
-
|
|
417
|
-
/**
|
|
418
|
-
* Performance event type
|
|
419
|
-
*/
|
|
420
|
-
export type PerformanceEvent = {
|
|
421
|
-
eventId?: string;
|
|
422
|
-
eventName: string;
|
|
423
|
-
correlationId?: string;
|
|
424
|
-
durationMs?: number;
|
|
425
|
-
startTimeMs?: number;
|
|
426
|
-
endTimeMs?: number;
|
|
427
|
-
[key: string]: unknown;
|
|
428
|
-
};
|
|
429
|
-
|
|
430
|
-
/**
|
|
431
|
-
* Performance callback function type
|
|
432
|
-
*/
|
|
433
|
-
export type PerformanceCallbackFunction = (events: PerformanceEvent[]) => void;
|
|
434
|
-
|
|
435
|
-
// ============================================================================
|
|
436
|
-
// Event Types
|
|
437
|
-
// ============================================================================
|
|
438
|
-
|
|
439
|
-
/**
|
|
440
|
-
* Event callback function type
|
|
441
|
-
*/
|
|
442
|
-
export type EventCallbackFunction = (message: EventMessage) => void;
|
|
443
|
-
|
|
444
|
-
/**
|
|
445
|
-
* Event message type
|
|
446
|
-
*/
|
|
447
|
-
export type EventMessage = {
|
|
448
|
-
eventType: string;
|
|
449
|
-
interactionType: string | null;
|
|
450
|
-
payload: unknown;
|
|
451
|
-
error: unknown;
|
|
452
|
-
timestamp: number;
|
|
453
|
-
};
|
|
454
|
-
|
|
455
|
-
// ============================================================================
|
|
456
|
-
// Navigation Types
|
|
457
|
-
// ============================================================================
|
|
458
|
-
|
|
459
|
-
/**
|
|
460
|
-
* API ID for telemetry
|
|
461
|
-
*/
|
|
462
|
-
export type ApiId =
|
|
463
|
-
| 861 // acquireTokenRedirect
|
|
464
|
-
| 862 // acquireTokenPopup
|
|
465
|
-
| 863 // ssoSilent
|
|
466
|
-
| 864 // acquireTokenSilent_authCode
|
|
467
|
-
| 865 // handleRedirectPromise
|
|
468
|
-
| 866 // acquireTokenByCode
|
|
469
|
-
| 61 // acquireTokenSilent_silentFlow
|
|
470
|
-
| 961 // logout
|
|
471
|
-
| 962; // logoutPopup
|
|
472
|
-
|
|
473
|
-
/**
|
|
474
|
-
* Navigation options for navigation client
|
|
475
|
-
*/
|
|
476
|
-
export type NavigationOptions = {
|
|
477
|
-
/** The Id of the API that initiated navigation */
|
|
478
|
-
apiId: ApiId;
|
|
479
|
-
/** Suggested timeout (ms) based on the configuration provided to PublicClientApplication */
|
|
480
|
-
timeout: number;
|
|
481
|
-
/** When set to true the url should not be added to the browser history */
|
|
482
|
-
noHistory: boolean;
|
|
483
|
-
};
|
|
484
|
-
|
|
485
|
-
/**
|
|
486
|
-
* Navigation client interface
|
|
487
|
-
*/
|
|
488
|
-
export interface INavigationClient {
|
|
489
|
-
/**
|
|
490
|
-
* Navigates to other pages within the same web application
|
|
491
|
-
* Return false if this doesn't cause the page to reload i.e. Client-side navigation
|
|
492
|
-
*/
|
|
493
|
-
navigateInternal(url: string, options: NavigationOptions): Promise<boolean>;
|
|
494
|
-
|
|
495
|
-
/**
|
|
496
|
-
* Navigates to other pages outside the web application i.e. the Identity Provider
|
|
497
|
-
*/
|
|
498
|
-
navigateExternal(url: string, options: NavigationOptions): Promise<boolean>;
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
// ============================================================================
|
|
502
|
-
// Token Cache Types
|
|
503
|
-
// ============================================================================
|
|
504
|
-
|
|
505
|
-
/**
|
|
506
|
-
* Token cache interface
|
|
507
|
-
*/
|
|
508
|
-
export interface ITokenCache {
|
|
509
|
-
/**
|
|
510
|
-
* API to side-load tokens to MSAL cache
|
|
511
|
-
* @returns `AuthenticationResult` for the response that was loaded.
|
|
512
|
-
*/
|
|
513
|
-
loadExternalTokens(
|
|
514
|
-
request: SilentRequest,
|
|
515
|
-
response: ExternalTokenResponse,
|
|
516
|
-
options: LoadTokenOptions,
|
|
517
|
-
): AuthenticationResult;
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
/**
|
|
521
|
-
* External token response type
|
|
522
|
-
*/
|
|
523
|
-
export type ExternalTokenResponse = {
|
|
524
|
-
access_token?: string;
|
|
525
|
-
id_token?: string;
|
|
526
|
-
refresh_token?: string;
|
|
527
|
-
expires_in?: number;
|
|
528
|
-
client_info?: string;
|
|
529
|
-
[key: string]: unknown;
|
|
530
|
-
};
|
|
531
|
-
|
|
532
|
-
/**
|
|
533
|
-
* Load token options
|
|
534
|
-
*/
|
|
535
|
-
export type LoadTokenOptions = {
|
|
536
|
-
clientInfo?: string;
|
|
537
|
-
expiresOn?: number;
|
|
538
|
-
extendedExpiresOn?: number;
|
|
539
|
-
};
|
|
540
|
-
|
|
541
|
-
// ============================================================================
|
|
542
|
-
// Configuration Types
|
|
543
|
-
// ============================================================================
|
|
544
|
-
|
|
545
|
-
/**
|
|
546
|
-
* Wrapper SKU type
|
|
547
|
-
*/
|
|
548
|
-
export type WrapperSKU = '@azure/msal-react' | '@azure/msal-angular';
|
|
549
|
-
|
|
550
|
-
/**
|
|
551
|
-
* Browser cache location
|
|
552
|
-
*/
|
|
553
|
-
export type BrowserCacheLocation = 'localStorage' | 'sessionStorage' | 'memoryStorage';
|
|
554
|
-
|
|
555
|
-
/**
|
|
556
|
-
* Browser auth options
|
|
557
|
-
*/
|
|
558
|
-
export type BrowserAuthOptions = {
|
|
559
|
-
clientId: string;
|
|
560
|
-
authority?: string;
|
|
561
|
-
knownAuthorities?: Array<string>;
|
|
562
|
-
cloudDiscoveryMetadata?: string;
|
|
563
|
-
authorityMetadata?: string;
|
|
564
|
-
redirectUri?: string;
|
|
565
|
-
postLogoutRedirectUri?: string | null;
|
|
566
|
-
navigateToLoginRequestUrl?: boolean;
|
|
567
|
-
clientCapabilities?: Array<string>;
|
|
568
|
-
protocolMode?: string;
|
|
569
|
-
OIDCOptions?: {
|
|
570
|
-
serverResponseType?: 'query' | 'fragment';
|
|
571
|
-
defaultScopes?: Array<string>;
|
|
572
|
-
};
|
|
573
|
-
azureCloudOptions?: AzureCloudOptions;
|
|
574
|
-
skipAuthorityMetadataCache?: boolean;
|
|
575
|
-
supportsNestedAppAuth?: boolean;
|
|
576
|
-
};
|
|
577
|
-
|
|
578
|
-
/**
|
|
579
|
-
* Cache options
|
|
580
|
-
*/
|
|
581
|
-
export type CacheOptions = {
|
|
582
|
-
cacheLocation?: BrowserCacheLocation | string;
|
|
583
|
-
temporaryCacheLocation?: BrowserCacheLocation | string;
|
|
584
|
-
storeAuthStateInCookie?: boolean;
|
|
585
|
-
secureCookies?: boolean;
|
|
586
|
-
cacheMigrationEnabled?: boolean;
|
|
587
|
-
claimsBasedCachingEnabled?: boolean;
|
|
588
|
-
};
|
|
589
|
-
|
|
590
|
-
/**
|
|
591
|
-
* Browser system options
|
|
592
|
-
*/
|
|
593
|
-
export type BrowserSystemOptions = {
|
|
594
|
-
loggerOptions?: LoggerOptions;
|
|
595
|
-
networkClient?: unknown;
|
|
596
|
-
navigationClient?: INavigationClient;
|
|
597
|
-
windowHashTimeout?: number;
|
|
598
|
-
iframeHashTimeout?: number;
|
|
599
|
-
loadFrameTimeout?: number;
|
|
600
|
-
navigateFrameWait?: number;
|
|
601
|
-
redirectNavigationTimeout?: number;
|
|
602
|
-
asyncPopups?: boolean;
|
|
603
|
-
allowRedirectInIframe?: boolean;
|
|
604
|
-
allowNativeBroker?: boolean;
|
|
605
|
-
nativeBrokerHandshakeTimeout?: number;
|
|
606
|
-
pollIntervalMilliseconds?: number;
|
|
607
|
-
};
|
|
608
|
-
|
|
609
|
-
/**
|
|
610
|
-
* Browser telemetry options
|
|
611
|
-
*/
|
|
612
|
-
export type BrowserTelemetryOptions = {
|
|
613
|
-
application?: {
|
|
614
|
-
appName: string;
|
|
615
|
-
appVersion: string;
|
|
616
|
-
};
|
|
617
|
-
client?: unknown;
|
|
618
|
-
};
|
|
619
|
-
|
|
620
|
-
/**
|
|
621
|
-
* Browser configuration type
|
|
622
|
-
*/
|
|
623
|
-
export type BrowserConfiguration = {
|
|
624
|
-
auth: Required<BrowserAuthOptions>;
|
|
625
|
-
cache: Required<CacheOptions>;
|
|
626
|
-
system: Required<BrowserSystemOptions>;
|
|
627
|
-
telemetry: Required<BrowserTelemetryOptions>;
|
|
628
|
-
};
|
|
629
|
-
|
|
630
|
-
// ============================================================================
|
|
631
|
-
// IPublicClientApplication Interface
|
|
632
|
-
// ============================================================================
|
|
633
|
-
|
|
634
|
-
/**
|
|
635
|
-
* IPublicClientApplication interface from MSAL v2.38.4
|
|
636
|
-
*/
|
|
637
|
-
export interface IPublicClientApplication {
|
|
638
|
-
initialize(): Promise<void>;
|
|
639
|
-
acquireTokenPopup(request: PopupRequest): Promise<AuthenticationResult>;
|
|
640
|
-
acquireTokenRedirect(request: RedirectRequest): Promise<void>;
|
|
641
|
-
acquireTokenSilent(silentRequest: SilentRequest): Promise<AuthenticationResult>;
|
|
642
|
-
acquireTokenByCode(request: AuthorizationCodeRequest): Promise<AuthenticationResult>;
|
|
643
|
-
addEventCallback(callback: EventCallbackFunction): string | null;
|
|
644
|
-
removeEventCallback(callbackId: string): void;
|
|
645
|
-
addPerformanceCallback(callback: PerformanceCallbackFunction): string;
|
|
646
|
-
removePerformanceCallback(callbackId: string): boolean;
|
|
647
|
-
enableAccountStorageEvents(): void;
|
|
648
|
-
disableAccountStorageEvents(): void;
|
|
649
|
-
getAccountByHomeId(homeAccountId: string): AccountInfo | null;
|
|
650
|
-
getAccountByLocalId(localId: string): AccountInfo | null;
|
|
651
|
-
getAccountByUsername(userName: string): AccountInfo | null;
|
|
652
|
-
getAllAccounts(): AccountInfo[];
|
|
653
|
-
handleRedirectPromise(hash?: string): Promise<AuthenticationResult | null>;
|
|
654
|
-
loginPopup(request?: PopupRequest): Promise<AuthenticationResult>;
|
|
655
|
-
loginRedirect(request?: RedirectRequest): Promise<void>;
|
|
656
|
-
logout(logoutRequest?: EndSessionRequest): Promise<void>;
|
|
657
|
-
logoutRedirect(logoutRequest?: EndSessionRequest): Promise<void>;
|
|
658
|
-
logoutPopup(logoutRequest?: EndSessionPopupRequest): Promise<void>;
|
|
659
|
-
ssoSilent(request: SsoSilentRequest): Promise<AuthenticationResult>;
|
|
660
|
-
getTokenCache(): ITokenCache;
|
|
661
|
-
getLogger(): Logger;
|
|
662
|
-
setLogger(logger: Logger): void;
|
|
663
|
-
setActiveAccount(account: AccountInfo | null): void;
|
|
664
|
-
getActiveAccount(): AccountInfo | null;
|
|
665
|
-
initializeWrapperLibrary(sku: WrapperSKU, version: string): void;
|
|
666
|
-
setNavigationClient(navigationClient: INavigationClient): void;
|
|
667
|
-
/** @internal */
|
|
668
|
-
getConfiguration(): BrowserConfiguration;
|
|
669
|
-
hydrateCache(
|
|
670
|
-
result: AuthenticationResult,
|
|
671
|
-
request: SilentRequest | SsoSilentRequest | RedirectRequest | PopupRequest,
|
|
672
|
-
): Promise<void>;
|
|
673
|
-
clearCache(logoutRequest?: ClearCacheRequest): Promise<void>;
|
|
674
|
-
}
|