@azure/msal-browser 2.36.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 (79) hide show
  1. package/README.md +1 -1
  2. package/dist/_virtual/_tslib.js +1 -1
  3. package/dist/app/ClientApplication.js +1 -1
  4. package/dist/app/IPublicClientApplication.js +1 -1
  5. package/dist/app/PublicClientApplication.js +1 -1
  6. package/dist/broker/nativeBroker/NativeMessageHandler.js +1 -1
  7. package/dist/cache/AsyncMemoryStorage.js +1 -1
  8. package/dist/cache/BrowserCacheManager.js +1 -1
  9. package/dist/cache/BrowserStorage.js +1 -1
  10. package/dist/cache/CryptoKeyStore.js +1 -1
  11. package/dist/cache/DatabaseStorage.js +1 -1
  12. package/dist/cache/MemoryStorage.js +1 -1
  13. package/dist/cache/TokenCache.js +1 -1
  14. package/dist/config/Configuration.js +1 -1
  15. package/dist/crypto/BrowserCrypto.js +1 -1
  16. package/dist/crypto/CryptoOps.js +1 -1
  17. package/dist/crypto/GuidGenerator.js +1 -1
  18. package/dist/crypto/ModernBrowserCrypto.js +1 -1
  19. package/dist/crypto/MsBrowserCrypto.js +1 -1
  20. package/dist/crypto/MsrBrowserCrypto.js +1 -1
  21. package/dist/crypto/PkceGenerator.js +1 -1
  22. package/dist/crypto/SignedHttpRequest.js +1 -1
  23. package/dist/encode/Base64Decode.js +1 -1
  24. package/dist/encode/Base64Encode.js +1 -1
  25. package/dist/error/BrowserAuthError.js +1 -1
  26. package/dist/error/BrowserConfigurationAuthError.js +1 -1
  27. package/dist/error/NativeAuthError.js +1 -1
  28. package/dist/event/EventHandler.js +1 -1
  29. package/dist/event/EventMessage.d.ts.map +1 -1
  30. package/dist/event/EventMessage.js +2 -1
  31. package/dist/event/EventMessage.js.map +1 -1
  32. package/dist/event/EventType.d.ts +2 -1
  33. package/dist/event/EventType.d.ts.map +1 -1
  34. package/dist/event/EventType.js +2 -1
  35. package/dist/event/EventType.js.map +1 -1
  36. package/dist/index.cjs.js +229 -113
  37. package/dist/index.cjs.js.map +1 -1
  38. package/dist/index.js +1 -1
  39. package/dist/interaction_client/BaseInteractionClient.d.ts +2 -1
  40. package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
  41. package/dist/interaction_client/BaseInteractionClient.js +33 -7
  42. package/dist/interaction_client/BaseInteractionClient.js.map +1 -1
  43. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +1 -1
  44. package/dist/interaction_client/NativeInteractionClient.d.ts +1 -1
  45. package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
  46. package/dist/interaction_client/NativeInteractionClient.js +22 -15
  47. package/dist/interaction_client/NativeInteractionClient.js.map +1 -1
  48. package/dist/interaction_client/PopupClient.js +1 -1
  49. package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
  50. package/dist/interaction_client/RedirectClient.js +3 -2
  51. package/dist/interaction_client/RedirectClient.js.map +1 -1
  52. package/dist/interaction_client/SilentAuthCodeClient.js +1 -1
  53. package/dist/interaction_client/SilentCacheClient.js +2 -2
  54. package/dist/interaction_client/SilentCacheClient.js.map +1 -1
  55. package/dist/interaction_client/SilentIframeClient.js +1 -1
  56. package/dist/interaction_client/SilentRefreshClient.js +2 -2
  57. package/dist/interaction_client/SilentRefreshClient.js.map +1 -1
  58. package/dist/interaction_client/StandardInteractionClient.js +1 -1
  59. package/dist/interaction_handler/InteractionHandler.js +1 -1
  60. package/dist/interaction_handler/RedirectHandler.js +1 -1
  61. package/dist/interaction_handler/SilentHandler.js +1 -1
  62. package/dist/internals.js +1 -1
  63. package/dist/navigation/NavigationClient.js +1 -1
  64. package/dist/network/FetchClient.js +1 -1
  65. package/dist/network/XhrClient.js +1 -1
  66. package/dist/packageMetadata.d.ts +1 -1
  67. package/dist/packageMetadata.js +2 -2
  68. package/dist/packageMetadata.js.map +1 -1
  69. package/dist/telemetry/BrowserPerformanceClient.js +1 -1
  70. package/dist/telemetry/BrowserPerformanceMeasurement.js +1 -1
  71. package/dist/utils/BrowserConstants.js +1 -1
  72. package/dist/utils/BrowserProtocolUtils.js +1 -1
  73. package/dist/utils/BrowserStringUtils.js +1 -1
  74. package/dist/utils/BrowserUtils.js +1 -1
  75. package/dist/utils/MathUtils.js +1 -1
  76. package/lib/msal-browser.js +229 -113
  77. package/lib/msal-browser.js.map +1 -1
  78. package/lib/msal-browser.min.js +35 -35
  79. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v2.36.0 2023-04-18 */
1
+ /*! @azure/msal-browser v2.37.1 2023-06-07 */
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 v12.0.0 2023-04-03 */
122
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
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 v12.0.0 2023-04-03 */
209
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
210
210
 
211
211
  /*
212
212
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -226,6 +226,9 @@
226
226
  DSTS: "dstsv2",
227
227
  // Default AAD Instance Discovery Endpoint
228
228
  AAD_INSTANCE_DISCOVERY_ENDPT: "https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=",
229
+ // CIAM URL
230
+ CIAM_AUTH_URL: ".ciamlogin.com",
231
+ AAD_TENANT_DOMAIN_SUFFIX: ".onmicrosoft.com",
229
232
  // Resource delimiter - used for certain cache entries
230
233
  RESOURCE_DELIM: "|",
231
234
  // Placeholder for non-existent account ids/objects
@@ -575,7 +578,7 @@
575
578
  JsonTypes["Pop"] = "pop";
576
579
  })(JsonTypes || (JsonTypes = {}));
577
580
 
578
- /*! @azure/msal-common v12.0.0 2023-04-03 */
581
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
579
582
 
580
583
  /*
581
584
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -631,7 +634,7 @@
631
634
  return AuthError;
632
635
  }(Error));
633
636
 
634
- /*! @azure/msal-common v12.0.0 2023-04-03 */
637
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
635
638
 
636
639
  /*
637
640
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -706,7 +709,7 @@
706
709
  }
707
710
  };
708
711
 
709
- /*! @azure/msal-common v12.0.0 2023-04-03 */
712
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
710
713
 
711
714
  /*
712
715
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1221,7 +1224,7 @@
1221
1224
  return ClientAuthError;
1222
1225
  }(AuthError));
1223
1226
 
1224
- /*! @azure/msal-common v12.0.0 2023-04-03 */
1227
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
1225
1228
 
1226
1229
  /*
1227
1230
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1346,7 +1349,7 @@
1346
1349
  return StringUtils;
1347
1350
  }());
1348
1351
 
1349
- /*! @azure/msal-common v12.0.0 2023-04-03 */
1352
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
1350
1353
 
1351
1354
  /*
1352
1355
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1536,12 +1539,12 @@
1536
1539
  return Logger;
1537
1540
  }());
1538
1541
 
1539
- /*! @azure/msal-common v12.0.0 2023-04-03 */
1542
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
1540
1543
  /* eslint-disable header/header */
1541
1544
  var name$1 = "@azure/msal-common";
1542
- var version$1 = "12.0.0";
1545
+ var version$1 = "13.1.0";
1543
1546
 
1544
- /*! @azure/msal-common v12.0.0 2023-04-03 */
1547
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
1545
1548
  /*
1546
1549
  * Copyright (c) Microsoft Corporation. All rights reserved.
1547
1550
  * Licensed under the MIT License.
@@ -1562,7 +1565,7 @@
1562
1565
  AzureCloudInstance["AzureUsGovernment"] = "https://login.microsoftonline.us";
1563
1566
  })(exports.AzureCloudInstance || (exports.AzureCloudInstance = {}));
1564
1567
 
1565
- /*! @azure/msal-common v12.0.0 2023-04-03 */
1568
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
1566
1569
 
1567
1570
  /*
1568
1571
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1663,6 +1666,10 @@
1663
1666
  invalidAuthenticationHeader: {
1664
1667
  code: "invalid_authentication_header",
1665
1668
  desc: "Invalid authentication header provided"
1669
+ },
1670
+ authorityMismatch: {
1671
+ code: "authority_mismatch",
1672
+ 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."
1666
1673
  }
1667
1674
  };
1668
1675
  /**
@@ -1814,10 +1821,16 @@
1814
1821
  ClientConfigurationError.createInvalidAuthenticationHeaderError = function (invalidHeaderName, details) {
1815
1822
  return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidAuthenticationHeader.code, ClientConfigurationErrorMessage.invalidAuthenticationHeader.desc + ". Invalid header: " + invalidHeaderName + ". Details: " + details);
1816
1823
  };
1824
+ /**
1825
+ * Create an error when the authority provided in request does not match authority provided in account or MSAL.js configuration.
1826
+ */
1827
+ ClientConfigurationError.createAuthorityMismatchError = function () {
1828
+ return new ClientConfigurationError(ClientConfigurationErrorMessage.authorityMismatch.code, ClientConfigurationErrorMessage.authorityMismatch.desc);
1829
+ };
1817
1830
  return ClientConfigurationError;
1818
1831
  }(ClientAuthError));
1819
1832
 
1820
- /*! @azure/msal-common v12.0.0 2023-04-03 */
1833
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
1821
1834
 
1822
1835
  /*
1823
1836
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2016,7 +2029,7 @@
2016
2029
  return ScopeSet;
2017
2030
  }());
2018
2031
 
2019
- /*! @azure/msal-common v12.0.0 2023-04-03 */
2032
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
2020
2033
 
2021
2034
  /*
2022
2035
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2054,7 +2067,7 @@
2054
2067
  };
2055
2068
  }
2056
2069
 
2057
- /*! @azure/msal-common v12.0.0 2023-04-03 */
2070
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
2058
2071
  /*
2059
2072
  * Copyright (c) Microsoft Corporation. All rights reserved.
2060
2073
  * Licensed under the MIT License.
@@ -2067,9 +2080,10 @@
2067
2080
  AuthorityType[AuthorityType["Default"] = 0] = "Default";
2068
2081
  AuthorityType[AuthorityType["Adfs"] = 1] = "Adfs";
2069
2082
  AuthorityType[AuthorityType["Dsts"] = 2] = "Dsts";
2083
+ AuthorityType[AuthorityType["Ciam"] = 3] = "Ciam";
2070
2084
  })(AuthorityType || (AuthorityType = {}));
2071
2085
 
2072
- /*! @azure/msal-common v12.0.0 2023-04-03 */
2086
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
2073
2087
 
2074
2088
  /*
2075
2089
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2308,7 +2322,7 @@
2308
2322
  return AccountEntity;
2309
2323
  }());
2310
2324
 
2311
- /*! @azure/msal-common v12.0.0 2023-04-03 */
2325
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
2312
2326
 
2313
2327
  /*
2314
2328
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2360,7 +2374,7 @@
2360
2374
  return AuthToken;
2361
2375
  }());
2362
2376
 
2363
- /*! @azure/msal-common v12.0.0 2023-04-03 */
2377
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
2364
2378
 
2365
2379
  /*
2366
2380
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3408,7 +3422,7 @@
3408
3422
  return DefaultStorageClass;
3409
3423
  }(CacheManager));
3410
3424
 
3411
- /*! @azure/msal-common v12.0.0 2023-04-03 */
3425
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
3412
3426
 
3413
3427
  /*
3414
3428
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3501,7 +3515,7 @@
3501
3515
  return __assign({ clientCapabilities: [], azureCloudOptions: DEFAULT_AZURE_CLOUD_OPTIONS, skipAuthorityMetadataCache: false }, authOptions);
3502
3516
  }
3503
3517
 
3504
- /*! @azure/msal-common v12.0.0 2023-04-03 */
3518
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
3505
3519
 
3506
3520
  /*
3507
3521
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3521,7 +3535,7 @@
3521
3535
  return ServerError;
3522
3536
  }(AuthError));
3523
3537
 
3524
- /*! @azure/msal-common v12.0.0 2023-04-03 */
3538
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
3525
3539
 
3526
3540
  /*
3527
3541
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3617,7 +3631,7 @@
3617
3631
  return ThrottlingUtils;
3618
3632
  }());
3619
3633
 
3620
- /*! @azure/msal-common v12.0.0 2023-04-03 */
3634
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
3621
3635
 
3622
3636
  /*
3623
3637
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3666,7 +3680,7 @@
3666
3680
  return NetworkManager;
3667
3681
  }());
3668
3682
 
3669
- /*! @azure/msal-common v12.0.0 2023-04-03 */
3683
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
3670
3684
  /*
3671
3685
  * Copyright (c) Microsoft Corporation. All rights reserved.
3672
3686
  * Licensed under the MIT License.
@@ -3677,7 +3691,7 @@
3677
3691
  CcsCredentialType["UPN"] = "UPN";
3678
3692
  })(CcsCredentialType || (CcsCredentialType = {}));
3679
3693
 
3680
- /*! @azure/msal-common v12.0.0 2023-04-03 */
3694
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
3681
3695
 
3682
3696
  /*
3683
3697
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3768,7 +3782,7 @@
3768
3782
  return RequestValidator;
3769
3783
  }());
3770
3784
 
3771
- /*! @azure/msal-common v12.0.0 2023-04-03 */
3785
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
3772
3786
 
3773
3787
  /*
3774
3788
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4146,7 +4160,7 @@
4146
4160
  return RequestParameterBuilder;
4147
4161
  }());
4148
4162
 
4149
- /*! @azure/msal-common v12.0.0 2023-04-03 */
4163
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
4150
4164
 
4151
4165
  /*
4152
4166
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4248,7 +4262,7 @@
4248
4262
  return BaseClient;
4249
4263
  }());
4250
4264
 
4251
- /*! @azure/msal-common v12.0.0 2023-04-03 */
4265
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
4252
4266
 
4253
4267
  /*
4254
4268
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4386,7 +4400,7 @@
4386
4400
  return CredentialEntity;
4387
4401
  }());
4388
4402
 
4389
- /*! @azure/msal-common v12.0.0 2023-04-03 */
4403
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
4390
4404
 
4391
4405
  /*
4392
4406
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4450,7 +4464,7 @@
4450
4464
  return IdTokenEntity;
4451
4465
  }(CredentialEntity));
4452
4466
 
4453
- /*! @azure/msal-common v12.0.0 2023-04-03 */
4467
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
4454
4468
  /*
4455
4469
  * Copyright (c) Microsoft Corporation. All rights reserved.
4456
4470
  * Licensed under the MIT License.
@@ -4500,7 +4514,7 @@
4500
4514
  return TimeUtils;
4501
4515
  }());
4502
4516
 
4503
- /*! @azure/msal-common v12.0.0 2023-04-03 */
4517
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
4504
4518
 
4505
4519
  /*
4506
4520
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4614,7 +4628,7 @@
4614
4628
  return AccessTokenEntity;
4615
4629
  }(CredentialEntity));
4616
4630
 
4617
- /*! @azure/msal-common v12.0.0 2023-04-03 */
4631
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
4618
4632
 
4619
4633
  /*
4620
4634
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4681,7 +4695,7 @@
4681
4695
  return RefreshTokenEntity;
4682
4696
  }(CredentialEntity));
4683
4697
 
4684
- /*! @azure/msal-common v12.0.0 2023-04-03 */
4698
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
4685
4699
 
4686
4700
  /*
4687
4701
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4760,7 +4774,7 @@
4760
4774
  return InteractionRequiredAuthError;
4761
4775
  }(AuthError));
4762
4776
 
4763
- /*! @azure/msal-common v12.0.0 2023-04-03 */
4777
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
4764
4778
  /*
4765
4779
  * Copyright (c) Microsoft Corporation. All rights reserved.
4766
4780
  * Licensed under the MIT License.
@@ -4776,7 +4790,7 @@
4776
4790
  return CacheRecord;
4777
4791
  }());
4778
4792
 
4779
- /*! @azure/msal-common v12.0.0 2023-04-03 */
4793
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
4780
4794
 
4781
4795
  /*
4782
4796
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4847,7 +4861,7 @@
4847
4861
  return ProtocolUtils;
4848
4862
  }());
4849
4863
 
4850
- /*! @azure/msal-common v12.0.0 2023-04-03 */
4864
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
4851
4865
 
4852
4866
  /*
4853
4867
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5081,7 +5095,7 @@
5081
5095
  return UrlString;
5082
5096
  }());
5083
5097
 
5084
- /*! @azure/msal-common v12.0.0 2023-04-03 */
5098
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
5085
5099
  /*
5086
5100
  * Copyright (c) Microsoft Corporation. All rights reserved.
5087
5101
  * Licensed under the MIT License.
@@ -5310,7 +5324,7 @@
5310
5324
  "status",
5311
5325
  ]);
5312
5326
 
5313
- /*! @azure/msal-common v12.0.0 2023-04-03 */
5327
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
5314
5328
 
5315
5329
  /*
5316
5330
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5419,7 +5433,7 @@
5419
5433
  return PopTokenGenerator;
5420
5434
  }());
5421
5435
 
5422
- /*! @azure/msal-common v12.0.0 2023-04-03 */
5436
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
5423
5437
 
5424
5438
  /*
5425
5439
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5489,7 +5503,7 @@
5489
5503
  return AppMetadataEntity;
5490
5504
  }());
5491
5505
 
5492
- /*! @azure/msal-common v12.0.0 2023-04-03 */
5506
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
5493
5507
  /*
5494
5508
  * Copyright (c) Microsoft Corporation. All rights reserved.
5495
5509
  * Licensed under the MIT License.
@@ -5525,7 +5539,7 @@
5525
5539
  return TokenCacheContext;
5526
5540
  }());
5527
5541
 
5528
- /*! @azure/msal-common v12.0.0 2023-04-03 */
5542
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
5529
5543
 
5530
5544
  /*
5531
5545
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5812,7 +5826,7 @@
5812
5826
  return ResponseHandler;
5813
5827
  }());
5814
5828
 
5815
- /*! @azure/msal-common v12.0.0 2023-04-03 */
5829
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
5816
5830
 
5817
5831
  /*
5818
5832
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6242,7 +6256,7 @@
6242
6256
  return [4 /*yield*/, popTokenGenerator.generateCnf(request)];
6243
6257
  case 1:
6244
6258
  reqCnfData = _b.sent();
6245
- parameterBuilder.addPopToken(reqCnfData.reqCnfHash);
6259
+ parameterBuilder.addPopToken(reqCnfData.reqCnfString);
6246
6260
  _b.label = 2;
6247
6261
  case 2: return [2 /*return*/, parameterBuilder.createQueryString()];
6248
6262
  }
@@ -6290,7 +6304,7 @@
6290
6304
  return AuthorizationCodeClient;
6291
6305
  }(BaseClient));
6292
6306
 
6293
- /*! @azure/msal-common v12.0.0 2023-04-03 */
6307
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
6294
6308
 
6295
6309
  /*
6296
6310
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6564,7 +6578,7 @@
6564
6578
  return RefreshTokenClient;
6565
6579
  }(BaseClient));
6566
6580
 
6567
- /*! @azure/msal-common v12.0.0 2023-04-03 */
6581
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
6568
6582
 
6569
6583
  /*
6570
6584
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6688,7 +6702,7 @@
6688
6702
  return SilentFlowClient;
6689
6703
  }(BaseClient));
6690
6704
 
6691
- /*! @azure/msal-common v12.0.0 2023-04-03 */
6705
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
6692
6706
  /*
6693
6707
  * Copyright (c) Microsoft Corporation. All rights reserved.
6694
6708
  * Licensed under the MIT License.
@@ -6700,7 +6714,7 @@
6700
6714
  response.hasOwnProperty("jwks_uri"));
6701
6715
  }
6702
6716
 
6703
- /*! @azure/msal-common v12.0.0 2023-04-03 */
6717
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
6704
6718
  /*
6705
6719
  * Copyright (c) Microsoft Corporation. All rights reserved.
6706
6720
  * Licensed under the MIT License.
@@ -6709,7 +6723,7 @@
6709
6723
  var EndpointMetadata = rawMetdataJSON.endpointMetadata;
6710
6724
  var InstanceDiscoveryMetadata = rawMetdataJSON.instanceDiscoveryMetadata;
6711
6725
 
6712
- /*! @azure/msal-common v12.0.0 2023-04-03 */
6726
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
6713
6727
  /*
6714
6728
  * Copyright (c) Microsoft Corporation. All rights reserved.
6715
6729
  * Licensed under the MIT License.
@@ -6723,7 +6737,7 @@
6723
6737
  ProtocolMode["OIDC"] = "OIDC";
6724
6738
  })(exports.ProtocolMode || (exports.ProtocolMode = {}));
6725
6739
 
6726
- /*! @azure/msal-common v12.0.0 2023-04-03 */
6740
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
6727
6741
 
6728
6742
  /*
6729
6743
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6800,7 +6814,7 @@
6800
6814
  return AuthorityMetadataEntity;
6801
6815
  }());
6802
6816
 
6803
- /*! @azure/msal-common v12.0.0 2023-04-03 */
6817
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
6804
6818
  /*
6805
6819
  * Copyright (c) Microsoft Corporation. All rights reserved.
6806
6820
  * Licensed under the MIT License.
@@ -6810,7 +6824,7 @@
6810
6824
  response.hasOwnProperty("metadata"));
6811
6825
  }
6812
6826
 
6813
- /*! @azure/msal-common v12.0.0 2023-04-03 */
6827
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
6814
6828
  /*
6815
6829
  * Copyright (c) Microsoft Corporation. All rights reserved.
6816
6830
  * Licensed under the MIT License.
@@ -6820,7 +6834,7 @@
6820
6834
  response.hasOwnProperty("error_description"));
6821
6835
  }
6822
6836
 
6823
- /*! @azure/msal-common v12.0.0 2023-04-03 */
6837
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
6824
6838
 
6825
6839
  /*
6826
6840
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6952,7 +6966,7 @@
6952
6966
  return RegionDiscovery;
6953
6967
  }());
6954
6968
 
6955
- /*! @azure/msal-common v12.0.0 2023-04-03 */
6969
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
6956
6970
 
6957
6971
  /*
6958
6972
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6975,19 +6989,31 @@
6975
6989
  this.correlationId = correlationId;
6976
6990
  this.regionDiscovery = new RegionDiscovery(networkInterface, this.performanceClient, this.correlationId);
6977
6991
  }
6992
+ /**
6993
+ * Get {@link AuthorityType}
6994
+ * @param authorityUri {@link IUri}
6995
+ * @private
6996
+ */
6997
+ Authority.prototype.getAuthorityType = function (authorityUri) {
6998
+ // CIAM auth url pattern is being standardized as: <tenant>.ciamlogin.com
6999
+ if (authorityUri.HostNameAndPort.endsWith(Constants.CIAM_AUTH_URL)) {
7000
+ return AuthorityType.Ciam;
7001
+ }
7002
+ var pathSegments = authorityUri.PathSegments;
7003
+ if (pathSegments.length) {
7004
+ switch (pathSegments[0].toLowerCase()) {
7005
+ case Constants.ADFS:
7006
+ return AuthorityType.Adfs;
7007
+ case Constants.DSTS:
7008
+ return AuthorityType.Dsts;
7009
+ }
7010
+ }
7011
+ return AuthorityType.Default;
7012
+ };
6978
7013
  Object.defineProperty(Authority.prototype, "authorityType", {
6979
7014
  // See above for AuthorityType
6980
7015
  get: function () {
6981
- var pathSegments = this.canonicalAuthorityUrlComponents.PathSegments;
6982
- if (pathSegments.length) {
6983
- switch (pathSegments[0].toLowerCase()) {
6984
- case Constants.ADFS:
6985
- return AuthorityType.Adfs;
6986
- case Constants.DSTS:
6987
- return AuthorityType.Dsts;
6988
- }
6989
- }
6990
- return AuthorityType.Default;
7016
+ return this.getAuthorityType(this.canonicalAuthorityUrlComponents);
6991
7017
  },
6992
7018
  enumerable: false,
6993
7019
  configurable: true
@@ -7069,8 +7095,7 @@
7069
7095
  */
7070
7096
  get: function () {
7071
7097
  if (this.discoveryComplete()) {
7072
- var endpoint = this.replacePath(this.metadata.authorization_endpoint);
7073
- return this.replaceTenant(endpoint);
7098
+ return this.replacePath(this.metadata.authorization_endpoint);
7074
7099
  }
7075
7100
  else {
7076
7101
  throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
@@ -7085,8 +7110,7 @@
7085
7110
  */
7086
7111
  get: function () {
7087
7112
  if (this.discoveryComplete()) {
7088
- var endpoint = this.replacePath(this.metadata.token_endpoint);
7089
- return this.replaceTenant(endpoint);
7113
+ return this.replacePath(this.metadata.token_endpoint);
7090
7114
  }
7091
7115
  else {
7092
7116
  throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
@@ -7098,8 +7122,7 @@
7098
7122
  Object.defineProperty(Authority.prototype, "deviceCodeEndpoint", {
7099
7123
  get: function () {
7100
7124
  if (this.discoveryComplete()) {
7101
- var endpoint = this.replacePath(this.metadata.token_endpoint.replace("/token", "/devicecode"));
7102
- return this.replaceTenant(endpoint);
7125
+ return this.replacePath(this.metadata.token_endpoint.replace("/token", "/devicecode"));
7103
7126
  }
7104
7127
  else {
7105
7128
  throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
@@ -7118,8 +7141,7 @@
7118
7141
  if (!this.metadata.end_session_endpoint) {
7119
7142
  throw ClientAuthError.createLogoutNotSupportedError();
7120
7143
  }
7121
- var endpoint = this.replacePath(this.metadata.end_session_endpoint);
7122
- return this.replaceTenant(endpoint);
7144
+ return this.replacePath(this.metadata.end_session_endpoint);
7123
7145
  }
7124
7146
  else {
7125
7147
  throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
@@ -7134,8 +7156,7 @@
7134
7156
  */
7135
7157
  get: function () {
7136
7158
  if (this.discoveryComplete()) {
7137
- var endpoint = this.replacePath(this.metadata.issuer);
7138
- return this.replaceTenant(endpoint);
7159
+ return this.replacePath(this.metadata.issuer);
7139
7160
  }
7140
7161
  else {
7141
7162
  throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
@@ -7150,8 +7171,7 @@
7150
7171
  */
7151
7172
  get: function () {
7152
7173
  if (this.discoveryComplete()) {
7153
- var endpoint = this.replacePath(this.metadata.jwks_uri);
7154
- return this.replaceTenant(endpoint);
7174
+ return this.replacePath(this.metadata.jwks_uri);
7155
7175
  }
7156
7176
  else {
7157
7177
  throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
@@ -7160,6 +7180,17 @@
7160
7180
  enumerable: false,
7161
7181
  configurable: true
7162
7182
  });
7183
+ /**
7184
+ * Returns a flag indicating that tenant name can be replaced in authority {@link IUri}
7185
+ * @param authorityUri {@link IUri}
7186
+ * @private
7187
+ */
7188
+ Authority.prototype.canReplaceTenant = function (authorityUri) {
7189
+ return authorityUri.PathSegments.length === 1
7190
+ && !Authority.reservedTenantDomains.has(authorityUri.PathSegments[0])
7191
+ && this.getAuthorityType(authorityUri) === AuthorityType.Default
7192
+ && this.protocolMode === exports.ProtocolMode.AAD;
7193
+ };
7163
7194
  /**
7164
7195
  * Replaces tenant in url path with current tenant. Defaults to common.
7165
7196
  * @param urlString
@@ -7172,17 +7203,31 @@
7172
7203
  * @param urlString
7173
7204
  */
7174
7205
  Authority.prototype.replacePath = function (urlString) {
7206
+ var _this = this;
7175
7207
  var endpoint = urlString;
7176
7208
  var cachedAuthorityUrl = new UrlString(this.metadata.canonical_authority);
7177
- var cachedAuthorityParts = cachedAuthorityUrl.getUrlComponents().PathSegments;
7209
+ var cachedAuthorityUrlComponents = cachedAuthorityUrl.getUrlComponents();
7210
+ var cachedAuthorityParts = cachedAuthorityUrlComponents.PathSegments;
7178
7211
  var currentAuthorityParts = this.canonicalAuthorityUrlComponents.PathSegments;
7179
7212
  currentAuthorityParts.forEach(function (currentPart, index) {
7180
7213
  var cachedPart = cachedAuthorityParts[index];
7214
+ if (index === 0 && _this.canReplaceTenant(cachedAuthorityUrlComponents)) {
7215
+ var tenantId = (new UrlString(_this.metadata.authorization_endpoint)).getUrlComponents().PathSegments[0];
7216
+ /**
7217
+ * Check if AAD canonical authority contains tenant domain name, for example "testdomain.onmicrosoft.com",
7218
+ * by comparing its first path segment to the corresponding authorization endpoint path segment, which is
7219
+ * always resolved with tenant id by OIDC.
7220
+ */
7221
+ if (cachedPart !== tenantId) {
7222
+ _this.logger.verbose("Replacing tenant domain name " + cachedPart + " with id " + tenantId);
7223
+ cachedPart = tenantId;
7224
+ }
7225
+ }
7181
7226
  if (currentPart !== cachedPart) {
7182
7227
  endpoint = endpoint.replace("/" + cachedPart + "/", "/" + currentPart + "/");
7183
7228
  }
7184
7229
  });
7185
- return endpoint;
7230
+ return this.replaceTenant(endpoint);
7186
7231
  };
7187
7232
  Object.defineProperty(Authority.prototype, "defaultOpenIdConfigurationEndpoint", {
7188
7233
  /**
@@ -7265,7 +7310,6 @@
7265
7310
  // No need to update
7266
7311
  return [2 /*return*/, AuthorityMetadataSource.CACHE];
7267
7312
  }
7268
- harcodedMetadata = this.getEndpointMetadataFromHardcodedValues();
7269
7313
  (_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(exports.PerformanceEvents.AuthorityGetEndpointMetadataFromNetwork, this.correlationId);
7270
7314
  return [4 /*yield*/, this.getEndpointMetadataFromNetwork()];
7271
7315
  case 1:
@@ -7281,6 +7325,7 @@
7281
7325
  metadataEntity.updateEndpointMetadata(metadata, true);
7282
7326
  return [2 /*return*/, AuthorityMetadataSource.NETWORK];
7283
7327
  case 4:
7328
+ harcodedMetadata = this.getEndpointMetadataFromHardcodedValues();
7284
7329
  if (!(harcodedMetadata && !this.authorityOptions.skipAuthorityMetadataCache)) return [3 /*break*/, 7];
7285
7330
  if (!((_e = this.authorityOptions.azureRegionConfiguration) === null || _e === void 0 ? void 0 : _e.azureRegion)) return [3 /*break*/, 6];
7286
7331
  (_f = this.performanceClient) === null || _f === void 0 ? void 0 : _f.setPreQueueTime(exports.PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation, this.correlationId);
@@ -7405,8 +7450,8 @@
7405
7450
  /**
7406
7451
  * Updates the AuthorityMetadataEntity with new aliases, preferred_network and preferred_cache
7407
7452
  * and returns where the information was retrieved from
7408
- * @param cachedMetadata
7409
- * @param newMetadata
7453
+ * @param metadataEntity
7454
+ * @returns AuthorityMetadataSource
7410
7455
  */
7411
7456
  Authority.prototype.updateCloudDiscoveryMetadata = function (metadataEntity) {
7412
7457
  var _a, _b;
@@ -7416,6 +7461,7 @@
7416
7461
  switch (_c.label) {
7417
7462
  case 0:
7418
7463
  (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.AuthorityUpdateCloudDiscoveryMetadata, this.correlationId);
7464
+ // attempt to read metadata from the config
7419
7465
  this.logger.verbose("Attempting to get cloud discovery metadata in the config");
7420
7466
  this.logger.verbosePii("Known Authorities: " + (this.authorityOptions.knownAuthorities || Constants.NOT_APPLICABLE));
7421
7467
  this.logger.verbosePii("Authority Metadata: " + (this.authorityOptions.authorityMetadata || Constants.NOT_APPLICABLE));
@@ -7465,6 +7511,11 @@
7465
7511
  * Parse cloudDiscoveryMetadata config or check knownAuthorities
7466
7512
  */
7467
7513
  Authority.prototype.getCloudDiscoveryMetadataFromConfig = function () {
7514
+ // CIAM does not support cloud discovery metadata
7515
+ if (this.authorityType === AuthorityType.Ciam) {
7516
+ this.logger.verbose("CIAM authorities do not support cloud discovery metadata, generate the aliases from authority host.");
7517
+ return Authority.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);
7518
+ }
7468
7519
  // Check if network response was provided in config
7469
7520
  if (this.authorityOptions.cloudDiscoveryMetadata) {
7470
7521
  this.logger.verbose("The cloud discovery metadata has been provided as a network response, in the config.");
@@ -7684,10 +7735,38 @@
7684
7735
  }
7685
7736
  return metadata;
7686
7737
  };
7738
+ /**
7739
+ * Transform CIAM_AUTHORIY as per the below rules:
7740
+ * If no path segments found and it is a CIAM authority (hostname ends with .ciamlogin.com), then transform it
7741
+ *
7742
+ * NOTE: The transformation path should go away once STS supports CIAM with the format: `tenantIdorDomain.ciamlogin.com`
7743
+ * `ciamlogin.com` can also change in the future and we should accommodate the same
7744
+ *
7745
+ * @param authority
7746
+ */
7747
+ Authority.transformCIAMAuthority = function (authority) {
7748
+ var ciamAuthority = authority.endsWith(Constants.FORWARD_SLASH) ? authority : "" + authority + Constants.FORWARD_SLASH;
7749
+ var authorityUrl = new UrlString(authority);
7750
+ var authorityUrlComponents = authorityUrl.getUrlComponents();
7751
+ // check if transformation is needed
7752
+ if (authorityUrlComponents.PathSegments.length === 0 && (authorityUrlComponents.HostNameAndPort.endsWith(Constants.CIAM_AUTH_URL))) {
7753
+ var tenantIdOrDomain = authorityUrlComponents.HostNameAndPort.split(".")[0];
7754
+ ciamAuthority = "" + ciamAuthority + tenantIdOrDomain + Constants.AAD_TENANT_DOMAIN_SUFFIX;
7755
+ }
7756
+ return ciamAuthority;
7757
+ };
7758
+ // Reserved tenant domain names that will not be replaced with tenant id
7759
+ Authority.reservedTenantDomains = (new Set([
7760
+ "{tenant}",
7761
+ "{tenantid}",
7762
+ AADAuthorityConstants.COMMON,
7763
+ AADAuthorityConstants.CONSUMERS,
7764
+ AADAuthorityConstants.ORGANIZATIONS
7765
+ ]));
7687
7766
  return Authority;
7688
7767
  }());
7689
7768
 
7690
- /*! @azure/msal-common v12.0.0 2023-04-03 */
7769
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
7691
7770
 
7692
7771
  /*
7693
7772
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7708,12 +7787,13 @@
7708
7787
  */
7709
7788
  AuthorityFactory.createDiscoveredInstance = function (authorityUri, networkClient, cacheManager, authorityOptions, logger, performanceClient, correlationId) {
7710
7789
  return __awaiter(this, void 0, void 0, function () {
7711
- var acquireTokenAuthority, e_1;
7790
+ var authorityUriFinal, acquireTokenAuthority, e_1;
7712
7791
  return __generator(this, function (_a) {
7713
7792
  switch (_a.label) {
7714
7793
  case 0:
7715
7794
  performanceClient === null || performanceClient === void 0 ? void 0 : performanceClient.addQueueMeasurement(exports.PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance, correlationId);
7716
- acquireTokenAuthority = AuthorityFactory.createInstance(authorityUri, networkClient, cacheManager, authorityOptions, logger, performanceClient, correlationId);
7795
+ authorityUriFinal = Authority.transformCIAMAuthority(authorityUri);
7796
+ acquireTokenAuthority = AuthorityFactory.createInstance(authorityUriFinal, networkClient, cacheManager, authorityOptions, logger, performanceClient, correlationId);
7717
7797
  _a.label = 1;
7718
7798
  case 1:
7719
7799
  _a.trys.push([1, 3, , 4]);
@@ -7750,7 +7830,7 @@
7750
7830
  return AuthorityFactory;
7751
7831
  }());
7752
7832
 
7753
- /*! @azure/msal-common v12.0.0 2023-04-03 */
7833
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
7754
7834
 
7755
7835
  /*
7756
7836
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7781,7 +7861,7 @@
7781
7861
  return ServerTelemetryEntity;
7782
7862
  }());
7783
7863
 
7784
- /*! @azure/msal-common v12.0.0 2023-04-03 */
7864
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
7785
7865
 
7786
7866
  /*
7787
7867
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7809,7 +7889,7 @@
7809
7889
  return ThrottlingEntity;
7810
7890
  }());
7811
7891
 
7812
- /*! @azure/msal-common v12.0.0 2023-04-03 */
7892
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
7813
7893
 
7814
7894
  /*
7815
7895
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7826,7 +7906,7 @@
7826
7906
  }
7827
7907
  };
7828
7908
 
7829
- /*! @azure/msal-common v12.0.0 2023-04-03 */
7909
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
7830
7910
 
7831
7911
  /*
7832
7912
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7871,7 +7951,7 @@
7871
7951
  return JoseHeaderError;
7872
7952
  }(AuthError));
7873
7953
 
7874
- /*! @azure/msal-common v12.0.0 2023-04-03 */
7954
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
7875
7955
 
7876
7956
  /*
7877
7957
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7911,7 +7991,7 @@
7911
7991
  return JoseHeader;
7912
7992
  }());
7913
7993
 
7914
- /*! @azure/msal-common v12.0.0 2023-04-03 */
7994
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
7915
7995
 
7916
7996
  /*
7917
7997
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7970,7 +8050,7 @@
7970
8050
  return AuthenticationHeaderParser;
7971
8051
  }());
7972
8052
 
7973
- /*! @azure/msal-common v12.0.0 2023-04-03 */
8053
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
7974
8054
 
7975
8055
  /*
7976
8056
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8132,7 +8212,7 @@
8132
8212
  return ServerTelemetryManager;
8133
8213
  }());
8134
8214
 
8135
- /*! @azure/msal-common v12.0.0 2023-04-03 */
8215
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
8136
8216
 
8137
8217
  /*
8138
8218
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8535,7 +8615,7 @@
8535
8615
  return PerformanceClient;
8536
8616
  }());
8537
8617
 
8538
- /*! @azure/msal-common v12.0.0 2023-04-03 */
8618
+ /*! @azure/msal-common v13.1.0 2023-06-07 */
8539
8619
 
8540
8620
  /*
8541
8621
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10760,7 +10840,7 @@
10760
10840
 
10761
10841
  /* eslint-disable header/header */
10762
10842
  var name = "@azure/msal-browser";
10763
- var version = "2.36.0";
10843
+ var version = "2.37.1";
10764
10844
 
10765
10845
  /*
10766
10846
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -11225,7 +11305,7 @@
11225
11305
  * Initializer function for all request APIs
11226
11306
  * @param request
11227
11307
  */
11228
- BaseInteractionClient.prototype.initializeBaseRequest = function (request) {
11308
+ BaseInteractionClient.prototype.initializeBaseRequest = function (request, account) {
11229
11309
  return __awaiter$1(this, void 0, void 0, function () {
11230
11310
  var authority, scopes, validatedRequest, _a;
11231
11311
  return __generator$1(this, function (_b) {
@@ -11234,6 +11314,12 @@
11234
11314
  this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.InitializeBaseRequest, request.correlationId);
11235
11315
  this.logger.verbose("Initializing BaseAuthRequest");
11236
11316
  authority = request.authority || this.config.auth.authority;
11317
+ if (!account) return [3 /*break*/, 2];
11318
+ return [4 /*yield*/, this.validateRequestAuthority(authority, account)];
11319
+ case 1:
11320
+ _b.sent();
11321
+ _b.label = 2;
11322
+ case 2:
11237
11323
  scopes = __spread(((request && request.scopes) || []));
11238
11324
  validatedRequest = __assign$1(__assign$1({}, request), { correlationId: this.correlationId, authority: authority,
11239
11325
  scopes: scopes });
@@ -11253,13 +11339,13 @@
11253
11339
  }
11254
11340
  this.logger.verbose("Authentication Scheme set to \"" + validatedRequest.authenticationScheme + "\" as configured in Auth request");
11255
11341
  }
11256
- if (!(request.claims && !StringUtils.isEmpty(request.claims))) return [3 /*break*/, 2];
11342
+ if (!(request.claims && !StringUtils.isEmpty(request.claims))) return [3 /*break*/, 4];
11257
11343
  _a = validatedRequest;
11258
11344
  return [4 /*yield*/, this.browserCrypto.hashString(request.claims)];
11259
- case 1:
11345
+ case 3:
11260
11346
  _a.requestedClaimsHash = _b.sent();
11261
- _b.label = 2;
11262
- case 2: return [2 /*return*/, validatedRequest];
11347
+ _b.label = 4;
11348
+ case 4: return [2 /*return*/, validatedRequest];
11263
11349
  }
11264
11350
  });
11265
11351
  });
@@ -11276,6 +11362,26 @@
11276
11362
  var redirectUri = requestRedirectUri || this.config.auth.redirectUri || BrowserUtils.getCurrentUri();
11277
11363
  return UrlString.getAbsoluteUrl(redirectUri, BrowserUtils.getCurrentUri());
11278
11364
  };
11365
+ /*
11366
+ * If authority provided in the request does not match environment/authority specified
11367
+ * in the account or MSAL config, we throw an error.
11368
+ */
11369
+ BaseInteractionClient.prototype.validateRequestAuthority = function (authority, account) {
11370
+ return __awaiter$1(this, void 0, void 0, function () {
11371
+ var discoveredAuthority;
11372
+ return __generator$1(this, function (_a) {
11373
+ switch (_a.label) {
11374
+ case 0: return [4 /*yield*/, this.getDiscoveredAuthority(authority)];
11375
+ case 1:
11376
+ discoveredAuthority = _a.sent();
11377
+ if (!discoveredAuthority.isAlias(account.environment)) {
11378
+ throw ClientConfigurationError.createAuthorityMismatchError();
11379
+ }
11380
+ return [2 /*return*/];
11381
+ }
11382
+ });
11383
+ });
11384
+ };
11279
11385
  /**
11280
11386
  *
11281
11387
  * @param apiId
@@ -11940,6 +12046,7 @@
11940
12046
  EventType["LOGOUT_SUCCESS"] = "msal:logoutSuccess";
11941
12047
  EventType["LOGOUT_FAILURE"] = "msal:logoutFailure";
11942
12048
  EventType["LOGOUT_END"] = "msal:logoutEnd";
12049
+ EventType["RESTORE_FROM_BFCACHE"] = "msal:restoreFromBFCache";
11943
12050
  })(exports.EventType || (exports.EventType = {}));
11944
12051
 
11945
12052
  /*
@@ -12120,7 +12227,7 @@
12120
12227
  this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.InitializeSilentRequest, this.correlationId);
12121
12228
  this.performanceClient.setPreQueueTime(exports.PerformanceEvents.InitializeBaseRequest, this.correlationId);
12122
12229
  _a = [__assign$1({}, request)];
12123
- return [4 /*yield*/, this.initializeBaseRequest(request)];
12230
+ return [4 /*yield*/, this.initializeBaseRequest(request, account)];
12124
12231
  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 }])];
12125
12232
  }
12126
12233
  });
@@ -12394,7 +12501,7 @@
12394
12501
  result = _a.sent();
12395
12502
  // cache accounts and tokens in the appropriate storage
12396
12503
  this.cacheAccount(accountEntity);
12397
- this.cacheNativeTokens(response, request, homeAccountIdentifier, idTokenObj, result.accessToken, result.tenantId, reqTimestamp);
12504
+ this.cacheNativeTokens(response, request, homeAccountIdentifier, accountEntity, idTokenObj, result.accessToken, result.tenantId, reqTimestamp);
12398
12505
  return [2 /*return*/, result];
12399
12506
  }
12400
12507
  });
@@ -12550,10 +12657,8 @@
12550
12657
  * @param tenantId
12551
12658
  * @param reqTimestamp
12552
12659
  */
12553
- NativeInteractionClient.prototype.cacheNativeTokens = function (response, request, homeAccountIdentifier, idTokenObj, responseAccessToken, tenantId, reqTimestamp) {
12554
- // cache idToken in inmemory storage
12555
- var idTokenEntity = IdTokenEntity.createIdTokenEntity(homeAccountIdentifier, request.authority, response.id_token || Constants.EMPTY_STRING, request.clientId, idTokenObj.claims.tid || Constants.EMPTY_STRING);
12556
- this.nativeStorageManager.setIdTokenCredential(idTokenEntity);
12660
+ NativeInteractionClient.prototype.cacheNativeTokens = function (response, request, homeAccountIdentifier, accountEntity, idTokenObj, responseAccessToken, tenantId, reqTimestamp) {
12661
+ var cachedIdToken = IdTokenEntity.createIdTokenEntity(homeAccountIdentifier, request.authority, response.id_token || Constants.EMPTY_STRING, request.clientId, idTokenObj.claims.tid || Constants.EMPTY_STRING);
12557
12662
  // cache accessToken in inmemory storage
12558
12663
  var expiresIn = (request.tokenType === exports.AuthenticationScheme.POP)
12559
12664
  ? Constants.SHR_NONCE_VALIDITY
@@ -12562,8 +12667,11 @@
12562
12667
  : response.expires_in) || 0;
12563
12668
  var tokenExpirationSeconds = reqTimestamp + expiresIn;
12564
12669
  var responseScopes = this.generateScopes(response, request);
12565
- var accessTokenEntity = AccessTokenEntity.createAccessTokenEntity(homeAccountIdentifier, request.authority, responseAccessToken, request.clientId, tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, this.browserCrypto);
12566
- this.nativeStorageManager.setAccessTokenCredential(accessTokenEntity);
12670
+ var cachedAccessToken = AccessTokenEntity.createAccessTokenEntity(homeAccountIdentifier, request.authority, responseAccessToken, request.clientId, idTokenObj
12671
+ ? idTokenObj.claims.tid || Constants.EMPTY_STRING
12672
+ : tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, this.browserCrypto);
12673
+ var nativeCacheRecord = new CacheRecord(accountEntity, cachedIdToken, cachedAccessToken);
12674
+ this.nativeStorageManager.saveCacheRecord(nativeCacheRecord);
12567
12675
  };
12568
12676
  NativeInteractionClient.prototype.addTelemetryFromNativeResponse = function (response) {
12569
12677
  var mats = this.getMATSFromResponse(response);
@@ -12647,6 +12755,12 @@
12647
12755
  case 0:
12648
12756
  this.logger.trace("NativeInteractionClient - initializeNativeRequest called");
12649
12757
  authority = request.authority || this.config.auth.authority;
12758
+ if (!request.account) return [3 /*break*/, 2];
12759
+ return [4 /*yield*/, this.validateRequestAuthority(authority, request.account)];
12760
+ case 1:
12761
+ _a.sent();
12762
+ _a.label = 2;
12763
+ case 2:
12650
12764
  canonicalAuthority = new UrlString(authority);
12651
12765
  canonicalAuthority.validateAsUri();
12652
12766
  scopes = request.scopes, remainingProperties = __rest(request, ["scopes"]);
@@ -12679,7 +12793,7 @@
12679
12793
  };
12680
12794
  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?
12681
12795
  });
12682
- if (!(request.authenticationScheme === exports.AuthenticationScheme.POP)) return [3 /*break*/, 2];
12796
+ if (!(request.authenticationScheme === exports.AuthenticationScheme.POP)) return [3 /*break*/, 4];
12683
12797
  shrParameters = {
12684
12798
  resourceRequestUri: request.resourceRequestUri,
12685
12799
  resourceRequestMethod: request.resourceRequestMethod,
@@ -12688,13 +12802,13 @@
12688
12802
  };
12689
12803
  popTokenGenerator = new PopTokenGenerator(this.browserCrypto);
12690
12804
  return [4 /*yield*/, popTokenGenerator.generateCnf(shrParameters)];
12691
- case 1:
12805
+ case 3:
12692
12806
  reqCnfData = _a.sent();
12693
- // to reduce the URL length, it is recommended to send the hash of the req_cnf instead of the whole string
12694
- validatedRequest.reqCnf = reqCnfData.reqCnfHash;
12807
+ // to reduce the URL length, it is recommended to send the short form of the req_cnf
12808
+ validatedRequest.reqCnf = reqCnfData.reqCnfString;
12695
12809
  validatedRequest.keyId = reqCnfData.kid;
12696
- _a.label = 2;
12697
- case 2: return [2 /*return*/, validatedRequest];
12810
+ _a.label = 4;
12811
+ case 4: return [2 /*return*/, validatedRequest];
12698
12812
  }
12699
12813
  });
12700
12814
  });
@@ -12996,6 +13110,7 @@
12996
13110
  if (event.persisted) {
12997
13111
  _this.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache.");
12998
13112
  _this.browserStorage.cleanRequestByState(validRequest.state);
13113
+ _this.eventHandler.emitEvent(exports.EventType.RESTORE_FROM_BFCACHE, exports.InteractionType.Redirect);
12999
13114
  }
13000
13115
  };
13001
13116
  _a.label = 2;
@@ -13187,7 +13302,7 @@
13187
13302
  if (!this.nativeMessageHandler) {
13188
13303
  throw BrowserAuthError.createNativeConnectionNotEstablishedError();
13189
13304
  }
13190
- 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);
13305
+ 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);
13191
13306
  userRequestState = ProtocolUtils.parseRequestState(this.browserCrypto, state).userRequestState;
13192
13307
  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
13193
13308
  })).finally(function () {
@@ -14241,7 +14356,7 @@
14241
14356
  this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.SilentRefreshClientAcquireToken, request.correlationId);
14242
14357
  this.performanceClient.setPreQueueTime(exports.PerformanceEvents.InitializeBaseRequest, request.correlationId);
14243
14358
  _a = [__assign$1({}, request)];
14244
- return [4 /*yield*/, this.initializeBaseRequest(request)];
14359
+ return [4 /*yield*/, this.initializeBaseRequest(request, request.account)];
14245
14360
  case 1:
14246
14361
  silentRequest = __assign$1.apply(void 0, _a.concat([_b.sent()]));
14247
14362
  acquireTokenMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.SilentRefreshClientAcquireToken, silentRequest.correlationId);
@@ -17941,6 +18056,7 @@
17941
18056
  case exports.EventType.LOGIN_FAILURE:
17942
18057
  case exports.EventType.ACQUIRE_TOKEN_SUCCESS:
17943
18058
  case exports.EventType.ACQUIRE_TOKEN_FAILURE:
18059
+ case exports.EventType.RESTORE_FROM_BFCACHE:
17944
18060
  if (message.interactionType === exports.InteractionType.Redirect || message.interactionType === exports.InteractionType.Popup) {
17945
18061
  if (currentStatus && currentStatus !== exports.InteractionStatus.Login && currentStatus !== exports.InteractionStatus.AcquireToken) {
17946
18062
  // Prevent this event from clearing any status other than login or acquireToken