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