@azure/msal-browser 2.37.0 → 2.37.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +213 -213
  3. package/dist/_virtual/_tslib.js +1 -1
  4. package/dist/app/ClientApplication.js +1 -1
  5. package/dist/app/ClientApplication.js.map +1 -1
  6. package/dist/app/IPublicClientApplication.js +1 -1
  7. package/dist/app/IPublicClientApplication.js.map +1 -1
  8. package/dist/app/PublicClientApplication.js +1 -1
  9. package/dist/app/PublicClientApplication.js.map +1 -1
  10. package/dist/broker/nativeBroker/NativeMessageHandler.js +1 -1
  11. package/dist/broker/nativeBroker/NativeMessageHandler.js.map +1 -1
  12. package/dist/cache/AsyncMemoryStorage.js +1 -1
  13. package/dist/cache/AsyncMemoryStorage.js.map +1 -1
  14. package/dist/cache/BrowserCacheManager.js +1 -1
  15. package/dist/cache/BrowserCacheManager.js.map +1 -1
  16. package/dist/cache/BrowserStorage.js +1 -1
  17. package/dist/cache/BrowserStorage.js.map +1 -1
  18. package/dist/cache/CryptoKeyStore.js +1 -1
  19. package/dist/cache/CryptoKeyStore.js.map +1 -1
  20. package/dist/cache/DatabaseStorage.js +1 -1
  21. package/dist/cache/DatabaseStorage.js.map +1 -1
  22. package/dist/cache/MemoryStorage.js +1 -1
  23. package/dist/cache/MemoryStorage.js.map +1 -1
  24. package/dist/cache/TokenCache.js +1 -1
  25. package/dist/cache/TokenCache.js.map +1 -1
  26. package/dist/config/Configuration.js +1 -1
  27. package/dist/config/Configuration.js.map +1 -1
  28. package/dist/crypto/BrowserCrypto.js +1 -1
  29. package/dist/crypto/BrowserCrypto.js.map +1 -1
  30. package/dist/crypto/CryptoOps.js +1 -1
  31. package/dist/crypto/CryptoOps.js.map +1 -1
  32. package/dist/crypto/GuidGenerator.js +1 -1
  33. package/dist/crypto/GuidGenerator.js.map +1 -1
  34. package/dist/crypto/ModernBrowserCrypto.js +1 -1
  35. package/dist/crypto/ModernBrowserCrypto.js.map +1 -1
  36. package/dist/crypto/MsBrowserCrypto.js +1 -1
  37. package/dist/crypto/MsBrowserCrypto.js.map +1 -1
  38. package/dist/crypto/MsrBrowserCrypto.js +1 -1
  39. package/dist/crypto/MsrBrowserCrypto.js.map +1 -1
  40. package/dist/crypto/PkceGenerator.js +1 -1
  41. package/dist/crypto/PkceGenerator.js.map +1 -1
  42. package/dist/crypto/SignedHttpRequest.js +1 -1
  43. package/dist/crypto/SignedHttpRequest.js.map +1 -1
  44. package/dist/encode/Base64Decode.js +1 -1
  45. package/dist/encode/Base64Decode.js.map +1 -1
  46. package/dist/encode/Base64Encode.js +1 -1
  47. package/dist/encode/Base64Encode.js.map +1 -1
  48. package/dist/error/BrowserAuthError.js +1 -1
  49. package/dist/error/BrowserAuthError.js.map +1 -1
  50. package/dist/error/BrowserConfigurationAuthError.js +1 -1
  51. package/dist/error/BrowserConfigurationAuthError.js.map +1 -1
  52. package/dist/error/NativeAuthError.js +1 -1
  53. package/dist/error/NativeAuthError.js.map +1 -1
  54. package/dist/event/EventHandler.js +1 -1
  55. package/dist/event/EventHandler.js.map +1 -1
  56. package/dist/event/EventMessage.d.ts.map +1 -1
  57. package/dist/event/EventMessage.js +2 -1
  58. package/dist/event/EventMessage.js.map +1 -1
  59. package/dist/event/EventType.d.ts +2 -1
  60. package/dist/event/EventType.d.ts.map +1 -1
  61. package/dist/event/EventType.js +2 -1
  62. package/dist/event/EventType.js.map +1 -1
  63. package/dist/index.cjs.js +193 -112
  64. package/dist/index.cjs.js.map +1 -1
  65. package/dist/index.js +1 -1
  66. package/dist/interaction_client/BaseInteractionClient.d.ts +2 -1
  67. package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
  68. package/dist/interaction_client/BaseInteractionClient.js +33 -7
  69. package/dist/interaction_client/BaseInteractionClient.js.map +1 -1
  70. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +1 -1
  71. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js.map +1 -1
  72. package/dist/interaction_client/NativeInteractionClient.d.ts +1 -1
  73. package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
  74. package/dist/interaction_client/NativeInteractionClient.js +22 -15
  75. package/dist/interaction_client/NativeInteractionClient.js.map +1 -1
  76. package/dist/interaction_client/PopupClient.js +1 -1
  77. package/dist/interaction_client/PopupClient.js.map +1 -1
  78. package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
  79. package/dist/interaction_client/RedirectClient.js +3 -2
  80. package/dist/interaction_client/RedirectClient.js.map +1 -1
  81. package/dist/interaction_client/SilentAuthCodeClient.js +1 -1
  82. package/dist/interaction_client/SilentAuthCodeClient.js.map +1 -1
  83. package/dist/interaction_client/SilentCacheClient.js +2 -2
  84. package/dist/interaction_client/SilentCacheClient.js.map +1 -1
  85. package/dist/interaction_client/SilentIframeClient.js +1 -1
  86. package/dist/interaction_client/SilentIframeClient.js.map +1 -1
  87. package/dist/interaction_client/SilentRefreshClient.js +2 -2
  88. package/dist/interaction_client/SilentRefreshClient.js.map +1 -1
  89. package/dist/interaction_client/StandardInteractionClient.js +1 -1
  90. package/dist/interaction_client/StandardInteractionClient.js.map +1 -1
  91. package/dist/interaction_handler/InteractionHandler.js +1 -1
  92. package/dist/interaction_handler/InteractionHandler.js.map +1 -1
  93. package/dist/interaction_handler/RedirectHandler.js +1 -1
  94. package/dist/interaction_handler/RedirectHandler.js.map +1 -1
  95. package/dist/interaction_handler/SilentHandler.js +1 -1
  96. package/dist/interaction_handler/SilentHandler.js.map +1 -1
  97. package/dist/internals.js +1 -1
  98. package/dist/internals.js.map +1 -1
  99. package/dist/navigation/NavigationClient.js +1 -1
  100. package/dist/navigation/NavigationClient.js.map +1 -1
  101. package/dist/network/FetchClient.js +1 -1
  102. package/dist/network/FetchClient.js.map +1 -1
  103. package/dist/network/XhrClient.js +1 -1
  104. package/dist/network/XhrClient.js.map +1 -1
  105. package/dist/packageMetadata.d.ts +1 -1
  106. package/dist/packageMetadata.js +2 -2
  107. package/dist/packageMetadata.js.map +1 -1
  108. package/dist/telemetry/BrowserPerformanceClient.js +1 -1
  109. package/dist/telemetry/BrowserPerformanceClient.js.map +1 -1
  110. package/dist/telemetry/BrowserPerformanceMeasurement.js +1 -1
  111. package/dist/telemetry/BrowserPerformanceMeasurement.js.map +1 -1
  112. package/dist/utils/BrowserConstants.js +1 -1
  113. package/dist/utils/BrowserConstants.js.map +1 -1
  114. package/dist/utils/BrowserProtocolUtils.js +1 -1
  115. package/dist/utils/BrowserProtocolUtils.js.map +1 -1
  116. package/dist/utils/BrowserStringUtils.js +1 -1
  117. package/dist/utils/BrowserStringUtils.js.map +1 -1
  118. package/dist/utils/BrowserUtils.js +1 -1
  119. package/dist/utils/BrowserUtils.js.map +1 -1
  120. package/dist/utils/MathUtils.js +1 -1
  121. package/dist/utils/MathUtils.js.map +1 -1
  122. package/lib/msal-browser.js +193 -112
  123. package/lib/msal-browser.js.map +1 -1
  124. package/lib/msal-browser.min.js +35 -35
  125. package/package.json +95 -95
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v2.37.0 2023-05-01 */
1
+ /*! @azure/msal-browser v2.37.1 2023-06-07 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
@@ -117,7 +117,7 @@ function __spread() {
117
117
  return ar;
118
118
  }
119
119
 
120
- /*! @azure/msal-common v13.0.0 2023-05-01 */
120
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
121
121
  /*! *****************************************************************************
122
122
  Copyright (c) Microsoft Corporation.
123
123
 
@@ -204,7 +204,7 @@ function __spreadArrays() {
204
204
  return r;
205
205
  }
206
206
 
207
- /*! @azure/msal-common v13.0.0 2023-05-01 */
207
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
208
208
 
209
209
  /*
210
210
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -576,7 +576,7 @@ var JsonTypes;
576
576
  JsonTypes["Pop"] = "pop";
577
577
  })(JsonTypes || (JsonTypes = {}));
578
578
 
579
- /*! @azure/msal-common v13.0.0 2023-05-01 */
579
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
580
580
 
581
581
  /*
582
582
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -632,7 +632,7 @@ var AuthError = /** @class */ (function (_super) {
632
632
  return AuthError;
633
633
  }(Error));
634
634
 
635
- /*! @azure/msal-common v13.0.0 2023-05-01 */
635
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
636
636
 
637
637
  /*
638
638
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -707,7 +707,7 @@ var DEFAULT_CRYPTO_IMPLEMENTATION = {
707
707
  }
708
708
  };
709
709
 
710
- /*! @azure/msal-common v13.0.0 2023-05-01 */
710
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
711
711
 
712
712
  /*
713
713
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1222,7 +1222,7 @@ var ClientAuthError = /** @class */ (function (_super) {
1222
1222
  return ClientAuthError;
1223
1223
  }(AuthError));
1224
1224
 
1225
- /*! @azure/msal-common v13.0.0 2023-05-01 */
1225
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
1226
1226
 
1227
1227
  /*
1228
1228
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1347,7 +1347,7 @@ var StringUtils = /** @class */ (function () {
1347
1347
  return StringUtils;
1348
1348
  }());
1349
1349
 
1350
- /*! @azure/msal-common v13.0.0 2023-05-01 */
1350
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
1351
1351
 
1352
1352
  /*
1353
1353
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1537,12 +1537,12 @@ var Logger = /** @class */ (function () {
1537
1537
  return Logger;
1538
1538
  }());
1539
1539
 
1540
- /*! @azure/msal-common v13.0.0 2023-05-01 */
1540
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
1541
1541
  /* eslint-disable header/header */
1542
1542
  var name$1 = "@azure/msal-common";
1543
- var version$1 = "13.0.0";
1543
+ var version$1 = "13.1.0";
1544
1544
 
1545
- /*! @azure/msal-common v13.0.0 2023-05-01 */
1545
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
1546
1546
  /*
1547
1547
  * Copyright (c) Microsoft Corporation. All rights reserved.
1548
1548
  * Licensed under the MIT License.
@@ -1563,7 +1563,7 @@ exports.AzureCloudInstance = void 0;
1563
1563
  AzureCloudInstance["AzureUsGovernment"] = "https://login.microsoftonline.us";
1564
1564
  })(exports.AzureCloudInstance || (exports.AzureCloudInstance = {}));
1565
1565
 
1566
- /*! @azure/msal-common v13.0.0 2023-05-01 */
1566
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
1567
1567
 
1568
1568
  /*
1569
1569
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1664,6 +1664,10 @@ var ClientConfigurationErrorMessage = {
1664
1664
  invalidAuthenticationHeader: {
1665
1665
  code: "invalid_authentication_header",
1666
1666
  desc: "Invalid authentication header provided"
1667
+ },
1668
+ authorityMismatch: {
1669
+ code: "authority_mismatch",
1670
+ desc: "Authority mismatch error. Authority provided in login request or PublicClientApplication config does not match the environment of the provided account. Please use a matching account or make an interactive request to login to this authority."
1667
1671
  }
1668
1672
  };
1669
1673
  /**
@@ -1815,10 +1819,16 @@ var ClientConfigurationError = /** @class */ (function (_super) {
1815
1819
  ClientConfigurationError.createInvalidAuthenticationHeaderError = function (invalidHeaderName, details) {
1816
1820
  return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidAuthenticationHeader.code, ClientConfigurationErrorMessage.invalidAuthenticationHeader.desc + ". Invalid header: " + invalidHeaderName + ". Details: " + details);
1817
1821
  };
1822
+ /**
1823
+ * Create an error when the authority provided in request does not match authority provided in account or MSAL.js configuration.
1824
+ */
1825
+ ClientConfigurationError.createAuthorityMismatchError = function () {
1826
+ return new ClientConfigurationError(ClientConfigurationErrorMessage.authorityMismatch.code, ClientConfigurationErrorMessage.authorityMismatch.desc);
1827
+ };
1818
1828
  return ClientConfigurationError;
1819
1829
  }(ClientAuthError));
1820
1830
 
1821
- /*! @azure/msal-common v13.0.0 2023-05-01 */
1831
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
1822
1832
 
1823
1833
  /*
1824
1834
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2017,7 +2027,7 @@ var ScopeSet = /** @class */ (function () {
2017
2027
  return ScopeSet;
2018
2028
  }());
2019
2029
 
2020
- /*! @azure/msal-common v13.0.0 2023-05-01 */
2030
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
2021
2031
 
2022
2032
  /*
2023
2033
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2055,7 +2065,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
2055
2065
  };
2056
2066
  }
2057
2067
 
2058
- /*! @azure/msal-common v13.0.0 2023-05-01 */
2068
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
2059
2069
  /*
2060
2070
  * Copyright (c) Microsoft Corporation. All rights reserved.
2061
2071
  * Licensed under the MIT License.
@@ -2071,7 +2081,7 @@ var AuthorityType;
2071
2081
  AuthorityType[AuthorityType["Ciam"] = 3] = "Ciam";
2072
2082
  })(AuthorityType || (AuthorityType = {}));
2073
2083
 
2074
- /*! @azure/msal-common v13.0.0 2023-05-01 */
2084
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
2075
2085
 
2076
2086
  /*
2077
2087
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2310,7 +2320,7 @@ var AccountEntity = /** @class */ (function () {
2310
2320
  return AccountEntity;
2311
2321
  }());
2312
2322
 
2313
- /*! @azure/msal-common v13.0.0 2023-05-01 */
2323
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
2314
2324
 
2315
2325
  /*
2316
2326
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2362,7 +2372,7 @@ var AuthToken = /** @class */ (function () {
2362
2372
  return AuthToken;
2363
2373
  }());
2364
2374
 
2365
- /*! @azure/msal-common v13.0.0 2023-05-01 */
2375
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
2366
2376
 
2367
2377
  /*
2368
2378
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3410,7 +3420,7 @@ var DefaultStorageClass = /** @class */ (function (_super) {
3410
3420
  return DefaultStorageClass;
3411
3421
  }(CacheManager));
3412
3422
 
3413
- /*! @azure/msal-common v13.0.0 2023-05-01 */
3423
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
3414
3424
 
3415
3425
  /*
3416
3426
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3503,7 +3513,7 @@ function buildAuthOptions(authOptions) {
3503
3513
  return __assign({ clientCapabilities: [], azureCloudOptions: DEFAULT_AZURE_CLOUD_OPTIONS, skipAuthorityMetadataCache: false }, authOptions);
3504
3514
  }
3505
3515
 
3506
- /*! @azure/msal-common v13.0.0 2023-05-01 */
3516
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
3507
3517
 
3508
3518
  /*
3509
3519
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3523,7 +3533,7 @@ var ServerError = /** @class */ (function (_super) {
3523
3533
  return ServerError;
3524
3534
  }(AuthError));
3525
3535
 
3526
- /*! @azure/msal-common v13.0.0 2023-05-01 */
3536
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
3527
3537
 
3528
3538
  /*
3529
3539
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3619,7 +3629,7 @@ var ThrottlingUtils = /** @class */ (function () {
3619
3629
  return ThrottlingUtils;
3620
3630
  }());
3621
3631
 
3622
- /*! @azure/msal-common v13.0.0 2023-05-01 */
3632
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
3623
3633
 
3624
3634
  /*
3625
3635
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3668,7 +3678,7 @@ var NetworkManager = /** @class */ (function () {
3668
3678
  return NetworkManager;
3669
3679
  }());
3670
3680
 
3671
- /*! @azure/msal-common v13.0.0 2023-05-01 */
3681
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
3672
3682
  /*
3673
3683
  * Copyright (c) Microsoft Corporation. All rights reserved.
3674
3684
  * Licensed under the MIT License.
@@ -3679,7 +3689,7 @@ var CcsCredentialType;
3679
3689
  CcsCredentialType["UPN"] = "UPN";
3680
3690
  })(CcsCredentialType || (CcsCredentialType = {}));
3681
3691
 
3682
- /*! @azure/msal-common v13.0.0 2023-05-01 */
3692
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
3683
3693
 
3684
3694
  /*
3685
3695
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3770,7 +3780,7 @@ var RequestValidator = /** @class */ (function () {
3770
3780
  return RequestValidator;
3771
3781
  }());
3772
3782
 
3773
- /*! @azure/msal-common v13.0.0 2023-05-01 */
3783
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
3774
3784
 
3775
3785
  /*
3776
3786
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4148,7 +4158,7 @@ var RequestParameterBuilder = /** @class */ (function () {
4148
4158
  return RequestParameterBuilder;
4149
4159
  }());
4150
4160
 
4151
- /*! @azure/msal-common v13.0.0 2023-05-01 */
4161
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
4152
4162
 
4153
4163
  /*
4154
4164
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4250,7 +4260,7 @@ var BaseClient = /** @class */ (function () {
4250
4260
  return BaseClient;
4251
4261
  }());
4252
4262
 
4253
- /*! @azure/msal-common v13.0.0 2023-05-01 */
4263
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
4254
4264
 
4255
4265
  /*
4256
4266
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4388,7 +4398,7 @@ var CredentialEntity = /** @class */ (function () {
4388
4398
  return CredentialEntity;
4389
4399
  }());
4390
4400
 
4391
- /*! @azure/msal-common v13.0.0 2023-05-01 */
4401
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
4392
4402
 
4393
4403
  /*
4394
4404
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4452,7 +4462,7 @@ var IdTokenEntity = /** @class */ (function (_super) {
4452
4462
  return IdTokenEntity;
4453
4463
  }(CredentialEntity));
4454
4464
 
4455
- /*! @azure/msal-common v13.0.0 2023-05-01 */
4465
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
4456
4466
  /*
4457
4467
  * Copyright (c) Microsoft Corporation. All rights reserved.
4458
4468
  * Licensed under the MIT License.
@@ -4502,7 +4512,7 @@ var TimeUtils = /** @class */ (function () {
4502
4512
  return TimeUtils;
4503
4513
  }());
4504
4514
 
4505
- /*! @azure/msal-common v13.0.0 2023-05-01 */
4515
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
4506
4516
 
4507
4517
  /*
4508
4518
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4616,7 +4626,7 @@ var AccessTokenEntity = /** @class */ (function (_super) {
4616
4626
  return AccessTokenEntity;
4617
4627
  }(CredentialEntity));
4618
4628
 
4619
- /*! @azure/msal-common v13.0.0 2023-05-01 */
4629
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
4620
4630
 
4621
4631
  /*
4622
4632
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4683,7 +4693,7 @@ var RefreshTokenEntity = /** @class */ (function (_super) {
4683
4693
  return RefreshTokenEntity;
4684
4694
  }(CredentialEntity));
4685
4695
 
4686
- /*! @azure/msal-common v13.0.0 2023-05-01 */
4696
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
4687
4697
 
4688
4698
  /*
4689
4699
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4762,7 +4772,7 @@ var InteractionRequiredAuthError = /** @class */ (function (_super) {
4762
4772
  return InteractionRequiredAuthError;
4763
4773
  }(AuthError));
4764
4774
 
4765
- /*! @azure/msal-common v13.0.0 2023-05-01 */
4775
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
4766
4776
  /*
4767
4777
  * Copyright (c) Microsoft Corporation. All rights reserved.
4768
4778
  * Licensed under the MIT License.
@@ -4778,7 +4788,7 @@ var CacheRecord = /** @class */ (function () {
4778
4788
  return CacheRecord;
4779
4789
  }());
4780
4790
 
4781
- /*! @azure/msal-common v13.0.0 2023-05-01 */
4791
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
4782
4792
 
4783
4793
  /*
4784
4794
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4849,7 +4859,7 @@ var ProtocolUtils = /** @class */ (function () {
4849
4859
  return ProtocolUtils;
4850
4860
  }());
4851
4861
 
4852
- /*! @azure/msal-common v13.0.0 2023-05-01 */
4862
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
4853
4863
 
4854
4864
  /*
4855
4865
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5083,7 +5093,7 @@ var UrlString = /** @class */ (function () {
5083
5093
  return UrlString;
5084
5094
  }());
5085
5095
 
5086
- /*! @azure/msal-common v13.0.0 2023-05-01 */
5096
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
5087
5097
  /*
5088
5098
  * Copyright (c) Microsoft Corporation. All rights reserved.
5089
5099
  * Licensed under the MIT License.
@@ -5312,7 +5322,7 @@ var IntFields = new Set([
5312
5322
  "status",
5313
5323
  ]);
5314
5324
 
5315
- /*! @azure/msal-common v13.0.0 2023-05-01 */
5325
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
5316
5326
 
5317
5327
  /*
5318
5328
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5421,7 +5431,7 @@ var PopTokenGenerator = /** @class */ (function () {
5421
5431
  return PopTokenGenerator;
5422
5432
  }());
5423
5433
 
5424
- /*! @azure/msal-common v13.0.0 2023-05-01 */
5434
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
5425
5435
 
5426
5436
  /*
5427
5437
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5491,7 +5501,7 @@ var AppMetadataEntity = /** @class */ (function () {
5491
5501
  return AppMetadataEntity;
5492
5502
  }());
5493
5503
 
5494
- /*! @azure/msal-common v13.0.0 2023-05-01 */
5504
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
5495
5505
  /*
5496
5506
  * Copyright (c) Microsoft Corporation. All rights reserved.
5497
5507
  * Licensed under the MIT License.
@@ -5527,7 +5537,7 @@ var AppMetadataEntity = /** @class */ (function () {
5527
5537
  return TokenCacheContext;
5528
5538
  }());
5529
5539
 
5530
- /*! @azure/msal-common v13.0.0 2023-05-01 */
5540
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
5531
5541
 
5532
5542
  /*
5533
5543
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5814,7 +5824,7 @@ var ResponseHandler = /** @class */ (function () {
5814
5824
  return ResponseHandler;
5815
5825
  }());
5816
5826
 
5817
- /*! @azure/msal-common v13.0.0 2023-05-01 */
5827
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
5818
5828
 
5819
5829
  /*
5820
5830
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6244,7 +6254,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
6244
6254
  return [4 /*yield*/, popTokenGenerator.generateCnf(request)];
6245
6255
  case 1:
6246
6256
  reqCnfData = _b.sent();
6247
- parameterBuilder.addPopToken(reqCnfData.reqCnfHash);
6257
+ parameterBuilder.addPopToken(reqCnfData.reqCnfString);
6248
6258
  _b.label = 2;
6249
6259
  case 2: return [2 /*return*/, parameterBuilder.createQueryString()];
6250
6260
  }
@@ -6292,7 +6302,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
6292
6302
  return AuthorizationCodeClient;
6293
6303
  }(BaseClient));
6294
6304
 
6295
- /*! @azure/msal-common v13.0.0 2023-05-01 */
6305
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
6296
6306
 
6297
6307
  /*
6298
6308
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6566,7 +6576,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
6566
6576
  return RefreshTokenClient;
6567
6577
  }(BaseClient));
6568
6578
 
6569
- /*! @azure/msal-common v13.0.0 2023-05-01 */
6579
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
6570
6580
 
6571
6581
  /*
6572
6582
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6690,7 +6700,7 @@ var SilentFlowClient = /** @class */ (function (_super) {
6690
6700
  return SilentFlowClient;
6691
6701
  }(BaseClient));
6692
6702
 
6693
- /*! @azure/msal-common v13.0.0 2023-05-01 */
6703
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
6694
6704
  /*
6695
6705
  * Copyright (c) Microsoft Corporation. All rights reserved.
6696
6706
  * Licensed under the MIT License.
@@ -6702,7 +6712,7 @@ function isOpenIdConfigResponse(response) {
6702
6712
  response.hasOwnProperty("jwks_uri"));
6703
6713
  }
6704
6714
 
6705
- /*! @azure/msal-common v13.0.0 2023-05-01 */
6715
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
6706
6716
  /*
6707
6717
  * Copyright (c) Microsoft Corporation. All rights reserved.
6708
6718
  * Licensed under the MIT License.
@@ -6711,7 +6721,7 @@ var rawMetdataJSON = { "endpointMetadata": { "https://login.microsoftonline.com/
6711
6721
  var EndpointMetadata = rawMetdataJSON.endpointMetadata;
6712
6722
  var InstanceDiscoveryMetadata = rawMetdataJSON.instanceDiscoveryMetadata;
6713
6723
 
6714
- /*! @azure/msal-common v13.0.0 2023-05-01 */
6724
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
6715
6725
  /*
6716
6726
  * Copyright (c) Microsoft Corporation. All rights reserved.
6717
6727
  * Licensed under the MIT License.
@@ -6725,7 +6735,7 @@ exports.ProtocolMode = void 0;
6725
6735
  ProtocolMode["OIDC"] = "OIDC";
6726
6736
  })(exports.ProtocolMode || (exports.ProtocolMode = {}));
6727
6737
 
6728
- /*! @azure/msal-common v13.0.0 2023-05-01 */
6738
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
6729
6739
 
6730
6740
  /*
6731
6741
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6802,7 +6812,7 @@ var AuthorityMetadataEntity = /** @class */ (function () {
6802
6812
  return AuthorityMetadataEntity;
6803
6813
  }());
6804
6814
 
6805
- /*! @azure/msal-common v13.0.0 2023-05-01 */
6815
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
6806
6816
  /*
6807
6817
  * Copyright (c) Microsoft Corporation. All rights reserved.
6808
6818
  * Licensed under the MIT License.
@@ -6812,7 +6822,7 @@ function isCloudInstanceDiscoveryResponse(response) {
6812
6822
  response.hasOwnProperty("metadata"));
6813
6823
  }
6814
6824
 
6815
- /*! @azure/msal-common v13.0.0 2023-05-01 */
6825
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
6816
6826
  /*
6817
6827
  * Copyright (c) Microsoft Corporation. All rights reserved.
6818
6828
  * Licensed under the MIT License.
@@ -6822,7 +6832,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
6822
6832
  response.hasOwnProperty("error_description"));
6823
6833
  }
6824
6834
 
6825
- /*! @azure/msal-common v13.0.0 2023-05-01 */
6835
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
6826
6836
 
6827
6837
  /*
6828
6838
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6954,7 +6964,7 @@ var RegionDiscovery = /** @class */ (function () {
6954
6964
  return RegionDiscovery;
6955
6965
  }());
6956
6966
 
6957
- /*! @azure/msal-common v13.0.0 2023-05-01 */
6967
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
6958
6968
 
6959
6969
  /*
6960
6970
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6977,23 +6987,31 @@ var Authority = /** @class */ (function () {
6977
6987
  this.correlationId = correlationId;
6978
6988
  this.regionDiscovery = new RegionDiscovery(networkInterface, this.performanceClient, this.correlationId);
6979
6989
  }
6990
+ /**
6991
+ * Get {@link AuthorityType}
6992
+ * @param authorityUri {@link IUri}
6993
+ * @private
6994
+ */
6995
+ Authority.prototype.getAuthorityType = function (authorityUri) {
6996
+ // CIAM auth url pattern is being standardized as: <tenant>.ciamlogin.com
6997
+ if (authorityUri.HostNameAndPort.endsWith(Constants.CIAM_AUTH_URL)) {
6998
+ return AuthorityType.Ciam;
6999
+ }
7000
+ var pathSegments = authorityUri.PathSegments;
7001
+ if (pathSegments.length) {
7002
+ switch (pathSegments[0].toLowerCase()) {
7003
+ case Constants.ADFS:
7004
+ return AuthorityType.Adfs;
7005
+ case Constants.DSTS:
7006
+ return AuthorityType.Dsts;
7007
+ }
7008
+ }
7009
+ return AuthorityType.Default;
7010
+ };
6980
7011
  Object.defineProperty(Authority.prototype, "authorityType", {
6981
7012
  // See above for AuthorityType
6982
7013
  get: function () {
6983
- // CIAM auth url pattern is being standardized as: <tenant>.ciamlogin.com
6984
- if (this.canonicalAuthorityUrlComponents.HostNameAndPort.endsWith(Constants.CIAM_AUTH_URL)) {
6985
- return AuthorityType.Ciam;
6986
- }
6987
- var pathSegments = this.canonicalAuthorityUrlComponents.PathSegments;
6988
- if (pathSegments.length) {
6989
- switch (pathSegments[0].toLowerCase()) {
6990
- case Constants.ADFS:
6991
- return AuthorityType.Adfs;
6992
- case Constants.DSTS:
6993
- return AuthorityType.Dsts;
6994
- }
6995
- }
6996
- return AuthorityType.Default;
7014
+ return this.getAuthorityType(this.canonicalAuthorityUrlComponents);
6997
7015
  },
6998
7016
  enumerable: false,
6999
7017
  configurable: true
@@ -7075,8 +7093,7 @@ var Authority = /** @class */ (function () {
7075
7093
  */
7076
7094
  get: function () {
7077
7095
  if (this.discoveryComplete()) {
7078
- var endpoint = this.replacePath(this.metadata.authorization_endpoint);
7079
- return this.replaceTenant(endpoint);
7096
+ return this.replacePath(this.metadata.authorization_endpoint);
7080
7097
  }
7081
7098
  else {
7082
7099
  throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
@@ -7091,8 +7108,7 @@ var Authority = /** @class */ (function () {
7091
7108
  */
7092
7109
  get: function () {
7093
7110
  if (this.discoveryComplete()) {
7094
- var endpoint = this.replacePath(this.metadata.token_endpoint);
7095
- return this.replaceTenant(endpoint);
7111
+ return this.replacePath(this.metadata.token_endpoint);
7096
7112
  }
7097
7113
  else {
7098
7114
  throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
@@ -7104,8 +7120,7 @@ var Authority = /** @class */ (function () {
7104
7120
  Object.defineProperty(Authority.prototype, "deviceCodeEndpoint", {
7105
7121
  get: function () {
7106
7122
  if (this.discoveryComplete()) {
7107
- var endpoint = this.replacePath(this.metadata.token_endpoint.replace("/token", "/devicecode"));
7108
- return this.replaceTenant(endpoint);
7123
+ return this.replacePath(this.metadata.token_endpoint.replace("/token", "/devicecode"));
7109
7124
  }
7110
7125
  else {
7111
7126
  throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
@@ -7124,8 +7139,7 @@ var Authority = /** @class */ (function () {
7124
7139
  if (!this.metadata.end_session_endpoint) {
7125
7140
  throw ClientAuthError.createLogoutNotSupportedError();
7126
7141
  }
7127
- var endpoint = this.replacePath(this.metadata.end_session_endpoint);
7128
- return this.replaceTenant(endpoint);
7142
+ return this.replacePath(this.metadata.end_session_endpoint);
7129
7143
  }
7130
7144
  else {
7131
7145
  throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
@@ -7140,8 +7154,7 @@ var Authority = /** @class */ (function () {
7140
7154
  */
7141
7155
  get: function () {
7142
7156
  if (this.discoveryComplete()) {
7143
- var endpoint = this.replacePath(this.metadata.issuer);
7144
- return this.replaceTenant(endpoint);
7157
+ return this.replacePath(this.metadata.issuer);
7145
7158
  }
7146
7159
  else {
7147
7160
  throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
@@ -7156,8 +7169,7 @@ var Authority = /** @class */ (function () {
7156
7169
  */
7157
7170
  get: function () {
7158
7171
  if (this.discoveryComplete()) {
7159
- var endpoint = this.replacePath(this.metadata.jwks_uri);
7160
- return this.replaceTenant(endpoint);
7172
+ return this.replacePath(this.metadata.jwks_uri);
7161
7173
  }
7162
7174
  else {
7163
7175
  throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
@@ -7166,6 +7178,17 @@ var Authority = /** @class */ (function () {
7166
7178
  enumerable: false,
7167
7179
  configurable: true
7168
7180
  });
7181
+ /**
7182
+ * Returns a flag indicating that tenant name can be replaced in authority {@link IUri}
7183
+ * @param authorityUri {@link IUri}
7184
+ * @private
7185
+ */
7186
+ Authority.prototype.canReplaceTenant = function (authorityUri) {
7187
+ return authorityUri.PathSegments.length === 1
7188
+ && !Authority.reservedTenantDomains.has(authorityUri.PathSegments[0])
7189
+ && this.getAuthorityType(authorityUri) === AuthorityType.Default
7190
+ && this.protocolMode === exports.ProtocolMode.AAD;
7191
+ };
7169
7192
  /**
7170
7193
  * Replaces tenant in url path with current tenant. Defaults to common.
7171
7194
  * @param urlString
@@ -7178,17 +7201,31 @@ var Authority = /** @class */ (function () {
7178
7201
  * @param urlString
7179
7202
  */
7180
7203
  Authority.prototype.replacePath = function (urlString) {
7204
+ var _this = this;
7181
7205
  var endpoint = urlString;
7182
7206
  var cachedAuthorityUrl = new UrlString(this.metadata.canonical_authority);
7183
- var cachedAuthorityParts = cachedAuthorityUrl.getUrlComponents().PathSegments;
7207
+ var cachedAuthorityUrlComponents = cachedAuthorityUrl.getUrlComponents();
7208
+ var cachedAuthorityParts = cachedAuthorityUrlComponents.PathSegments;
7184
7209
  var currentAuthorityParts = this.canonicalAuthorityUrlComponents.PathSegments;
7185
7210
  currentAuthorityParts.forEach(function (currentPart, index) {
7186
7211
  var cachedPart = cachedAuthorityParts[index];
7212
+ if (index === 0 && _this.canReplaceTenant(cachedAuthorityUrlComponents)) {
7213
+ var tenantId = (new UrlString(_this.metadata.authorization_endpoint)).getUrlComponents().PathSegments[0];
7214
+ /**
7215
+ * Check if AAD canonical authority contains tenant domain name, for example "testdomain.onmicrosoft.com",
7216
+ * by comparing its first path segment to the corresponding authorization endpoint path segment, which is
7217
+ * always resolved with tenant id by OIDC.
7218
+ */
7219
+ if (cachedPart !== tenantId) {
7220
+ _this.logger.verbose("Replacing tenant domain name " + cachedPart + " with id " + tenantId);
7221
+ cachedPart = tenantId;
7222
+ }
7223
+ }
7187
7224
  if (currentPart !== cachedPart) {
7188
7225
  endpoint = endpoint.replace("/" + cachedPart + "/", "/" + currentPart + "/");
7189
7226
  }
7190
7227
  });
7191
- return endpoint;
7228
+ return this.replaceTenant(endpoint);
7192
7229
  };
7193
7230
  Object.defineProperty(Authority.prototype, "defaultOpenIdConfigurationEndpoint", {
7194
7231
  /**
@@ -7716,10 +7753,18 @@ var Authority = /** @class */ (function () {
7716
7753
  }
7717
7754
  return ciamAuthority;
7718
7755
  };
7756
+ // Reserved tenant domain names that will not be replaced with tenant id
7757
+ Authority.reservedTenantDomains = (new Set([
7758
+ "{tenant}",
7759
+ "{tenantid}",
7760
+ AADAuthorityConstants.COMMON,
7761
+ AADAuthorityConstants.CONSUMERS,
7762
+ AADAuthorityConstants.ORGANIZATIONS
7763
+ ]));
7719
7764
  return Authority;
7720
7765
  }());
7721
7766
 
7722
- /*! @azure/msal-common v13.0.0 2023-05-01 */
7767
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
7723
7768
 
7724
7769
  /*
7725
7770
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7783,7 +7828,7 @@ var AuthorityFactory = /** @class */ (function () {
7783
7828
  return AuthorityFactory;
7784
7829
  }());
7785
7830
 
7786
- /*! @azure/msal-common v13.0.0 2023-05-01 */
7831
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
7787
7832
 
7788
7833
  /*
7789
7834
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7814,7 +7859,7 @@ var ServerTelemetryEntity = /** @class */ (function () {
7814
7859
  return ServerTelemetryEntity;
7815
7860
  }());
7816
7861
 
7817
- /*! @azure/msal-common v13.0.0 2023-05-01 */
7862
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
7818
7863
 
7819
7864
  /*
7820
7865
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7842,7 +7887,7 @@ var ThrottlingEntity = /** @class */ (function () {
7842
7887
  return ThrottlingEntity;
7843
7888
  }());
7844
7889
 
7845
- /*! @azure/msal-common v13.0.0 2023-05-01 */
7890
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
7846
7891
 
7847
7892
  /*
7848
7893
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7859,7 +7904,7 @@ var StubbedNetworkModule = {
7859
7904
  }
7860
7905
  };
7861
7906
 
7862
- /*! @azure/msal-common v13.0.0 2023-05-01 */
7907
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
7863
7908
 
7864
7909
  /*
7865
7910
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7904,7 +7949,7 @@ var JoseHeaderError = /** @class */ (function (_super) {
7904
7949
  return JoseHeaderError;
7905
7950
  }(AuthError));
7906
7951
 
7907
- /*! @azure/msal-common v13.0.0 2023-05-01 */
7952
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
7908
7953
 
7909
7954
  /*
7910
7955
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7944,7 +7989,7 @@ var JoseHeader = /** @class */ (function () {
7944
7989
  return JoseHeader;
7945
7990
  }());
7946
7991
 
7947
- /*! @azure/msal-common v13.0.0 2023-05-01 */
7992
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
7948
7993
 
7949
7994
  /*
7950
7995
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8003,7 +8048,7 @@ var AuthenticationHeaderParser = /** @class */ (function () {
8003
8048
  return AuthenticationHeaderParser;
8004
8049
  }());
8005
8050
 
8006
- /*! @azure/msal-common v13.0.0 2023-05-01 */
8051
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
8007
8052
 
8008
8053
  /*
8009
8054
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8165,7 +8210,7 @@ var ServerTelemetryManager = /** @class */ (function () {
8165
8210
  return ServerTelemetryManager;
8166
8211
  }());
8167
8212
 
8168
- /*! @azure/msal-common v13.0.0 2023-05-01 */
8213
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
8169
8214
 
8170
8215
  /*
8171
8216
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8568,7 +8613,7 @@ var PerformanceClient = /** @class */ (function () {
8568
8613
  return PerformanceClient;
8569
8614
  }());
8570
8615
 
8571
- /*! @azure/msal-common v13.0.0 2023-05-01 */
8616
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
8572
8617
 
8573
8618
  /*
8574
8619
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10793,7 +10838,7 @@ var DEFAULT_BROWSER_CACHE_MANAGER = function (clientId, logger) {
10793
10838
 
10794
10839
  /* eslint-disable header/header */
10795
10840
  var name = "@azure/msal-browser";
10796
- var version = "2.37.0";
10841
+ var version = "2.37.1";
10797
10842
 
10798
10843
  /*
10799
10844
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -11258,7 +11303,7 @@ var BaseInteractionClient = /** @class */ (function () {
11258
11303
  * Initializer function for all request APIs
11259
11304
  * @param request
11260
11305
  */
11261
- BaseInteractionClient.prototype.initializeBaseRequest = function (request) {
11306
+ BaseInteractionClient.prototype.initializeBaseRequest = function (request, account) {
11262
11307
  return __awaiter$1(this, void 0, void 0, function () {
11263
11308
  var authority, scopes, validatedRequest, _a;
11264
11309
  return __generator$1(this, function (_b) {
@@ -11267,6 +11312,12 @@ var BaseInteractionClient = /** @class */ (function () {
11267
11312
  this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.InitializeBaseRequest, request.correlationId);
11268
11313
  this.logger.verbose("Initializing BaseAuthRequest");
11269
11314
  authority = request.authority || this.config.auth.authority;
11315
+ if (!account) return [3 /*break*/, 2];
11316
+ return [4 /*yield*/, this.validateRequestAuthority(authority, account)];
11317
+ case 1:
11318
+ _b.sent();
11319
+ _b.label = 2;
11320
+ case 2:
11270
11321
  scopes = __spread(((request && request.scopes) || []));
11271
11322
  validatedRequest = __assign$1(__assign$1({}, request), { correlationId: this.correlationId, authority: authority,
11272
11323
  scopes: scopes });
@@ -11286,13 +11337,13 @@ var BaseInteractionClient = /** @class */ (function () {
11286
11337
  }
11287
11338
  this.logger.verbose("Authentication Scheme set to \"" + validatedRequest.authenticationScheme + "\" as configured in Auth request");
11288
11339
  }
11289
- if (!(request.claims && !StringUtils.isEmpty(request.claims))) return [3 /*break*/, 2];
11340
+ if (!(request.claims && !StringUtils.isEmpty(request.claims))) return [3 /*break*/, 4];
11290
11341
  _a = validatedRequest;
11291
11342
  return [4 /*yield*/, this.browserCrypto.hashString(request.claims)];
11292
- case 1:
11343
+ case 3:
11293
11344
  _a.requestedClaimsHash = _b.sent();
11294
- _b.label = 2;
11295
- case 2: return [2 /*return*/, validatedRequest];
11345
+ _b.label = 4;
11346
+ case 4: return [2 /*return*/, validatedRequest];
11296
11347
  }
11297
11348
  });
11298
11349
  });
@@ -11309,6 +11360,26 @@ var BaseInteractionClient = /** @class */ (function () {
11309
11360
  var redirectUri = requestRedirectUri || this.config.auth.redirectUri || BrowserUtils.getCurrentUri();
11310
11361
  return UrlString.getAbsoluteUrl(redirectUri, BrowserUtils.getCurrentUri());
11311
11362
  };
11363
+ /*
11364
+ * If authority provided in the request does not match environment/authority specified
11365
+ * in the account or MSAL config, we throw an error.
11366
+ */
11367
+ BaseInteractionClient.prototype.validateRequestAuthority = function (authority, account) {
11368
+ return __awaiter$1(this, void 0, void 0, function () {
11369
+ var discoveredAuthority;
11370
+ return __generator$1(this, function (_a) {
11371
+ switch (_a.label) {
11372
+ case 0: return [4 /*yield*/, this.getDiscoveredAuthority(authority)];
11373
+ case 1:
11374
+ discoveredAuthority = _a.sent();
11375
+ if (!discoveredAuthority.isAlias(account.environment)) {
11376
+ throw ClientConfigurationError.createAuthorityMismatchError();
11377
+ }
11378
+ return [2 /*return*/];
11379
+ }
11380
+ });
11381
+ });
11382
+ };
11312
11383
  /**
11313
11384
  *
11314
11385
  * @param apiId
@@ -11973,6 +12044,7 @@ exports.EventType = void 0;
11973
12044
  EventType["LOGOUT_SUCCESS"] = "msal:logoutSuccess";
11974
12045
  EventType["LOGOUT_FAILURE"] = "msal:logoutFailure";
11975
12046
  EventType["LOGOUT_END"] = "msal:logoutEnd";
12047
+ EventType["RESTORE_FROM_BFCACHE"] = "msal:restoreFromBFCache";
11976
12048
  })(exports.EventType || (exports.EventType = {}));
11977
12049
 
11978
12050
  /*
@@ -12153,7 +12225,7 @@ var SilentCacheClient = /** @class */ (function (_super) {
12153
12225
  this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.InitializeSilentRequest, this.correlationId);
12154
12226
  this.performanceClient.setPreQueueTime(exports.PerformanceEvents.InitializeBaseRequest, this.correlationId);
12155
12227
  _a = [__assign$1({}, request)];
12156
- return [4 /*yield*/, this.initializeBaseRequest(request)];
12228
+ return [4 /*yield*/, this.initializeBaseRequest(request, account)];
12157
12229
  case 1: return [2 /*return*/, __assign$1.apply(void 0, [__assign$1.apply(void 0, _a.concat([_b.sent()])), { account: account, forceRefresh: request.forceRefresh || false }])];
12158
12230
  }
12159
12231
  });
@@ -12427,7 +12499,7 @@ var NativeInteractionClient = /** @class */ (function (_super) {
12427
12499
  result = _a.sent();
12428
12500
  // cache accounts and tokens in the appropriate storage
12429
12501
  this.cacheAccount(accountEntity);
12430
- this.cacheNativeTokens(response, request, homeAccountIdentifier, idTokenObj, result.accessToken, result.tenantId, reqTimestamp);
12502
+ this.cacheNativeTokens(response, request, homeAccountIdentifier, accountEntity, idTokenObj, result.accessToken, result.tenantId, reqTimestamp);
12431
12503
  return [2 /*return*/, result];
12432
12504
  }
12433
12505
  });
@@ -12583,10 +12655,8 @@ var NativeInteractionClient = /** @class */ (function (_super) {
12583
12655
  * @param tenantId
12584
12656
  * @param reqTimestamp
12585
12657
  */
12586
- NativeInteractionClient.prototype.cacheNativeTokens = function (response, request, homeAccountIdentifier, idTokenObj, responseAccessToken, tenantId, reqTimestamp) {
12587
- // cache idToken in inmemory storage
12588
- var idTokenEntity = IdTokenEntity.createIdTokenEntity(homeAccountIdentifier, request.authority, response.id_token || Constants.EMPTY_STRING, request.clientId, idTokenObj.claims.tid || Constants.EMPTY_STRING);
12589
- this.nativeStorageManager.setIdTokenCredential(idTokenEntity);
12658
+ NativeInteractionClient.prototype.cacheNativeTokens = function (response, request, homeAccountIdentifier, accountEntity, idTokenObj, responseAccessToken, tenantId, reqTimestamp) {
12659
+ var cachedIdToken = IdTokenEntity.createIdTokenEntity(homeAccountIdentifier, request.authority, response.id_token || Constants.EMPTY_STRING, request.clientId, idTokenObj.claims.tid || Constants.EMPTY_STRING);
12590
12660
  // cache accessToken in inmemory storage
12591
12661
  var expiresIn = (request.tokenType === exports.AuthenticationScheme.POP)
12592
12662
  ? Constants.SHR_NONCE_VALIDITY
@@ -12595,8 +12665,11 @@ var NativeInteractionClient = /** @class */ (function (_super) {
12595
12665
  : response.expires_in) || 0;
12596
12666
  var tokenExpirationSeconds = reqTimestamp + expiresIn;
12597
12667
  var responseScopes = this.generateScopes(response, request);
12598
- var accessTokenEntity = AccessTokenEntity.createAccessTokenEntity(homeAccountIdentifier, request.authority, responseAccessToken, request.clientId, tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, this.browserCrypto);
12599
- this.nativeStorageManager.setAccessTokenCredential(accessTokenEntity);
12668
+ var cachedAccessToken = AccessTokenEntity.createAccessTokenEntity(homeAccountIdentifier, request.authority, responseAccessToken, request.clientId, idTokenObj
12669
+ ? idTokenObj.claims.tid || Constants.EMPTY_STRING
12670
+ : tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, this.browserCrypto);
12671
+ var nativeCacheRecord = new CacheRecord(accountEntity, cachedIdToken, cachedAccessToken);
12672
+ this.nativeStorageManager.saveCacheRecord(nativeCacheRecord);
12600
12673
  };
12601
12674
  NativeInteractionClient.prototype.addTelemetryFromNativeResponse = function (response) {
12602
12675
  var mats = this.getMATSFromResponse(response);
@@ -12680,6 +12753,12 @@ var NativeInteractionClient = /** @class */ (function (_super) {
12680
12753
  case 0:
12681
12754
  this.logger.trace("NativeInteractionClient - initializeNativeRequest called");
12682
12755
  authority = request.authority || this.config.auth.authority;
12756
+ if (!request.account) return [3 /*break*/, 2];
12757
+ return [4 /*yield*/, this.validateRequestAuthority(authority, request.account)];
12758
+ case 1:
12759
+ _a.sent();
12760
+ _a.label = 2;
12761
+ case 2:
12683
12762
  canonicalAuthority = new UrlString(authority);
12684
12763
  canonicalAuthority.validateAsUri();
12685
12764
  scopes = request.scopes, remainingProperties = __rest(request, ["scopes"]);
@@ -12712,7 +12791,7 @@ var NativeInteractionClient = /** @class */ (function (_super) {
12712
12791
  };
12713
12792
  validatedRequest = __assign$1(__assign$1({}, remainingProperties), { accountId: this.accountId, clientId: this.config.auth.clientId, authority: canonicalAuthority.urlString, scope: scopeSet.printScopes(), redirectUri: this.getRedirectUri(request.redirectUri), prompt: getPrompt(), correlationId: this.correlationId, tokenType: request.authenticationScheme, windowTitleSubstring: document.title, extraParameters: __assign$1(__assign$1(__assign$1({}, request.extraQueryParameters), request.tokenQueryParameters), { telemetry: NativeConstants.MATS_TELEMETRY }), extendedExpiryToken: false // Make this configurable?
12714
12793
  });
12715
- if (!(request.authenticationScheme === exports.AuthenticationScheme.POP)) return [3 /*break*/, 2];
12794
+ if (!(request.authenticationScheme === exports.AuthenticationScheme.POP)) return [3 /*break*/, 4];
12716
12795
  shrParameters = {
12717
12796
  resourceRequestUri: request.resourceRequestUri,
12718
12797
  resourceRequestMethod: request.resourceRequestMethod,
@@ -12721,13 +12800,13 @@ var NativeInteractionClient = /** @class */ (function (_super) {
12721
12800
  };
12722
12801
  popTokenGenerator = new PopTokenGenerator(this.browserCrypto);
12723
12802
  return [4 /*yield*/, popTokenGenerator.generateCnf(shrParameters)];
12724
- case 1:
12803
+ case 3:
12725
12804
  reqCnfData = _a.sent();
12726
- // to reduce the URL length, it is recommended to send the hash of the req_cnf instead of the whole string
12727
- validatedRequest.reqCnf = reqCnfData.reqCnfHash;
12805
+ // to reduce the URL length, it is recommended to send the short form of the req_cnf
12806
+ validatedRequest.reqCnf = reqCnfData.reqCnfString;
12728
12807
  validatedRequest.keyId = reqCnfData.kid;
12729
- _a.label = 2;
12730
- case 2: return [2 /*return*/, validatedRequest];
12808
+ _a.label = 4;
12809
+ case 4: return [2 /*return*/, validatedRequest];
12731
12810
  }
12732
12811
  });
12733
12812
  });
@@ -13029,6 +13108,7 @@ var RedirectClient = /** @class */ (function (_super) {
13029
13108
  if (event.persisted) {
13030
13109
  _this.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache.");
13031
13110
  _this.browserStorage.cleanRequestByState(validRequest.state);
13111
+ _this.eventHandler.emitEvent(exports.EventType.RESTORE_FROM_BFCACHE, exports.InteractionType.Redirect);
13032
13112
  }
13033
13113
  };
13034
13114
  _a.label = 2;
@@ -13220,7 +13300,7 @@ var RedirectClient = /** @class */ (function (_super) {
13220
13300
  if (!this.nativeMessageHandler) {
13221
13301
  throw BrowserAuthError.createNativeConnectionNotEstablishedError();
13222
13302
  }
13223
- nativeInteractionClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, exports.ApiId.acquireTokenPopup, this.performanceClient, this.nativeMessageHandler, serverParams.accountId, this.browserStorage, cachedRequest.correlationId);
13303
+ nativeInteractionClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, exports.ApiId.acquireTokenPopup, this.performanceClient, this.nativeMessageHandler, serverParams.accountId, this.nativeStorage, cachedRequest.correlationId);
13224
13304
  userRequestState = ProtocolUtils.parseRequestState(this.browserCrypto, state).userRequestState;
13225
13305
  return [2 /*return*/, nativeInteractionClient.acquireToken(__assign$1(__assign$1({}, cachedRequest), { state: userRequestState, prompt: undefined // Server should handle the prompt, ideally native broker can do this part silently
13226
13306
  })).finally(function () {
@@ -14274,7 +14354,7 @@ var SilentRefreshClient = /** @class */ (function (_super) {
14274
14354
  this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.SilentRefreshClientAcquireToken, request.correlationId);
14275
14355
  this.performanceClient.setPreQueueTime(exports.PerformanceEvents.InitializeBaseRequest, request.correlationId);
14276
14356
  _a = [__assign$1({}, request)];
14277
- return [4 /*yield*/, this.initializeBaseRequest(request)];
14357
+ return [4 /*yield*/, this.initializeBaseRequest(request, request.account)];
14278
14358
  case 1:
14279
14359
  silentRequest = __assign$1.apply(void 0, _a.concat([_b.sent()]));
14280
14360
  acquireTokenMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.SilentRefreshClientAcquireToken, silentRequest.correlationId);
@@ -17974,6 +18054,7 @@ var EventMessageUtils = /** @class */ (function () {
17974
18054
  case exports.EventType.LOGIN_FAILURE:
17975
18055
  case exports.EventType.ACQUIRE_TOKEN_SUCCESS:
17976
18056
  case exports.EventType.ACQUIRE_TOKEN_FAILURE:
18057
+ case exports.EventType.RESTORE_FROM_BFCACHE:
17977
18058
  if (message.interactionType === exports.InteractionType.Redirect || message.interactionType === exports.InteractionType.Popup) {
17978
18059
  if (currentStatus && currentStatus !== exports.InteractionStatus.Login && currentStatus !== exports.InteractionStatus.AcquireToken) {
17979
18060
  // Prevent this event from clearing any status other than login or acquireToken