@azure/msal-browser 3.7.2-alpha.3 → 3.9.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/dist/app/IPublicClientApplication.mjs +1 -1
- package/dist/app/PublicClientApplication.mjs +1 -1
- package/dist/app/PublicClientNext.mjs +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs +1 -1
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
- package/dist/cache/AsyncMemoryStorage.mjs +1 -1
- package/dist/cache/BrowserCacheManager.mjs +1 -1
- package/dist/cache/BrowserStorage.mjs +1 -1
- package/dist/cache/CryptoKeyStore.mjs +1 -1
- package/dist/cache/DatabaseStorage.mjs +1 -1
- package/dist/cache/MemoryStorage.mjs +1 -1
- package/dist/cache/TokenCache.mjs +1 -1
- package/dist/config/Configuration.mjs +1 -1
- package/dist/controllers/ControllerFactory.mjs +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +1 -1
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.mjs +32 -14
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/controllers/UnknownOperatingContextController.mjs +1 -1
- package/dist/crypto/BrowserCrypto.mjs +1 -1
- package/dist/crypto/CryptoOps.mjs +1 -1
- package/dist/crypto/PkceGenerator.mjs +1 -1
- package/dist/crypto/SignedHttpRequest.mjs +1 -1
- package/dist/encode/Base64Decode.mjs +1 -1
- package/dist/encode/Base64Encode.mjs +1 -1
- package/dist/error/BrowserAuthError.mjs +1 -1
- package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
- package/dist/error/NativeAuthError.mjs +1 -1
- package/dist/error/NativeAuthErrorCodes.mjs +1 -1
- package/dist/error/NestedAppAuthError.mjs +1 -1
- package/dist/event/EventHandler.mjs +1 -1
- package/dist/event/EventMessage.mjs +1 -1
- package/dist/event/EventType.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/interaction_client/BaseInteractionClient.mjs +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts +3 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.mjs +7 -2
- package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/PopupClient.mjs +1 -1
- package/dist/interaction_client/RedirectClient.d.ts +4 -2
- package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
- package/dist/interaction_client/RedirectClient.mjs +8 -3
- package/dist/interaction_client/RedirectClient.mjs.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
- package/dist/interaction_client/SilentCacheClient.mjs +1 -1
- package/dist/interaction_client/SilentIframeClient.mjs +1 -1
- package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +1 -1
- package/dist/interaction_handler/InteractionHandler.mjs +1 -1
- package/dist/interaction_handler/RedirectHandler.mjs +1 -1
- package/dist/interaction_handler/SilentHandler.mjs +1 -1
- package/dist/naa/BridgeError.mjs +1 -1
- package/dist/naa/BridgeProxy.mjs +1 -1
- package/dist/naa/BridgeStatusCode.mjs +1 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
- package/dist/navigation/NavigationClient.mjs +1 -1
- package/dist/network/FetchClient.mjs +1 -1
- package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
- package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
- package/dist/operatingcontext/TeamsAppOperatingContext.mjs +1 -1
- package/dist/operatingcontext/UnknownOperatingContext.mjs +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.d.ts.map +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/response/ResponseHandler.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
- package/dist/utils/BrowserConstants.mjs +1 -1
- package/dist/utils/BrowserProtocolUtils.mjs +1 -1
- package/dist/utils/BrowserUtils.mjs +1 -1
- package/lib/msal-browser.cjs +113 -79
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +113 -79
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +62 -62
- package/package.json +2 -2
- package/src/controllers/StandardController.ts +61 -22
- package/src/interaction_client/NativeInteractionClient.ts +12 -1
- package/src/interaction_client/RedirectClient.ts +12 -2
- package/src/packageMetadata.ts +1 -1
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/AzureAD/microsoft-authentication-library-for-js.git"
|
|
12
12
|
},
|
|
13
|
-
"version": "3.
|
|
13
|
+
"version": "3.9.0",
|
|
14
14
|
"description": "Microsoft Authentication Library for js",
|
|
15
15
|
"keywords": [
|
|
16
16
|
"implicit",
|
|
@@ -101,6 +101,6 @@
|
|
|
101
101
|
"typescript": "^4.9.5"
|
|
102
102
|
},
|
|
103
103
|
"dependencies": {
|
|
104
|
-
"@azure/msal-common": "14.
|
|
104
|
+
"@azure/msal-common": "14.7.0"
|
|
105
105
|
}
|
|
106
106
|
}
|
|
@@ -345,18 +345,9 @@ export class StandardController implements IController {
|
|
|
345
345
|
const redirectResponseKey = hash || "";
|
|
346
346
|
let response = this.redirectResponse.get(redirectResponseKey);
|
|
347
347
|
if (typeof response === "undefined") {
|
|
348
|
-
this.eventHandler.emitEvent(
|
|
349
|
-
EventType.HANDLE_REDIRECT_START,
|
|
350
|
-
InteractionType.Redirect
|
|
351
|
-
);
|
|
352
|
-
this.logger.verbose(
|
|
353
|
-
"handleRedirectPromise has been called for the first time, storing the promise"
|
|
354
|
-
);
|
|
355
|
-
|
|
356
348
|
const request: NativeTokenRequest | null =
|
|
357
349
|
this.browserStorage.getCachedNativeRequest();
|
|
358
|
-
|
|
359
|
-
if (
|
|
350
|
+
const useNative =
|
|
360
351
|
request &&
|
|
361
352
|
NativeMessageHandler.isNativeAvailable(
|
|
362
353
|
this.config,
|
|
@@ -364,8 +355,26 @@ export class StandardController implements IController {
|
|
|
364
355
|
this.nativeExtensionProvider
|
|
365
356
|
) &&
|
|
366
357
|
this.nativeExtensionProvider &&
|
|
367
|
-
!hash
|
|
368
|
-
|
|
358
|
+
!hash;
|
|
359
|
+
const correlationId = useNative
|
|
360
|
+
? request?.correlationId
|
|
361
|
+
: this.browserStorage.getTemporaryCache(
|
|
362
|
+
TemporaryCacheKeys.CORRELATION_ID,
|
|
363
|
+
true
|
|
364
|
+
) || "";
|
|
365
|
+
const rootMeasurement = this.performanceClient.startMeasurement(
|
|
366
|
+
"acquireTokenRedirect",
|
|
367
|
+
correlationId
|
|
368
|
+
);
|
|
369
|
+
this.eventHandler.emitEvent(
|
|
370
|
+
EventType.HANDLE_REDIRECT_START,
|
|
371
|
+
InteractionType.Redirect
|
|
372
|
+
);
|
|
373
|
+
this.logger.verbose(
|
|
374
|
+
"handleRedirectPromise has been called for the first time, storing the promise"
|
|
375
|
+
);
|
|
376
|
+
let redirectResponse: Promise<AuthenticationResult | null>;
|
|
377
|
+
if (useNative && this.nativeExtensionProvider) {
|
|
369
378
|
this.logger.trace(
|
|
370
379
|
"handleRedirectPromise - acquiring token from native platform"
|
|
371
380
|
);
|
|
@@ -383,20 +392,36 @@ export class StandardController implements IController {
|
|
|
383
392
|
this.nativeInternalStorage,
|
|
384
393
|
request.correlationId
|
|
385
394
|
);
|
|
386
|
-
|
|
395
|
+
|
|
396
|
+
redirectResponse = invokeAsync(
|
|
397
|
+
nativeClient.handleRedirectPromise.bind(nativeClient),
|
|
398
|
+
PerformanceEvents.HandleNativeRedirectPromiseMeasurement,
|
|
399
|
+
this.logger,
|
|
400
|
+
this.performanceClient,
|
|
401
|
+
rootMeasurement.event.correlationId
|
|
402
|
+
)(
|
|
403
|
+
this.performanceClient,
|
|
404
|
+
rootMeasurement.event.correlationId
|
|
405
|
+
);
|
|
387
406
|
} else {
|
|
388
407
|
this.logger.trace(
|
|
389
408
|
"handleRedirectPromise - acquiring token from web flow"
|
|
390
409
|
);
|
|
391
|
-
const correlationId =
|
|
392
|
-
this.browserStorage.getTemporaryCache(
|
|
393
|
-
TemporaryCacheKeys.CORRELATION_ID,
|
|
394
|
-
true
|
|
395
|
-
) || Constants.EMPTY_STRING;
|
|
396
410
|
const redirectClient =
|
|
397
411
|
this.createRedirectClient(correlationId);
|
|
398
|
-
redirectResponse =
|
|
399
|
-
redirectClient.handleRedirectPromise(
|
|
412
|
+
redirectResponse = invokeAsync(
|
|
413
|
+
redirectClient.handleRedirectPromise.bind(
|
|
414
|
+
redirectClient
|
|
415
|
+
),
|
|
416
|
+
PerformanceEvents.HandleRedirectPromiseMeasurement,
|
|
417
|
+
this.logger,
|
|
418
|
+
this.performanceClient,
|
|
419
|
+
rootMeasurement.event.correlationId
|
|
420
|
+
)(
|
|
421
|
+
hash,
|
|
422
|
+
this.performanceClient,
|
|
423
|
+
rootMeasurement.event.correlationId
|
|
424
|
+
);
|
|
400
425
|
}
|
|
401
426
|
|
|
402
427
|
response = redirectResponse
|
|
@@ -426,35 +451,49 @@ export class StandardController implements IController {
|
|
|
426
451
|
"handleRedirectResponse returned result, acquire token success"
|
|
427
452
|
);
|
|
428
453
|
}
|
|
454
|
+
rootMeasurement.end({ success: true });
|
|
429
455
|
}
|
|
430
456
|
this.eventHandler.emitEvent(
|
|
431
457
|
EventType.HANDLE_REDIRECT_END,
|
|
432
458
|
InteractionType.Redirect
|
|
433
459
|
);
|
|
460
|
+
rootMeasurement.end({ success: false });
|
|
434
461
|
|
|
435
462
|
return result;
|
|
436
463
|
})
|
|
437
464
|
.catch((e) => {
|
|
465
|
+
const eventError = e as EventError;
|
|
438
466
|
// Emit login event if there is an account
|
|
439
467
|
if (loggedInAccounts.length > 0) {
|
|
440
468
|
this.eventHandler.emitEvent(
|
|
441
469
|
EventType.ACQUIRE_TOKEN_FAILURE,
|
|
442
470
|
InteractionType.Redirect,
|
|
443
471
|
null,
|
|
444
|
-
|
|
472
|
+
eventError
|
|
445
473
|
);
|
|
446
474
|
} else {
|
|
447
475
|
this.eventHandler.emitEvent(
|
|
448
476
|
EventType.LOGIN_FAILURE,
|
|
449
477
|
InteractionType.Redirect,
|
|
450
478
|
null,
|
|
451
|
-
|
|
479
|
+
eventError
|
|
452
480
|
);
|
|
453
481
|
}
|
|
454
482
|
this.eventHandler.emitEvent(
|
|
455
483
|
EventType.HANDLE_REDIRECT_END,
|
|
456
484
|
InteractionType.Redirect
|
|
457
485
|
);
|
|
486
|
+
if (eventError instanceof AuthError) {
|
|
487
|
+
rootMeasurement.end({
|
|
488
|
+
success: false,
|
|
489
|
+
errorCode: eventError.errorCode,
|
|
490
|
+
subErrorCode: eventError.subError,
|
|
491
|
+
});
|
|
492
|
+
} else {
|
|
493
|
+
rootMeasurement.end({
|
|
494
|
+
success: false,
|
|
495
|
+
});
|
|
496
|
+
}
|
|
458
497
|
|
|
459
498
|
throw e;
|
|
460
499
|
});
|
|
@@ -320,8 +320,13 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
320
320
|
|
|
321
321
|
/**
|
|
322
322
|
* If the previous page called native platform for a token using redirect APIs, send the same request again and return the response
|
|
323
|
+
* @param performanceClient {IPerformanceClient?}
|
|
324
|
+
* @param correlationId {string?} correlation identifier
|
|
323
325
|
*/
|
|
324
|
-
async handleRedirectPromise(
|
|
326
|
+
async handleRedirectPromise(
|
|
327
|
+
performanceClient?: IPerformanceClient,
|
|
328
|
+
correlationId?: string
|
|
329
|
+
): Promise<AuthenticationResult | null> {
|
|
325
330
|
this.logger.trace(
|
|
326
331
|
"NativeInteractionClient - handleRedirectPromise called."
|
|
327
332
|
);
|
|
@@ -338,6 +343,12 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
338
343
|
this.logger.verbose(
|
|
339
344
|
"NativeInteractionClient - handleRedirectPromise called but there is no cached request, returning null."
|
|
340
345
|
);
|
|
346
|
+
if (performanceClient && correlationId) {
|
|
347
|
+
performanceClient?.addFields(
|
|
348
|
+
{ errorCode: "no_cached_request" },
|
|
349
|
+
correlationId
|
|
350
|
+
);
|
|
351
|
+
}
|
|
341
352
|
return null;
|
|
342
353
|
}
|
|
343
354
|
|
|
@@ -190,10 +190,14 @@ export class RedirectClient extends StandardInteractionClient {
|
|
|
190
190
|
* Checks if navigateToLoginRequestUrl is set, and:
|
|
191
191
|
* - if true, performs logic to cache and navigate
|
|
192
192
|
* - if false, handles hash string and parses response
|
|
193
|
-
* @param hash
|
|
193
|
+
* @param hash {string?} url hash
|
|
194
|
+
* @param performanceClient {IPerformanceClient?}
|
|
195
|
+
* @param correlationId {string?} correlation identifier
|
|
194
196
|
*/
|
|
195
197
|
async handleRedirectPromise(
|
|
196
|
-
hash?: string
|
|
198
|
+
hash?: string,
|
|
199
|
+
performanceClient?: IPerformanceClient,
|
|
200
|
+
correlationId?: string
|
|
197
201
|
): Promise<AuthenticationResult | null> {
|
|
198
202
|
const serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
199
203
|
ApiId.handleRedirectPromise
|
|
@@ -216,6 +220,12 @@ export class RedirectClient extends StandardInteractionClient {
|
|
|
216
220
|
this.browserStorage.cleanRequestByInteractionType(
|
|
217
221
|
InteractionType.Redirect
|
|
218
222
|
);
|
|
223
|
+
if (performanceClient && correlationId) {
|
|
224
|
+
performanceClient?.addFields(
|
|
225
|
+
{ errorCode: "no_server_response" },
|
|
226
|
+
correlationId
|
|
227
|
+
);
|
|
228
|
+
}
|
|
219
229
|
return null;
|
|
220
230
|
}
|
|
221
231
|
|
package/src/packageMetadata.ts
CHANGED