@azure/msal-browser 2.37.0 → 2.38.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 (88) hide show
  1. package/README.md +1 -1
  2. package/dist/_virtual/_tslib.js +1 -1
  3. package/dist/app/ClientApplication.d.ts.map +1 -1
  4. package/dist/app/ClientApplication.js +3 -2
  5. package/dist/app/ClientApplication.js.map +1 -1
  6. package/dist/app/IPublicClientApplication.js +1 -1
  7. package/dist/app/PublicClientApplication.js +1 -1
  8. package/dist/broker/nativeBroker/NativeMessageHandler.js +1 -1
  9. package/dist/cache/AsyncMemoryStorage.js +1 -1
  10. package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
  11. package/dist/cache/BrowserCacheManager.js +3 -2
  12. package/dist/cache/BrowserCacheManager.js.map +1 -1
  13. package/dist/cache/BrowserStorage.js +1 -1
  14. package/dist/cache/CryptoKeyStore.js +1 -1
  15. package/dist/cache/DatabaseStorage.js +1 -1
  16. package/dist/cache/MemoryStorage.js +1 -1
  17. package/dist/cache/TokenCache.js +1 -1
  18. package/dist/config/Configuration.d.ts +4 -0
  19. package/dist/config/Configuration.d.ts.map +1 -1
  20. package/dist/config/Configuration.js +3 -2
  21. package/dist/config/Configuration.js.map +1 -1
  22. package/dist/crypto/BrowserCrypto.js +1 -1
  23. package/dist/crypto/CryptoOps.js +1 -1
  24. package/dist/crypto/GuidGenerator.js +1 -1
  25. package/dist/crypto/ModernBrowserCrypto.js +1 -1
  26. package/dist/crypto/MsBrowserCrypto.js +1 -1
  27. package/dist/crypto/MsrBrowserCrypto.js +1 -1
  28. package/dist/crypto/PkceGenerator.js +1 -1
  29. package/dist/crypto/SignedHttpRequest.js +1 -1
  30. package/dist/encode/Base64Decode.js +1 -1
  31. package/dist/encode/Base64Encode.js +1 -1
  32. package/dist/error/BrowserAuthError.js +1 -1
  33. package/dist/error/BrowserConfigurationAuthError.js +1 -1
  34. package/dist/error/NativeAuthError.js +1 -1
  35. package/dist/event/EventHandler.js +1 -1
  36. package/dist/event/EventMessage.d.ts.map +1 -1
  37. package/dist/event/EventMessage.js +2 -1
  38. package/dist/event/EventMessage.js.map +1 -1
  39. package/dist/event/EventType.d.ts +2 -1
  40. package/dist/event/EventType.d.ts.map +1 -1
  41. package/dist/event/EventType.js +2 -1
  42. package/dist/event/EventType.js.map +1 -1
  43. package/dist/index.cjs.js +243 -152
  44. package/dist/index.cjs.js.map +1 -1
  45. package/dist/index.js +1 -1
  46. package/dist/interaction_client/BaseInteractionClient.d.ts +2 -1
  47. package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
  48. package/dist/interaction_client/BaseInteractionClient.js +33 -7
  49. package/dist/interaction_client/BaseInteractionClient.js.map +1 -1
  50. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +1 -1
  51. package/dist/interaction_client/NativeInteractionClient.d.ts +1 -1
  52. package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
  53. package/dist/interaction_client/NativeInteractionClient.js +22 -15
  54. package/dist/interaction_client/NativeInteractionClient.js.map +1 -1
  55. package/dist/interaction_client/PopupClient.js +1 -1
  56. package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
  57. package/dist/interaction_client/RedirectClient.js +3 -2
  58. package/dist/interaction_client/RedirectClient.js.map +1 -1
  59. package/dist/interaction_client/SilentAuthCodeClient.js +1 -1
  60. package/dist/interaction_client/SilentCacheClient.js +2 -2
  61. package/dist/interaction_client/SilentCacheClient.js.map +1 -1
  62. package/dist/interaction_client/SilentIframeClient.js +1 -1
  63. package/dist/interaction_client/SilentRefreshClient.js +2 -2
  64. package/dist/interaction_client/SilentRefreshClient.js.map +1 -1
  65. package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
  66. package/dist/interaction_client/StandardInteractionClient.js +4 -1
  67. package/dist/interaction_client/StandardInteractionClient.js.map +1 -1
  68. package/dist/interaction_handler/InteractionHandler.js +1 -1
  69. package/dist/interaction_handler/RedirectHandler.js +1 -1
  70. package/dist/interaction_handler/SilentHandler.js +1 -1
  71. package/dist/internals.js +1 -1
  72. package/dist/navigation/NavigationClient.js +1 -1
  73. package/dist/network/FetchClient.js +1 -1
  74. package/dist/network/XhrClient.js +1 -1
  75. package/dist/packageMetadata.d.ts +1 -1
  76. package/dist/packageMetadata.js +2 -2
  77. package/dist/packageMetadata.js.map +1 -1
  78. package/dist/telemetry/BrowserPerformanceClient.js +1 -1
  79. package/dist/telemetry/BrowserPerformanceMeasurement.js +1 -1
  80. package/dist/utils/BrowserConstants.js +1 -1
  81. package/dist/utils/BrowserProtocolUtils.js +1 -1
  82. package/dist/utils/BrowserStringUtils.js +1 -1
  83. package/dist/utils/BrowserUtils.js +1 -1
  84. package/dist/utils/MathUtils.js +1 -1
  85. package/lib/msal-browser.js +243 -152
  86. package/lib/msal-browser.js.map +1 -1
  87. package/lib/msal-browser.min.js +38 -38
  88. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v2.37.0 2023-05-01 */
1
+ /*! @azure/msal-browser v2.38.0 2023-07-05 */
2
2
  'use strict';
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
@@ -119,7 +119,7 @@
119
119
  return ar;
120
120
  }
121
121
 
122
- /*! @azure/msal-common v13.0.0 2023-05-01 */
122
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
123
123
  /*! *****************************************************************************
124
124
  Copyright (c) Microsoft Corporation.
125
125
 
@@ -206,7 +206,7 @@
206
206
  return r;
207
207
  }
208
208
 
209
- /*! @azure/msal-common v13.0.0 2023-05-01 */
209
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
210
210
 
211
211
  /*
212
212
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -570,6 +570,7 @@
570
570
  CacheOutcome["NO_CACHED_ACCESS_TOKEN"] = "2";
571
571
  CacheOutcome["CACHED_ACCESS_TOKEN_EXPIRED"] = "3";
572
572
  CacheOutcome["REFRESH_CACHED_ACCESS_TOKEN"] = "4";
573
+ CacheOutcome["CLAIMS_REQUESTED_CACHE_SKIPPED"] = "5";
573
574
  })(CacheOutcome || (CacheOutcome = {}));
574
575
  var JsonTypes;
575
576
  (function (JsonTypes) {
@@ -578,7 +579,7 @@
578
579
  JsonTypes["Pop"] = "pop";
579
580
  })(JsonTypes || (JsonTypes = {}));
580
581
 
581
- /*! @azure/msal-common v13.0.0 2023-05-01 */
582
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
582
583
 
583
584
  /*
584
585
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -634,7 +635,7 @@
634
635
  return AuthError;
635
636
  }(Error));
636
637
 
637
- /*! @azure/msal-common v13.0.0 2023-05-01 */
638
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
638
639
 
639
640
  /*
640
641
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -709,7 +710,7 @@
709
710
  }
710
711
  };
711
712
 
712
- /*! @azure/msal-common v13.0.0 2023-05-01 */
713
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
713
714
 
714
715
  /*
715
716
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1224,7 +1225,7 @@
1224
1225
  return ClientAuthError;
1225
1226
  }(AuthError));
1226
1227
 
1227
- /*! @azure/msal-common v13.0.0 2023-05-01 */
1228
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
1228
1229
 
1229
1230
  /*
1230
1231
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1349,7 +1350,7 @@
1349
1350
  return StringUtils;
1350
1351
  }());
1351
1352
 
1352
- /*! @azure/msal-common v13.0.0 2023-05-01 */
1353
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
1353
1354
 
1354
1355
  /*
1355
1356
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1539,12 +1540,12 @@
1539
1540
  return Logger;
1540
1541
  }());
1541
1542
 
1542
- /*! @azure/msal-common v13.0.0 2023-05-01 */
1543
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
1543
1544
  /* eslint-disable header/header */
1544
1545
  var name$1 = "@azure/msal-common";
1545
- var version$1 = "13.0.0";
1546
+ var version$1 = "13.2.0";
1546
1547
 
1547
- /*! @azure/msal-common v13.0.0 2023-05-01 */
1548
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
1548
1549
  /*
1549
1550
  * Copyright (c) Microsoft Corporation. All rights reserved.
1550
1551
  * Licensed under the MIT License.
@@ -1565,7 +1566,7 @@
1565
1566
  AzureCloudInstance["AzureUsGovernment"] = "https://login.microsoftonline.us";
1566
1567
  })(exports.AzureCloudInstance || (exports.AzureCloudInstance = {}));
1567
1568
 
1568
- /*! @azure/msal-common v13.0.0 2023-05-01 */
1569
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
1569
1570
 
1570
1571
  /*
1571
1572
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1666,6 +1667,10 @@
1666
1667
  invalidAuthenticationHeader: {
1667
1668
  code: "invalid_authentication_header",
1668
1669
  desc: "Invalid authentication header provided"
1670
+ },
1671
+ authorityMismatch: {
1672
+ code: "authority_mismatch",
1673
+ 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."
1669
1674
  }
1670
1675
  };
1671
1676
  /**
@@ -1817,10 +1822,16 @@
1817
1822
  ClientConfigurationError.createInvalidAuthenticationHeaderError = function (invalidHeaderName, details) {
1818
1823
  return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidAuthenticationHeader.code, ClientConfigurationErrorMessage.invalidAuthenticationHeader.desc + ". Invalid header: " + invalidHeaderName + ". Details: " + details);
1819
1824
  };
1825
+ /**
1826
+ * Create an error when the authority provided in request does not match authority provided in account or MSAL.js configuration.
1827
+ */
1828
+ ClientConfigurationError.createAuthorityMismatchError = function () {
1829
+ return new ClientConfigurationError(ClientConfigurationErrorMessage.authorityMismatch.code, ClientConfigurationErrorMessage.authorityMismatch.desc);
1830
+ };
1820
1831
  return ClientConfigurationError;
1821
1832
  }(ClientAuthError));
1822
1833
 
1823
- /*! @azure/msal-common v13.0.0 2023-05-01 */
1834
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
1824
1835
 
1825
1836
  /*
1826
1837
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2019,7 +2030,7 @@
2019
2030
  return ScopeSet;
2020
2031
  }());
2021
2032
 
2022
- /*! @azure/msal-common v13.0.0 2023-05-01 */
2033
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
2023
2034
 
2024
2035
  /*
2025
2036
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2057,7 +2068,7 @@
2057
2068
  };
2058
2069
  }
2059
2070
 
2060
- /*! @azure/msal-common v13.0.0 2023-05-01 */
2071
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
2061
2072
  /*
2062
2073
  * Copyright (c) Microsoft Corporation. All rights reserved.
2063
2074
  * Licensed under the MIT License.
@@ -2073,7 +2084,7 @@
2073
2084
  AuthorityType[AuthorityType["Ciam"] = 3] = "Ciam";
2074
2085
  })(AuthorityType || (AuthorityType = {}));
2075
2086
 
2076
- /*! @azure/msal-common v13.0.0 2023-05-01 */
2087
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
2077
2088
 
2078
2089
  /*
2079
2090
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2312,7 +2323,7 @@
2312
2323
  return AccountEntity;
2313
2324
  }());
2314
2325
 
2315
- /*! @azure/msal-common v13.0.0 2023-05-01 */
2326
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
2316
2327
 
2317
2328
  /*
2318
2329
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2364,7 +2375,7 @@
2364
2375
  return AuthToken;
2365
2376
  }());
2366
2377
 
2367
- /*! @azure/msal-common v13.0.0 2023-05-01 */
2378
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
2368
2379
 
2369
2380
  /*
2370
2381
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3412,7 +3423,7 @@
3412
3423
  return DefaultStorageClass;
3413
3424
  }(CacheManager));
3414
3425
 
3415
- /*! @azure/msal-common v13.0.0 2023-05-01 */
3426
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
3416
3427
 
3417
3428
  /*
3418
3429
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3432,6 +3443,9 @@
3432
3443
  logLevel: exports.LogLevel.Info,
3433
3444
  correlationId: Constants.EMPTY_STRING
3434
3445
  };
3446
+ var DEFAULT_CACHE_OPTIONS = {
3447
+ claimsBasedCachingEnabled: true
3448
+ };
3435
3449
  var DEFAULT_NETWORK_IMPLEMENTATION = {
3436
3450
  sendGetRequestAsync: function () {
3437
3451
  return __awaiter(this, void 0, void 0, function () {
@@ -3480,12 +3494,13 @@
3480
3494
  * @returns Configuration
3481
3495
  */
3482
3496
  function buildClientConfiguration(_a) {
3483
- var userAuthOptions = _a.authOptions, userSystemOptions = _a.systemOptions, userLoggerOption = _a.loggerOptions, storageImplementation = _a.storageInterface, networkImplementation = _a.networkInterface, cryptoImplementation = _a.cryptoInterface, clientCredentials = _a.clientCredentials, libraryInfo = _a.libraryInfo, telemetry = _a.telemetry, serverTelemetryManager = _a.serverTelemetryManager, persistencePlugin = _a.persistencePlugin, serializableCache = _a.serializableCache;
3497
+ var userAuthOptions = _a.authOptions, userSystemOptions = _a.systemOptions, userLoggerOption = _a.loggerOptions, userCacheOptions = _a.cacheOptions, storageImplementation = _a.storageInterface, networkImplementation = _a.networkInterface, cryptoImplementation = _a.cryptoInterface, clientCredentials = _a.clientCredentials, libraryInfo = _a.libraryInfo, telemetry = _a.telemetry, serverTelemetryManager = _a.serverTelemetryManager, persistencePlugin = _a.persistencePlugin, serializableCache = _a.serializableCache;
3484
3498
  var loggerOptions = __assign(__assign({}, DEFAULT_LOGGER_IMPLEMENTATION), userLoggerOption);
3485
3499
  return {
3486
3500
  authOptions: buildAuthOptions(userAuthOptions),
3487
3501
  systemOptions: __assign(__assign({}, DEFAULT_SYSTEM_OPTIONS), userSystemOptions),
3488
3502
  loggerOptions: loggerOptions,
3503
+ cacheOptions: __assign(__assign({}, DEFAULT_CACHE_OPTIONS), userCacheOptions),
3489
3504
  storageInterface: storageImplementation || new DefaultStorageClass(userAuthOptions.clientId, DEFAULT_CRYPTO_IMPLEMENTATION, new Logger(loggerOptions)),
3490
3505
  networkInterface: networkImplementation || DEFAULT_NETWORK_IMPLEMENTATION,
3491
3506
  cryptoInterface: cryptoImplementation || DEFAULT_CRYPTO_IMPLEMENTATION,
@@ -3505,7 +3520,7 @@
3505
3520
  return __assign({ clientCapabilities: [], azureCloudOptions: DEFAULT_AZURE_CLOUD_OPTIONS, skipAuthorityMetadataCache: false }, authOptions);
3506
3521
  }
3507
3522
 
3508
- /*! @azure/msal-common v13.0.0 2023-05-01 */
3523
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
3509
3524
 
3510
3525
  /*
3511
3526
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3525,7 +3540,7 @@
3525
3540
  return ServerError;
3526
3541
  }(AuthError));
3527
3542
 
3528
- /*! @azure/msal-common v13.0.0 2023-05-01 */
3543
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
3529
3544
 
3530
3545
  /*
3531
3546
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3621,7 +3636,7 @@
3621
3636
  return ThrottlingUtils;
3622
3637
  }());
3623
3638
 
3624
- /*! @azure/msal-common v13.0.0 2023-05-01 */
3639
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
3625
3640
 
3626
3641
  /*
3627
3642
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3670,7 +3685,7 @@
3670
3685
  return NetworkManager;
3671
3686
  }());
3672
3687
 
3673
- /*! @azure/msal-common v13.0.0 2023-05-01 */
3688
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
3674
3689
  /*
3675
3690
  * Copyright (c) Microsoft Corporation. All rights reserved.
3676
3691
  * Licensed under the MIT License.
@@ -3681,7 +3696,7 @@
3681
3696
  CcsCredentialType["UPN"] = "UPN";
3682
3697
  })(CcsCredentialType || (CcsCredentialType = {}));
3683
3698
 
3684
- /*! @azure/msal-common v13.0.0 2023-05-01 */
3699
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
3685
3700
 
3686
3701
  /*
3687
3702
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3772,7 +3787,7 @@
3772
3787
  return RequestValidator;
3773
3788
  }());
3774
3789
 
3775
- /*! @azure/msal-common v13.0.0 2023-05-01 */
3790
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
3776
3791
 
3777
3792
  /*
3778
3793
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4150,7 +4165,7 @@
4150
4165
  return RequestParameterBuilder;
4151
4166
  }());
4152
4167
 
4153
- /*! @azure/msal-common v13.0.0 2023-05-01 */
4168
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
4154
4169
 
4155
4170
  /*
4156
4171
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4252,7 +4267,7 @@
4252
4267
  return BaseClient;
4253
4268
  }());
4254
4269
 
4255
- /*! @azure/msal-common v13.0.0 2023-05-01 */
4270
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
4256
4271
 
4257
4272
  /*
4258
4273
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4390,7 +4405,7 @@
4390
4405
  return CredentialEntity;
4391
4406
  }());
4392
4407
 
4393
- /*! @azure/msal-common v13.0.0 2023-05-01 */
4408
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
4394
4409
 
4395
4410
  /*
4396
4411
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4454,7 +4469,7 @@
4454
4469
  return IdTokenEntity;
4455
4470
  }(CredentialEntity));
4456
4471
 
4457
- /*! @azure/msal-common v13.0.0 2023-05-01 */
4472
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
4458
4473
  /*
4459
4474
  * Copyright (c) Microsoft Corporation. All rights reserved.
4460
4475
  * Licensed under the MIT License.
@@ -4504,7 +4519,7 @@
4504
4519
  return TimeUtils;
4505
4520
  }());
4506
4521
 
4507
- /*! @azure/msal-common v13.0.0 2023-05-01 */
4522
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
4508
4523
 
4509
4524
  /*
4510
4525
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4618,7 +4633,7 @@
4618
4633
  return AccessTokenEntity;
4619
4634
  }(CredentialEntity));
4620
4635
 
4621
- /*! @azure/msal-common v13.0.0 2023-05-01 */
4636
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
4622
4637
 
4623
4638
  /*
4624
4639
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4685,7 +4700,7 @@
4685
4700
  return RefreshTokenEntity;
4686
4701
  }(CredentialEntity));
4687
4702
 
4688
- /*! @azure/msal-common v13.0.0 2023-05-01 */
4703
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
4689
4704
 
4690
4705
  /*
4691
4706
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4764,7 +4779,7 @@
4764
4779
  return InteractionRequiredAuthError;
4765
4780
  }(AuthError));
4766
4781
 
4767
- /*! @azure/msal-common v13.0.0 2023-05-01 */
4782
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
4768
4783
  /*
4769
4784
  * Copyright (c) Microsoft Corporation. All rights reserved.
4770
4785
  * Licensed under the MIT License.
@@ -4780,7 +4795,7 @@
4780
4795
  return CacheRecord;
4781
4796
  }());
4782
4797
 
4783
- /*! @azure/msal-common v13.0.0 2023-05-01 */
4798
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
4784
4799
 
4785
4800
  /*
4786
4801
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4851,7 +4866,7 @@
4851
4866
  return ProtocolUtils;
4852
4867
  }());
4853
4868
 
4854
- /*! @azure/msal-common v13.0.0 2023-05-01 */
4869
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
4855
4870
 
4856
4871
  /*
4857
4872
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5085,7 +5100,7 @@
5085
5100
  return UrlString;
5086
5101
  }());
5087
5102
 
5088
- /*! @azure/msal-common v13.0.0 2023-05-01 */
5103
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
5089
5104
  /*
5090
5105
  * Copyright (c) Microsoft Corporation. All rights reserved.
5091
5106
  * Licensed under the MIT License.
@@ -5314,7 +5329,7 @@
5314
5329
  "status",
5315
5330
  ]);
5316
5331
 
5317
- /*! @azure/msal-common v13.0.0 2023-05-01 */
5332
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
5318
5333
 
5319
5334
  /*
5320
5335
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5423,7 +5438,7 @@
5423
5438
  return PopTokenGenerator;
5424
5439
  }());
5425
5440
 
5426
- /*! @azure/msal-common v13.0.0 2023-05-01 */
5441
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
5427
5442
 
5428
5443
  /*
5429
5444
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5493,7 +5508,7 @@
5493
5508
  return AppMetadataEntity;
5494
5509
  }());
5495
5510
 
5496
- /*! @azure/msal-common v13.0.0 2023-05-01 */
5511
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
5497
5512
  /*
5498
5513
  * Copyright (c) Microsoft Corporation. All rights reserved.
5499
5514
  * Licensed under the MIT License.
@@ -5529,7 +5544,7 @@
5529
5544
  return TokenCacheContext;
5530
5545
  }());
5531
5546
 
5532
- /*! @azure/msal-common v13.0.0 2023-05-01 */
5547
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
5533
5548
 
5534
5549
  /*
5535
5550
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5816,7 +5831,7 @@
5816
5831
  return ResponseHandler;
5817
5832
  }());
5818
5833
 
5819
- /*! @azure/msal-common v13.0.0 2023-05-01 */
5834
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
5820
5835
 
5821
5836
  /*
5822
5837
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6246,7 +6261,7 @@
6246
6261
  return [4 /*yield*/, popTokenGenerator.generateCnf(request)];
6247
6262
  case 1:
6248
6263
  reqCnfData = _b.sent();
6249
- parameterBuilder.addPopToken(reqCnfData.reqCnfHash);
6264
+ parameterBuilder.addPopToken(reqCnfData.reqCnfString);
6250
6265
  _b.label = 2;
6251
6266
  case 2: return [2 /*return*/, parameterBuilder.createQueryString()];
6252
6267
  }
@@ -6294,7 +6309,7 @@
6294
6309
  return AuthorizationCodeClient;
6295
6310
  }(BaseClient));
6296
6311
 
6297
- /*! @azure/msal-common v13.0.0 2023-05-01 */
6312
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
6298
6313
 
6299
6314
  /*
6300
6315
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6568,7 +6583,7 @@
6568
6583
  return RefreshTokenClient;
6569
6584
  }(BaseClient));
6570
6585
 
6571
- /*! @azure/msal-common v13.0.0 2023-05-01 */
6586
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
6572
6587
 
6573
6588
  /*
6574
6589
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6612,11 +6627,11 @@
6612
6627
  * @param request
6613
6628
  */
6614
6629
  SilentFlowClient.prototype.acquireCachedToken = function (request) {
6615
- var _a, _b, _c, _d;
6630
+ var _a, _b, _c, _d, _e;
6616
6631
  return __awaiter(this, void 0, void 0, function () {
6617
6632
  var environment, cacheRecord;
6618
- return __generator(this, function (_e) {
6619
- switch (_e.label) {
6633
+ return __generator(this, function (_f) {
6634
+ switch (_f.label) {
6620
6635
  case 0:
6621
6636
  // Cannot renew token if no request object is given.
6622
6637
  if (!request) {
@@ -6628,6 +6643,12 @@
6628
6643
  this.logger.info("SilentFlowClient:acquireCachedToken - Skipping cache because forceRefresh is true.");
6629
6644
  throw ClientAuthError.createRefreshRequiredError();
6630
6645
  }
6646
+ else if (!this.config.cacheOptions.claimsBasedCachingEnabled && !StringUtils.isEmptyObj(request.claims)) {
6647
+ // Must refresh due to presence of claims in request preventing cache lookup
6648
+ (_b = this.serverTelemetryManager) === null || _b === void 0 ? void 0 : _b.setCacheOutcome(CacheOutcome.CLAIMS_REQUESTED_CACHE_SKIPPED);
6649
+ this.logger.info("SilentFlowClient:acquireCachedToken - Skipping cache because claims-based caching is disabled and claims were requested.");
6650
+ throw ClientAuthError.createRefreshRequiredError();
6651
+ }
6631
6652
  // We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases
6632
6653
  if (!request.account) {
6633
6654
  throw ClientAuthError.createNoAccountInSilentRequestError();
@@ -6636,20 +6657,20 @@
6636
6657
  cacheRecord = this.cacheManager.readCacheRecord(request.account, request, environment);
6637
6658
  if (!cacheRecord.accessToken) {
6638
6659
  // Must refresh due to non-existent access_token.
6639
- (_b = this.serverTelemetryManager) === null || _b === void 0 ? void 0 : _b.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN);
6660
+ (_c = this.serverTelemetryManager) === null || _c === void 0 ? void 0 : _c.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN);
6640
6661
  this.logger.info("SilentFlowClient:acquireCachedToken - No access token found in cache for the given properties.");
6641
6662
  throw ClientAuthError.createRefreshRequiredError();
6642
6663
  }
6643
6664
  else if (TimeUtils.wasClockTurnedBack(cacheRecord.accessToken.cachedAt) ||
6644
6665
  TimeUtils.isTokenExpired(cacheRecord.accessToken.expiresOn, this.config.systemOptions.tokenRenewalOffsetSeconds)) {
6645
6666
  // Must refresh due to expired access_token.
6646
- (_c = this.serverTelemetryManager) === null || _c === void 0 ? void 0 : _c.setCacheOutcome(CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED);
6667
+ (_d = this.serverTelemetryManager) === null || _d === void 0 ? void 0 : _d.setCacheOutcome(CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED);
6647
6668
  this.logger.info("SilentFlowClient:acquireCachedToken - Cached access token is expired or will expire within " + this.config.systemOptions.tokenRenewalOffsetSeconds + " seconds.");
6648
6669
  throw ClientAuthError.createRefreshRequiredError();
6649
6670
  }
6650
6671
  else if (cacheRecord.accessToken.refreshOn && TimeUtils.isTokenExpired(cacheRecord.accessToken.refreshOn, 0)) {
6651
6672
  // Must refresh due to the refresh_in value.
6652
- (_d = this.serverTelemetryManager) === null || _d === void 0 ? void 0 : _d.setCacheOutcome(CacheOutcome.REFRESH_CACHED_ACCESS_TOKEN);
6673
+ (_e = this.serverTelemetryManager) === null || _e === void 0 ? void 0 : _e.setCacheOutcome(CacheOutcome.REFRESH_CACHED_ACCESS_TOKEN);
6653
6674
  this.logger.info("SilentFlowClient:acquireCachedToken - Cached access token's refreshOn property has been exceeded'.");
6654
6675
  throw ClientAuthError.createRefreshRequiredError();
6655
6676
  }
@@ -6657,7 +6678,7 @@
6657
6678
  this.config.serverTelemetryManager.incrementCacheHits();
6658
6679
  }
6659
6680
  return [4 /*yield*/, this.generateResultFromCacheRecord(cacheRecord, request)];
6660
- case 1: return [2 /*return*/, _e.sent()];
6681
+ case 1: return [2 /*return*/, _f.sent()];
6661
6682
  }
6662
6683
  });
6663
6684
  });
@@ -6692,7 +6713,7 @@
6692
6713
  return SilentFlowClient;
6693
6714
  }(BaseClient));
6694
6715
 
6695
- /*! @azure/msal-common v13.0.0 2023-05-01 */
6716
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
6696
6717
  /*
6697
6718
  * Copyright (c) Microsoft Corporation. All rights reserved.
6698
6719
  * Licensed under the MIT License.
@@ -6704,7 +6725,7 @@
6704
6725
  response.hasOwnProperty("jwks_uri"));
6705
6726
  }
6706
6727
 
6707
- /*! @azure/msal-common v13.0.0 2023-05-01 */
6728
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
6708
6729
  /*
6709
6730
  * Copyright (c) Microsoft Corporation. All rights reserved.
6710
6731
  * Licensed under the MIT License.
@@ -6713,7 +6734,7 @@
6713
6734
  var EndpointMetadata = rawMetdataJSON.endpointMetadata;
6714
6735
  var InstanceDiscoveryMetadata = rawMetdataJSON.instanceDiscoveryMetadata;
6715
6736
 
6716
- /*! @azure/msal-common v13.0.0 2023-05-01 */
6737
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
6717
6738
  /*
6718
6739
  * Copyright (c) Microsoft Corporation. All rights reserved.
6719
6740
  * Licensed under the MIT License.
@@ -6727,7 +6748,7 @@
6727
6748
  ProtocolMode["OIDC"] = "OIDC";
6728
6749
  })(exports.ProtocolMode || (exports.ProtocolMode = {}));
6729
6750
 
6730
- /*! @azure/msal-common v13.0.0 2023-05-01 */
6751
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
6731
6752
 
6732
6753
  /*
6733
6754
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6804,7 +6825,7 @@
6804
6825
  return AuthorityMetadataEntity;
6805
6826
  }());
6806
6827
 
6807
- /*! @azure/msal-common v13.0.0 2023-05-01 */
6828
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
6808
6829
  /*
6809
6830
  * Copyright (c) Microsoft Corporation. All rights reserved.
6810
6831
  * Licensed under the MIT License.
@@ -6814,7 +6835,7 @@
6814
6835
  response.hasOwnProperty("metadata"));
6815
6836
  }
6816
6837
 
6817
- /*! @azure/msal-common v13.0.0 2023-05-01 */
6838
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
6818
6839
  /*
6819
6840
  * Copyright (c) Microsoft Corporation. All rights reserved.
6820
6841
  * Licensed under the MIT License.
@@ -6824,7 +6845,7 @@
6824
6845
  response.hasOwnProperty("error_description"));
6825
6846
  }
6826
6847
 
6827
- /*! @azure/msal-common v13.0.0 2023-05-01 */
6848
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
6828
6849
 
6829
6850
  /*
6830
6851
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6956,7 +6977,7 @@
6956
6977
  return RegionDiscovery;
6957
6978
  }());
6958
6979
 
6959
- /*! @azure/msal-common v13.0.0 2023-05-01 */
6980
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
6960
6981
 
6961
6982
  /*
6962
6983
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6979,23 +7000,31 @@
6979
7000
  this.correlationId = correlationId;
6980
7001
  this.regionDiscovery = new RegionDiscovery(networkInterface, this.performanceClient, this.correlationId);
6981
7002
  }
7003
+ /**
7004
+ * Get {@link AuthorityType}
7005
+ * @param authorityUri {@link IUri}
7006
+ * @private
7007
+ */
7008
+ Authority.prototype.getAuthorityType = function (authorityUri) {
7009
+ // CIAM auth url pattern is being standardized as: <tenant>.ciamlogin.com
7010
+ if (authorityUri.HostNameAndPort.endsWith(Constants.CIAM_AUTH_URL)) {
7011
+ return AuthorityType.Ciam;
7012
+ }
7013
+ var pathSegments = authorityUri.PathSegments;
7014
+ if (pathSegments.length) {
7015
+ switch (pathSegments[0].toLowerCase()) {
7016
+ case Constants.ADFS:
7017
+ return AuthorityType.Adfs;
7018
+ case Constants.DSTS:
7019
+ return AuthorityType.Dsts;
7020
+ }
7021
+ }
7022
+ return AuthorityType.Default;
7023
+ };
6982
7024
  Object.defineProperty(Authority.prototype, "authorityType", {
6983
7025
  // See above for AuthorityType
6984
7026
  get: function () {
6985
- // CIAM auth url pattern is being standardized as: <tenant>.ciamlogin.com
6986
- if (this.canonicalAuthorityUrlComponents.HostNameAndPort.endsWith(Constants.CIAM_AUTH_URL)) {
6987
- return AuthorityType.Ciam;
6988
- }
6989
- var pathSegments = this.canonicalAuthorityUrlComponents.PathSegments;
6990
- if (pathSegments.length) {
6991
- switch (pathSegments[0].toLowerCase()) {
6992
- case Constants.ADFS:
6993
- return AuthorityType.Adfs;
6994
- case Constants.DSTS:
6995
- return AuthorityType.Dsts;
6996
- }
6997
- }
6998
- return AuthorityType.Default;
7027
+ return this.getAuthorityType(this.canonicalAuthorityUrlComponents);
6999
7028
  },
7000
7029
  enumerable: false,
7001
7030
  configurable: true
@@ -7077,8 +7106,7 @@
7077
7106
  */
7078
7107
  get: function () {
7079
7108
  if (this.discoveryComplete()) {
7080
- var endpoint = this.replacePath(this.metadata.authorization_endpoint);
7081
- return this.replaceTenant(endpoint);
7109
+ return this.replacePath(this.metadata.authorization_endpoint);
7082
7110
  }
7083
7111
  else {
7084
7112
  throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
@@ -7093,8 +7121,7 @@
7093
7121
  */
7094
7122
  get: function () {
7095
7123
  if (this.discoveryComplete()) {
7096
- var endpoint = this.replacePath(this.metadata.token_endpoint);
7097
- return this.replaceTenant(endpoint);
7124
+ return this.replacePath(this.metadata.token_endpoint);
7098
7125
  }
7099
7126
  else {
7100
7127
  throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
@@ -7106,8 +7133,7 @@
7106
7133
  Object.defineProperty(Authority.prototype, "deviceCodeEndpoint", {
7107
7134
  get: function () {
7108
7135
  if (this.discoveryComplete()) {
7109
- var endpoint = this.replacePath(this.metadata.token_endpoint.replace("/token", "/devicecode"));
7110
- return this.replaceTenant(endpoint);
7136
+ return this.replacePath(this.metadata.token_endpoint.replace("/token", "/devicecode"));
7111
7137
  }
7112
7138
  else {
7113
7139
  throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
@@ -7126,8 +7152,7 @@
7126
7152
  if (!this.metadata.end_session_endpoint) {
7127
7153
  throw ClientAuthError.createLogoutNotSupportedError();
7128
7154
  }
7129
- var endpoint = this.replacePath(this.metadata.end_session_endpoint);
7130
- return this.replaceTenant(endpoint);
7155
+ return this.replacePath(this.metadata.end_session_endpoint);
7131
7156
  }
7132
7157
  else {
7133
7158
  throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
@@ -7142,8 +7167,7 @@
7142
7167
  */
7143
7168
  get: function () {
7144
7169
  if (this.discoveryComplete()) {
7145
- var endpoint = this.replacePath(this.metadata.issuer);
7146
- return this.replaceTenant(endpoint);
7170
+ return this.replacePath(this.metadata.issuer);
7147
7171
  }
7148
7172
  else {
7149
7173
  throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
@@ -7158,8 +7182,7 @@
7158
7182
  */
7159
7183
  get: function () {
7160
7184
  if (this.discoveryComplete()) {
7161
- var endpoint = this.replacePath(this.metadata.jwks_uri);
7162
- return this.replaceTenant(endpoint);
7185
+ return this.replacePath(this.metadata.jwks_uri);
7163
7186
  }
7164
7187
  else {
7165
7188
  throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
@@ -7168,6 +7191,17 @@
7168
7191
  enumerable: false,
7169
7192
  configurable: true
7170
7193
  });
7194
+ /**
7195
+ * Returns a flag indicating that tenant name can be replaced in authority {@link IUri}
7196
+ * @param authorityUri {@link IUri}
7197
+ * @private
7198
+ */
7199
+ Authority.prototype.canReplaceTenant = function (authorityUri) {
7200
+ return authorityUri.PathSegments.length === 1
7201
+ && !Authority.reservedTenantDomains.has(authorityUri.PathSegments[0])
7202
+ && this.getAuthorityType(authorityUri) === AuthorityType.Default
7203
+ && this.protocolMode === exports.ProtocolMode.AAD;
7204
+ };
7171
7205
  /**
7172
7206
  * Replaces tenant in url path with current tenant. Defaults to common.
7173
7207
  * @param urlString
@@ -7180,17 +7214,31 @@
7180
7214
  * @param urlString
7181
7215
  */
7182
7216
  Authority.prototype.replacePath = function (urlString) {
7217
+ var _this = this;
7183
7218
  var endpoint = urlString;
7184
7219
  var cachedAuthorityUrl = new UrlString(this.metadata.canonical_authority);
7185
- var cachedAuthorityParts = cachedAuthorityUrl.getUrlComponents().PathSegments;
7220
+ var cachedAuthorityUrlComponents = cachedAuthorityUrl.getUrlComponents();
7221
+ var cachedAuthorityParts = cachedAuthorityUrlComponents.PathSegments;
7186
7222
  var currentAuthorityParts = this.canonicalAuthorityUrlComponents.PathSegments;
7187
7223
  currentAuthorityParts.forEach(function (currentPart, index) {
7188
7224
  var cachedPart = cachedAuthorityParts[index];
7225
+ if (index === 0 && _this.canReplaceTenant(cachedAuthorityUrlComponents)) {
7226
+ var tenantId = (new UrlString(_this.metadata.authorization_endpoint)).getUrlComponents().PathSegments[0];
7227
+ /**
7228
+ * Check if AAD canonical authority contains tenant domain name, for example "testdomain.onmicrosoft.com",
7229
+ * by comparing its first path segment to the corresponding authorization endpoint path segment, which is
7230
+ * always resolved with tenant id by OIDC.
7231
+ */
7232
+ if (cachedPart !== tenantId) {
7233
+ _this.logger.verbose("Replacing tenant domain name " + cachedPart + " with id " + tenantId);
7234
+ cachedPart = tenantId;
7235
+ }
7236
+ }
7189
7237
  if (currentPart !== cachedPart) {
7190
7238
  endpoint = endpoint.replace("/" + cachedPart + "/", "/" + currentPart + "/");
7191
7239
  }
7192
7240
  });
7193
- return endpoint;
7241
+ return this.replaceTenant(endpoint);
7194
7242
  };
7195
7243
  Object.defineProperty(Authority.prototype, "defaultOpenIdConfigurationEndpoint", {
7196
7244
  /**
@@ -7370,42 +7418,35 @@
7370
7418
  };
7371
7419
  /**
7372
7420
  * Update the retrieved metadata with regional information.
7421
+ * User selected Azure region will be used if configured.
7373
7422
  */
7374
7423
  Authority.prototype.updateMetadataWithRegionalInformation = function (metadata) {
7375
- var _a, _b, _c, _d, _e, _f, _g;
7424
+ var _a, _b, _c, _d;
7376
7425
  return __awaiter(this, void 0, void 0, function () {
7377
- var autodetectedRegionName, azureRegion;
7378
- return __generator(this, function (_h) {
7379
- switch (_h.label) {
7426
+ var userConfiguredAzureRegion, autodetectedRegionName;
7427
+ return __generator(this, function (_e) {
7428
+ switch (_e.label) {
7380
7429
  case 0:
7381
7430
  (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation, this.correlationId);
7382
- (_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(exports.PerformanceEvents.RegionDiscoveryDetectRegion, this.correlationId);
7383
- return [4 /*yield*/, this.regionDiscovery.detectRegion((_c = this.authorityOptions.azureRegionConfiguration) === null || _c === void 0 ? void 0 : _c.environmentRegion, this.regionDiscoveryMetadata)];
7384
- case 1:
7385
- autodetectedRegionName = _h.sent();
7386
- azureRegion = ((_d = this.authorityOptions.azureRegionConfiguration) === null || _d === void 0 ? void 0 : _d.azureRegion) === Constants.AZURE_REGION_AUTO_DISCOVER_FLAG
7387
- ? autodetectedRegionName
7388
- : (_e = this.authorityOptions.azureRegionConfiguration) === null || _e === void 0 ? void 0 : _e.azureRegion;
7389
- if (((_f = this.authorityOptions.azureRegionConfiguration) === null || _f === void 0 ? void 0 : _f.azureRegion) === Constants.AZURE_REGION_AUTO_DISCOVER_FLAG) {
7390
- this.regionDiscoveryMetadata.region_outcome = autodetectedRegionName ?
7391
- RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_SUCCESSFUL :
7392
- RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_FAILED;
7393
- }
7394
- else {
7395
- if (autodetectedRegionName) {
7396
- this.regionDiscoveryMetadata.region_outcome = (((_g = this.authorityOptions.azureRegionConfiguration) === null || _g === void 0 ? void 0 : _g.azureRegion) === autodetectedRegionName) ?
7397
- RegionDiscoveryOutcomes.CONFIGURED_MATCHES_DETECTED :
7398
- RegionDiscoveryOutcomes.CONFIGURED_NOT_DETECTED;
7399
- }
7400
- else {
7401
- this.regionDiscoveryMetadata.region_outcome = RegionDiscoveryOutcomes.CONFIGURED_NO_AUTO_DETECTION;
7402
- }
7431
+ userConfiguredAzureRegion = (_b = this.authorityOptions.azureRegionConfiguration) === null || _b === void 0 ? void 0 : _b.azureRegion;
7432
+ if (!userConfiguredAzureRegion) return [3 /*break*/, 2];
7433
+ if (userConfiguredAzureRegion !== Constants.AZURE_REGION_AUTO_DISCOVER_FLAG) {
7434
+ this.regionDiscoveryMetadata.region_outcome = RegionDiscoveryOutcomes.CONFIGURED_NO_AUTO_DETECTION;
7435
+ this.regionDiscoveryMetadata.region_used = userConfiguredAzureRegion;
7436
+ return [2 /*return*/, Authority.replaceWithRegionalInformation(metadata, userConfiguredAzureRegion)];
7403
7437
  }
7404
- if (azureRegion) {
7405
- this.regionDiscoveryMetadata.region_used = azureRegion;
7406
- return [2 /*return*/, Authority.replaceWithRegionalInformation(metadata, azureRegion)];
7438
+ (_c = this.performanceClient) === null || _c === void 0 ? void 0 : _c.setPreQueueTime(exports.PerformanceEvents.RegionDiscoveryDetectRegion, this.correlationId);
7439
+ return [4 /*yield*/, this.regionDiscovery.detectRegion((_d = this.authorityOptions.azureRegionConfiguration) === null || _d === void 0 ? void 0 : _d.environmentRegion, this.regionDiscoveryMetadata)];
7440
+ case 1:
7441
+ autodetectedRegionName = _e.sent();
7442
+ if (autodetectedRegionName) {
7443
+ this.regionDiscoveryMetadata.region_outcome = RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_SUCCESSFUL;
7444
+ this.regionDiscoveryMetadata.region_used = autodetectedRegionName;
7445
+ return [2 /*return*/, Authority.replaceWithRegionalInformation(metadata, autodetectedRegionName)];
7407
7446
  }
7408
- return [2 /*return*/, metadata];
7447
+ this.regionDiscoveryMetadata.region_outcome = RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_FAILED;
7448
+ _e.label = 2;
7449
+ case 2: return [2 /*return*/, metadata];
7409
7450
  }
7410
7451
  });
7411
7452
  });
@@ -7718,10 +7759,18 @@
7718
7759
  }
7719
7760
  return ciamAuthority;
7720
7761
  };
7762
+ // Reserved tenant domain names that will not be replaced with tenant id
7763
+ Authority.reservedTenantDomains = (new Set([
7764
+ "{tenant}",
7765
+ "{tenantid}",
7766
+ AADAuthorityConstants.COMMON,
7767
+ AADAuthorityConstants.CONSUMERS,
7768
+ AADAuthorityConstants.ORGANIZATIONS
7769
+ ]));
7721
7770
  return Authority;
7722
7771
  }());
7723
7772
 
7724
- /*! @azure/msal-common v13.0.0 2023-05-01 */
7773
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
7725
7774
 
7726
7775
  /*
7727
7776
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7785,7 +7834,7 @@
7785
7834
  return AuthorityFactory;
7786
7835
  }());
7787
7836
 
7788
- /*! @azure/msal-common v13.0.0 2023-05-01 */
7837
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
7789
7838
 
7790
7839
  /*
7791
7840
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7816,7 +7865,7 @@
7816
7865
  return ServerTelemetryEntity;
7817
7866
  }());
7818
7867
 
7819
- /*! @azure/msal-common v13.0.0 2023-05-01 */
7868
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
7820
7869
 
7821
7870
  /*
7822
7871
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7844,7 +7893,7 @@
7844
7893
  return ThrottlingEntity;
7845
7894
  }());
7846
7895
 
7847
- /*! @azure/msal-common v13.0.0 2023-05-01 */
7896
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
7848
7897
 
7849
7898
  /*
7850
7899
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7861,7 +7910,7 @@
7861
7910
  }
7862
7911
  };
7863
7912
 
7864
- /*! @azure/msal-common v13.0.0 2023-05-01 */
7913
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
7865
7914
 
7866
7915
  /*
7867
7916
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7906,7 +7955,7 @@
7906
7955
  return JoseHeaderError;
7907
7956
  }(AuthError));
7908
7957
 
7909
- /*! @azure/msal-common v13.0.0 2023-05-01 */
7958
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
7910
7959
 
7911
7960
  /*
7912
7961
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7946,7 +7995,7 @@
7946
7995
  return JoseHeader;
7947
7996
  }());
7948
7997
 
7949
- /*! @azure/msal-common v13.0.0 2023-05-01 */
7998
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
7950
7999
 
7951
8000
  /*
7952
8001
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8005,7 +8054,7 @@
8005
8054
  return AuthenticationHeaderParser;
8006
8055
  }());
8007
8056
 
8008
- /*! @azure/msal-common v13.0.0 2023-05-01 */
8057
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
8009
8058
 
8010
8059
  /*
8011
8060
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8167,7 +8216,7 @@
8167
8216
  return ServerTelemetryManager;
8168
8217
  }());
8169
8218
 
8170
- /*! @azure/msal-common v13.0.0 2023-05-01 */
8219
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
8171
8220
 
8172
8221
  /*
8173
8222
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8570,7 +8619,7 @@
8570
8619
  return PerformanceClient;
8571
8620
  }());
8572
8621
 
8573
- /*! @azure/msal-common v13.0.0 2023-05-01 */
8622
+ /*! @azure/msal-common v13.2.0 2023-07-05 */
8574
8623
 
8575
8624
  /*
8576
8625
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10788,14 +10837,15 @@
10788
10837
  temporaryCacheLocation: exports.BrowserCacheLocation.MemoryStorage,
10789
10838
  storeAuthStateInCookie: false,
10790
10839
  secureCookies: false,
10791
- cacheMigrationEnabled: false
10840
+ cacheMigrationEnabled: false,
10841
+ claimsBasedCachingEnabled: true
10792
10842
  };
10793
10843
  return new BrowserCacheManager(clientId, cacheOptions, DEFAULT_CRYPTO_IMPLEMENTATION, logger);
10794
10844
  };
10795
10845
 
10796
10846
  /* eslint-disable header/header */
10797
10847
  var name = "@azure/msal-browser";
10798
- var version = "2.37.0";
10848
+ var version = "2.38.0";
10799
10849
 
10800
10850
  /*
10801
10851
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -11260,7 +11310,7 @@
11260
11310
  * Initializer function for all request APIs
11261
11311
  * @param request
11262
11312
  */
11263
- BaseInteractionClient.prototype.initializeBaseRequest = function (request) {
11313
+ BaseInteractionClient.prototype.initializeBaseRequest = function (request, account) {
11264
11314
  return __awaiter$1(this, void 0, void 0, function () {
11265
11315
  var authority, scopes, validatedRequest, _a;
11266
11316
  return __generator$1(this, function (_b) {
@@ -11269,6 +11319,12 @@
11269
11319
  this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.InitializeBaseRequest, request.correlationId);
11270
11320
  this.logger.verbose("Initializing BaseAuthRequest");
11271
11321
  authority = request.authority || this.config.auth.authority;
11322
+ if (!account) return [3 /*break*/, 2];
11323
+ return [4 /*yield*/, this.validateRequestAuthority(authority, account)];
11324
+ case 1:
11325
+ _b.sent();
11326
+ _b.label = 2;
11327
+ case 2:
11272
11328
  scopes = __spread(((request && request.scopes) || []));
11273
11329
  validatedRequest = __assign$1(__assign$1({}, request), { correlationId: this.correlationId, authority: authority,
11274
11330
  scopes: scopes });
@@ -11288,13 +11344,13 @@
11288
11344
  }
11289
11345
  this.logger.verbose("Authentication Scheme set to \"" + validatedRequest.authenticationScheme + "\" as configured in Auth request");
11290
11346
  }
11291
- if (!(request.claims && !StringUtils.isEmpty(request.claims))) return [3 /*break*/, 2];
11347
+ if (!(this.config.cache.claimsBasedCachingEnabled && request.claims && !StringUtils.isEmptyObj(request.claims))) return [3 /*break*/, 4];
11292
11348
  _a = validatedRequest;
11293
11349
  return [4 /*yield*/, this.browserCrypto.hashString(request.claims)];
11294
- case 1:
11350
+ case 3:
11295
11351
  _a.requestedClaimsHash = _b.sent();
11296
- _b.label = 2;
11297
- case 2: return [2 /*return*/, validatedRequest];
11352
+ _b.label = 4;
11353
+ case 4: return [2 /*return*/, validatedRequest];
11298
11354
  }
11299
11355
  });
11300
11356
  });
@@ -11311,6 +11367,26 @@
11311
11367
  var redirectUri = requestRedirectUri || this.config.auth.redirectUri || BrowserUtils.getCurrentUri();
11312
11368
  return UrlString.getAbsoluteUrl(redirectUri, BrowserUtils.getCurrentUri());
11313
11369
  };
11370
+ /*
11371
+ * If authority provided in the request does not match environment/authority specified
11372
+ * in the account or MSAL config, we throw an error.
11373
+ */
11374
+ BaseInteractionClient.prototype.validateRequestAuthority = function (authority, account) {
11375
+ return __awaiter$1(this, void 0, void 0, function () {
11376
+ var discoveredAuthority;
11377
+ return __generator$1(this, function (_a) {
11378
+ switch (_a.label) {
11379
+ case 0: return [4 /*yield*/, this.getDiscoveredAuthority(authority)];
11380
+ case 1:
11381
+ discoveredAuthority = _a.sent();
11382
+ if (!discoveredAuthority.isAlias(account.environment)) {
11383
+ throw ClientConfigurationError.createAuthorityMismatchError();
11384
+ }
11385
+ return [2 /*return*/];
11386
+ }
11387
+ });
11388
+ });
11389
+ };
11314
11390
  /**
11315
11391
  *
11316
11392
  * @param apiId
@@ -11532,6 +11608,9 @@
11532
11608
  logLevel: logger.logLevel,
11533
11609
  correlationId: this.correlationId
11534
11610
  },
11611
+ cacheOptions: {
11612
+ claimsBasedCachingEnabled: this.config.cache.claimsBasedCachingEnabled
11613
+ },
11535
11614
  cryptoInterface: this.browserCrypto,
11536
11615
  networkInterface: this.networkClient,
11537
11616
  storageInterface: this.browserStorage,
@@ -11975,6 +12054,7 @@
11975
12054
  EventType["LOGOUT_SUCCESS"] = "msal:logoutSuccess";
11976
12055
  EventType["LOGOUT_FAILURE"] = "msal:logoutFailure";
11977
12056
  EventType["LOGOUT_END"] = "msal:logoutEnd";
12057
+ EventType["RESTORE_FROM_BFCACHE"] = "msal:restoreFromBFCache";
11978
12058
  })(exports.EventType || (exports.EventType = {}));
11979
12059
 
11980
12060
  /*
@@ -12155,7 +12235,7 @@
12155
12235
  this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.InitializeSilentRequest, this.correlationId);
12156
12236
  this.performanceClient.setPreQueueTime(exports.PerformanceEvents.InitializeBaseRequest, this.correlationId);
12157
12237
  _a = [__assign$1({}, request)];
12158
- return [4 /*yield*/, this.initializeBaseRequest(request)];
12238
+ return [4 /*yield*/, this.initializeBaseRequest(request, account)];
12159
12239
  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 }])];
12160
12240
  }
12161
12241
  });
@@ -12429,7 +12509,7 @@
12429
12509
  result = _a.sent();
12430
12510
  // cache accounts and tokens in the appropriate storage
12431
12511
  this.cacheAccount(accountEntity);
12432
- this.cacheNativeTokens(response, request, homeAccountIdentifier, idTokenObj, result.accessToken, result.tenantId, reqTimestamp);
12512
+ this.cacheNativeTokens(response, request, homeAccountIdentifier, accountEntity, idTokenObj, result.accessToken, result.tenantId, reqTimestamp);
12433
12513
  return [2 /*return*/, result];
12434
12514
  }
12435
12515
  });
@@ -12585,10 +12665,8 @@
12585
12665
  * @param tenantId
12586
12666
  * @param reqTimestamp
12587
12667
  */
12588
- NativeInteractionClient.prototype.cacheNativeTokens = function (response, request, homeAccountIdentifier, idTokenObj, responseAccessToken, tenantId, reqTimestamp) {
12589
- // cache idToken in inmemory storage
12590
- var idTokenEntity = IdTokenEntity.createIdTokenEntity(homeAccountIdentifier, request.authority, response.id_token || Constants.EMPTY_STRING, request.clientId, idTokenObj.claims.tid || Constants.EMPTY_STRING);
12591
- this.nativeStorageManager.setIdTokenCredential(idTokenEntity);
12668
+ NativeInteractionClient.prototype.cacheNativeTokens = function (response, request, homeAccountIdentifier, accountEntity, idTokenObj, responseAccessToken, tenantId, reqTimestamp) {
12669
+ var cachedIdToken = IdTokenEntity.createIdTokenEntity(homeAccountIdentifier, request.authority, response.id_token || Constants.EMPTY_STRING, request.clientId, idTokenObj.claims.tid || Constants.EMPTY_STRING);
12592
12670
  // cache accessToken in inmemory storage
12593
12671
  var expiresIn = (request.tokenType === exports.AuthenticationScheme.POP)
12594
12672
  ? Constants.SHR_NONCE_VALIDITY
@@ -12597,8 +12675,11 @@
12597
12675
  : response.expires_in) || 0;
12598
12676
  var tokenExpirationSeconds = reqTimestamp + expiresIn;
12599
12677
  var responseScopes = this.generateScopes(response, request);
12600
- var accessTokenEntity = AccessTokenEntity.createAccessTokenEntity(homeAccountIdentifier, request.authority, responseAccessToken, request.clientId, tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, this.browserCrypto);
12601
- this.nativeStorageManager.setAccessTokenCredential(accessTokenEntity);
12678
+ var cachedAccessToken = AccessTokenEntity.createAccessTokenEntity(homeAccountIdentifier, request.authority, responseAccessToken, request.clientId, idTokenObj
12679
+ ? idTokenObj.claims.tid || Constants.EMPTY_STRING
12680
+ : tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, this.browserCrypto);
12681
+ var nativeCacheRecord = new CacheRecord(accountEntity, cachedIdToken, cachedAccessToken);
12682
+ this.nativeStorageManager.saveCacheRecord(nativeCacheRecord);
12602
12683
  };
12603
12684
  NativeInteractionClient.prototype.addTelemetryFromNativeResponse = function (response) {
12604
12685
  var mats = this.getMATSFromResponse(response);
@@ -12682,6 +12763,12 @@
12682
12763
  case 0:
12683
12764
  this.logger.trace("NativeInteractionClient - initializeNativeRequest called");
12684
12765
  authority = request.authority || this.config.auth.authority;
12766
+ if (!request.account) return [3 /*break*/, 2];
12767
+ return [4 /*yield*/, this.validateRequestAuthority(authority, request.account)];
12768
+ case 1:
12769
+ _a.sent();
12770
+ _a.label = 2;
12771
+ case 2:
12685
12772
  canonicalAuthority = new UrlString(authority);
12686
12773
  canonicalAuthority.validateAsUri();
12687
12774
  scopes = request.scopes, remainingProperties = __rest(request, ["scopes"]);
@@ -12714,7 +12801,7 @@
12714
12801
  };
12715
12802
  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?
12716
12803
  });
12717
- if (!(request.authenticationScheme === exports.AuthenticationScheme.POP)) return [3 /*break*/, 2];
12804
+ if (!(request.authenticationScheme === exports.AuthenticationScheme.POP)) return [3 /*break*/, 4];
12718
12805
  shrParameters = {
12719
12806
  resourceRequestUri: request.resourceRequestUri,
12720
12807
  resourceRequestMethod: request.resourceRequestMethod,
@@ -12723,13 +12810,13 @@
12723
12810
  };
12724
12811
  popTokenGenerator = new PopTokenGenerator(this.browserCrypto);
12725
12812
  return [4 /*yield*/, popTokenGenerator.generateCnf(shrParameters)];
12726
- case 1:
12813
+ case 3:
12727
12814
  reqCnfData = _a.sent();
12728
- // to reduce the URL length, it is recommended to send the hash of the req_cnf instead of the whole string
12729
- validatedRequest.reqCnf = reqCnfData.reqCnfHash;
12815
+ // to reduce the URL length, it is recommended to send the short form of the req_cnf
12816
+ validatedRequest.reqCnf = reqCnfData.reqCnfString;
12730
12817
  validatedRequest.keyId = reqCnfData.kid;
12731
- _a.label = 2;
12732
- case 2: return [2 /*return*/, validatedRequest];
12818
+ _a.label = 4;
12819
+ case 4: return [2 /*return*/, validatedRequest];
12733
12820
  }
12734
12821
  });
12735
12822
  });
@@ -13031,6 +13118,7 @@
13031
13118
  if (event.persisted) {
13032
13119
  _this.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache.");
13033
13120
  _this.browserStorage.cleanRequestByState(validRequest.state);
13121
+ _this.eventHandler.emitEvent(exports.EventType.RESTORE_FROM_BFCACHE, exports.InteractionType.Redirect);
13034
13122
  }
13035
13123
  };
13036
13124
  _a.label = 2;
@@ -13222,7 +13310,7 @@
13222
13310
  if (!this.nativeMessageHandler) {
13223
13311
  throw BrowserAuthError.createNativeConnectionNotEstablishedError();
13224
13312
  }
13225
- 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);
13313
+ 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);
13226
13314
  userRequestState = ProtocolUtils.parseRequestState(this.browserCrypto, state).userRequestState;
13227
13315
  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
13228
13316
  })).finally(function () {
@@ -13923,7 +14011,8 @@
13923
14011
  storeAuthStateInCookie: false,
13924
14012
  secureCookies: false,
13925
14013
  // Default cache migration to true if cache location is localStorage since entries are preserved across tabs/windows. Migration has little to no benefit in sessionStorage and memoryStorage
13926
- cacheMigrationEnabled: userInputCache && userInputCache.cacheLocation === exports.BrowserCacheLocation.LocalStorage ? true : false
14014
+ cacheMigrationEnabled: userInputCache && userInputCache.cacheLocation === exports.BrowserCacheLocation.LocalStorage ? true : false,
14015
+ claimsBasedCachingEnabled: true
13927
14016
  };
13928
14017
  // Default logger options for browser
13929
14018
  var DEFAULT_LOGGER_OPTIONS = {
@@ -14276,7 +14365,7 @@
14276
14365
  this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.SilentRefreshClientAcquireToken, request.correlationId);
14277
14366
  this.performanceClient.setPreQueueTime(exports.PerformanceEvents.InitializeBaseRequest, request.correlationId);
14278
14367
  _a = [__assign$1({}, request)];
14279
- return [4 /*yield*/, this.initializeBaseRequest(request)];
14368
+ return [4 /*yield*/, this.initializeBaseRequest(request, request.account)];
14280
14369
  case 1:
14281
14370
  silentRequest = __assign$1.apply(void 0, _a.concat([_b.sent()]));
14282
14371
  acquireTokenMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.SilentRefreshClientAcquireToken, silentRequest.correlationId);
@@ -16608,7 +16697,8 @@
16608
16697
  temporaryCacheLocation: exports.BrowserCacheLocation.MemoryStorage,
16609
16698
  storeAuthStateInCookie: false,
16610
16699
  secureCookies: false,
16611
- cacheMigrationEnabled: false
16700
+ cacheMigrationEnabled: false,
16701
+ claimsBasedCachingEnabled: true
16612
16702
  };
16613
16703
  this.nativeInternalStorage = new BrowserCacheManager(this.config.auth.clientId, nativeCacheOptions, this.browserCrypto, this.logger);
16614
16704
  // Initialize the token cache
@@ -17976,6 +18066,7 @@
17976
18066
  case exports.EventType.LOGIN_FAILURE:
17977
18067
  case exports.EventType.ACQUIRE_TOKEN_SUCCESS:
17978
18068
  case exports.EventType.ACQUIRE_TOKEN_FAILURE:
18069
+ case exports.EventType.RESTORE_FROM_BFCACHE:
17979
18070
  if (message.interactionType === exports.InteractionType.Redirect || message.interactionType === exports.InteractionType.Popup) {
17980
18071
  if (currentStatus && currentStatus !== exports.InteractionStatus.Login && currentStatus !== exports.InteractionStatus.AcquireToken) {
17981
18072
  // Prevent this event from clearing any status other than login or acquireToken