@azure/msal-browser 3.17.0 → 3.19.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.
Files changed (110) hide show
  1. package/dist/app/IPublicClientApplication.d.ts +2 -1
  2. package/dist/app/IPublicClientApplication.d.ts.map +1 -1
  3. package/dist/app/IPublicClientApplication.mjs +1 -1
  4. package/dist/app/IPublicClientApplication.mjs.map +1 -1
  5. package/dist/app/PublicClientApplication.d.ts +8 -1
  6. package/dist/app/PublicClientApplication.d.ts.map +1 -1
  7. package/dist/app/PublicClientApplication.mjs +9 -4
  8. package/dist/app/PublicClientApplication.mjs.map +1 -1
  9. package/dist/app/PublicClientNext.mjs +1 -1
  10. package/dist/broker/nativeBroker/NativeMessageHandler.mjs +1 -1
  11. package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
  12. package/dist/cache/AccountManager.mjs +1 -1
  13. package/dist/cache/AsyncMemoryStorage.mjs +1 -1
  14. package/dist/cache/BrowserCacheManager.d.ts +2 -1
  15. package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
  16. package/dist/cache/BrowserCacheManager.mjs +9 -5
  17. package/dist/cache/BrowserCacheManager.mjs.map +1 -1
  18. package/dist/cache/BrowserStorage.mjs +1 -1
  19. package/dist/cache/DatabaseStorage.mjs +1 -1
  20. package/dist/cache/MemoryStorage.mjs +1 -1
  21. package/dist/cache/TokenCache.d.ts.map +1 -1
  22. package/dist/cache/TokenCache.mjs +90 -117
  23. package/dist/cache/TokenCache.mjs.map +1 -1
  24. package/dist/config/Configuration.mjs +1 -1
  25. package/dist/controllers/ControllerFactory.d.ts +2 -1
  26. package/dist/controllers/ControllerFactory.d.ts.map +1 -1
  27. package/dist/controllers/ControllerFactory.mjs +3 -3
  28. package/dist/controllers/ControllerFactory.mjs.map +1 -1
  29. package/dist/controllers/IController.d.ts +2 -1
  30. package/dist/controllers/IController.d.ts.map +1 -1
  31. package/dist/controllers/NestedAppAuthController.mjs +1 -1
  32. package/dist/controllers/StandardController.d.ts +4 -2
  33. package/dist/controllers/StandardController.d.ts.map +1 -1
  34. package/dist/controllers/StandardController.mjs +11 -8
  35. package/dist/controllers/StandardController.mjs.map +1 -1
  36. package/dist/controllers/UnknownOperatingContextController.mjs +1 -1
  37. package/dist/crypto/BrowserCrypto.mjs +1 -1
  38. package/dist/crypto/CryptoOps.mjs +1 -1
  39. package/dist/crypto/PkceGenerator.mjs +1 -1
  40. package/dist/crypto/SignedHttpRequest.mjs +1 -1
  41. package/dist/encode/Base64Decode.mjs +1 -1
  42. package/dist/encode/Base64Encode.mjs +1 -1
  43. package/dist/error/BrowserAuthError.mjs +1 -1
  44. package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
  45. package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
  46. package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
  47. package/dist/error/NativeAuthError.mjs +1 -1
  48. package/dist/error/NativeAuthErrorCodes.mjs +1 -1
  49. package/dist/error/NestedAppAuthError.mjs +2 -2
  50. package/dist/error/NestedAppAuthError.mjs.map +1 -1
  51. package/dist/event/EventHandler.mjs +1 -1
  52. package/dist/event/EventMessage.mjs +1 -1
  53. package/dist/event/EventType.mjs +1 -1
  54. package/dist/index.d.ts +1 -0
  55. package/dist/index.d.ts.map +1 -1
  56. package/dist/index.mjs +1 -1
  57. package/dist/interaction_client/BaseInteractionClient.mjs +1 -1
  58. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
  59. package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
  60. package/dist/interaction_client/NativeInteractionClient.mjs +11 -7
  61. package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
  62. package/dist/interaction_client/PopupClient.mjs +1 -1
  63. package/dist/interaction_client/RedirectClient.mjs +1 -1
  64. package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
  65. package/dist/interaction_client/SilentCacheClient.mjs +1 -1
  66. package/dist/interaction_client/SilentIframeClient.mjs +1 -1
  67. package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
  68. package/dist/interaction_client/StandardInteractionClient.mjs +1 -1
  69. package/dist/interaction_handler/InteractionHandler.mjs +1 -1
  70. package/dist/interaction_handler/RedirectHandler.mjs +1 -1
  71. package/dist/interaction_handler/SilentHandler.mjs +1 -1
  72. package/dist/naa/BridgeError.mjs +1 -1
  73. package/dist/naa/BridgeProxy.mjs +1 -1
  74. package/dist/naa/BridgeStatusCode.mjs +1 -1
  75. package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
  76. package/dist/navigation/NavigationClient.mjs +1 -1
  77. package/dist/network/FetchClient.mjs +1 -1
  78. package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
  79. package/dist/operatingcontext/NestedAppOperatingContext.mjs +1 -1
  80. package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
  81. package/dist/operatingcontext/UnknownOperatingContext.mjs +1 -1
  82. package/dist/packageMetadata.d.ts +1 -1
  83. package/dist/packageMetadata.mjs +2 -2
  84. package/dist/request/InitializeApplicationRequest.d.ts +9 -0
  85. package/dist/request/InitializeApplicationRequest.d.ts.map +1 -0
  86. package/dist/request/RequestHelpers.mjs +1 -1
  87. package/dist/response/ResponseHandler.mjs +1 -1
  88. package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
  89. package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
  90. package/dist/utils/BrowserConstants.mjs +1 -1
  91. package/dist/utils/BrowserProtocolUtils.mjs +1 -1
  92. package/dist/utils/BrowserUtils.mjs +1 -1
  93. package/lib/msal-browser.cjs +214 -248
  94. package/lib/msal-browser.cjs.map +1 -1
  95. package/lib/msal-browser.js +214 -248
  96. package/lib/msal-browser.js.map +1 -1
  97. package/lib/msal-browser.min.js +63 -64
  98. package/package.json +3 -2
  99. package/src/app/IPublicClientApplication.ts +3 -1
  100. package/src/app/PublicClientApplication.ts +9 -3
  101. package/src/cache/BrowserCacheManager.ts +9 -7
  102. package/src/cache/TokenCache.ts +158 -243
  103. package/src/controllers/ControllerFactory.ts +4 -2
  104. package/src/controllers/IController.ts +3 -1
  105. package/src/controllers/StandardController.ts +19 -11
  106. package/src/error/NestedAppAuthError.ts +1 -1
  107. package/src/index.ts +1 -0
  108. package/src/interaction_client/NativeInteractionClient.ts +12 -10
  109. package/src/packageMetadata.ts +1 -1
  110. package/src/request/InitializeApplicationRequest.ts +13 -0
@@ -84,6 +84,7 @@ import { AuthenticationResult } from "../response/AuthenticationResult";
84
84
  import { ClearCacheRequest } from "../request/ClearCacheRequest";
85
85
  import { createNewGuid } from "../crypto/BrowserCrypto";
86
86
  import { initializeSilentRequest } from "../request/RequestHelpers";
87
+ import { InitializeApplicationRequest } from "../request/InitializeApplicationRequest";
87
88
 
88
89
  function getAccountType(
89
90
  account?: AccountInfo
@@ -281,10 +282,11 @@ export class StandardController implements IController {
281
282
  }
282
283
 
283
284
  static async createController(
284
- operatingContext: BaseOperatingContext
285
+ operatingContext: BaseOperatingContext,
286
+ request?: InitializeApplicationRequest
285
287
  ): Promise<IController> {
286
288
  const controller = new StandardController(operatingContext);
287
- await controller.initialize();
289
+ await controller.initialize(request);
288
290
  return controller;
289
291
  }
290
292
 
@@ -301,8 +303,9 @@ export class StandardController implements IController {
301
303
 
302
304
  /**
303
305
  * Initializer function to perform async startup tasks such as connecting to WAM extension
306
+ * @param request {?InitializeApplicationRequest} correlation id
304
307
  */
305
- async initialize(): Promise<void> {
308
+ async initialize(request?: InitializeApplicationRequest): Promise<void> {
306
309
  this.logger.trace("initialize called");
307
310
  if (this.initialized) {
308
311
  this.logger.info(
@@ -311,9 +314,12 @@ export class StandardController implements IController {
311
314
  return;
312
315
  }
313
316
 
317
+ const initCorrelationId =
318
+ request?.correlationId || this.getRequestCorrelationId();
314
319
  const allowNativeBroker = this.config.system.allowNativeBroker;
315
320
  const initMeasurement = this.performanceClient.startMeasurement(
316
- PerformanceEvents.InitializeClientApplication
321
+ PerformanceEvents.InitializeClientApplication,
322
+ initCorrelationId
317
323
  );
318
324
  this.eventHandler.emitEvent(EventType.INITIALIZE_START);
319
325
 
@@ -341,8 +347,9 @@ export class StandardController implements IController {
341
347
  ),
342
348
  PerformanceEvents.ClearTokensAndKeysWithClaims,
343
349
  this.logger,
344
- this.performanceClient
345
- )(this.performanceClient);
350
+ this.performanceClient,
351
+ initCorrelationId
352
+ )(this.performanceClient, initCorrelationId);
346
353
  }
347
354
 
348
355
  this.initialized = true;
@@ -1963,6 +1970,8 @@ export class StandardController implements IController {
1963
1970
  request: SilentRequest & { correlationId: string },
1964
1971
  account: AccountInfo
1965
1972
  ): Promise<AuthenticationResult> {
1973
+ const trackPageVisibility = () =>
1974
+ this.trackPageVisibility(request.correlationId);
1966
1975
  this.performanceClient.addQueueMeasurement(
1967
1976
  PerformanceEvents.AcquireTokenSilentAsync,
1968
1977
  request.correlationId
@@ -1981,9 +1990,7 @@ export class StandardController implements IController {
1981
1990
  );
1982
1991
  }
1983
1992
 
1984
- document.addEventListener("visibilitychange", () =>
1985
- this.trackPageVisibility(request.correlationId)
1986
- );
1993
+ document.addEventListener("visibilitychange", trackPageVisibility);
1987
1994
 
1988
1995
  const silentRequest = await invokeAsync(
1989
1996
  initializeSilentRequest,
@@ -2124,8 +2131,9 @@ export class StandardController implements IController {
2124
2131
  throw tokenRenewalError;
2125
2132
  })
2126
2133
  .finally(() => {
2127
- document.removeEventListener("visibilitychange", () =>
2128
- this.trackPageVisibility(request.correlationId)
2134
+ document.removeEventListener(
2135
+ "visibilitychange",
2136
+ trackPageVisibility
2129
2137
  );
2130
2138
  });
2131
2139
  }
@@ -11,7 +11,7 @@ import { AuthError } from "@azure/msal-common";
11
11
  export const NestedAppAuthErrorMessage = {
12
12
  unsupportedMethod: {
13
13
  code: "unsupported_method",
14
- desc: "The PKCE code challenge and verifier could not be generated.",
14
+ desc: "This method is not supported in nested app environment.",
15
15
  },
16
16
  };
17
17
 
package/src/index.ts CHANGED
@@ -66,6 +66,7 @@ export { AuthorizationUrlRequest } from "./request/AuthorizationUrlRequest";
66
66
  export { AuthorizationCodeRequest } from "./request/AuthorizationCodeRequest";
67
67
  export { AuthenticationResult } from "./response/AuthenticationResult";
68
68
  export { ClearCacheRequest } from "./request/ClearCacheRequest";
69
+ export { InitializeApplicationRequest } from "./request/InitializeApplicationRequest";
69
70
 
70
71
  // Cache
71
72
  export { LoadTokenOptions } from "./cache/TokenCache";
@@ -25,7 +25,6 @@ import {
25
25
  AuthError,
26
26
  CommonSilentFlowRequest,
27
27
  AccountInfo,
28
- CacheRecord,
29
28
  AADServerParamKeys,
30
29
  TokenClaims,
31
30
  createClientAuthError,
@@ -289,13 +288,17 @@ export class NativeInteractionClient extends BaseInteractionClient {
289
288
  this.logger.trace(
290
289
  "NativeInteractionClient - acquireTokenRedirect called."
291
290
  );
292
- const nativeRequest = await this.initializeNativeRequest(request);
293
291
 
294
- const { ...nativeTokenRequest } = nativeRequest;
292
+ const { ...remainingParameters } = request;
293
+ delete remainingParameters.onRedirectNavigate;
294
+
295
+ const nativeRequest = await this.initializeNativeRequest(
296
+ remainingParameters
297
+ );
295
298
 
296
299
  const messageBody: NativeExtensionRequestBody = {
297
300
  method: NativeExtensionMethod.GetToken,
298
- request: nativeTokenRequest,
301
+ request: nativeRequest,
299
302
  };
300
303
 
301
304
  try {
@@ -458,8 +461,8 @@ export class NativeInteractionClient extends BaseInteractionClient {
458
461
  this.browserStorage,
459
462
  authority,
460
463
  homeAccountIdentifier,
461
- idTokenClaims,
462
464
  base64Decode,
465
+ idTokenClaims,
463
466
  response.client_info,
464
467
  undefined, // environment
465
468
  idTokenClaims.tid,
@@ -739,11 +742,10 @@ export class NativeInteractionClient extends BaseInteractionClient {
739
742
  request.keyId
740
743
  );
741
744
 
742
- const nativeCacheRecord = new CacheRecord(
743
- undefined,
744
- cachedIdToken,
745
- cachedAccessToken
746
- );
745
+ const nativeCacheRecord = {
746
+ idToken: cachedIdToken,
747
+ accessToken: cachedAccessToken,
748
+ };
747
749
 
748
750
  void this.nativeStorageManager.saveCacheRecord(
749
751
  nativeCacheRecord,
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable header/header */
2
2
  export const name = "@azure/msal-browser";
3
- export const version = "3.17.0";
3
+ export const version = "3.19.0";
@@ -0,0 +1,13 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ /**
7
+ * InitializeApplicationRequest: Request object passed by user to initialize application
8
+ *
9
+ * - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
10
+ */
11
+ export type InitializeApplicationRequest = {
12
+ correlationId?: string;
13
+ };