@azure/msal-browser 4.0.2 → 4.2.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 (127) hide show
  1. package/dist/app/IPublicClientApplication.mjs +1 -1
  2. package/dist/app/PublicClientApplication.mjs +1 -1
  3. package/dist/app/PublicClientNext.mjs +1 -1
  4. package/dist/broker/nativeBroker/NativeMessageHandler.mjs +1 -1
  5. package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
  6. package/dist/cache/AccountManager.mjs +1 -1
  7. package/dist/cache/AsyncMemoryStorage.mjs +1 -1
  8. package/dist/cache/BrowserCacheManager.d.ts +10 -3
  9. package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
  10. package/dist/cache/BrowserCacheManager.mjs +32 -6
  11. package/dist/cache/BrowserCacheManager.mjs.map +1 -1
  12. package/dist/cache/CacheHelpers.mjs +1 -1
  13. package/dist/cache/CookieStorage.d.ts +6 -1
  14. package/dist/cache/CookieStorage.d.ts.map +1 -1
  15. package/dist/cache/CookieStorage.mjs +10 -5
  16. package/dist/cache/CookieStorage.mjs.map +1 -1
  17. package/dist/cache/DatabaseStorage.mjs +1 -1
  18. package/dist/cache/LocalStorage.d.ts +2 -0
  19. package/dist/cache/LocalStorage.d.ts.map +1 -1
  20. package/dist/cache/LocalStorage.mjs +52 -4
  21. package/dist/cache/LocalStorage.mjs.map +1 -1
  22. package/dist/cache/MemoryStorage.mjs +1 -1
  23. package/dist/cache/SessionStorage.mjs +1 -1
  24. package/dist/cache/TokenCache.mjs +1 -1
  25. package/dist/config/Configuration.d.ts +2 -1
  26. package/dist/config/Configuration.d.ts.map +1 -1
  27. package/dist/config/Configuration.mjs +1 -1
  28. package/dist/config/Configuration.mjs.map +1 -1
  29. package/dist/controllers/ControllerFactory.mjs +1 -1
  30. package/dist/controllers/NestedAppAuthController.d.ts.map +1 -1
  31. package/dist/controllers/NestedAppAuthController.mjs +4 -4
  32. package/dist/controllers/NestedAppAuthController.mjs.map +1 -1
  33. package/dist/controllers/StandardController.d.ts +2 -5
  34. package/dist/controllers/StandardController.d.ts.map +1 -1
  35. package/dist/controllers/StandardController.mjs +16 -63
  36. package/dist/controllers/StandardController.mjs.map +1 -1
  37. package/dist/controllers/UnknownOperatingContextController.d.ts +1 -0
  38. package/dist/controllers/UnknownOperatingContextController.d.ts.map +1 -1
  39. package/dist/controllers/UnknownOperatingContextController.mjs +5 -3
  40. package/dist/controllers/UnknownOperatingContextController.mjs.map +1 -1
  41. package/dist/crypto/BrowserCrypto.mjs +1 -1
  42. package/dist/crypto/CryptoOps.mjs +1 -1
  43. package/dist/crypto/PkceGenerator.mjs +1 -1
  44. package/dist/crypto/SignedHttpRequest.mjs +1 -1
  45. package/dist/encode/Base64Decode.mjs +1 -1
  46. package/dist/encode/Base64Encode.mjs +1 -1
  47. package/dist/error/BrowserAuthError.mjs +1 -1
  48. package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
  49. package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
  50. package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
  51. package/dist/error/NativeAuthError.mjs +1 -1
  52. package/dist/error/NativeAuthErrorCodes.mjs +1 -1
  53. package/dist/error/NestedAppAuthError.mjs +1 -1
  54. package/dist/event/EventHandler.d.ts +19 -0
  55. package/dist/event/EventHandler.d.ts.map +1 -1
  56. package/dist/event/EventHandler.mjs +56 -16
  57. package/dist/event/EventHandler.mjs.map +1 -1
  58. package/dist/event/EventMessage.mjs +1 -1
  59. package/dist/event/EventType.mjs +1 -1
  60. package/dist/index.mjs +1 -1
  61. package/dist/interaction_client/BaseInteractionClient.mjs +1 -1
  62. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
  63. package/dist/interaction_client/NativeInteractionClient.mjs +1 -1
  64. package/dist/interaction_client/PopupClient.d.ts.map +1 -1
  65. package/dist/interaction_client/PopupClient.mjs +2 -1
  66. package/dist/interaction_client/PopupClient.mjs.map +1 -1
  67. package/dist/interaction_client/RedirectClient.mjs +1 -1
  68. package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
  69. package/dist/interaction_client/SilentCacheClient.mjs +1 -1
  70. package/dist/interaction_client/SilentIframeClient.mjs +1 -1
  71. package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
  72. package/dist/interaction_client/StandardInteractionClient.mjs +1 -1
  73. package/dist/interaction_handler/InteractionHandler.mjs +1 -1
  74. package/dist/interaction_handler/RedirectHandler.mjs +1 -1
  75. package/dist/interaction_handler/SilentHandler.mjs +1 -1
  76. package/dist/naa/BridgeError.mjs +1 -1
  77. package/dist/naa/BridgeProxy.mjs +1 -1
  78. package/dist/naa/BridgeStatusCode.mjs +1 -1
  79. package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
  80. package/dist/navigation/NavigationClient.mjs +1 -1
  81. package/dist/network/FetchClient.mjs +1 -1
  82. package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
  83. package/dist/operatingcontext/NestedAppOperatingContext.mjs +1 -1
  84. package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
  85. package/dist/operatingcontext/UnknownOperatingContext.mjs +1 -1
  86. package/dist/packageMetadata.d.ts +1 -1
  87. package/dist/packageMetadata.mjs +2 -2
  88. package/dist/request/RequestHelpers.mjs +1 -1
  89. package/dist/response/ResponseHandler.mjs +1 -1
  90. package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
  91. package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
  92. package/dist/utils/BrowserConstants.mjs +1 -1
  93. package/dist/utils/BrowserProtocolUtils.mjs +1 -1
  94. package/dist/utils/BrowserUtils.mjs +1 -1
  95. package/lib/msal-browser.cjs +279 -232
  96. package/lib/msal-browser.cjs.map +1 -1
  97. package/lib/msal-browser.js +279 -232
  98. package/lib/msal-browser.js.map +1 -1
  99. package/lib/msal-browser.min.js +63 -63
  100. package/lib/types/cache/BrowserCacheManager.d.ts +10 -3
  101. package/lib/types/cache/BrowserCacheManager.d.ts.map +1 -1
  102. package/lib/types/cache/CookieStorage.d.ts +6 -1
  103. package/lib/types/cache/CookieStorage.d.ts.map +1 -1
  104. package/lib/types/cache/LocalStorage.d.ts +2 -0
  105. package/lib/types/cache/LocalStorage.d.ts.map +1 -1
  106. package/lib/types/config/Configuration.d.ts +2 -1
  107. package/lib/types/config/Configuration.d.ts.map +1 -1
  108. package/lib/types/controllers/NestedAppAuthController.d.ts.map +1 -1
  109. package/lib/types/controllers/StandardController.d.ts +2 -5
  110. package/lib/types/controllers/StandardController.d.ts.map +1 -1
  111. package/lib/types/controllers/UnknownOperatingContextController.d.ts +1 -0
  112. package/lib/types/controllers/UnknownOperatingContextController.d.ts.map +1 -1
  113. package/lib/types/event/EventHandler.d.ts +19 -0
  114. package/lib/types/event/EventHandler.d.ts.map +1 -1
  115. package/lib/types/interaction_client/PopupClient.d.ts.map +1 -1
  116. package/lib/types/packageMetadata.d.ts +1 -1
  117. package/package.json +3 -3
  118. package/src/cache/BrowserCacheManager.ts +51 -4
  119. package/src/cache/CookieStorage.ts +12 -3
  120. package/src/cache/LocalStorage.ts +65 -3
  121. package/src/config/Configuration.ts +2 -1
  122. package/src/controllers/NestedAppAuthController.ts +4 -3
  123. package/src/controllers/StandardController.ts +23 -82
  124. package/src/controllers/UnknownOperatingContextController.ts +9 -1
  125. package/src/event/EventHandler.ts +78 -27
  126. package/src/interaction_client/PopupClient.ts +5 -0
  127. package/src/packageMetadata.ts +1 -1
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v4.0.2 2025-01-22 */
1
+ /*! @azure/msal-browser v4.2.0 2025-02-05 */
2
2
  'use strict';
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
@@ -6,7 +6,7 @@
6
6
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.msal = {}));
7
7
  })(this, (function (exports) { 'use strict';
8
8
 
9
- /*! @azure/msal-common v15.0.2 2025-01-22 */
9
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
10
10
  /*
11
11
  * Copyright (c) Microsoft Corporation. All rights reserved.
12
12
  * Licensed under the MIT License.
@@ -310,7 +310,7 @@
310
310
  // Token renewal offset default in seconds
311
311
  const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
312
312
 
313
- /*! @azure/msal-common v15.0.2 2025-01-22 */
313
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
314
314
  /*
315
315
  * Copyright (c) Microsoft Corporation. All rights reserved.
316
316
  * Licensed under the MIT License.
@@ -327,7 +327,7 @@
327
327
  unexpectedError: unexpectedError
328
328
  });
329
329
 
330
- /*! @azure/msal-common v15.0.2 2025-01-22 */
330
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
331
331
 
332
332
  /*
333
333
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -376,7 +376,7 @@
376
376
  : AuthErrorMessages[code]);
377
377
  }
378
378
 
379
- /*! @azure/msal-common v15.0.2 2025-01-22 */
379
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
380
380
  /*
381
381
  * Copyright (c) Microsoft Corporation. All rights reserved.
382
382
  * Licensed under the MIT License.
@@ -474,7 +474,7 @@
474
474
  userTimeoutReached: userTimeoutReached
475
475
  });
476
476
 
477
- /*! @azure/msal-common v15.0.2 2025-01-22 */
477
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
478
478
 
479
479
  /*
480
480
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -726,7 +726,7 @@
726
726
  return new ClientAuthError(errorCode, additionalMessage);
727
727
  }
728
728
 
729
- /*! @azure/msal-common v15.0.2 2025-01-22 */
729
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
730
730
 
731
731
  /*
732
732
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -765,7 +765,7 @@
765
765
  },
766
766
  };
767
767
 
768
- /*! @azure/msal-common v15.0.2 2025-01-22 */
768
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
769
769
 
770
770
  /*
771
771
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -956,12 +956,12 @@
956
956
  }
957
957
  }
958
958
 
959
- /*! @azure/msal-common v15.0.2 2025-01-22 */
959
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
960
960
  /* eslint-disable header/header */
961
961
  const name$1 = "@azure/msal-common";
962
- const version$1 = "15.0.2";
962
+ const version$1 = "15.1.1";
963
963
 
964
- /*! @azure/msal-common v15.0.2 2025-01-22 */
964
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
965
965
  /*
966
966
  * Copyright (c) Microsoft Corporation. All rights reserved.
967
967
  * Licensed under the MIT License.
@@ -981,7 +981,7 @@
981
981
  AzureUsGovernment: "https://login.microsoftonline.us",
982
982
  };
983
983
 
984
- /*! @azure/msal-common v15.0.2 2025-01-22 */
984
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
985
985
 
986
986
  /*
987
987
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1042,7 +1042,7 @@
1042
1042
  }
1043
1043
  }
1044
1044
 
1045
- /*! @azure/msal-common v15.0.2 2025-01-22 */
1045
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
1046
1046
  /*
1047
1047
  * Copyright (c) Microsoft Corporation. All rights reserved.
1048
1048
  * Licensed under the MIT License.
@@ -1079,7 +1079,7 @@
1079
1079
  return cachedAtSec > nowSeconds();
1080
1080
  }
1081
1081
 
1082
- /*! @azure/msal-common v15.0.2 2025-01-22 */
1082
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
1083
1083
 
1084
1084
  /*
1085
1085
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1406,7 +1406,7 @@
1406
1406
  return metadata.expiresAt <= nowSeconds();
1407
1407
  }
1408
1408
 
1409
- /*! @azure/msal-common v15.0.2 2025-01-22 */
1409
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
1410
1410
  /*
1411
1411
  * Copyright (c) Microsoft Corporation. All rights reserved.
1412
1412
  * Licensed under the MIT License.
@@ -1460,7 +1460,7 @@
1460
1460
  urlParseError: urlParseError
1461
1461
  });
1462
1462
 
1463
- /*! @azure/msal-common v15.0.2 2025-01-22 */
1463
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
1464
1464
 
1465
1465
  /*
1466
1466
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1598,7 +1598,7 @@
1598
1598
  return new ClientConfigurationError(errorCode);
1599
1599
  }
1600
1600
 
1601
- /*! @azure/msal-common v15.0.2 2025-01-22 */
1601
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
1602
1602
  /*
1603
1603
  * Copyright (c) Microsoft Corporation. All rights reserved.
1604
1604
  * Licensed under the MIT License.
@@ -1695,7 +1695,7 @@
1695
1695
  }
1696
1696
  }
1697
1697
 
1698
- /*! @azure/msal-common v15.0.2 2025-01-22 */
1698
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
1699
1699
 
1700
1700
  /*
1701
1701
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1886,7 +1886,7 @@
1886
1886
  }
1887
1887
  }
1888
1888
 
1889
- /*! @azure/msal-common v15.0.2 2025-01-22 */
1889
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
1890
1890
 
1891
1891
  /*
1892
1892
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1926,7 +1926,7 @@
1926
1926
  };
1927
1927
  }
1928
1928
 
1929
- /*! @azure/msal-common v15.0.2 2025-01-22 */
1929
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
1930
1930
  /*
1931
1931
  * Copyright (c) Microsoft Corporation. All rights reserved.
1932
1932
  * Licensed under the MIT License.
@@ -2005,7 +2005,7 @@
2005
2005
  return updatedAccountInfo;
2006
2006
  }
2007
2007
 
2008
- /*! @azure/msal-common v15.0.2 2025-01-22 */
2008
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
2009
2009
  /*
2010
2010
  * Copyright (c) Microsoft Corporation. All rights reserved.
2011
2011
  * Licensed under the MIT License.
@@ -2020,7 +2020,7 @@
2020
2020
  Ciam: 3,
2021
2021
  };
2022
2022
 
2023
- /*! @azure/msal-common v15.0.2 2025-01-22 */
2023
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
2024
2024
  /*
2025
2025
  * Copyright (c) Microsoft Corporation. All rights reserved.
2026
2026
  * Licensed under the MIT License.
@@ -2042,7 +2042,7 @@
2042
2042
  return null;
2043
2043
  }
2044
2044
 
2045
- /*! @azure/msal-common v15.0.2 2025-01-22 */
2045
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
2046
2046
  /*
2047
2047
  * Copyright (c) Microsoft Corporation. All rights reserved.
2048
2048
  * Licensed under the MIT License.
@@ -2055,7 +2055,7 @@
2055
2055
  OIDC: "OIDC",
2056
2056
  };
2057
2057
 
2058
- /*! @azure/msal-common v15.0.2 2025-01-22 */
2058
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
2059
2059
 
2060
2060
  /*
2061
2061
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2298,7 +2298,7 @@
2298
2298
  }
2299
2299
  }
2300
2300
 
2301
- /*! @azure/msal-common v15.0.2 2025-01-22 */
2301
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
2302
2302
 
2303
2303
  /*
2304
2304
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2345,7 +2345,7 @@
2345
2345
  return null;
2346
2346
  }
2347
2347
 
2348
- /*! @azure/msal-common v15.0.2 2025-01-22 */
2348
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
2349
2349
 
2350
2350
  /*
2351
2351
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2509,7 +2509,7 @@
2509
2509
  }
2510
2510
  }
2511
2511
 
2512
- /*! @azure/msal-common v15.0.2 2025-01-22 */
2512
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
2513
2513
 
2514
2514
  /*
2515
2515
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2649,7 +2649,7 @@
2649
2649
  return null;
2650
2650
  }
2651
2651
 
2652
- /*! @azure/msal-common v15.0.2 2025-01-22 */
2652
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
2653
2653
  /*
2654
2654
  * Copyright (c) Microsoft Corporation. All rights reserved.
2655
2655
  * Licensed under the MIT License.
@@ -2657,7 +2657,7 @@
2657
2657
  const cacheQuotaExceededErrorCode = "cache_quota_exceeded";
2658
2658
  const cacheUnknownErrorCode = "cache_error_unknown";
2659
2659
 
2660
- /*! @azure/msal-common v15.0.2 2025-01-22 */
2660
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
2661
2661
 
2662
2662
  /*
2663
2663
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2684,7 +2684,7 @@
2684
2684
  }
2685
2685
  }
2686
2686
 
2687
- /*! @azure/msal-common v15.0.2 2025-01-22 */
2687
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
2688
2688
 
2689
2689
  /*
2690
2690
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3869,7 +3869,7 @@
3869
3869
  }
3870
3870
  }
3871
3871
 
3872
- /*! @azure/msal-common v15.0.2 2025-01-22 */
3872
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
3873
3873
 
3874
3874
  /*
3875
3875
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3968,7 +3968,7 @@
3968
3968
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
3969
3969
  }
3970
3970
 
3971
- /*! @azure/msal-common v15.0.2 2025-01-22 */
3971
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
3972
3972
  /*
3973
3973
  * Copyright (c) Microsoft Corporation. All rights reserved.
3974
3974
  * Licensed under the MIT License.
@@ -3978,7 +3978,7 @@
3978
3978
  UPN: "UPN",
3979
3979
  };
3980
3980
 
3981
- /*! @azure/msal-common v15.0.2 2025-01-22 */
3981
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
3982
3982
  /*
3983
3983
  * Copyright (c) Microsoft Corporation. All rights reserved.
3984
3984
  * Licensed under the MIT License.
@@ -4028,7 +4028,7 @@
4028
4028
  const BROKER_CLIENT_ID = "brk_client_id";
4029
4029
  const BROKER_REDIRECT_URI = "brk_redirect_uri";
4030
4030
 
4031
- /*! @azure/msal-common v15.0.2 2025-01-22 */
4031
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
4032
4032
 
4033
4033
  /*
4034
4034
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4095,7 +4095,7 @@
4095
4095
  }
4096
4096
  }
4097
4097
 
4098
- /*! @azure/msal-common v15.0.2 2025-01-22 */
4098
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
4099
4099
 
4100
4100
  /*
4101
4101
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4503,7 +4503,7 @@
4503
4503
  }
4504
4504
  }
4505
4505
 
4506
- /*! @azure/msal-common v15.0.2 2025-01-22 */
4506
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
4507
4507
  /*
4508
4508
  * Copyright (c) Microsoft Corporation. All rights reserved.
4509
4509
  * Licensed under the MIT License.
@@ -4515,7 +4515,7 @@
4515
4515
  response.hasOwnProperty("jwks_uri"));
4516
4516
  }
4517
4517
 
4518
- /*! @azure/msal-common v15.0.2 2025-01-22 */
4518
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
4519
4519
  /*
4520
4520
  * Copyright (c) Microsoft Corporation. All rights reserved.
4521
4521
  * Licensed under the MIT License.
@@ -4525,7 +4525,7 @@
4525
4525
  response.hasOwnProperty("metadata"));
4526
4526
  }
4527
4527
 
4528
- /*! @azure/msal-common v15.0.2 2025-01-22 */
4528
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
4529
4529
  /*
4530
4530
  * Copyright (c) Microsoft Corporation. All rights reserved.
4531
4531
  * Licensed under the MIT License.
@@ -4535,7 +4535,7 @@
4535
4535
  response.hasOwnProperty("error_description"));
4536
4536
  }
4537
4537
 
4538
- /*! @azure/msal-common v15.0.2 2025-01-22 */
4538
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
4539
4539
  /*
4540
4540
  * Copyright (c) Microsoft Corporation. All rights reserved.
4541
4541
  * Licensed under the MIT License.
@@ -4773,6 +4773,7 @@
4773
4773
  CacheManagerGetRefreshToken: "cacheManagerGetRefreshToken",
4774
4774
  ImportExistingCache: "importExistingCache",
4775
4775
  SetUserData: "setUserData",
4776
+ LocalStorageUpdated: "localStorageUpdated",
4776
4777
  /**
4777
4778
  * Crypto Operations
4778
4779
  */
@@ -4874,6 +4875,7 @@
4874
4875
  [PerformanceEvents.InitializeCache, "InitCache"],
4875
4876
  [PerformanceEvents.ImportExistingCache, "importCache"],
4876
4877
  [PerformanceEvents.SetUserData, "setUserData"],
4878
+ [PerformanceEvents.LocalStorageUpdated, "localStorageUpdated"],
4877
4879
  [PerformanceEvents.SilentIframeClientTokenHelper, "SIClientTHelper"],
4878
4880
  [
4879
4881
  PerformanceEvents.SilentHandlerInitiateAuthRequest,
@@ -5042,7 +5044,7 @@
5042
5044
  "encryptedCacheExpiredCount",
5043
5045
  ]);
5044
5046
 
5045
- /*! @azure/msal-common v15.0.2 2025-01-22 */
5047
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
5046
5048
  /*
5047
5049
  * Copyright (c) Microsoft Corporation. All rights reserved.
5048
5050
  * Licensed under the MIT License.
@@ -5138,7 +5140,7 @@
5138
5140
  };
5139
5141
  };
5140
5142
 
5141
- /*! @azure/msal-common v15.0.2 2025-01-22 */
5143
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
5142
5144
 
5143
5145
  /*
5144
5146
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5247,7 +5249,7 @@
5247
5249
  },
5248
5250
  };
5249
5251
 
5250
- /*! @azure/msal-common v15.0.2 2025-01-22 */
5252
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
5251
5253
 
5252
5254
  /*
5253
5255
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6086,7 +6088,7 @@
6086
6088
  };
6087
6089
  }
6088
6090
 
6089
- /*! @azure/msal-common v15.0.2 2025-01-22 */
6091
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
6090
6092
 
6091
6093
  /*
6092
6094
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6117,7 +6119,7 @@
6117
6119
  }
6118
6120
  }
6119
6121
 
6120
- /*! @azure/msal-common v15.0.2 2025-01-22 */
6122
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
6121
6123
 
6122
6124
  /*
6123
6125
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6136,7 +6138,7 @@
6136
6138
  }
6137
6139
  }
6138
6140
 
6139
- /*! @azure/msal-common v15.0.2 2025-01-22 */
6141
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
6140
6142
 
6141
6143
  /*
6142
6144
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6234,7 +6236,7 @@
6234
6236
  }
6235
6237
  }
6236
6238
 
6237
- /*! @azure/msal-common v15.0.2 2025-01-22 */
6239
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
6238
6240
 
6239
6241
  /*
6240
6242
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6264,7 +6266,7 @@
6264
6266
  return new NetworkError(error, httpStatus, responseHeaders);
6265
6267
  }
6266
6268
 
6267
- /*! @azure/msal-common v15.0.2 2025-01-22 */
6269
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
6268
6270
 
6269
6271
  /*
6270
6272
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6414,7 +6416,7 @@
6414
6416
  }
6415
6417
  }
6416
6418
 
6417
- /*! @azure/msal-common v15.0.2 2025-01-22 */
6419
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
6418
6420
  /*
6419
6421
  * Copyright (c) Microsoft Corporation. All rights reserved.
6420
6422
  * Licensed under the MIT License.
@@ -6440,7 +6442,7 @@
6440
6442
  refreshTokenExpired: refreshTokenExpired
6441
6443
  });
6442
6444
 
6443
- /*! @azure/msal-common v15.0.2 2025-01-22 */
6445
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
6444
6446
 
6445
6447
  /*
6446
6448
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6528,7 +6530,7 @@
6528
6530
  return new InteractionRequiredAuthError(errorCode, InteractionRequiredAuthErrorMessages[errorCode]);
6529
6531
  }
6530
6532
 
6531
- /*! @azure/msal-common v15.0.2 2025-01-22 */
6533
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
6532
6534
 
6533
6535
  /*
6534
6536
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6600,7 +6602,7 @@
6600
6602
  }
6601
6603
  }
6602
6604
 
6603
- /*! @azure/msal-common v15.0.2 2025-01-22 */
6605
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
6604
6606
 
6605
6607
  /*
6606
6608
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6684,7 +6686,7 @@
6684
6686
  }
6685
6687
  }
6686
6688
 
6687
- /*! @azure/msal-common v15.0.2 2025-01-22 */
6689
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
6688
6690
  /*
6689
6691
  * Copyright (c) Microsoft Corporation. All rights reserved.
6690
6692
  * Licensed under the MIT License.
@@ -6711,7 +6713,7 @@
6711
6713
  }
6712
6714
  }
6713
6715
 
6714
- /*! @azure/msal-common v15.0.2 2025-01-22 */
6716
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
6715
6717
 
6716
6718
  /*
6717
6719
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7088,7 +7090,7 @@
7088
7090
  return baseAccount;
7089
7091
  }
7090
7092
 
7091
- /*! @azure/msal-common v15.0.2 2025-01-22 */
7093
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
7092
7094
  /*
7093
7095
  * Copyright (c) Microsoft Corporation. All rights reserved.
7094
7096
  * Licensed under the MIT License.
@@ -7106,7 +7108,7 @@
7106
7108
  }
7107
7109
  }
7108
7110
 
7109
- /*! @azure/msal-common v15.0.2 2025-01-22 */
7111
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
7110
7112
 
7111
7113
  /*
7112
7114
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7392,7 +7394,9 @@
7392
7394
  }
7393
7395
  if (request.domainHint) {
7394
7396
  parameterBuilder.addDomainHint(request.domainHint);
7397
+ this.performanceClient?.addFields({ domainHintFromRequest: true }, correlationId);
7395
7398
  }
7399
+ this.performanceClient?.addFields({ prompt: request.prompt }, correlationId);
7396
7400
  // Add sid or loginHint with preference for login_hint claim (in request) -> sid -> loginHint (upn/email) -> username of AccountInfo object
7397
7401
  if (request.prompt !== PromptValue.SELECT_ACCOUNT) {
7398
7402
  // AAD will throw if prompt=select_account is passed with an account hint
@@ -7400,6 +7404,7 @@
7400
7404
  // SessionID is only used in silent calls
7401
7405
  this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from request");
7402
7406
  parameterBuilder.addSid(request.sid);
7407
+ this.performanceClient?.addFields({ sidFromRequest: true }, correlationId);
7403
7408
  }
7404
7409
  else if (request.account) {
7405
7410
  const accountSid = this.extractAccountSid(request.account);
@@ -7412,6 +7417,7 @@
7412
7417
  if (accountLoginHintClaim) {
7413
7418
  this.logger.verbose("createAuthCodeUrlQueryString: login_hint claim present on account");
7414
7419
  parameterBuilder.addLoginHint(accountLoginHintClaim);
7420
+ this.performanceClient?.addFields({ loginHintFromClaim: true }, correlationId);
7415
7421
  try {
7416
7422
  const clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);
7417
7423
  parameterBuilder.addCcsOid(clientInfo);
@@ -7427,6 +7433,7 @@
7427
7433
  */
7428
7434
  this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account");
7429
7435
  parameterBuilder.addSid(accountSid);
7436
+ this.performanceClient?.addFields({ sidFromClaim: true }, correlationId);
7430
7437
  try {
7431
7438
  const clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);
7432
7439
  parameterBuilder.addCcsOid(clientInfo);
@@ -7439,11 +7446,13 @@
7439
7446
  this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from request");
7440
7447
  parameterBuilder.addLoginHint(request.loginHint);
7441
7448
  parameterBuilder.addCcsUpn(request.loginHint);
7449
+ this.performanceClient?.addFields({ loginHintFromRequest: true }, correlationId);
7442
7450
  }
7443
7451
  else if (request.account.username) {
7444
7452
  // Fallback to account username if provided
7445
7453
  this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from account");
7446
7454
  parameterBuilder.addLoginHint(request.account.username);
7455
+ this.performanceClient?.addFields({ loginHintFromUpn: true }, correlationId);
7447
7456
  try {
7448
7457
  const clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);
7449
7458
  parameterBuilder.addCcsOid(clientInfo);
@@ -7457,6 +7466,7 @@
7457
7466
  this.logger.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request");
7458
7467
  parameterBuilder.addLoginHint(request.loginHint);
7459
7468
  parameterBuilder.addCcsUpn(request.loginHint);
7469
+ this.performanceClient?.addFields({ loginHintFromRequest: true }, correlationId);
7460
7470
  }
7461
7471
  }
7462
7472
  else {
@@ -7548,7 +7558,7 @@
7548
7558
  }
7549
7559
  }
7550
7560
 
7551
- /*! @azure/msal-common v15.0.2 2025-01-22 */
7561
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
7552
7562
 
7553
7563
  /*
7554
7564
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7628,6 +7638,7 @@
7628
7638
  if (refreshToken.expiresOn &&
7629
7639
  isTokenExpired(refreshToken.expiresOn, request.refreshTokenExpirationOffsetSeconds ||
7630
7640
  DEFAULT_REFRESH_TOKEN_EXPIRATION_OFFSET_SECONDS)) {
7641
+ this.performanceClient?.addFields({ rtExpiresOnMs: Number(refreshToken.expiresOn) }, request.correlationId);
7631
7642
  throw createInteractionRequiredAuthError(refreshTokenExpired);
7632
7643
  }
7633
7644
  // attach cached RT size to the current measurement
@@ -7644,12 +7655,14 @@
7644
7655
  return await invokeAsync(this.acquireToken.bind(this), PerformanceEvents.RefreshTokenClientAcquireToken, this.logger, this.performanceClient, request.correlationId)(refreshTokenRequest);
7645
7656
  }
7646
7657
  catch (e) {
7647
- if (e instanceof InteractionRequiredAuthError &&
7648
- e.subError === badToken) {
7649
- // Remove bad refresh token from cache
7650
- this.logger.verbose("acquireTokenWithRefreshToken: bad refresh token, removing from cache");
7651
- const badRefreshTokenKey = generateCredentialKey(refreshToken);
7652
- this.cacheManager.removeRefreshToken(badRefreshTokenKey);
7658
+ if (e instanceof InteractionRequiredAuthError) {
7659
+ this.performanceClient?.addFields({ rtExpiresOnMs: Number(refreshToken.expiresOn) }, request.correlationId);
7660
+ if (e.subError === badToken) {
7661
+ // Remove bad refresh token from cache
7662
+ this.logger.verbose("acquireTokenWithRefreshToken: bad refresh token, removing from cache");
7663
+ const badRefreshTokenKey = generateCredentialKey(refreshToken);
7664
+ this.cacheManager.removeRefreshToken(badRefreshTokenKey);
7665
+ }
7653
7666
  }
7654
7667
  throw e;
7655
7668
  }
@@ -7768,7 +7781,7 @@
7768
7781
  }
7769
7782
  }
7770
7783
 
7771
- /*! @azure/msal-common v15.0.2 2025-01-22 */
7784
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
7772
7785
 
7773
7786
  /*
7774
7787
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7779,44 +7792,6 @@
7779
7792
  constructor(configuration, performanceClient) {
7780
7793
  super(configuration, performanceClient);
7781
7794
  }
7782
- /**
7783
- * Retrieves a token from cache if it is still valid, or uses the cached refresh token to renew
7784
- * the given token and returns the renewed token
7785
- * @param request
7786
- */
7787
- async acquireToken(request) {
7788
- try {
7789
- const [authResponse, cacheOutcome] = await this.acquireCachedToken({
7790
- ...request,
7791
- scopes: request.scopes?.length
7792
- ? request.scopes
7793
- : [...OIDC_DEFAULT_SCOPES],
7794
- });
7795
- // if the token is not expired but must be refreshed; get a new one in the background
7796
- if (cacheOutcome === CacheOutcome.PROACTIVELY_REFRESHED) {
7797
- this.logger.info("SilentFlowClient:acquireCachedToken - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed.");
7798
- // refresh the access token in the background
7799
- const refreshTokenClient = new RefreshTokenClient(this.config, this.performanceClient);
7800
- refreshTokenClient
7801
- .acquireTokenByRefreshToken(request)
7802
- .catch(() => {
7803
- // do nothing, this is running in the background and no action is to be taken upon success or failure
7804
- });
7805
- }
7806
- // return the cached token
7807
- return authResponse;
7808
- }
7809
- catch (e) {
7810
- if (e instanceof ClientAuthError &&
7811
- e.errorCode === tokenRefreshRequired) {
7812
- const refreshTokenClient = new RefreshTokenClient(this.config, this.performanceClient);
7813
- return refreshTokenClient.acquireTokenByRefreshToken(request);
7814
- }
7815
- else {
7816
- throw e;
7817
- }
7818
- }
7819
- }
7820
7795
  /**
7821
7796
  * Retrieves token from cache or throws an error if it must be refreshed.
7822
7797
  * @param request
@@ -7904,7 +7879,7 @@
7904
7879
  }
7905
7880
  }
7906
7881
 
7907
- /*! @azure/msal-common v15.0.2 2025-01-22 */
7882
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
7908
7883
 
7909
7884
  /*
7910
7885
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7919,7 +7894,7 @@
7919
7894
  },
7920
7895
  };
7921
7896
 
7922
- /*! @azure/msal-common v15.0.2 2025-01-22 */
7897
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
7923
7898
 
7924
7899
  /*
7925
7900
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7977,7 +7952,7 @@
7977
7952
  }
7978
7953
  }
7979
7954
 
7980
- /*! @azure/msal-common v15.0.2 2025-01-22 */
7955
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
7981
7956
 
7982
7957
  /*
7983
7958
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8240,7 +8215,7 @@
8240
8215
  }
8241
8216
  }
8242
8217
 
8243
- /*! @azure/msal-common v15.0.2 2025-01-22 */
8218
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
8244
8219
  /*
8245
8220
  * Copyright (c) Microsoft Corporation. All rights reserved.
8246
8221
  * Licensed under the MIT License.
@@ -8248,7 +8223,7 @@
8248
8223
  const missingKidError = "missing_kid_error";
8249
8224
  const missingAlgError = "missing_alg_error";
8250
8225
 
8251
- /*! @azure/msal-common v15.0.2 2025-01-22 */
8226
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
8252
8227
 
8253
8228
  /*
8254
8229
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8273,7 +8248,7 @@
8273
8248
  return new JoseHeaderError(code, JoseHeaderErrorMessages[code]);
8274
8249
  }
8275
8250
 
8276
- /*! @azure/msal-common v15.0.2 2025-01-22 */
8251
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
8277
8252
 
8278
8253
  /*
8279
8254
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8313,7 +8288,7 @@
8313
8288
  }
8314
8289
  }
8315
8290
 
8316
- /*! @azure/msal-common v15.0.2 2025-01-22 */
8291
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
8317
8292
 
8318
8293
  /*
8319
8294
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8392,7 +8367,7 @@
8392
8367
  }
8393
8368
  }
8394
8369
 
8395
- /*! @azure/msal-common v15.0.2 2025-01-22 */
8370
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
8396
8371
 
8397
8372
  /*
8398
8373
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10429,7 +10404,7 @@
10429
10404
 
10430
10405
  /* eslint-disable header/header */
10431
10406
  const name = "@azure/msal-browser";
10432
- const version = "4.0.2";
10407
+ const version = "4.2.0";
10433
10408
 
10434
10409
  /*
10435
10410
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -11362,6 +11337,10 @@
11362
11337
  */
11363
11338
  // Cookie life calculation (hours * minutes * seconds * ms)
11364
11339
  const COOKIE_LIFE_MULTIPLIER = 24 * 60 * 60 * 1000;
11340
+ const SameSiteOptions = {
11341
+ Lax: "Lax",
11342
+ None: "None",
11343
+ };
11365
11344
  class CookieStorage {
11366
11345
  initialize() {
11367
11346
  return Promise.resolve();
@@ -11382,13 +11361,14 @@
11382
11361
  getUserData() {
11383
11362
  throw createClientAuthError(methodNotImplemented);
11384
11363
  }
11385
- setItem(key, value, cookieLifeDays, secure = true) {
11386
- let cookieStr = `${encodeURIComponent(key)}=${encodeURIComponent(value)};path=/;SameSite=Lax;`;
11364
+ setItem(key, value, cookieLifeDays, secure = true, sameSite = SameSiteOptions.Lax) {
11365
+ let cookieStr = `${encodeURIComponent(key)}=${encodeURIComponent(value)};path=/;SameSite=${sameSite};`;
11387
11366
  if (cookieLifeDays) {
11388
11367
  const expireTime = getCookieExpirationTime(cookieLifeDays);
11389
11368
  cookieStr += `expires=${expireTime};`;
11390
11369
  }
11391
- if (secure) {
11370
+ if (secure || sameSite === SameSiteOptions.None) {
11371
+ // SameSite None requires Secure flag
11392
11372
  cookieStr += "Secure;";
11393
11373
  }
11394
11374
  document.cookie = cookieStr;
@@ -11468,6 +11448,7 @@
11468
11448
  * Licensed under the MIT License.
11469
11449
  */
11470
11450
  const ENCRYPTION_KEY = "msal.cache.encryption";
11451
+ const BROADCAST_CHANNEL_NAME$1 = "msal.broadcast.cache";
11471
11452
  class LocalStorage {
11472
11453
  constructor(clientId, logger, performanceClient) {
11473
11454
  if (!window.localStorage) {
@@ -11478,6 +11459,7 @@
11478
11459
  this.clientId = clientId;
11479
11460
  this.logger = logger;
11480
11461
  this.performanceClient = performanceClient;
11462
+ this.broadcast = new BroadcastChannel(BROADCAST_CHANNEL_NAME$1);
11481
11463
  }
11482
11464
  async initialize(correlationId) {
11483
11465
  this.initialized = true;
@@ -11513,8 +11495,13 @@
11513
11495
  id: id,
11514
11496
  key: keyStr,
11515
11497
  };
11516
- cookies.setItem(ENCRYPTION_KEY, JSON.stringify(cookieData));
11498
+ cookies.setItem(ENCRYPTION_KEY, JSON.stringify(cookieData), 0, // Expiration - 0 means cookie will be cleared at the end of the browser session
11499
+ true, // Secure flag
11500
+ SameSiteOptions.None // SameSite must be None to support iframed apps
11501
+ );
11517
11502
  }
11503
+ // Register listener for cache updates in other tabs
11504
+ this.broadcast.addEventListener("message", this.updateCache.bind(this));
11518
11505
  }
11519
11506
  getItem(key) {
11520
11507
  return window.localStorage.getItem(key);
@@ -11540,9 +11527,22 @@
11540
11527
  };
11541
11528
  this.memoryStorage.setItem(key, value);
11542
11529
  this.setItem(key, JSON.stringify(encryptedData));
11530
+ // Notify other frames to update their in-memory cache
11531
+ this.broadcast.postMessage({
11532
+ key: key,
11533
+ value: value,
11534
+ context: this.getContext(key),
11535
+ });
11543
11536
  }
11544
11537
  removeItem(key) {
11545
- this.memoryStorage.removeItem(key);
11538
+ if (this.memoryStorage.containsKey(key)) {
11539
+ this.memoryStorage.removeItem(key);
11540
+ this.broadcast.postMessage({
11541
+ key: key,
11542
+ value: null,
11543
+ context: this.getContext(key),
11544
+ });
11545
+ }
11546
11546
  window.localStorage.removeItem(key);
11547
11547
  }
11548
11548
  getKeys() {
@@ -11659,6 +11659,34 @@
11659
11659
  }
11660
11660
  return context;
11661
11661
  }
11662
+ updateCache(event) {
11663
+ this.logger.trace("Updating internal cache from broadcast event");
11664
+ const perfMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.LocalStorageUpdated);
11665
+ perfMeasurement.add({ isBackground: true });
11666
+ const { key, value, context } = event.data;
11667
+ if (!key) {
11668
+ this.logger.error("Broadcast event missing key");
11669
+ perfMeasurement.end({ success: false, errorCode: "noKey" });
11670
+ return;
11671
+ }
11672
+ if (context && context !== this.clientId) {
11673
+ this.logger.trace(`Ignoring broadcast event from clientId: ${context}`);
11674
+ perfMeasurement.end({
11675
+ success: false,
11676
+ errorCode: "contextMismatch",
11677
+ });
11678
+ return;
11679
+ }
11680
+ if (!value) {
11681
+ this.memoryStorage.removeItem(key);
11682
+ this.logger.verbose("Removed item from internal cache");
11683
+ }
11684
+ else {
11685
+ this.memoryStorage.setItem(key, value);
11686
+ this.logger.verbose("Updated item in internal cache");
11687
+ }
11688
+ perfMeasurement.end({ success: true });
11689
+ }
11662
11690
  }
11663
11691
 
11664
11692
  /*
@@ -11719,6 +11747,39 @@
11719
11747
  }
11720
11748
  }
11721
11749
 
11750
+ /*
11751
+ * Copyright (c) Microsoft Corporation. All rights reserved.
11752
+ * Licensed under the MIT License.
11753
+ */
11754
+ const EventType = {
11755
+ INITIALIZE_START: "msal:initializeStart",
11756
+ INITIALIZE_END: "msal:initializeEnd",
11757
+ ACCOUNT_ADDED: "msal:accountAdded",
11758
+ ACCOUNT_REMOVED: "msal:accountRemoved",
11759
+ ACTIVE_ACCOUNT_CHANGED: "msal:activeAccountChanged",
11760
+ LOGIN_START: "msal:loginStart",
11761
+ LOGIN_SUCCESS: "msal:loginSuccess",
11762
+ LOGIN_FAILURE: "msal:loginFailure",
11763
+ ACQUIRE_TOKEN_START: "msal:acquireTokenStart",
11764
+ ACQUIRE_TOKEN_SUCCESS: "msal:acquireTokenSuccess",
11765
+ ACQUIRE_TOKEN_FAILURE: "msal:acquireTokenFailure",
11766
+ ACQUIRE_TOKEN_NETWORK_START: "msal:acquireTokenFromNetworkStart",
11767
+ SSO_SILENT_START: "msal:ssoSilentStart",
11768
+ SSO_SILENT_SUCCESS: "msal:ssoSilentSuccess",
11769
+ SSO_SILENT_FAILURE: "msal:ssoSilentFailure",
11770
+ ACQUIRE_TOKEN_BY_CODE_START: "msal:acquireTokenByCodeStart",
11771
+ ACQUIRE_TOKEN_BY_CODE_SUCCESS: "msal:acquireTokenByCodeSuccess",
11772
+ ACQUIRE_TOKEN_BY_CODE_FAILURE: "msal:acquireTokenByCodeFailure",
11773
+ HANDLE_REDIRECT_START: "msal:handleRedirectStart",
11774
+ HANDLE_REDIRECT_END: "msal:handleRedirectEnd",
11775
+ POPUP_OPENED: "msal:popupOpened",
11776
+ LOGOUT_START: "msal:logoutStart",
11777
+ LOGOUT_SUCCESS: "msal:logoutSuccess",
11778
+ LOGOUT_FAILURE: "msal:logoutFailure",
11779
+ LOGOUT_END: "msal:logoutEnd",
11780
+ RESTORE_FROM_BFCACHE: "msal:restoreFromBFCache",
11781
+ };
11782
+
11722
11783
  /*
11723
11784
  * Copyright (c) Microsoft Corporation. All rights reserved.
11724
11785
  * Licensed under the MIT License.
@@ -11729,7 +11790,7 @@
11729
11790
  * parameters such as state and nonce, generally.
11730
11791
  */
11731
11792
  class BrowserCacheManager extends CacheManager {
11732
- constructor(clientId, cacheConfig, cryptoImpl, logger, performanceClient, staticAuthorityOptions) {
11793
+ constructor(clientId, cacheConfig, cryptoImpl, logger, performanceClient, eventHandler, staticAuthorityOptions) {
11733
11794
  super(clientId, cryptoImpl, logger, staticAuthorityOptions);
11734
11795
  this.cacheConfig = cacheConfig;
11735
11796
  this.logger = logger;
@@ -11738,6 +11799,7 @@
11738
11799
  this.temporaryCacheStorage = getStorageImplementation(clientId, cacheConfig.temporaryCacheLocation, logger, performanceClient);
11739
11800
  this.cookieStorage = new CookieStorage();
11740
11801
  this.performanceClient = performanceClient;
11802
+ this.eventHandler = eventHandler;
11741
11803
  }
11742
11804
  async initialize(correlationId) {
11743
11805
  await this.browserStorage.initialize(correlationId);
@@ -11791,7 +11853,15 @@
11791
11853
  this.logger.trace("BrowserCacheManager.setAccount called");
11792
11854
  const key = account.generateAccountKey();
11793
11855
  await invokeAsync(this.browserStorage.setUserData.bind(this.browserStorage), PerformanceEvents.SetUserData, this.logger, this.performanceClient)(key, JSON.stringify(account), correlationId);
11794
- this.addAccountKeyToMap(key);
11856
+ const wasAdded = this.addAccountKeyToMap(key);
11857
+ /**
11858
+ * @deprecated - Remove this in next major version in favor of more consistent LOGIN event
11859
+ */
11860
+ if (this.cacheConfig.cacheLocation ===
11861
+ BrowserCacheLocation.LocalStorage &&
11862
+ wasAdded) {
11863
+ this.eventHandler.emitEvent(EventType.ACCOUNT_ADDED, undefined, account.getAccountInfo());
11864
+ }
11795
11865
  }
11796
11866
  /**
11797
11867
  * Returns the array of account keys currently cached
@@ -11813,9 +11883,11 @@
11813
11883
  accountKeys.push(key);
11814
11884
  this.browserStorage.setItem(StaticCacheKeys.ACCOUNT_KEYS, JSON.stringify(accountKeys));
11815
11885
  this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key added");
11886
+ return true;
11816
11887
  }
11817
11888
  else {
11818
11889
  this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key already exists in map");
11890
+ return false;
11819
11891
  }
11820
11892
  }
11821
11893
  /**
@@ -11844,6 +11916,19 @@
11844
11916
  void super.removeAccount(key);
11845
11917
  this.removeAccountKeyFromMap(key);
11846
11918
  }
11919
+ /**
11920
+ * Removes credentials associated with the provided account
11921
+ * @param account
11922
+ */
11923
+ async removeAccountContext(account) {
11924
+ await super.removeAccountContext(account);
11925
+ /**
11926
+ * @deprecated - Remove this in next major version in favor of more consistent LOGOUT event
11927
+ */
11928
+ if (this.cacheConfig.cacheLocation === BrowserCacheLocation.LocalStorage) {
11929
+ this.eventHandler.emitEvent(EventType.ACCOUNT_REMOVED, undefined, account.getAccountInfo());
11930
+ }
11931
+ }
11847
11932
  /**
11848
11933
  * Removes given idToken from the cache and from the key map
11849
11934
  * @param key
@@ -12198,6 +12283,7 @@
12198
12283
  this.logger.verbose("setActiveAccount: No account passed, active account not set");
12199
12284
  this.browserStorage.removeItem(activeAccountKey);
12200
12285
  }
12286
+ this.eventHandler.emitEvent(EventType.ACTIVE_ACCOUNT_CHANGED);
12201
12287
  }
12202
12288
  /**
12203
12289
  * fetch throttling entity from the platform cache
@@ -12655,7 +12741,7 @@
12655
12741
  }
12656
12742
  return new MemoryStorage();
12657
12743
  }
12658
- const DEFAULT_BROWSER_CACHE_MANAGER = (clientId, logger, performanceClient) => {
12744
+ const DEFAULT_BROWSER_CACHE_MANAGER = (clientId, logger, performanceClient, eventHandler) => {
12659
12745
  const cacheOptions = {
12660
12746
  cacheLocation: BrowserCacheLocation.MemoryStorage,
12661
12747
  temporaryCacheLocation: BrowserCacheLocation.MemoryStorage,
@@ -12664,7 +12750,7 @@
12664
12750
  cacheMigrationEnabled: false,
12665
12751
  claimsBasedCachingEnabled: false,
12666
12752
  };
12667
- return new BrowserCacheManager(clientId, cacheOptions, DEFAULT_CRYPTO_IMPLEMENTATION, logger, performanceClient);
12753
+ return new BrowserCacheManager(clientId, cacheOptions, DEFAULT_CRYPTO_IMPLEMENTATION, logger, performanceClient, eventHandler);
12668
12754
  };
12669
12755
 
12670
12756
  /*
@@ -12798,43 +12884,13 @@
12798
12884
  * Copyright (c) Microsoft Corporation. All rights reserved.
12799
12885
  * Licensed under the MIT License.
12800
12886
  */
12801
- const EventType = {
12802
- INITIALIZE_START: "msal:initializeStart",
12803
- INITIALIZE_END: "msal:initializeEnd",
12804
- ACCOUNT_ADDED: "msal:accountAdded",
12805
- ACCOUNT_REMOVED: "msal:accountRemoved",
12806
- ACTIVE_ACCOUNT_CHANGED: "msal:activeAccountChanged",
12807
- LOGIN_START: "msal:loginStart",
12808
- LOGIN_SUCCESS: "msal:loginSuccess",
12809
- LOGIN_FAILURE: "msal:loginFailure",
12810
- ACQUIRE_TOKEN_START: "msal:acquireTokenStart",
12811
- ACQUIRE_TOKEN_SUCCESS: "msal:acquireTokenSuccess",
12812
- ACQUIRE_TOKEN_FAILURE: "msal:acquireTokenFailure",
12813
- ACQUIRE_TOKEN_NETWORK_START: "msal:acquireTokenFromNetworkStart",
12814
- SSO_SILENT_START: "msal:ssoSilentStart",
12815
- SSO_SILENT_SUCCESS: "msal:ssoSilentSuccess",
12816
- SSO_SILENT_FAILURE: "msal:ssoSilentFailure",
12817
- ACQUIRE_TOKEN_BY_CODE_START: "msal:acquireTokenByCodeStart",
12818
- ACQUIRE_TOKEN_BY_CODE_SUCCESS: "msal:acquireTokenByCodeSuccess",
12819
- ACQUIRE_TOKEN_BY_CODE_FAILURE: "msal:acquireTokenByCodeFailure",
12820
- HANDLE_REDIRECT_START: "msal:handleRedirectStart",
12821
- HANDLE_REDIRECT_END: "msal:handleRedirectEnd",
12822
- POPUP_OPENED: "msal:popupOpened",
12823
- LOGOUT_START: "msal:logoutStart",
12824
- LOGOUT_SUCCESS: "msal:logoutSuccess",
12825
- LOGOUT_FAILURE: "msal:logoutFailure",
12826
- LOGOUT_END: "msal:logoutEnd",
12827
- RESTORE_FROM_BFCACHE: "msal:restoreFromBFCache",
12828
- };
12829
-
12830
- /*
12831
- * Copyright (c) Microsoft Corporation. All rights reserved.
12832
- * Licensed under the MIT License.
12833
- */
12887
+ const BROADCAST_CHANNEL_NAME = "msal.broadcast.event";
12834
12888
  class EventHandler {
12835
12889
  constructor(logger) {
12836
12890
  this.eventCallbacks = new Map();
12837
12891
  this.logger = logger || new Logger({});
12892
+ this.broadcastChannel = new BroadcastChannel(BROADCAST_CHANNEL_NAME);
12893
+ this.invokeCrossTabCallbacks = this.invokeCrossTabCallbacks.bind(this);
12838
12894
  }
12839
12895
  /**
12840
12896
  * Adds event callbacks to array
@@ -12871,23 +12927,59 @@
12871
12927
  * @param error
12872
12928
  */
12873
12929
  emitEvent(eventType, interactionType, payload, error) {
12874
- if (typeof window !== "undefined") {
12875
- const message = {
12876
- eventType: eventType,
12877
- interactionType: interactionType || null,
12878
- payload: payload || null,
12879
- error: error || null,
12880
- timestamp: Date.now(),
12881
- };
12882
- this.eventCallbacks.forEach(([callback, eventTypes], callbackId) => {
12883
- if (eventTypes.length === 0 ||
12884
- eventTypes.includes(eventType)) {
12885
- this.logger.verbose(`Emitting event to callback ${callbackId}: ${eventType}`);
12886
- callback.apply(null, [message]);
12887
- }
12888
- });
12930
+ const message = {
12931
+ eventType: eventType,
12932
+ interactionType: interactionType || null,
12933
+ payload: payload || null,
12934
+ error: error || null,
12935
+ timestamp: Date.now(),
12936
+ };
12937
+ switch (eventType) {
12938
+ case EventType.ACCOUNT_ADDED:
12939
+ case EventType.ACCOUNT_REMOVED:
12940
+ case EventType.ACTIVE_ACCOUNT_CHANGED:
12941
+ // Send event to other open tabs / MSAL instances on same domain
12942
+ this.broadcastChannel.postMessage(message);
12943
+ break;
12944
+ default:
12945
+ // Emit event to callbacks registered in this instance
12946
+ this.invokeCallbacks(message);
12947
+ break;
12889
12948
  }
12890
12949
  }
12950
+ /**
12951
+ * Invoke registered callbacks
12952
+ * @param message
12953
+ */
12954
+ invokeCallbacks(message) {
12955
+ this.eventCallbacks.forEach(([callback, eventTypes], callbackId) => {
12956
+ if (eventTypes.length === 0 ||
12957
+ eventTypes.includes(message.eventType)) {
12958
+ this.logger.verbose(`Emitting event to callback ${callbackId}: ${message.eventType}`);
12959
+ callback.apply(null, [message]);
12960
+ }
12961
+ });
12962
+ }
12963
+ /**
12964
+ * Wrapper around invokeCallbacks to handle broadcast events received from other tabs/instances
12965
+ * @param event
12966
+ */
12967
+ invokeCrossTabCallbacks(event) {
12968
+ const message = event.data;
12969
+ this.invokeCallbacks(message);
12970
+ }
12971
+ /**
12972
+ * Listen for events broadcasted from other tabs/instances
12973
+ */
12974
+ subscribeCrossTab() {
12975
+ this.broadcastChannel.addEventListener("message", this.invokeCrossTabCallbacks);
12976
+ }
12977
+ /**
12978
+ * Unsubscribe from broadcast events
12979
+ */
12980
+ unsubscribeCrossTab() {
12981
+ this.broadcastChannel.removeEventListener("message", this.invokeCrossTabCallbacks);
12982
+ }
12891
12983
  }
12892
12984
 
12893
12985
  /*
@@ -14505,6 +14597,7 @@
14505
14597
  popupWindowAttributes: request.popupWindowAttributes || {},
14506
14598
  popupWindowParent: request.popupWindowParent ?? window,
14507
14599
  };
14600
+ this.performanceClient.addFields({ isAsyncPopup: this.config.system.asyncPopups }, this.correlationId);
14508
14601
  // asyncPopups flag is true. Acquires token without first opening popup. Popup will be opened later asynchronously.
14509
14602
  if (this.config.system.asyncPopups) {
14510
14603
  this.logger.verbose("asyncPopups set to true, acquiring token");
@@ -16059,8 +16152,8 @@
16059
16152
  this.eventHandler = new EventHandler(this.logger);
16060
16153
  // Initialize the browser storage class.
16061
16154
  this.browserStorage = this.isBrowserEnvironment
16062
- ? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, this.performanceClient, buildStaticAuthorityOptions(this.config.auth))
16063
- : DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger, this.performanceClient);
16155
+ ? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, this.performanceClient, this.eventHandler, buildStaticAuthorityOptions(this.config.auth))
16156
+ : DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger, this.performanceClient, this.eventHandler);
16064
16157
  // initialize in memory storage for native flows
16065
16158
  const nativeCacheOptions = {
16066
16159
  cacheLocation: BrowserCacheLocation.MemoryStorage,
@@ -16070,7 +16163,7 @@
16070
16163
  cacheMigrationEnabled: false,
16071
16164
  claimsBasedCachingEnabled: false,
16072
16165
  };
16073
- this.nativeInternalStorage = new BrowserCacheManager(this.config.auth.clientId, nativeCacheOptions, this.browserCrypto, this.logger, this.performanceClient);
16166
+ this.nativeInternalStorage = new BrowserCacheManager(this.config.auth.clientId, nativeCacheOptions, this.browserCrypto, this.logger, this.performanceClient, this.eventHandler);
16074
16167
  // Initialize the token cache
16075
16168
  this.tokenCache = new TokenCache(this.config, this.browserStorage, this.logger, this.browserCrypto);
16076
16169
  this.activeSilentTokenRequests = new Map();
@@ -16079,10 +16172,6 @@
16079
16172
  // Register listener functions
16080
16173
  this.trackPageVisibilityWithMeasurement =
16081
16174
  this.trackPageVisibilityWithMeasurement.bind(this);
16082
- // account storage events
16083
- this.listeningToStorageEvents = false;
16084
- this.handleAccountCacheChange =
16085
- this.handleAccountCacheChange.bind(this);
16086
16175
  }
16087
16176
  static async createController(operatingContext, request) {
16088
16177
  const controller = new StandardController(operatingContext);
@@ -16981,70 +17070,27 @@
16981
17070
  }
16982
17071
  /**
16983
17072
  * Adds event listener that emits an event when a user account is added or removed from localstorage in a different browser tab or window
17073
+ * @deprecated These events will be raised by default and this method will be removed in a future major version.
16984
17074
  */
16985
17075
  enableAccountStorageEvents() {
16986
- if (typeof window === "undefined") {
17076
+ if (this.config.cache.cacheLocation !==
17077
+ BrowserCacheLocation.LocalStorage) {
17078
+ this.logger.info("Account storage events are only available when cacheLocation is set to localStorage");
16987
17079
  return;
16988
17080
  }
16989
- if (!this.listeningToStorageEvents) {
16990
- this.logger.verbose("Adding account storage listener.");
16991
- this.listeningToStorageEvents = true;
16992
- window.addEventListener("storage", this.handleAccountCacheChange);
16993
- }
16994
- else {
16995
- this.logger.verbose("Account storage listener already registered.");
16996
- }
17081
+ this.eventHandler.subscribeCrossTab();
16997
17082
  }
16998
17083
  /**
16999
17084
  * Removes event listener that emits an event when a user account is added or removed from localstorage in a different browser tab or window
17085
+ * @deprecated These events will be raised by default and this method will be removed in a future major version.
17000
17086
  */
17001
17087
  disableAccountStorageEvents() {
17002
- if (typeof window === "undefined") {
17003
- return;
17004
- }
17005
- if (this.listeningToStorageEvents) {
17006
- this.logger.verbose("Removing account storage listener.");
17007
- window.removeEventListener("storage", this.handleAccountCacheChange);
17008
- this.listeningToStorageEvents = false;
17009
- }
17010
- else {
17011
- this.logger.verbose("No account storage listener registered.");
17012
- }
17013
- }
17014
- /**
17015
- * Emit account added/removed events when cached accounts are changed in a different tab or frame
17016
- */
17017
- handleAccountCacheChange(e) {
17018
- try {
17019
- // Handle active account filter change
17020
- if (e.key?.includes(PersistentCacheKeys.ACTIVE_ACCOUNT_FILTERS)) {
17021
- // This event has no payload, it only signals cross-tab app instances that the results of calling getActiveAccount() will have changed
17022
- this.eventHandler.emitEvent(EventType.ACTIVE_ACCOUNT_CHANGED);
17023
- }
17024
- // Handle account object change
17025
- const cacheValue = e.newValue || e.oldValue;
17026
- if (!cacheValue) {
17027
- return;
17028
- }
17029
- const parsedValue = JSON.parse(cacheValue);
17030
- if (typeof parsedValue !== "object" ||
17031
- !AccountEntity.isAccountEntity(parsedValue)) {
17032
- return;
17033
- }
17034
- const accountEntity = CacheManager.toObject(new AccountEntity(), parsedValue);
17035
- const accountInfo = accountEntity.getAccountInfo();
17036
- if (!e.oldValue && e.newValue) {
17037
- this.logger.info("Account was added to cache in a different window");
17038
- this.eventHandler.emitEvent(EventType.ACCOUNT_ADDED, undefined, accountInfo);
17039
- }
17040
- else if (!e.newValue && e.oldValue) {
17041
- this.logger.info("Account was removed from cache in a different window");
17042
- this.eventHandler.emitEvent(EventType.ACCOUNT_REMOVED, undefined, accountInfo);
17043
- }
17044
- }
17045
- catch (e) {
17088
+ if (this.config.cache.cacheLocation !==
17089
+ BrowserCacheLocation.LocalStorage) {
17090
+ this.logger.info("Account storage events are only available when cacheLocation is set to localStorage");
17046
17091
  return;
17047
17092
  }
17093
+ this.eventHandler.unsubscribeCrossTab();
17048
17094
  }
17049
17095
  /**
17050
17096
  * Gets the token cache for the application.
@@ -17617,11 +17663,11 @@
17617
17663
  this.browserCrypto = operatingContext.isBrowserEnvironment()
17618
17664
  ? new CryptoOps(this.logger, this.performanceClient, true)
17619
17665
  : DEFAULT_CRYPTO_IMPLEMENTATION;
17666
+ this.eventHandler = new EventHandler(this.logger);
17620
17667
  // Initialize the browser storage class.
17621
17668
  this.browserStorage = this.operatingContext.isBrowserEnvironment()
17622
- ? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, this.performanceClient, buildStaticAuthorityOptions(this.config.auth))
17623
- : DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger, this.performanceClient);
17624
- this.eventHandler = new EventHandler(this.logger);
17669
+ ? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, this.performanceClient, this.eventHandler, buildStaticAuthorityOptions(this.config.auth))
17670
+ : DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger, this.performanceClient, this.eventHandler);
17625
17671
  this.nestedAppAuthAdapter = new NestedAppAuthAdapter(this.config.auth.clientId, this.config.auth.clientCapabilities, this.browserCrypto, this.logger);
17626
17672
  // Set the active account if available
17627
17673
  const accountContext = this.bridgeProxy.getAccountContext();
@@ -18517,10 +18563,11 @@
18517
18563
  this.browserCrypto = this.isBrowserEnvironment
18518
18564
  ? new CryptoOps(this.logger, this.performanceClient)
18519
18565
  : DEFAULT_CRYPTO_IMPLEMENTATION;
18566
+ this.eventHandler = new EventHandler(this.logger);
18520
18567
  // Initialize the browser storage class.
18521
18568
  this.browserStorage = this.isBrowserEnvironment
18522
- ? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, this.performanceClient, undefined)
18523
- : DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger, this.performanceClient);
18569
+ ? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, this.performanceClient, this.eventHandler, undefined)
18570
+ : DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger, this.performanceClient, this.eventHandler);
18524
18571
  }
18525
18572
  getBrowserStorage() {
18526
18573
  return this.browserStorage;