@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/v4/types.ts
DELETED
|
@@ -1,727 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MSAL v4/v5 compatible type definitions.
|
|
3
|
-
*
|
|
4
|
-
* @remarks
|
|
5
|
-
* This file contains explicit type snapshots from MSAL v5 (browser 5.0.2, common 15.14.1)
|
|
6
|
-
* to provide a stable v4 compatibility layer. These types are frozen snapshots to prevent
|
|
7
|
-
* breaking changes from future MSAL versions automatically propagating to v4 consumers.
|
|
8
|
-
*
|
|
9
|
-
* Since MSAL v4 and v5 are API compatible, these types directly match the v5 API surface.
|
|
10
|
-
*
|
|
11
|
-
* @module v4/types
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
// ============================================================================
|
|
15
|
-
// Framework Types
|
|
16
|
-
// ============================================================================
|
|
17
|
-
|
|
18
|
-
export type {
|
|
19
|
-
IMsalClient,
|
|
20
|
-
AcquireTokenResult,
|
|
21
|
-
LoginOptions,
|
|
22
|
-
LogoutOptions,
|
|
23
|
-
LoginResult,
|
|
24
|
-
AcquireTokenOptions,
|
|
25
|
-
AuthBehavior,
|
|
26
|
-
} from '../MsalClient.interface';
|
|
27
|
-
|
|
28
|
-
export type { IMsalProvider } from '../MsalProvider.interface';
|
|
29
|
-
export type { IProxyProvider } from '../MsalProxyProvider.interface';
|
|
30
|
-
|
|
31
|
-
// ============================================================================
|
|
32
|
-
// Basic Types
|
|
33
|
-
// ============================================================================
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Key-Value type to support queryParams, extraQueryParameters and claims
|
|
37
|
-
*/
|
|
38
|
-
export type StringDict = { [key: string]: string };
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Response mode for authorization requests
|
|
42
|
-
*/
|
|
43
|
-
export type ResponseMode = 'query' | 'fragment' | 'form_post';
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Authentication scheme type
|
|
47
|
-
*/
|
|
48
|
-
export type AuthenticationScheme = 'Bearer' | 'pop' | 'ssh-cert';
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Data boundary type for account
|
|
52
|
-
*/
|
|
53
|
-
export type DataBoundary = 'EU' | 'None';
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Azure Cloud Instance options
|
|
57
|
-
*/
|
|
58
|
-
export type AzureCloudInstance =
|
|
59
|
-
| 0 // None
|
|
60
|
-
| 1 // AzurePublic
|
|
61
|
-
| 2 // AzurePPE
|
|
62
|
-
| 3 // AzureChina
|
|
63
|
-
| 4 // AzureGermany
|
|
64
|
-
| 5; // AzureUsGovernment
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Azure Cloud Options
|
|
68
|
-
*/
|
|
69
|
-
export type AzureCloudOptions = {
|
|
70
|
-
azureCloudInstance: AzureCloudInstance;
|
|
71
|
-
tenant?: string;
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
// ============================================================================
|
|
75
|
-
// Token Claims Types
|
|
76
|
-
// ============================================================================
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Type which describes Id Token claims known by MSAL.
|
|
80
|
-
*/
|
|
81
|
-
export type TokenClaims = {
|
|
82
|
-
/** Audience */
|
|
83
|
-
aud?: string;
|
|
84
|
-
/** Issuer */
|
|
85
|
-
iss?: string;
|
|
86
|
-
/** Issued at */
|
|
87
|
-
iat?: number;
|
|
88
|
-
/** Not valid before */
|
|
89
|
-
nbf?: number;
|
|
90
|
-
/** Immutable object identifier, this ID uniquely identifies the user across applications */
|
|
91
|
-
oid?: string;
|
|
92
|
-
/** Immutable subject identifier, this is a pairwise identifier - it is unique to a particular application ID */
|
|
93
|
-
sub?: string;
|
|
94
|
-
/** Users' tenant or '9188040d-6c67-4c5b-b112-36a304b66dad' for personal accounts. */
|
|
95
|
-
tid?: string;
|
|
96
|
-
/** Trusted Framework Policy (B2C) The name of the policy that was used to acquire the ID token. */
|
|
97
|
-
tfp?: string;
|
|
98
|
-
/** Authentication Context Class Reference (B2C) Used only with older policies. */
|
|
99
|
-
acr?: string;
|
|
100
|
-
ver?: string;
|
|
101
|
-
upn?: string;
|
|
102
|
-
preferred_username?: string;
|
|
103
|
-
login_hint?: string;
|
|
104
|
-
/** Contains KMSI (Keep Me Signed In) status among other things */
|
|
105
|
-
signin_state?: Array<string>;
|
|
106
|
-
emails?: string[];
|
|
107
|
-
name?: string;
|
|
108
|
-
nonce?: string;
|
|
109
|
-
/** Expiration */
|
|
110
|
-
exp?: number;
|
|
111
|
-
home_oid?: string;
|
|
112
|
-
sid?: string;
|
|
113
|
-
cloud_instance_host_name?: string;
|
|
114
|
-
cnf?: {
|
|
115
|
-
kid: string;
|
|
116
|
-
};
|
|
117
|
-
x5c_ca?: string[];
|
|
118
|
-
ts?: number;
|
|
119
|
-
at?: string;
|
|
120
|
-
u?: string;
|
|
121
|
-
p?: string;
|
|
122
|
-
m?: string;
|
|
123
|
-
roles?: string[];
|
|
124
|
-
amr?: string[];
|
|
125
|
-
idp?: string;
|
|
126
|
-
auth_time?: number;
|
|
127
|
-
/** Region of the resource tenant */
|
|
128
|
-
tenant_region_scope?: string;
|
|
129
|
-
tenant_region_sub_scope?: string;
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
// ============================================================================
|
|
133
|
-
// Account Types
|
|
134
|
-
// ============================================================================
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Account details that vary across tenants for the same user
|
|
138
|
-
*/
|
|
139
|
-
export type TenantProfile = {
|
|
140
|
-
tenantId: string;
|
|
141
|
-
localAccountId: string;
|
|
142
|
-
name?: string;
|
|
143
|
-
username: string;
|
|
144
|
-
loginHint?: string;
|
|
145
|
-
/** True if this is the home tenant profile of the account, false if it's a guest tenant profile */
|
|
146
|
-
isHomeTenant?: boolean;
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* MSAL v5 AccountInfo type.
|
|
151
|
-
*
|
|
152
|
-
* Account object with the following signature:
|
|
153
|
-
* - homeAccountId - Home account identifier for this account object
|
|
154
|
-
* - environment - Entity which issued the token represented by the domain of the issuer (e.g. login.microsoftonline.com)
|
|
155
|
-
* - tenantId - Full tenant or organizational id that this account belongs to
|
|
156
|
-
* - username - preferred_username claim of the id_token that represents this account
|
|
157
|
-
* - localAccountId - Local, tenant-specific account identifer for this account object, usually used in legacy cases
|
|
158
|
-
* - name - Full name for the account, including given name and family name
|
|
159
|
-
* - idToken - raw ID token
|
|
160
|
-
* - idTokenClaims - Object contains claims from ID token
|
|
161
|
-
* - nativeAccountId - The user's native account ID
|
|
162
|
-
* - tenantProfiles - Map of tenant profile objects for each tenant that the account has authenticated with in the browser
|
|
163
|
-
* - dataBoundary - Data boundary extracted from clientInfo
|
|
164
|
-
*/
|
|
165
|
-
export type AccountInfo = {
|
|
166
|
-
homeAccountId: string;
|
|
167
|
-
environment: string;
|
|
168
|
-
tenantId: string;
|
|
169
|
-
username: string;
|
|
170
|
-
localAccountId: string;
|
|
171
|
-
loginHint?: string;
|
|
172
|
-
name?: string;
|
|
173
|
-
idToken?: string;
|
|
174
|
-
idTokenClaims?: TokenClaims & {
|
|
175
|
-
[key: string]: string | number | string[] | object | undefined | unknown;
|
|
176
|
-
};
|
|
177
|
-
nativeAccountId?: string;
|
|
178
|
-
authorityType?: string;
|
|
179
|
-
tenantProfiles?: Map<string, TenantProfile>;
|
|
180
|
-
dataBoundary?: DataBoundary;
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
// ============================================================================
|
|
184
|
-
// Authentication Result Types
|
|
185
|
-
// ============================================================================
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* MSAL v5 AuthenticationResult type.
|
|
189
|
-
*
|
|
190
|
-
* Result returned from the authority's token endpoint.
|
|
191
|
-
* - uniqueId - `oid` or `sub` claim from ID token
|
|
192
|
-
* - tenantId - `tid` claim from ID token
|
|
193
|
-
* - scopes - Scopes that are validated for the respective token
|
|
194
|
-
* - account - An account object representation of the currently signed-in user
|
|
195
|
-
* - idToken - Id token received as part of the response
|
|
196
|
-
* - idTokenClaims - MSAL-relevant ID token claims
|
|
197
|
-
* - accessToken - Access token or SSH certificate received as part of the response
|
|
198
|
-
* - fromCache - Boolean denoting whether token came from cache
|
|
199
|
-
* - expiresOn - Javascript Date object representing relative expiration of access token
|
|
200
|
-
* - extExpiresOn - Javascript Date object representing extended relative expiration of access token in case of server outage
|
|
201
|
-
* - refreshOn - Javascript Date object representing relative time until an access token must be refreshed
|
|
202
|
-
* - state - Value passed in by user in request
|
|
203
|
-
* - familyId - Family ID identifier, usually only used for refresh tokens
|
|
204
|
-
* - requestId - Request ID returned as part of the response
|
|
205
|
-
*/
|
|
206
|
-
export type AuthenticationResult = {
|
|
207
|
-
authority: string;
|
|
208
|
-
uniqueId: string;
|
|
209
|
-
tenantId: string;
|
|
210
|
-
scopes: Array<string>;
|
|
211
|
-
account: AccountInfo;
|
|
212
|
-
idToken: string;
|
|
213
|
-
idTokenClaims: object;
|
|
214
|
-
accessToken: string;
|
|
215
|
-
fromCache: boolean;
|
|
216
|
-
expiresOn: Date | null;
|
|
217
|
-
extExpiresOn?: Date;
|
|
218
|
-
refreshOn?: Date;
|
|
219
|
-
tokenType: string;
|
|
220
|
-
correlationId: string;
|
|
221
|
-
requestId?: string;
|
|
222
|
-
state?: string;
|
|
223
|
-
familyId?: string;
|
|
224
|
-
cloudGraphHostName?: string;
|
|
225
|
-
msGraphHost?: string;
|
|
226
|
-
code?: string;
|
|
227
|
-
fromNativeBroker?: boolean;
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
// ============================================================================
|
|
231
|
-
// Request Types
|
|
232
|
-
// ============================================================================
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Cache lookup policy for silent token requests
|
|
236
|
-
*/
|
|
237
|
-
export type CacheLookupPolicy =
|
|
238
|
-
| 0 // Default
|
|
239
|
-
| 1 // AccessToken
|
|
240
|
-
| 2 // AccessTokenAndRefreshToken
|
|
241
|
-
| 3 // RefreshToken
|
|
242
|
-
| 4 // RefreshTokenAndNetwork
|
|
243
|
-
| 5; // Skip
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Popup window size configuration
|
|
247
|
-
*/
|
|
248
|
-
export type PopupSize = {
|
|
249
|
-
height: number;
|
|
250
|
-
width: number;
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Popup window position configuration
|
|
255
|
-
*/
|
|
256
|
-
export type PopupPosition = {
|
|
257
|
-
top: number;
|
|
258
|
-
left: number;
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* Popup configurations for setting dimensions and position of popup window
|
|
263
|
-
*/
|
|
264
|
-
export type PopupWindowAttributes = {
|
|
265
|
-
popupSize?: PopupSize;
|
|
266
|
-
popupPosition?: PopupPosition;
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* PopupRequest: Request object passed by user to retrieve a Code from the
|
|
271
|
-
* server (first leg of authorization code grant flow) with a popup window.
|
|
272
|
-
*/
|
|
273
|
-
export type PopupRequest = {
|
|
274
|
-
scopes: Array<string>;
|
|
275
|
-
authority?: string;
|
|
276
|
-
correlationId?: string;
|
|
277
|
-
redirectUri?: string;
|
|
278
|
-
extraScopesToConsent?: Array<string>;
|
|
279
|
-
state?: string;
|
|
280
|
-
prompt?: string;
|
|
281
|
-
loginHint?: string;
|
|
282
|
-
domainHint?: string;
|
|
283
|
-
claims?: string;
|
|
284
|
-
nonce?: string;
|
|
285
|
-
extraQueryParameters?: StringDict;
|
|
286
|
-
tokenQueryParameters?: StringDict;
|
|
287
|
-
sid?: string;
|
|
288
|
-
account?: AccountInfo;
|
|
289
|
-
popupWindowAttributes?: PopupWindowAttributes;
|
|
290
|
-
authenticationScheme?: AuthenticationScheme;
|
|
291
|
-
resourceRequestMethod?: string;
|
|
292
|
-
resourceRequestUri?: string;
|
|
293
|
-
shrClaims?: string;
|
|
294
|
-
shrNonce?: string;
|
|
295
|
-
azureCloudOptions?: AzureCloudOptions;
|
|
296
|
-
maxAge?: number;
|
|
297
|
-
};
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* RedirectRequest: Request object passed by user to retrieve a Code from the
|
|
301
|
-
* server (first leg of authorization code grant flow) with a full page redirect.
|
|
302
|
-
*/
|
|
303
|
-
export type RedirectRequest = {
|
|
304
|
-
scopes: Array<string>;
|
|
305
|
-
authority?: string;
|
|
306
|
-
correlationId?: string;
|
|
307
|
-
redirectUri?: string;
|
|
308
|
-
extraScopesToConsent?: Array<string>;
|
|
309
|
-
state?: string;
|
|
310
|
-
prompt?: string;
|
|
311
|
-
loginHint?: string;
|
|
312
|
-
domainHint?: string;
|
|
313
|
-
claims?: string;
|
|
314
|
-
nonce?: string;
|
|
315
|
-
extraQueryParameters?: StringDict;
|
|
316
|
-
tokenQueryParameters?: StringDict;
|
|
317
|
-
sid?: string;
|
|
318
|
-
account?: AccountInfo;
|
|
319
|
-
redirectStartPage?: string;
|
|
320
|
-
// 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
|
|
321
|
-
onRedirectNavigate?: (url: string) => boolean | void;
|
|
322
|
-
authenticationScheme?: AuthenticationScheme;
|
|
323
|
-
resourceRequestMethod?: string;
|
|
324
|
-
resourceRequestUri?: string;
|
|
325
|
-
shrClaims?: string;
|
|
326
|
-
shrNonce?: string;
|
|
327
|
-
azureCloudOptions?: AzureCloudOptions;
|
|
328
|
-
maxAge?: number;
|
|
329
|
-
};
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* SilentRequest: Request object passed by user to retrieve tokens from the
|
|
333
|
-
* cache, renew an expired token with a refresh token, or retrieve a code (first leg of authorization code grant flow)
|
|
334
|
-
* in a hidden iframe.
|
|
335
|
-
*/
|
|
336
|
-
export type SilentRequest = {
|
|
337
|
-
scopes: Array<string>;
|
|
338
|
-
account: AccountInfo;
|
|
339
|
-
authority?: string;
|
|
340
|
-
correlationId?: string;
|
|
341
|
-
forceRefresh?: boolean;
|
|
342
|
-
redirectUri?: string;
|
|
343
|
-
extraQueryParameters?: StringDict;
|
|
344
|
-
tokenQueryParameters?: StringDict;
|
|
345
|
-
claims?: string;
|
|
346
|
-
cacheLookupPolicy?: CacheLookupPolicy;
|
|
347
|
-
authenticationScheme?: AuthenticationScheme;
|
|
348
|
-
resourceRequestMethod?: string;
|
|
349
|
-
resourceRequestUri?: string;
|
|
350
|
-
shrClaims?: string;
|
|
351
|
-
shrNonce?: string;
|
|
352
|
-
azureCloudOptions?: AzureCloudOptions;
|
|
353
|
-
maxAge?: number;
|
|
354
|
-
};
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
* SsoSilentRequest: Request object passed by user to ssoSilent to retrieve a Code from the server
|
|
358
|
-
* (first leg of authorization code grant flow)
|
|
359
|
-
*/
|
|
360
|
-
export type SsoSilentRequest = {
|
|
361
|
-
scopes?: Array<string>;
|
|
362
|
-
authority?: string;
|
|
363
|
-
correlationId?: string;
|
|
364
|
-
redirectUri?: string;
|
|
365
|
-
extraScopesToConsent?: Array<string>;
|
|
366
|
-
state?: string;
|
|
367
|
-
prompt?: string;
|
|
368
|
-
loginHint?: string;
|
|
369
|
-
domainHint?: string;
|
|
370
|
-
claims?: string;
|
|
371
|
-
nonce?: string;
|
|
372
|
-
extraQueryParameters?: StringDict;
|
|
373
|
-
tokenQueryParameters?: StringDict;
|
|
374
|
-
sid?: string;
|
|
375
|
-
account?: AccountInfo;
|
|
376
|
-
authenticationScheme?: AuthenticationScheme;
|
|
377
|
-
resourceRequestMethod?: string;
|
|
378
|
-
resourceRequestUri?: string;
|
|
379
|
-
shrClaims?: string;
|
|
380
|
-
shrNonce?: string;
|
|
381
|
-
azureCloudOptions?: AzureCloudOptions;
|
|
382
|
-
maxAge?: number;
|
|
383
|
-
};
|
|
384
|
-
|
|
385
|
-
/**
|
|
386
|
-
* EndSessionRequest: Request object for logging out
|
|
387
|
-
*/
|
|
388
|
-
export type EndSessionRequest = {
|
|
389
|
-
account?: AccountInfo | null;
|
|
390
|
-
postLogoutRedirectUri?: string | null;
|
|
391
|
-
authority?: string;
|
|
392
|
-
correlationId?: string;
|
|
393
|
-
idTokenHint?: string;
|
|
394
|
-
state?: string;
|
|
395
|
-
logoutHint?: string;
|
|
396
|
-
extraQueryParameters?: StringDict;
|
|
397
|
-
// 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
|
|
398
|
-
onRedirectNavigate?: (url: string) => boolean | void;
|
|
399
|
-
};
|
|
400
|
-
|
|
401
|
-
/**
|
|
402
|
-
* EndSessionPopupRequest: Request object for logging out via popup
|
|
403
|
-
*/
|
|
404
|
-
export type EndSessionPopupRequest = {
|
|
405
|
-
account?: AccountInfo | null;
|
|
406
|
-
postLogoutRedirectUri?: string | null;
|
|
407
|
-
authority?: string;
|
|
408
|
-
correlationId?: string;
|
|
409
|
-
idTokenHint?: string;
|
|
410
|
-
state?: string;
|
|
411
|
-
logoutHint?: string;
|
|
412
|
-
extraQueryParameters?: StringDict;
|
|
413
|
-
mainWindowRedirectUri?: string;
|
|
414
|
-
popupWindowAttributes?: PopupWindowAttributes;
|
|
415
|
-
};
|
|
416
|
-
|
|
417
|
-
/**
|
|
418
|
-
* AuthorizationCodeRequest: Request object for acquiring token by code
|
|
419
|
-
*/
|
|
420
|
-
export type AuthorizationCodeRequest = {
|
|
421
|
-
code?: string;
|
|
422
|
-
scopes?: Array<string>;
|
|
423
|
-
authority?: string;
|
|
424
|
-
correlationId?: string;
|
|
425
|
-
redirectUri?: string;
|
|
426
|
-
claims?: string;
|
|
427
|
-
authenticationScheme?: AuthenticationScheme;
|
|
428
|
-
resourceRequestMethod?: string;
|
|
429
|
-
resourceRequestUri?: string;
|
|
430
|
-
shrClaims?: string;
|
|
431
|
-
shrNonce?: string;
|
|
432
|
-
azureCloudOptions?: AzureCloudOptions;
|
|
433
|
-
maxAge?: number;
|
|
434
|
-
nativeAccountId?: string;
|
|
435
|
-
cloudGraphHostName?: string;
|
|
436
|
-
msGraphHost?: string;
|
|
437
|
-
cloudInstanceHostName?: string;
|
|
438
|
-
};
|
|
439
|
-
|
|
440
|
-
/**
|
|
441
|
-
* ClearCacheRequest: Request object for clearing cache
|
|
442
|
-
*/
|
|
443
|
-
export type ClearCacheRequest = {
|
|
444
|
-
correlationId?: string;
|
|
445
|
-
account?: AccountInfo | null;
|
|
446
|
-
};
|
|
447
|
-
|
|
448
|
-
/**
|
|
449
|
-
* InitializeApplicationRequest: Request object for initializing the application
|
|
450
|
-
*/
|
|
451
|
-
export type InitializeApplicationRequest = {
|
|
452
|
-
correlationId?: string;
|
|
453
|
-
};
|
|
454
|
-
|
|
455
|
-
// ============================================================================
|
|
456
|
-
// Logger Types
|
|
457
|
-
// ============================================================================
|
|
458
|
-
|
|
459
|
-
/**
|
|
460
|
-
* Log message level
|
|
461
|
-
*/
|
|
462
|
-
export enum LogLevel {
|
|
463
|
-
Error = 0,
|
|
464
|
-
Warning = 1,
|
|
465
|
-
Info = 2,
|
|
466
|
-
Verbose = 3,
|
|
467
|
-
Trace = 4,
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
/**
|
|
471
|
-
* Callback to send the messages to
|
|
472
|
-
*/
|
|
473
|
-
export type ILoggerCallback = (level: LogLevel, message: string, containsPii: boolean) => void;
|
|
474
|
-
|
|
475
|
-
// ============================================================================
|
|
476
|
-
// Event Types
|
|
477
|
-
// ============================================================================
|
|
478
|
-
|
|
479
|
-
/**
|
|
480
|
-
* Event callback function type
|
|
481
|
-
*/
|
|
482
|
-
export type EventCallbackFunction = (message: EventMessage) => void;
|
|
483
|
-
|
|
484
|
-
/**
|
|
485
|
-
* Event message type
|
|
486
|
-
*/
|
|
487
|
-
export type EventMessage = {
|
|
488
|
-
eventType: string;
|
|
489
|
-
interactionType: string | null;
|
|
490
|
-
payload: unknown;
|
|
491
|
-
error: unknown;
|
|
492
|
-
timestamp: number;
|
|
493
|
-
};
|
|
494
|
-
|
|
495
|
-
/**
|
|
496
|
-
* Event type enum
|
|
497
|
-
*/
|
|
498
|
-
export type EventType =
|
|
499
|
-
| 'LOGIN_START'
|
|
500
|
-
| 'LOGIN_SUCCESS'
|
|
501
|
-
| 'LOGIN_FAILURE'
|
|
502
|
-
| 'ACQUIRE_TOKEN_START'
|
|
503
|
-
| 'ACQUIRE_TOKEN_SUCCESS'
|
|
504
|
-
| 'ACQUIRE_TOKEN_FAILURE'
|
|
505
|
-
| 'ACQUIRE_TOKEN_NETWORK_START'
|
|
506
|
-
| 'SSO_SILENT_START'
|
|
507
|
-
| 'SSO_SILENT_SUCCESS'
|
|
508
|
-
| 'SSO_SILENT_FAILURE'
|
|
509
|
-
| 'HANDLE_REDIRECT_START'
|
|
510
|
-
| 'HANDLE_REDIRECT_END'
|
|
511
|
-
| 'LOGOUT_START'
|
|
512
|
-
| 'LOGOUT_SUCCESS'
|
|
513
|
-
| 'LOGOUT_FAILURE'
|
|
514
|
-
| 'LOGOUT_END'
|
|
515
|
-
| 'ACCOUNT_ADDED'
|
|
516
|
-
| 'ACCOUNT_REMOVED'
|
|
517
|
-
| 'INITIALIZE_START'
|
|
518
|
-
| 'INITIALIZE_END'
|
|
519
|
-
| 'RESTORE_FROM_BFCACHE';
|
|
520
|
-
|
|
521
|
-
// ============================================================================
|
|
522
|
-
// Performance Types
|
|
523
|
-
// ============================================================================
|
|
524
|
-
|
|
525
|
-
/**
|
|
526
|
-
* Performance event type
|
|
527
|
-
*/
|
|
528
|
-
export type PerformanceEvent = {
|
|
529
|
-
eventId?: string;
|
|
530
|
-
eventName: string;
|
|
531
|
-
correlationId?: string;
|
|
532
|
-
durationMs?: number;
|
|
533
|
-
startTimeMs?: number;
|
|
534
|
-
endTimeMs?: number;
|
|
535
|
-
[key: string]: unknown;
|
|
536
|
-
};
|
|
537
|
-
|
|
538
|
-
/**
|
|
539
|
-
* Performance callback function type
|
|
540
|
-
*/
|
|
541
|
-
export type PerformanceCallbackFunction = (events: PerformanceEvent[]) => void;
|
|
542
|
-
|
|
543
|
-
// ============================================================================
|
|
544
|
-
// Configuration Types
|
|
545
|
-
// ============================================================================
|
|
546
|
-
|
|
547
|
-
/**
|
|
548
|
-
* Protocol mode type
|
|
549
|
-
*/
|
|
550
|
-
export type ProtocolMode = 'AAD' | 'OIDC';
|
|
551
|
-
|
|
552
|
-
/**
|
|
553
|
-
* Wrapper SKU type
|
|
554
|
-
*/
|
|
555
|
-
export type WrapperSKU = '@azure/msal-react' | '@azure/msal-angular';
|
|
556
|
-
|
|
557
|
-
/**
|
|
558
|
-
* Browser cache location
|
|
559
|
-
*/
|
|
560
|
-
export type BrowserCacheLocation = 'localStorage' | 'sessionStorage' | 'memoryStorage';
|
|
561
|
-
|
|
562
|
-
/**
|
|
563
|
-
* Browser auth options
|
|
564
|
-
*/
|
|
565
|
-
export type BrowserAuthOptions = {
|
|
566
|
-
clientId: string;
|
|
567
|
-
authority?: string;
|
|
568
|
-
knownAuthorities?: Array<string>;
|
|
569
|
-
cloudDiscoveryMetadata?: string;
|
|
570
|
-
authorityMetadata?: string;
|
|
571
|
-
redirectUri?: string;
|
|
572
|
-
postLogoutRedirectUri?: string | null;
|
|
573
|
-
navigateToLoginRequestUrl?: boolean;
|
|
574
|
-
clientCapabilities?: Array<string>;
|
|
575
|
-
protocolMode?: ProtocolMode;
|
|
576
|
-
OIDCOptions?: {
|
|
577
|
-
serverResponseType?: 'query' | 'fragment';
|
|
578
|
-
defaultScopes?: Array<string>;
|
|
579
|
-
};
|
|
580
|
-
azureCloudOptions?: AzureCloudOptions;
|
|
581
|
-
skipAuthorityMetadataCache?: boolean;
|
|
582
|
-
supportsNestedAppAuth?: boolean;
|
|
583
|
-
};
|
|
584
|
-
|
|
585
|
-
/**
|
|
586
|
-
* Cache options
|
|
587
|
-
*/
|
|
588
|
-
export type CacheOptions = {
|
|
589
|
-
cacheLocation?: BrowserCacheLocation | string;
|
|
590
|
-
temporaryCacheLocation?: BrowserCacheLocation | string;
|
|
591
|
-
storeAuthStateInCookie?: boolean;
|
|
592
|
-
secureCookies?: boolean;
|
|
593
|
-
cacheMigrationEnabled?: boolean;
|
|
594
|
-
claimsBasedCachingEnabled?: boolean;
|
|
595
|
-
};
|
|
596
|
-
|
|
597
|
-
/**
|
|
598
|
-
* Logger options for configuration
|
|
599
|
-
*/
|
|
600
|
-
export type LoggerOptions = {
|
|
601
|
-
loggerCallback?: ILoggerCallback;
|
|
602
|
-
piiLoggingEnabled?: boolean;
|
|
603
|
-
logLevel?: LogLevel;
|
|
604
|
-
};
|
|
605
|
-
|
|
606
|
-
/**
|
|
607
|
-
* Navigation options for navigation client
|
|
608
|
-
*/
|
|
609
|
-
export type NavigationOptions = {
|
|
610
|
-
apiId: number;
|
|
611
|
-
timeout: number;
|
|
612
|
-
noHistory: boolean;
|
|
613
|
-
};
|
|
614
|
-
|
|
615
|
-
/**
|
|
616
|
-
* Navigation client interface
|
|
617
|
-
*/
|
|
618
|
-
export interface INavigationClient {
|
|
619
|
-
navigateInternal(url: string, options: NavigationOptions): Promise<boolean>;
|
|
620
|
-
navigateExternal(url: string, options: NavigationOptions): Promise<boolean>;
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
/**
|
|
624
|
-
* Browser system options
|
|
625
|
-
*/
|
|
626
|
-
export type BrowserSystemOptions = {
|
|
627
|
-
loggerOptions?: LoggerOptions;
|
|
628
|
-
networkClient?: unknown;
|
|
629
|
-
navigationClient?: INavigationClient;
|
|
630
|
-
windowHashTimeout?: number;
|
|
631
|
-
iframeHashTimeout?: number;
|
|
632
|
-
loadFrameTimeout?: number;
|
|
633
|
-
navigateFrameWait?: number;
|
|
634
|
-
redirectNavigationTimeout?: number;
|
|
635
|
-
asyncPopups?: boolean;
|
|
636
|
-
allowRedirectInIframe?: boolean;
|
|
637
|
-
allowNativeBroker?: boolean;
|
|
638
|
-
nativeBrokerHandshakeTimeout?: number;
|
|
639
|
-
pollIntervalMilliseconds?: number;
|
|
640
|
-
};
|
|
641
|
-
|
|
642
|
-
/**
|
|
643
|
-
* Browser telemetry options
|
|
644
|
-
*/
|
|
645
|
-
export type BrowserTelemetryOptions = {
|
|
646
|
-
application?: {
|
|
647
|
-
appName: string;
|
|
648
|
-
appVersion: string;
|
|
649
|
-
};
|
|
650
|
-
};
|
|
651
|
-
|
|
652
|
-
/**
|
|
653
|
-
* Browser configuration type
|
|
654
|
-
*/
|
|
655
|
-
export type BrowserConfiguration = {
|
|
656
|
-
auth: Required<BrowserAuthOptions>;
|
|
657
|
-
cache: Required<CacheOptions>;
|
|
658
|
-
system: Required<BrowserSystemOptions>;
|
|
659
|
-
telemetry: Required<BrowserTelemetryOptions>;
|
|
660
|
-
};
|
|
661
|
-
|
|
662
|
-
// ============================================================================
|
|
663
|
-
// Account Filter Types
|
|
664
|
-
// ============================================================================
|
|
665
|
-
|
|
666
|
-
/**
|
|
667
|
-
* Account filter type for querying accounts
|
|
668
|
-
*/
|
|
669
|
-
export type AccountFilter = {
|
|
670
|
-
homeAccountId?: string;
|
|
671
|
-
localAccountId?: string;
|
|
672
|
-
username?: string;
|
|
673
|
-
environment?: string;
|
|
674
|
-
realm?: string;
|
|
675
|
-
nativeAccountId?: string;
|
|
676
|
-
loginHint?: string;
|
|
677
|
-
tenantId?: string;
|
|
678
|
-
};
|
|
679
|
-
|
|
680
|
-
/**
|
|
681
|
-
* Handle redirect promise options
|
|
682
|
-
*/
|
|
683
|
-
export type HandleRedirectPromiseOptions = {
|
|
684
|
-
hash?: string;
|
|
685
|
-
};
|
|
686
|
-
|
|
687
|
-
// ============================================================================
|
|
688
|
-
// IPublicClientApplication Interface
|
|
689
|
-
// ============================================================================
|
|
690
|
-
|
|
691
|
-
/**
|
|
692
|
-
* IPublicClientApplication interface from MSAL v5
|
|
693
|
-
*/
|
|
694
|
-
export interface IPublicClientApplication {
|
|
695
|
-
initialize(request?: InitializeApplicationRequest): Promise<void>;
|
|
696
|
-
acquireTokenPopup(request: PopupRequest): Promise<AuthenticationResult>;
|
|
697
|
-
acquireTokenRedirect(request: RedirectRequest): Promise<void>;
|
|
698
|
-
acquireTokenSilent(silentRequest: SilentRequest): Promise<AuthenticationResult>;
|
|
699
|
-
acquireTokenByCode(request: AuthorizationCodeRequest): Promise<AuthenticationResult>;
|
|
700
|
-
addEventCallback(callback: EventCallbackFunction, eventTypes?: Array<EventType>): string | null;
|
|
701
|
-
removeEventCallback(callbackId: string): void;
|
|
702
|
-
addPerformanceCallback(callback: PerformanceCallbackFunction): string;
|
|
703
|
-
removePerformanceCallback(callbackId: string): boolean;
|
|
704
|
-
getAccount(accountFilter: AccountFilter): AccountInfo | null;
|
|
705
|
-
getAllAccounts(accountFilter?: AccountFilter): AccountInfo[];
|
|
706
|
-
handleRedirectPromise(
|
|
707
|
-
options?: HandleRedirectPromiseOptions,
|
|
708
|
-
): Promise<AuthenticationResult | null>;
|
|
709
|
-
loginPopup(request?: PopupRequest): Promise<AuthenticationResult>;
|
|
710
|
-
loginRedirect(request?: RedirectRequest): Promise<void>;
|
|
711
|
-
logoutRedirect(logoutRequest?: EndSessionRequest): Promise<void>;
|
|
712
|
-
logoutPopup(logoutRequest?: EndSessionPopupRequest): Promise<void>;
|
|
713
|
-
ssoSilent(request: SsoSilentRequest): Promise<AuthenticationResult>;
|
|
714
|
-
getLogger(): unknown;
|
|
715
|
-
setLogger(logger: unknown): void;
|
|
716
|
-
setActiveAccount(account: AccountInfo | null): void;
|
|
717
|
-
getActiveAccount(): AccountInfo | null;
|
|
718
|
-
initializeWrapperLibrary(sku: WrapperSKU, version: string): void;
|
|
719
|
-
setNavigationClient(navigationClient: INavigationClient): void;
|
|
720
|
-
/** @internal */
|
|
721
|
-
getConfiguration(): BrowserConfiguration;
|
|
722
|
-
hydrateCache(
|
|
723
|
-
result: AuthenticationResult,
|
|
724
|
-
request: SilentRequest | SsoSilentRequest | RedirectRequest | PopupRequest,
|
|
725
|
-
): Promise<void>;
|
|
726
|
-
clearCache(logoutRequest?: ClearCacheRequest): Promise<void>;
|
|
727
|
-
}
|