@azure/msal-browser 2.20.0 → 2.22.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 (127) hide show
  1. package/README.md +3 -3
  2. package/dist/_virtual/_tslib.js +1 -1
  3. package/dist/app/ClientApplication.d.ts +7 -1
  4. package/dist/app/ClientApplication.d.ts.map +1 -1
  5. package/dist/app/ClientApplication.js +18 -3
  6. package/dist/app/ClientApplication.js.map +1 -1
  7. package/dist/app/IPublicClientApplication.js +1 -1
  8. package/dist/app/PublicClientApplication.d.ts +2 -2
  9. package/dist/app/PublicClientApplication.d.ts.map +1 -1
  10. package/dist/app/PublicClientApplication.js +29 -24
  11. package/dist/app/PublicClientApplication.js.map +1 -1
  12. package/dist/cache/AsyncMemoryStorage.js +1 -1
  13. package/dist/cache/BrowserCacheManager.d.ts +19 -13
  14. package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
  15. package/dist/cache/BrowserCacheManager.js +31 -7
  16. package/dist/cache/BrowserCacheManager.js.map +1 -1
  17. package/dist/cache/BrowserStorage.js +1 -1
  18. package/dist/cache/DatabaseStorage.js +1 -1
  19. package/dist/cache/MemoryStorage.js +1 -1
  20. package/dist/cache/TokenCache.d.ts.map +1 -1
  21. package/dist/cache/TokenCache.js +4 -3
  22. package/dist/cache/TokenCache.js.map +1 -1
  23. package/dist/config/Configuration.d.ts +10 -9
  24. package/dist/config/Configuration.d.ts.map +1 -1
  25. package/dist/config/Configuration.js +7 -3
  26. package/dist/config/Configuration.js.map +1 -1
  27. package/dist/crypto/BrowserCrypto.js +1 -1
  28. package/dist/crypto/CryptoOps.d.ts +5 -0
  29. package/dist/crypto/CryptoOps.d.ts.map +1 -1
  30. package/dist/crypto/CryptoOps.js +22 -5
  31. package/dist/crypto/CryptoOps.js.map +1 -1
  32. package/dist/crypto/GuidGenerator.js +1 -1
  33. package/dist/crypto/PkceGenerator.js +1 -1
  34. package/dist/crypto/SignedHttpRequest.js +1 -1
  35. package/dist/encode/Base64Decode.js +1 -1
  36. package/dist/encode/Base64Encode.js +1 -1
  37. package/dist/error/BrowserAuthError.js +1 -1
  38. package/dist/error/BrowserConfigurationAuthError.js +1 -1
  39. package/dist/event/EventHandler.js +1 -1
  40. package/dist/event/EventMessage.js +1 -1
  41. package/dist/event/EventType.js +1 -1
  42. package/dist/index.cjs.js +615 -346
  43. package/dist/index.cjs.js.map +1 -1
  44. package/dist/index.d.ts +14 -2
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +14 -3
  47. package/dist/index.js.map +1 -1
  48. package/dist/interaction_client/BaseInteractionClient.d.ts +2 -2
  49. package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
  50. package/dist/interaction_client/BaseInteractionClient.js +37 -23
  51. package/dist/interaction_client/BaseInteractionClient.js.map +1 -1
  52. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +1 -1
  53. package/dist/interaction_client/PopupClient.d.ts +4 -3
  54. package/dist/interaction_client/PopupClient.d.ts.map +1 -1
  55. package/dist/interaction_client/PopupClient.js +22 -20
  56. package/dist/interaction_client/PopupClient.js.map +1 -1
  57. package/dist/interaction_client/RedirectClient.d.ts +3 -3
  58. package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
  59. package/dist/interaction_client/RedirectClient.js +32 -19
  60. package/dist/interaction_client/RedirectClient.js.map +1 -1
  61. package/dist/interaction_client/SilentAuthCodeClient.d.ts.map +1 -1
  62. package/dist/interaction_client/SilentAuthCodeClient.js +11 -8
  63. package/dist/interaction_client/SilentAuthCodeClient.js.map +1 -1
  64. package/dist/interaction_client/SilentCacheClient.d.ts +3 -3
  65. package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
  66. package/dist/interaction_client/SilentCacheClient.js +15 -5
  67. package/dist/interaction_client/SilentCacheClient.js.map +1 -1
  68. package/dist/interaction_client/SilentIframeClient.d.ts +3 -3
  69. package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
  70. package/dist/interaction_client/SilentIframeClient.js +15 -12
  71. package/dist/interaction_client/SilentIframeClient.js.map +1 -1
  72. package/dist/interaction_client/SilentRefreshClient.d.ts +2 -2
  73. package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
  74. package/dist/interaction_client/SilentRefreshClient.js +13 -10
  75. package/dist/interaction_client/SilentRefreshClient.js.map +1 -1
  76. package/dist/interaction_client/StandardInteractionClient.d.ts +11 -11
  77. package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
  78. package/dist/interaction_client/StandardInteractionClient.js +90 -57
  79. package/dist/interaction_client/StandardInteractionClient.js.map +1 -1
  80. package/dist/interaction_handler/InteractionHandler.js +1 -1
  81. package/dist/interaction_handler/PopupHandler.d.ts.map +1 -1
  82. package/dist/interaction_handler/PopupHandler.js +1 -3
  83. package/dist/interaction_handler/PopupHandler.js.map +1 -1
  84. package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
  85. package/dist/interaction_handler/RedirectHandler.js +1 -2
  86. package/dist/interaction_handler/RedirectHandler.js.map +1 -1
  87. package/dist/interaction_handler/SilentHandler.js +1 -1
  88. package/dist/navigation/NavigationClient.js +1 -1
  89. package/dist/network/FetchClient.js +1 -1
  90. package/dist/network/XhrClient.js +1 -1
  91. package/dist/packageMetadata.d.ts +1 -1
  92. package/dist/packageMetadata.js +2 -2
  93. package/dist/packageMetadata.js.map +1 -1
  94. package/dist/request/AuthorizationCodeRequest.d.ts +1 -1
  95. package/dist/request/AuthorizationCodeRequest.d.ts.map +1 -1
  96. package/dist/request/AuthorizationUrlRequest.d.ts +1 -1
  97. package/dist/request/AuthorizationUrlRequest.d.ts.map +1 -1
  98. package/dist/request/EndSessionPopupRequest.d.ts +1 -0
  99. package/dist/request/EndSessionPopupRequest.d.ts.map +1 -1
  100. package/dist/request/EndSessionRequest.d.ts +1 -0
  101. package/dist/request/EndSessionRequest.d.ts.map +1 -1
  102. package/dist/request/PopupRequest.d.ts +1 -1
  103. package/dist/request/PopupRequest.d.ts.map +1 -1
  104. package/dist/request/RedirectRequest.d.ts +1 -1
  105. package/dist/request/RedirectRequest.d.ts.map +1 -1
  106. package/dist/request/SilentRequest.d.ts +1 -1
  107. package/dist/request/SilentRequest.d.ts.map +1 -1
  108. package/dist/request/SsoSilentRequest.d.ts +1 -1
  109. package/dist/request/SsoSilentRequest.d.ts.map +1 -1
  110. package/dist/utils/BrowserConstants.d.ts +2 -1
  111. package/dist/utils/BrowserConstants.d.ts.map +1 -1
  112. package/dist/utils/BrowserConstants.js +2 -1
  113. package/dist/utils/BrowserConstants.js.map +1 -1
  114. package/dist/utils/BrowserProtocolUtils.js +1 -1
  115. package/dist/utils/BrowserStringUtils.js +1 -1
  116. package/dist/utils/BrowserUtils.js +1 -1
  117. package/dist/utils/MathUtils.js +1 -1
  118. package/dist/utils/PopupUtils.d.ts +1 -2
  119. package/dist/utils/PopupUtils.d.ts.map +1 -1
  120. package/dist/utils/PopupUtils.js +3 -3
  121. package/dist/utils/PopupUtils.js.map +1 -1
  122. package/lib/msal-browser.js +615 -346
  123. package/lib/msal-browser.js.map +1 -1
  124. package/lib/msal-browser.min.js +34 -29
  125. package/package.json +2 -2
  126. package/CHANGELOG.json +0 -1656
  127. package/CHANGELOG.md +0 -523
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v2.20.0 2021-12-07 */
1
+ /*! @azure/msal-browser v2.22.1 2022-03-07 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
@@ -105,7 +105,7 @@ function __spread() {
105
105
  return ar;
106
106
  }
107
107
 
108
- /*! @azure/msal-common v5.2.0 2021-12-07 */
108
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
109
109
  /*! *****************************************************************************
110
110
  Copyright (c) Microsoft Corporation.
111
111
 
@@ -192,7 +192,7 @@ function __spreadArrays() {
192
192
  return r;
193
193
  }
194
194
 
195
- /*! @azure/msal-common v5.2.0 2021-12-07 */
195
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
196
196
 
197
197
  /*
198
198
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -206,6 +206,7 @@ var Constants = {
206
206
  // default authority
207
207
  DEFAULT_AUTHORITY: "https://login.microsoftonline.com/common/",
208
208
  DEFAULT_AUTHORITY_HOST: "login.microsoftonline.com",
209
+ DEFAULT_COMMON_TENANT: "common",
209
210
  // ADFS String
210
211
  ADFS: "adfs",
211
212
  // Default AAD Instance Discovery Endpoint
@@ -330,6 +331,7 @@ var AADServerParamKeys;
330
331
  AADServerParamKeys["FOCI"] = "foci";
331
332
  AADServerParamKeys["CCS_HEADER"] = "X-AnchorMailbox";
332
333
  AADServerParamKeys["RETURN_SPA_CODE"] = "return_spa_code";
334
+ AADServerParamKeys["LOGOUT_HINT"] = "logout_hint";
333
335
  })(AADServerParamKeys || (AADServerParamKeys = {}));
334
336
  /**
335
337
  * Claims request keys
@@ -554,7 +556,7 @@ var CacheOutcome;
554
556
  CacheOutcome["REFRESH_CACHED_ACCESS_TOKEN"] = "4";
555
557
  })(CacheOutcome || (CacheOutcome = {}));
556
558
 
557
- /*! @azure/msal-common v5.2.0 2021-12-07 */
559
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
558
560
 
559
561
  /*
560
562
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -598,7 +600,7 @@ var AuthError = /** @class */ (function (_super) {
598
600
  return AuthError;
599
601
  }(Error));
600
602
 
601
- /*! @azure/msal-common v5.2.0 2021-12-07 */
603
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
602
604
 
603
605
  /*
604
606
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -661,10 +663,19 @@ var DEFAULT_CRYPTO_IMPLEMENTATION = {
661
663
  throw AuthError.createUnexpectedError(notImplErr);
662
664
  });
663
665
  });
666
+ },
667
+ hashString: function () {
668
+ return __awaiter(this, void 0, void 0, function () {
669
+ var notImplErr;
670
+ return __generator(this, function (_a) {
671
+ notImplErr = "Crypto interface - hashString() has not been implemented";
672
+ throw AuthError.createUnexpectedError(notImplErr);
673
+ });
674
+ });
664
675
  }
665
676
  };
666
677
 
667
- /*! @azure/msal-common v5.2.0 2021-12-07 */
678
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
668
679
 
669
680
  /*
670
681
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1126,7 +1137,7 @@ var ClientAuthError = /** @class */ (function (_super) {
1126
1137
  return ClientAuthError;
1127
1138
  }(AuthError));
1128
1139
 
1129
- /*! @azure/msal-common v5.2.0 2021-12-07 */
1140
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
1130
1141
 
1131
1142
  /*
1132
1143
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1251,7 +1262,7 @@ var StringUtils = /** @class */ (function () {
1251
1262
  return StringUtils;
1252
1263
  }());
1253
1264
 
1254
- /*! @azure/msal-common v5.2.0 2021-12-07 */
1265
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
1255
1266
 
1256
1267
  /*
1257
1268
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1431,12 +1442,31 @@ var Logger = /** @class */ (function () {
1431
1442
  return Logger;
1432
1443
  }());
1433
1444
 
1434
- /*! @azure/msal-common v5.2.0 2021-12-07 */
1445
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
1435
1446
  /* eslint-disable header/header */
1436
1447
  var name$1 = "@azure/msal-common";
1437
- var version$1 = "5.2.0";
1448
+ var version$1 = "6.1.0";
1438
1449
 
1439
- /*! @azure/msal-common v5.2.0 2021-12-07 */
1450
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
1451
+ /*
1452
+ * Copyright (c) Microsoft Corporation. All rights reserved.
1453
+ * Licensed under the MIT License.
1454
+ */
1455
+ exports.AzureCloudInstance = void 0;
1456
+ (function (AzureCloudInstance) {
1457
+ // AzureCloudInstance is not specified.
1458
+ AzureCloudInstance[AzureCloudInstance["None"] = 0] = "None";
1459
+ // Microsoft Azure public cloud
1460
+ AzureCloudInstance["AzurePublic"] = "https://login.microsoftonline.com";
1461
+ // Microsoft Chinese national cloud
1462
+ AzureCloudInstance["AzureChina"] = "https://login.chinacloudapi.cn";
1463
+ // Microsoft German national cloud ("Black Forest")
1464
+ AzureCloudInstance["AzureGermany"] = "https://login.microsoftonline.de";
1465
+ // US Government cloud
1466
+ AzureCloudInstance["AzureUsGovernment"] = "https://login.microsoftonline.us";
1467
+ })(exports.AzureCloudInstance || (exports.AzureCloudInstance = {}));
1468
+
1469
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
1440
1470
 
1441
1471
  /*
1442
1472
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1447,7 +1477,7 @@ var version$1 = "5.2.0";
1447
1477
  *
1448
1478
  * Key:Value Schema:
1449
1479
  *
1450
- * Key: <home_account_id*>-<environment>-<credential_type>-<client_id>-<realm*>-<target*>-<scheme>
1480
+ * Key: <home_account_id*>-<environment>-<credential_type>-<client_id>-<realm*>-<target*>-<requestedClaims*>-<scheme*>
1451
1481
  *
1452
1482
  * Value Schema:
1453
1483
  * {
@@ -1461,6 +1491,7 @@ var version$1 = "5.2.0";
1461
1491
  * target: Permissions that are included in the token, or for refresh tokens, the resource identifier.
1462
1492
  * oboAssertion: access token passed in as part of OBO request
1463
1493
  * tokenType: Matches the authentication scheme for which the token was issued (i.e. Bearer or pop)
1494
+ * requestedClaimsHash: Matches the SHA 256 hash of the claims object included in the token request
1464
1495
  * }
1465
1496
  */
1466
1497
  var CredentialEntity = /** @class */ (function () {
@@ -1488,7 +1519,7 @@ var CredentialEntity = /** @class */ (function () {
1488
1519
  * generates credential key
1489
1520
  */
1490
1521
  CredentialEntity.prototype.generateCredentialKey = function () {
1491
- return CredentialEntity.generateCredentialCacheKey(this.homeAccountId, this.environment, this.credentialType, this.clientId, this.realm, this.target, this.familyId, this.tokenType);
1522
+ return CredentialEntity.generateCredentialCacheKey(this.homeAccountId, this.environment, this.credentialType, this.clientId, this.realm, this.target, this.familyId, this.tokenType, this.requestedClaimsHash);
1492
1523
  };
1493
1524
  /**
1494
1525
  * returns the type of the cache (in this case credential)
@@ -1532,16 +1563,14 @@ var CredentialEntity = /** @class */ (function () {
1532
1563
  * generates credential key
1533
1564
  * <home_account_id*>-\<environment>-<credential_type>-<client_id>-<realm\*>-<target\*>-<scheme\*>
1534
1565
  */
1535
- CredentialEntity.generateCredentialCacheKey = function (homeAccountId, environment, credentialType, clientId, realm, target, familyId, tokenType) {
1566
+ CredentialEntity.generateCredentialCacheKey = function (homeAccountId, environment, credentialType, clientId, realm, target, familyId, tokenType, requestedClaimsHash) {
1536
1567
  var credentialKey = [
1537
1568
  this.generateAccountIdForCacheKey(homeAccountId, environment),
1538
1569
  this.generateCredentialIdForCacheKey(credentialType, clientId, realm, familyId),
1539
- this.generateTargetForCacheKey(target)
1570
+ this.generateTargetForCacheKey(target),
1571
+ this.generateClaimsHashForCacheKey(requestedClaimsHash),
1572
+ this.generateSchemeForCacheKey(tokenType)
1540
1573
  ];
1541
- // PoP Tokens and SSH certs include scheme in cache key
1542
- if (tokenType && tokenType !== exports.AuthenticationScheme.BEARER) {
1543
- credentialKey.push(tokenType.toLowerCase());
1544
- }
1545
1574
  return credentialKey.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();
1546
1575
  };
1547
1576
  /**
@@ -1577,10 +1606,26 @@ var CredentialEntity = /** @class */ (function () {
1577
1606
  CredentialEntity.generateTargetForCacheKey = function (scopes) {
1578
1607
  return (scopes || "").toLowerCase();
1579
1608
  };
1609
+ /**
1610
+ * Generate requested claims key component as per schema: <requestedClaims>
1611
+ */
1612
+ CredentialEntity.generateClaimsHashForCacheKey = function (requestedClaimsHash) {
1613
+ return (requestedClaimsHash || "").toLowerCase();
1614
+ };
1615
+ /**
1616
+ * Generate scheme key componenet as per schema: <scheme>
1617
+ */
1618
+ CredentialEntity.generateSchemeForCacheKey = function (tokenType) {
1619
+ /*
1620
+ * PoP Tokens and SSH certs include scheme in cache key
1621
+ * Cast to lowercase to handle "bearer" from ADFS
1622
+ */
1623
+ return (tokenType && tokenType.toLowerCase() !== exports.AuthenticationScheme.BEARER.toLowerCase()) ? tokenType.toLowerCase() : "";
1624
+ };
1580
1625
  return CredentialEntity;
1581
1626
  }());
1582
1627
 
1583
- /*! @azure/msal-common v5.2.0 2021-12-07 */
1628
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
1584
1629
 
1585
1630
  /*
1586
1631
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1662,6 +1707,10 @@ var ClientConfigurationErrorMessage = {
1662
1707
  code: "untrusted_authority",
1663
1708
  desc: "The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter."
1664
1709
  },
1710
+ invalidAzureCloudInstance: {
1711
+ code: "invalid_azure_cloud_instance",
1712
+ desc: "Invalid AzureCloudInstance provided. Please refer MSAL JS docs: aks.ms/msaljs/azure_cloud_instance for valid values"
1713
+ },
1665
1714
  missingSshJwk: {
1666
1715
  code: "missing_ssh_jwk",
1667
1716
  desc: "Missing sshJwk in SSH certificate request. A stringified JSON Web Key is required when using the SSH authentication scheme."
@@ -1798,7 +1847,13 @@ var ClientConfigurationError = /** @class */ (function (_super) {
1798
1847
  ClientConfigurationError.createUntrustedAuthorityError = function () {
1799
1848
  return new ClientConfigurationError(ClientConfigurationErrorMessage.untrustedAuthority.code, ClientConfigurationErrorMessage.untrustedAuthority.desc);
1800
1849
  };
1801
- /*
1850
+ /**
1851
+ * Throws error when the AzureCloudInstance is set to an invalid value
1852
+ */
1853
+ ClientConfigurationError.createInvalidAzureCloudInstanceError = function () {
1854
+ return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidAzureCloudInstance.code, ClientConfigurationErrorMessage.invalidAzureCloudInstance.desc);
1855
+ };
1856
+ /**
1802
1857
  * Throws an error when the authentication scheme is set to SSH but the SSH public key is omitted from the request
1803
1858
  */
1804
1859
  ClientConfigurationError.createMissingSshJwkError = function () {
@@ -1825,7 +1880,7 @@ var ClientConfigurationError = /** @class */ (function (_super) {
1825
1880
  return ClientConfigurationError;
1826
1881
  }(ClientAuthError));
1827
1882
 
1828
- /*! @azure/msal-common v5.2.0 2021-12-07 */
1883
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
1829
1884
 
1830
1885
  /*
1831
1886
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2009,7 +2064,7 @@ var ScopeSet = /** @class */ (function () {
2009
2064
  return ScopeSet;
2010
2065
  }());
2011
2066
 
2012
- /*! @azure/msal-common v5.2.0 2021-12-07 */
2067
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
2013
2068
 
2014
2069
  /*
2015
2070
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2047,7 +2102,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
2047
2102
  };
2048
2103
  }
2049
2104
 
2050
- /*! @azure/msal-common v5.2.0 2021-12-07 */
2105
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
2051
2106
  /*
2052
2107
  * Copyright (c) Microsoft Corporation. All rights reserved.
2053
2108
  * Licensed under the MIT License.
@@ -2061,7 +2116,7 @@ var AuthorityType;
2061
2116
  AuthorityType[AuthorityType["Adfs"] = 1] = "Adfs";
2062
2117
  })(AuthorityType || (AuthorityType = {}));
2063
2118
 
2064
- /*! @azure/msal-common v5.2.0 2021-12-07 */
2119
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
2065
2120
 
2066
2121
  /*
2067
2122
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2295,7 +2350,7 @@ var AccountEntity = /** @class */ (function () {
2295
2350
  return AccountEntity;
2296
2351
  }());
2297
2352
 
2298
- /*! @azure/msal-common v5.2.0 2021-12-07 */
2353
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
2299
2354
 
2300
2355
  /*
2301
2356
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2333,7 +2388,7 @@ var AuthToken = /** @class */ (function () {
2333
2388
  return AuthToken;
2334
2389
  }());
2335
2390
 
2336
- /*! @azure/msal-common v5.2.0 2021-12-07 */
2391
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
2337
2392
 
2338
2393
  /*
2339
2394
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2423,7 +2478,8 @@ var CacheManager = /** @class */ (function () {
2423
2478
  environment: credential.environment,
2424
2479
  homeAccountId: credential.homeAccountId,
2425
2480
  realm: credential.realm,
2426
- tokenType: credential.tokenType
2481
+ tokenType: credential.tokenType,
2482
+ requestedClaimsHash: credential.requestedClaimsHash
2427
2483
  });
2428
2484
  currentScopes = ScopeSet.fromString(credential.target);
2429
2485
  currentAccessTokens = Object.keys(currentTokenCache.accessTokens).map(function (key) { return currentTokenCache.accessTokens[key]; });
@@ -2495,7 +2551,7 @@ var CacheManager = /** @class */ (function () {
2495
2551
  * @param target
2496
2552
  */
2497
2553
  CacheManager.prototype.getCredentialsFilteredBy = function (filter) {
2498
- return this.getCredentialsFilteredByInternal(filter.homeAccountId, filter.environment, filter.credentialType, filter.clientId, filter.familyId, filter.realm, filter.target, filter.oboAssertion, filter.tokenType, filter.keyId);
2554
+ return this.getCredentialsFilteredByInternal(filter.homeAccountId, filter.environment, filter.credentialType, filter.clientId, filter.familyId, filter.realm, filter.target, filter.oboAssertion, filter.tokenType, filter.keyId, filter.requestedClaimsHash);
2499
2555
  };
2500
2556
  /**
2501
2557
  * Support function to help match credentials
@@ -2508,7 +2564,7 @@ var CacheManager = /** @class */ (function () {
2508
2564
  * @param oboAssertion
2509
2565
  * @param tokenType
2510
2566
  */
2511
- CacheManager.prototype.getCredentialsFilteredByInternal = function (homeAccountId, environment, credentialType, clientId, familyId, realm, target, oboAssertion, tokenType, keyId) {
2567
+ CacheManager.prototype.getCredentialsFilteredByInternal = function (homeAccountId, environment, credentialType, clientId, familyId, realm, target, oboAssertion, tokenType, keyId, requestedClaimsHash) {
2512
2568
  var _this = this;
2513
2569
  var allCacheKeys = this.getKeys();
2514
2570
  var matchingCredentials = {
@@ -2555,38 +2611,37 @@ var CacheManager = /** @class */ (function () {
2555
2611
  if (!!target && !_this.matchTarget(entity, target)) {
2556
2612
  return;
2557
2613
  }
2614
+ // If request OR cached entity has requested Claims Hash, check if they match
2615
+ if (requestedClaimsHash || entity.requestedClaimsHash) {
2616
+ // Don't match if either is undefined or they are different
2617
+ if (entity.requestedClaimsHash !== requestedClaimsHash) {
2618
+ return;
2619
+ }
2620
+ }
2558
2621
  // Access Token with Auth Scheme specific matching
2559
2622
  if (credentialType === CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME) {
2560
2623
  if (!!tokenType && !_this.matchTokenType(entity, tokenType)) {
2561
2624
  return;
2562
2625
  }
2563
- switch (tokenType) {
2564
- case exports.AuthenticationScheme.POP:
2565
- // This check avoids matching outdated POP tokens that don't have the <-scheme> in the cache key
2566
- if (cacheKey.indexOf(exports.AuthenticationScheme.POP) === -1) {
2567
- // AccessToken_With_AuthScheme that doesn't have "-pop" in the key is outdated and needs to be removed
2568
- _this.removeItem(cacheKey, CacheSchemaType.CREDENTIAL);
2569
- return;
2570
- }
2571
- break;
2572
- case exports.AuthenticationScheme.SSH:
2573
- // KeyId (sshKid) in request must match cached SSH certificate keyId because SSH cert is bound to a specific key
2574
- if (keyId && !_this.matchKeyId(entity, keyId)) {
2575
- return;
2576
- }
2577
- break;
2626
+ // KeyId (sshKid) in request must match cached SSH certificate keyId because SSH cert is bound to a specific key
2627
+ if (tokenType === exports.AuthenticationScheme.SSH) {
2628
+ if (keyId && !_this.matchKeyId(entity, keyId)) {
2629
+ return;
2630
+ }
2578
2631
  }
2579
2632
  }
2633
+ // At this point, the entity matches the request, update cache key if key schema has changed
2634
+ var updatedCacheKey = _this.updateCredentialCacheKey(cacheKey, entity);
2580
2635
  switch (credType) {
2581
2636
  case CredentialType.ID_TOKEN:
2582
- matchingCredentials.idTokens[cacheKey] = entity;
2637
+ matchingCredentials.idTokens[updatedCacheKey] = entity;
2583
2638
  break;
2584
2639
  case CredentialType.ACCESS_TOKEN:
2585
2640
  case CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME:
2586
- matchingCredentials.accessTokens[cacheKey] = entity;
2641
+ matchingCredentials.accessTokens[updatedCacheKey] = entity;
2587
2642
  break;
2588
2643
  case CredentialType.REFRESH_TOKEN:
2589
- matchingCredentials.refreshTokens[cacheKey] = entity;
2644
+ matchingCredentials.refreshTokens[updatedCacheKey] = entity;
2590
2645
  break;
2591
2646
  }
2592
2647
  });
@@ -2785,10 +2840,10 @@ var CacheManager = /** @class */ (function () {
2785
2840
  * @param environment
2786
2841
  * @param authScheme
2787
2842
  */
2788
- CacheManager.prototype.readCacheRecord = function (account, clientId, scopes, environment, authScheme, keyId) {
2843
+ CacheManager.prototype.readCacheRecord = function (account, clientId, request, environment) {
2789
2844
  var cachedAccount = this.readAccountFromCache(account);
2790
2845
  var cachedIdToken = this.readIdTokenFromCache(clientId, account);
2791
- var cachedAccessToken = this.readAccessTokenFromCache(clientId, account, scopes, authScheme, keyId);
2846
+ var cachedAccessToken = this.readAccessTokenFromCache(clientId, account, request);
2792
2847
  var cachedRefreshToken = this.readRefreshTokenFromCache(clientId, account, false);
2793
2848
  var cachedAppMetadata = this.readAppMetadataFromCache(environment, clientId);
2794
2849
  if (cachedAccount && cachedIdToken) {
@@ -2842,9 +2897,14 @@ var CacheManager = /** @class */ (function () {
2842
2897
  * @param scopes
2843
2898
  * @param authScheme
2844
2899
  */
2845
- CacheManager.prototype.readAccessTokenFromCache = function (clientId, account, scopes, authScheme, keyId) {
2846
- // Distinguish between Bearer and PoP/SSH token cache types
2847
- var credentialType = (authScheme && authScheme !== exports.AuthenticationScheme.BEARER) ? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME : CredentialType.ACCESS_TOKEN;
2900
+ CacheManager.prototype.readAccessTokenFromCache = function (clientId, account, request) {
2901
+ var scopes = new ScopeSet(request.scopes || []);
2902
+ var authScheme = request.authenticationScheme || exports.AuthenticationScheme.BEARER;
2903
+ /*
2904
+ * Distinguish between Bearer and PoP/SSH token cache types
2905
+ * Cast to lowercase to handle "bearer" from ADFS
2906
+ */
2907
+ var credentialType = (authScheme && authScheme.toLowerCase() !== exports.AuthenticationScheme.BEARER.toLowerCase()) ? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME : CredentialType.ACCESS_TOKEN;
2848
2908
  var accessTokenFilter = {
2849
2909
  homeAccountId: account.homeAccountId,
2850
2910
  environment: account.environment,
@@ -2853,7 +2913,8 @@ var CacheManager = /** @class */ (function () {
2853
2913
  realm: account.tenantId,
2854
2914
  target: scopes.printScopesLowerCase(),
2855
2915
  tokenType: authScheme,
2856
- keyId: keyId
2916
+ keyId: request.sshKid,
2917
+ requestedClaimsHash: request.requestedClaimsHash
2857
2918
  };
2858
2919
  var credentialCache = this.getCredentialsFilteredBy(accessTokenFilter);
2859
2920
  var accessTokens = Object.keys(credentialCache.accessTokens).map(function (key) { return credentialCache.accessTokens[key]; });
@@ -3162,10 +3223,14 @@ var DefaultStorageClass = /** @class */ (function (_super) {
3162
3223
  });
3163
3224
  });
3164
3225
  };
3226
+ DefaultStorageClass.prototype.updateCredentialCacheKey = function () {
3227
+ var notImplErr = "Storage interface - updateCredentialCacheKey() has not been implemented for the cacheStorage interface.";
3228
+ throw AuthError.createUnexpectedError(notImplErr);
3229
+ };
3165
3230
  return DefaultStorageClass;
3166
3231
  }(CacheManager));
3167
3232
 
3168
- /*! @azure/msal-common v5.2.0 2021-12-07 */
3233
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
3169
3234
 
3170
3235
  /*
3171
3236
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3175,7 +3240,8 @@ var DefaultStorageClass = /** @class */ (function (_super) {
3175
3240
  var DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
3176
3241
  var DEFAULT_SYSTEM_OPTIONS = {
3177
3242
  tokenRenewalOffsetSeconds: DEFAULT_TOKEN_RENEWAL_OFFSET_SEC,
3178
- preventCorsPreflight: false
3243
+ preventCorsPreflight: false,
3244
+ proxyUrl: "",
3179
3245
  };
3180
3246
  var DEFAULT_LOGGER_IMPLEMENTATION = {
3181
3247
  loggerCallback: function () {
@@ -3215,6 +3281,10 @@ var DEFAULT_CLIENT_CREDENTIALS = {
3215
3281
  clientSecret: "",
3216
3282
  clientAssertion: undefined
3217
3283
  };
3284
+ var DEFAULT_AZURE_CLOUD_OPTIONS = {
3285
+ azureCloudInstance: exports.AzureCloudInstance.None,
3286
+ tenant: "" + Constants.DEFAULT_COMMON_TENANT
3287
+ };
3218
3288
  /**
3219
3289
  * Function that sets the default options when not explicitly configured from app developer
3220
3290
  *
@@ -3244,10 +3314,10 @@ function buildClientConfiguration(_a) {
3244
3314
  * @param authOptions
3245
3315
  */
3246
3316
  function buildAuthOptions(authOptions) {
3247
- return __assign({ clientCapabilities: [] }, authOptions);
3317
+ return __assign({ clientCapabilities: [], azureCloudOptions: DEFAULT_AZURE_CLOUD_OPTIONS }, authOptions);
3248
3318
  }
3249
3319
 
3250
- /*! @azure/msal-common v5.2.0 2021-12-07 */
3320
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
3251
3321
 
3252
3322
  /*
3253
3323
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3267,7 +3337,7 @@ var ServerError = /** @class */ (function (_super) {
3267
3337
  return ServerError;
3268
3338
  }(AuthError));
3269
3339
 
3270
- /*! @azure/msal-common v5.2.0 2021-12-07 */
3340
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
3271
3341
 
3272
3342
  /*
3273
3343
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3350,11 +3420,11 @@ var ThrottlingUtils = /** @class */ (function () {
3350
3420
  authority: request.authority,
3351
3421
  scopes: request.scopes,
3352
3422
  homeAccountIdentifier: homeAccountIdentifier,
3423
+ claims: request.claims,
3353
3424
  authenticationScheme: request.authenticationScheme,
3354
3425
  resourceRequestMethod: request.resourceRequestMethod,
3355
3426
  resourceRequestUri: request.resourceRequestUri,
3356
3427
  shrClaims: request.shrClaims,
3357
- sshJwk: request.sshJwk,
3358
3428
  sshKid: request.sshKid
3359
3429
  };
3360
3430
  var key = this.generateThrottlingStorageKey(thumbprint);
@@ -3363,7 +3433,7 @@ var ThrottlingUtils = /** @class */ (function () {
3363
3433
  return ThrottlingUtils;
3364
3434
  }());
3365
3435
 
3366
- /*! @azure/msal-common v5.2.0 2021-12-07 */
3436
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
3367
3437
 
3368
3438
  /*
3369
3439
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3412,7 +3482,7 @@ var NetworkManager = /** @class */ (function () {
3412
3482
  return NetworkManager;
3413
3483
  }());
3414
3484
 
3415
- /*! @azure/msal-common v5.2.0 2021-12-07 */
3485
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
3416
3486
  /*
3417
3487
  * Copyright (c) Microsoft Corporation. All rights reserved.
3418
3488
  * Licensed under the MIT License.
@@ -3423,7 +3493,7 @@ var CcsCredentialType;
3423
3493
  CcsCredentialType["UPN"] = "UPN";
3424
3494
  })(CcsCredentialType || (CcsCredentialType = {}));
3425
3495
 
3426
- /*! @azure/msal-common v5.2.0 2021-12-07 */
3496
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
3427
3497
 
3428
3498
  /*
3429
3499
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3487,7 +3557,7 @@ var BaseClient = /** @class */ (function () {
3487
3557
  var response;
3488
3558
  return __generator(this, function (_a) {
3489
3559
  switch (_a.label) {
3490
- case 0: return [4 /*yield*/, this.networkManager.sendPostRequest(thumbprint, tokenEndpoint, { body: queryString, headers: headers })];
3560
+ case 0: return [4 /*yield*/, this.networkManager.sendPostRequest(thumbprint, tokenEndpoint, { body: queryString, headers: headers, proxyUrl: this.config.systemOptions.proxyUrl })];
3491
3561
  case 1:
3492
3562
  response = _a.sent();
3493
3563
  if (this.config.serverTelemetryManager && response.status < 500 && response.status !== 429) {
@@ -3512,7 +3582,7 @@ var BaseClient = /** @class */ (function () {
3512
3582
  return BaseClient;
3513
3583
  }());
3514
3584
 
3515
- /*! @azure/msal-common v5.2.0 2021-12-07 */
3585
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
3516
3586
 
3517
3587
  /*
3518
3588
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3598,7 +3668,7 @@ var RequestValidator = /** @class */ (function () {
3598
3668
  return RequestValidator;
3599
3669
  }());
3600
3670
 
3601
- /*! @azure/msal-common v5.2.0 2021-12-07 */
3671
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
3602
3672
 
3603
3673
  /*
3604
3674
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3925,6 +3995,12 @@ var RequestParameterBuilder = /** @class */ (function () {
3925
3995
  RequestParameterBuilder.prototype.addThrottling = function () {
3926
3996
  this.parameters.set(AADServerParamKeys.X_MS_LIB_CAPABILITY, ThrottlingConstants.X_MS_LIB_CAPABILITY_VALUE);
3927
3997
  };
3998
+ /**
3999
+ * Adds logout_hint parameter for "silent" logout which prevent server account picker
4000
+ */
4001
+ RequestParameterBuilder.prototype.addLogoutHint = function (logoutHint) {
4002
+ this.parameters.set(AADServerParamKeys.LOGOUT_HINT, encodeURIComponent(logoutHint));
4003
+ };
3928
4004
  /**
3929
4005
  * Utility to create a URL from the params map
3930
4006
  */
@@ -3938,7 +4014,7 @@ var RequestParameterBuilder = /** @class */ (function () {
3938
4014
  return RequestParameterBuilder;
3939
4015
  }());
3940
4016
 
3941
- /*! @azure/msal-common v5.2.0 2021-12-07 */
4017
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
3942
4018
 
3943
4019
  /*
3944
4020
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4003,7 +4079,7 @@ var IdTokenEntity = /** @class */ (function (_super) {
4003
4079
  return IdTokenEntity;
4004
4080
  }(CredentialEntity));
4005
4081
 
4006
- /*! @azure/msal-common v5.2.0 2021-12-07 */
4082
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
4007
4083
  /*
4008
4084
  * Copyright (c) Microsoft Corporation. All rights reserved.
4009
4085
  * Licensed under the MIT License.
@@ -4053,7 +4129,7 @@ var TimeUtils = /** @class */ (function () {
4053
4129
  return TimeUtils;
4054
4130
  }());
4055
4131
 
4056
- /*! @azure/msal-common v5.2.0 2021-12-07 */
4132
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
4057
4133
 
4058
4134
  /*
4059
4135
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4099,8 +4175,8 @@ var AccessTokenEntity = /** @class */ (function (_super) {
4099
4175
  * @param expiresOn
4100
4176
  * @param extExpiresOn
4101
4177
  */
4102
- AccessTokenEntity.createAccessTokenEntity = function (homeAccountId, environment, accessToken, clientId, tenantId, scopes, expiresOn, extExpiresOn, cryptoUtils, refreshOn, tokenType, oboAssertion, keyId) {
4103
- var _a;
4178
+ AccessTokenEntity.createAccessTokenEntity = function (homeAccountId, environment, accessToken, clientId, tenantId, scopes, expiresOn, extExpiresOn, cryptoUtils, refreshOn, tokenType, oboAssertion, keyId, requestedClaims, requestedClaimsHash) {
4179
+ var _a, _b;
4104
4180
  var atEntity = new AccessTokenEntity();
4105
4181
  atEntity.homeAccountId = homeAccountId;
4106
4182
  atEntity.credentialType = CredentialType.ACCESS_TOKEN;
@@ -4122,14 +4198,21 @@ var AccessTokenEntity = /** @class */ (function (_super) {
4122
4198
  atEntity.target = scopes;
4123
4199
  atEntity.oboAssertion = oboAssertion;
4124
4200
  atEntity.tokenType = StringUtils.isEmpty(tokenType) ? exports.AuthenticationScheme.BEARER : tokenType;
4125
- // Create Access Token With Auth Scheme instead of regular access token
4126
- if (atEntity.tokenType !== exports.AuthenticationScheme.BEARER) {
4201
+ if (requestedClaims) {
4202
+ atEntity.requestedClaims = requestedClaims;
4203
+ atEntity.requestedClaimsHash = requestedClaimsHash;
4204
+ }
4205
+ /*
4206
+ * Create Access Token With Auth Scheme instead of regular access token
4207
+ * Cast to lower to handle "bearer" from ADFS
4208
+ */
4209
+ if (((_a = atEntity.tokenType) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== exports.AuthenticationScheme.BEARER.toLowerCase()) {
4127
4210
  atEntity.credentialType = CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;
4128
4211
  switch (atEntity.tokenType) {
4129
4212
  case exports.AuthenticationScheme.POP:
4130
4213
  // Make sure keyId is present and add it to credential
4131
4214
  var tokenClaims = AuthToken.extractTokenClaims(accessToken, cryptoUtils);
4132
- if (!((_a = tokenClaims === null || tokenClaims === void 0 ? void 0 : tokenClaims.cnf) === null || _a === void 0 ? void 0 : _a.kid)) {
4215
+ if (!((_b = tokenClaims === null || tokenClaims === void 0 ? void 0 : tokenClaims.cnf) === null || _b === void 0 ? void 0 : _b.kid)) {
4133
4216
  throw ClientAuthError.createTokenClaimsRequiredError();
4134
4217
  }
4135
4218
  atEntity.keyId = tokenClaims.cnf.kid;
@@ -4160,7 +4243,7 @@ var AccessTokenEntity = /** @class */ (function (_super) {
4160
4243
  return AccessTokenEntity;
4161
4244
  }(CredentialEntity));
4162
4245
 
4163
- /*! @azure/msal-common v5.2.0 2021-12-07 */
4246
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
4164
4247
 
4165
4248
  /*
4166
4249
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4227,7 +4310,7 @@ var RefreshTokenEntity = /** @class */ (function (_super) {
4227
4310
  return RefreshTokenEntity;
4228
4311
  }(CredentialEntity));
4229
4312
 
4230
- /*! @azure/msal-common v5.2.0 2021-12-07 */
4313
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
4231
4314
 
4232
4315
  /*
4233
4316
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4291,7 +4374,7 @@ var InteractionRequiredAuthError = /** @class */ (function (_super) {
4291
4374
  return InteractionRequiredAuthError;
4292
4375
  }(AuthError));
4293
4376
 
4294
- /*! @azure/msal-common v5.2.0 2021-12-07 */
4377
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
4295
4378
  /*
4296
4379
  * Copyright (c) Microsoft Corporation. All rights reserved.
4297
4380
  * Licensed under the MIT License.
@@ -4307,7 +4390,7 @@ var CacheRecord = /** @class */ (function () {
4307
4390
  return CacheRecord;
4308
4391
  }());
4309
4392
 
4310
- /*! @azure/msal-common v5.2.0 2021-12-07 */
4393
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
4311
4394
 
4312
4395
  /*
4313
4396
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4378,7 +4461,7 @@ var ProtocolUtils = /** @class */ (function () {
4378
4461
  return ProtocolUtils;
4379
4462
  }());
4380
4463
 
4381
- /*! @azure/msal-common v5.2.0 2021-12-07 */
4464
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
4382
4465
 
4383
4466
  /*
4384
4467
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4579,7 +4662,7 @@ var UrlString = /** @class */ (function () {
4579
4662
  return UrlString;
4580
4663
  }());
4581
4664
 
4582
- /*! @azure/msal-common v5.2.0 2021-12-07 */
4665
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
4583
4666
 
4584
4667
  /*
4585
4668
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4654,7 +4737,7 @@ var PopTokenGenerator = /** @class */ (function () {
4654
4737
  return PopTokenGenerator;
4655
4738
  }());
4656
4739
 
4657
- /*! @azure/msal-common v5.2.0 2021-12-07 */
4740
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
4658
4741
 
4659
4742
  /*
4660
4743
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4724,7 +4807,7 @@ var AppMetadataEntity = /** @class */ (function () {
4724
4807
  return AppMetadataEntity;
4725
4808
  }());
4726
4809
 
4727
- /*! @azure/msal-common v5.2.0 2021-12-07 */
4810
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
4728
4811
  /*
4729
4812
  * Copyright (c) Microsoft Corporation. All rights reserved.
4730
4813
  * Licensed under the MIT License.
@@ -4760,7 +4843,7 @@ var AppMetadataEntity = /** @class */ (function () {
4760
4843
  return TokenCacheContext;
4761
4844
  }());
4762
4845
 
4763
- /*! @azure/msal-common v5.2.0 2021-12-07 */
4846
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
4764
4847
 
4765
4848
  /*
4766
4849
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4843,7 +4926,7 @@ var ResponseHandler = /** @class */ (function () {
4843
4926
  }
4844
4927
  // Add keyId from request to serverTokenResponse if defined
4845
4928
  serverTokenResponse.key_id = serverTokenResponse.key_id || request.sshKid || undefined;
4846
- cacheRecord = this.generateCacheRecord(serverTokenResponse, authority, reqTimestamp, idTokenObj, request.scopes, oboAssertion, authCodePayload);
4929
+ cacheRecord = this.generateCacheRecord(serverTokenResponse, authority, reqTimestamp, request, idTokenObj, oboAssertion, authCodePayload);
4847
4930
  _a.label = 1;
4848
4931
  case 1:
4849
4932
  _a.trys.push([1, , 5, 8]);
@@ -4891,7 +4974,7 @@ var ResponseHandler = /** @class */ (function () {
4891
4974
  * @param idTokenObj
4892
4975
  * @param authority
4893
4976
  */
4894
- ResponseHandler.prototype.generateCacheRecord = function (serverTokenResponse, authority, reqTimestamp, idTokenObj, requestScopes, oboAssertion, authCodePayload) {
4977
+ ResponseHandler.prototype.generateCacheRecord = function (serverTokenResponse, authority, reqTimestamp, request, idTokenObj, oboAssertion, authCodePayload) {
4895
4978
  var env = authority.getPreferredCache();
4896
4979
  if (StringUtils.isEmpty(env)) {
4897
4980
  throw ClientAuthError.createInvalidCacheEnvironmentError();
@@ -4907,7 +4990,7 @@ var ResponseHandler = /** @class */ (function () {
4907
4990
  var cachedAccessToken = null;
4908
4991
  if (!StringUtils.isEmpty(serverTokenResponse.access_token)) {
4909
4992
  // If scopes not returned in server response, use request scopes
4910
- var responseScopes = serverTokenResponse.scope ? ScopeSet.fromString(serverTokenResponse.scope) : new ScopeSet(requestScopes || []);
4993
+ var responseScopes = serverTokenResponse.scope ? ScopeSet.fromString(serverTokenResponse.scope) : new ScopeSet(request.scopes || []);
4911
4994
  /*
4912
4995
  * Use timestamp calculated before request
4913
4996
  * Server may return timestamps as strings, parse to numbers if so.
@@ -4919,7 +5002,7 @@ var ResponseHandler = /** @class */ (function () {
4919
5002
  var extendedTokenExpirationSeconds = tokenExpirationSeconds + extExpiresIn;
4920
5003
  var refreshOnSeconds = refreshIn && refreshIn > 0 ? reqTimestamp + refreshIn : undefined;
4921
5004
  // non AAD scenarios can have empty realm
4922
- cachedAccessToken = AccessTokenEntity.createAccessTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.access_token || Constants.EMPTY_STRING, this.clientId, idTokenObj ? idTokenObj.claims.tid || Constants.EMPTY_STRING : authority.tenant, responseScopes.printScopes(), tokenExpirationSeconds, extendedTokenExpirationSeconds, this.cryptoObj, refreshOnSeconds, serverTokenResponse.token_type, oboAssertion, serverTokenResponse.key_id);
5005
+ cachedAccessToken = AccessTokenEntity.createAccessTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.access_token || Constants.EMPTY_STRING, this.clientId, idTokenObj ? idTokenObj.claims.tid || Constants.EMPTY_STRING : authority.tenant, responseScopes.printScopes(), tokenExpirationSeconds, extendedTokenExpirationSeconds, this.cryptoObj, refreshOnSeconds, serverTokenResponse.token_type, oboAssertion, serverTokenResponse.key_id, request.claims, request.requestedClaimsHash);
4923
5006
  }
4924
5007
  // refreshToken
4925
5008
  var cachedRefreshToken = null;
@@ -5025,7 +5108,7 @@ var ResponseHandler = /** @class */ (function () {
5025
5108
  return ResponseHandler;
5026
5109
  }());
5027
5110
 
5028
- /*! @azure/msal-common v5.2.0 2021-12-07 */
5111
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
5029
5112
 
5030
5113
  /*
5031
5114
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5140,11 +5223,11 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5140
5223
  clientId: this.config.authOptions.clientId,
5141
5224
  authority: authority.canonicalAuthority,
5142
5225
  scopes: request.scopes,
5226
+ claims: request.claims,
5143
5227
  authenticationScheme: request.authenticationScheme,
5144
5228
  resourceRequestMethod: request.resourceRequestMethod,
5145
5229
  resourceRequestUri: request.resourceRequestUri,
5146
5230
  shrClaims: request.shrClaims,
5147
- sshJwk: request.sshJwk,
5148
5231
  sshKid: request.sshKid
5149
5232
  };
5150
5233
  return [4 /*yield*/, this.createTokenRequestBody(request)];
@@ -5414,6 +5497,9 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5414
5497
  if (request.state) {
5415
5498
  parameterBuilder.addState(request.state);
5416
5499
  }
5500
+ if (request.logoutHint) {
5501
+ parameterBuilder.addLogoutHint(request.logoutHint);
5502
+ }
5417
5503
  if (request.extraQueryParameters) {
5418
5504
  parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);
5419
5505
  }
@@ -5433,7 +5519,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5433
5519
  return AuthorizationCodeClient;
5434
5520
  }(BaseClient));
5435
5521
 
5436
- /*! @azure/msal-common v5.2.0 2021-12-07 */
5522
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
5437
5523
 
5438
5524
  /*
5439
5525
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5544,11 +5630,11 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5544
5630
  clientId: this.config.authOptions.clientId,
5545
5631
  authority: authority.canonicalAuthority,
5546
5632
  scopes: request.scopes,
5633
+ claims: request.claims,
5547
5634
  authenticationScheme: request.authenticationScheme,
5548
5635
  resourceRequestMethod: request.resourceRequestMethod,
5549
5636
  resourceRequestUri: request.resourceRequestUri,
5550
5637
  shrClaims: request.shrClaims,
5551
- sshJwk: request.sshJwk,
5552
5638
  sshKid: request.sshKid
5553
5639
  };
5554
5640
  endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParameters);
@@ -5644,7 +5730,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5644
5730
  return RefreshTokenClient;
5645
5731
  }(BaseClient));
5646
5732
 
5647
- /*! @azure/msal-common v5.2.0 2021-12-07 */
5733
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
5648
5734
 
5649
5735
  /*
5650
5736
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5690,7 +5776,7 @@ var SilentFlowClient = /** @class */ (function (_super) {
5690
5776
  SilentFlowClient.prototype.acquireCachedToken = function (request) {
5691
5777
  var _a, _b, _c, _d;
5692
5778
  return __awaiter(this, void 0, void 0, function () {
5693
- var requestScopes, environment, authScheme, cacheRecord;
5779
+ var environment, cacheRecord;
5694
5780
  return __generator(this, function (_e) {
5695
5781
  switch (_e.label) {
5696
5782
  case 0:
@@ -5704,19 +5790,12 @@ var SilentFlowClient = /** @class */ (function (_super) {
5704
5790
  this.logger.info("SilentFlowClient:acquireCachedToken - Skipping cache because forceRefresh is true.");
5705
5791
  throw ClientAuthError.createRefreshRequiredError();
5706
5792
  }
5707
- else if (!StringUtils.isEmptyObj(request.claims)) {
5708
- // Must refresh due to request parameters.
5709
- this.logger.info("SilentFlowClient:acquireCachedToken - Skipping cache because claims are requested.");
5710
- throw ClientAuthError.createRefreshRequiredError();
5711
- }
5712
5793
  // We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases
5713
5794
  if (!request.account) {
5714
5795
  throw ClientAuthError.createNoAccountInSilentRequestError();
5715
5796
  }
5716
- requestScopes = new ScopeSet(request.scopes || []);
5717
5797
  environment = request.authority || this.authority.getPreferredCache();
5718
- authScheme = request.authenticationScheme || exports.AuthenticationScheme.BEARER;
5719
- cacheRecord = this.cacheManager.readCacheRecord(request.account, this.config.authOptions.clientId, requestScopes, environment, authScheme, request.sshKid);
5798
+ cacheRecord = this.cacheManager.readCacheRecord(request.account, this.config.authOptions.clientId, request, environment);
5720
5799
  if (!cacheRecord.accessToken) {
5721
5800
  // Must refresh due to non-existent access_token.
5722
5801
  (_b = this.serverTelemetryManager) === null || _b === void 0 ? void 0 : _b.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN);
@@ -5767,7 +5846,7 @@ var SilentFlowClient = /** @class */ (function (_super) {
5767
5846
  return SilentFlowClient;
5768
5847
  }(BaseClient));
5769
5848
 
5770
- /*! @azure/msal-common v5.2.0 2021-12-07 */
5849
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
5771
5850
  /*
5772
5851
  * Copyright (c) Microsoft Corporation. All rights reserved.
5773
5852
  * Licensed under the MIT License.
@@ -5778,7 +5857,7 @@ function isOpenIdConfigResponse(response) {
5778
5857
  response.hasOwnProperty("issuer"));
5779
5858
  }
5780
5859
 
5781
- /*! @azure/msal-common v5.2.0 2021-12-07 */
5860
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
5782
5861
  /*
5783
5862
  * Copyright (c) Microsoft Corporation. All rights reserved.
5784
5863
  * Licensed under the MIT License.
@@ -5792,7 +5871,7 @@ exports.ProtocolMode = void 0;
5792
5871
  ProtocolMode["OIDC"] = "OIDC";
5793
5872
  })(exports.ProtocolMode || (exports.ProtocolMode = {}));
5794
5873
 
5795
- /*! @azure/msal-common v5.2.0 2021-12-07 */
5874
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
5796
5875
 
5797
5876
  /*
5798
5877
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5867,7 +5946,7 @@ var AuthorityMetadataEntity = /** @class */ (function () {
5867
5946
  return AuthorityMetadataEntity;
5868
5947
  }());
5869
5948
 
5870
- /*! @azure/msal-common v5.2.0 2021-12-07 */
5949
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
5871
5950
  /*
5872
5951
  * Copyright (c) Microsoft Corporation. All rights reserved.
5873
5952
  * Licensed under the MIT License.
@@ -5877,7 +5956,7 @@ function isCloudInstanceDiscoveryResponse(response) {
5877
5956
  response.hasOwnProperty("metadata"));
5878
5957
  }
5879
5958
 
5880
- /*! @azure/msal-common v5.2.0 2021-12-07 */
5959
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
5881
5960
 
5882
5961
  /*
5883
5962
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5892,18 +5971,22 @@ var RegionDiscovery = /** @class */ (function () {
5892
5971
  *
5893
5972
  * @returns Promise<string | null>
5894
5973
  */
5895
- RegionDiscovery.prototype.detectRegion = function (environmentRegion, regionDiscoveryMetadata) {
5974
+ RegionDiscovery.prototype.detectRegion = function (environmentRegion, regionDiscoveryMetadata, proxyUrl) {
5896
5975
  return __awaiter(this, void 0, void 0, function () {
5897
- var autodetectedRegionName, localIMDSVersionResponse, currentIMDSVersion, currentIMDSVersionResponse;
5976
+ var autodetectedRegionName, options, localIMDSVersionResponse, currentIMDSVersion, currentIMDSVersionResponse;
5898
5977
  return __generator(this, function (_a) {
5899
5978
  switch (_a.label) {
5900
5979
  case 0:
5901
5980
  autodetectedRegionName = environmentRegion;
5902
5981
  if (!!autodetectedRegionName) return [3 /*break*/, 8];
5982
+ options = RegionDiscovery.IMDS_OPTIONS;
5983
+ if (proxyUrl) {
5984
+ options.proxyUrl = proxyUrl;
5985
+ }
5903
5986
  _a.label = 1;
5904
5987
  case 1:
5905
5988
  _a.trys.push([1, 6, , 7]);
5906
- return [4 /*yield*/, this.getRegionFromIMDS(Constants.IMDS_VERSION)];
5989
+ return [4 /*yield*/, this.getRegionFromIMDS(Constants.IMDS_VERSION, options)];
5907
5990
  case 2:
5908
5991
  localIMDSVersionResponse = _a.sent();
5909
5992
  if (localIMDSVersionResponse.status === ResponseCodes.httpSuccess) {
@@ -5911,14 +5994,14 @@ var RegionDiscovery = /** @class */ (function () {
5911
5994
  regionDiscoveryMetadata.region_source = RegionDiscoverySources.IMDS;
5912
5995
  }
5913
5996
  if (!(localIMDSVersionResponse.status === ResponseCodes.httpBadRequest)) return [3 /*break*/, 5];
5914
- return [4 /*yield*/, this.getCurrentVersion()];
5997
+ return [4 /*yield*/, this.getCurrentVersion(options)];
5915
5998
  case 3:
5916
5999
  currentIMDSVersion = _a.sent();
5917
6000
  if (!currentIMDSVersion) {
5918
6001
  regionDiscoveryMetadata.region_source = RegionDiscoverySources.FAILED_AUTO_DETECTION;
5919
6002
  return [2 /*return*/, null];
5920
6003
  }
5921
- return [4 /*yield*/, this.getRegionFromIMDS(currentIMDSVersion)];
6004
+ return [4 /*yield*/, this.getRegionFromIMDS(currentIMDSVersion, options)];
5922
6005
  case 4:
5923
6006
  currentIMDSVersionResponse = _a.sent();
5924
6007
  if (currentIMDSVersionResponse.status === ResponseCodes.httpSuccess) {
@@ -5951,10 +6034,10 @@ var RegionDiscovery = /** @class */ (function () {
5951
6034
  * @param imdsEndpointUrl
5952
6035
  * @returns Promise<NetworkResponse<string>>
5953
6036
  */
5954
- RegionDiscovery.prototype.getRegionFromIMDS = function (version) {
6037
+ RegionDiscovery.prototype.getRegionFromIMDS = function (version, options) {
5955
6038
  return __awaiter(this, void 0, void 0, function () {
5956
6039
  return __generator(this, function (_a) {
5957
- return [2 /*return*/, this.networkInterface.sendGetRequestAsync(Constants.IMDS_ENDPOINT + "?api-version=" + version + "&format=text", RegionDiscovery.IMDS_OPTIONS, Constants.IMDS_TIMEOUT)];
6040
+ return [2 /*return*/, this.networkInterface.sendGetRequestAsync(Constants.IMDS_ENDPOINT + "?api-version=" + version + "&format=text", options, Constants.IMDS_TIMEOUT)];
5958
6041
  });
5959
6042
  });
5960
6043
  };
@@ -5963,14 +6046,14 @@ var RegionDiscovery = /** @class */ (function () {
5963
6046
  *
5964
6047
  * @returns Promise<string | null>
5965
6048
  */
5966
- RegionDiscovery.prototype.getCurrentVersion = function () {
6049
+ RegionDiscovery.prototype.getCurrentVersion = function (options) {
5967
6050
  return __awaiter(this, void 0, void 0, function () {
5968
6051
  var response;
5969
6052
  return __generator(this, function (_a) {
5970
6053
  switch (_a.label) {
5971
6054
  case 0:
5972
6055
  _a.trys.push([0, 2, , 3]);
5973
- return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(Constants.IMDS_ENDPOINT + "?format=json", RegionDiscovery.IMDS_OPTIONS)];
6056
+ return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(Constants.IMDS_ENDPOINT + "?format=json", options)];
5974
6057
  case 1:
5975
6058
  response = _a.sent();
5976
6059
  // When IMDS endpoint is called without the api version query param, bad request response comes back with latest version.
@@ -5987,11 +6070,15 @@ var RegionDiscovery = /** @class */ (function () {
5987
6070
  });
5988
6071
  };
5989
6072
  // Options for the IMDS endpoint request
5990
- RegionDiscovery.IMDS_OPTIONS = { headers: { "Metadata": "true" } };
6073
+ RegionDiscovery.IMDS_OPTIONS = {
6074
+ headers: {
6075
+ Metadata: "true",
6076
+ },
6077
+ };
5991
6078
  return RegionDiscovery;
5992
6079
  }());
5993
6080
 
5994
- /*! @azure/msal-common v5.2.0 2021-12-07 */
6081
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
5995
6082
 
5996
6083
  /*
5997
6084
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6002,7 +6089,7 @@ var RegionDiscovery = /** @class */ (function () {
6002
6089
  * endpoint. It will store the pertinent config data in this object for use during token calls.
6003
6090
  */
6004
6091
  var Authority = /** @class */ (function () {
6005
- function Authority(authority, networkInterface, cacheManager, authorityOptions) {
6092
+ function Authority(authority, networkInterface, cacheManager, authorityOptions, proxyUrl) {
6006
6093
  this.canonicalAuthority = authority;
6007
6094
  this._canonicalAuthority.validateAsUri();
6008
6095
  this.networkInterface = networkInterface;
@@ -6010,6 +6097,7 @@ var Authority = /** @class */ (function () {
6010
6097
  this.authorityOptions = authorityOptions;
6011
6098
  this.regionDiscovery = new RegionDiscovery(networkInterface);
6012
6099
  this.regionDiscoveryMetadata = { region_used: undefined, region_source: undefined, region_outcome: undefined };
6100
+ this.proxyUrl = proxyUrl || Constants.EMPTY_STRING;
6013
6101
  }
6014
6102
  Object.defineProperty(Authority.prototype, "authorityType", {
6015
6103
  // See above for AuthorityType
@@ -6278,7 +6366,7 @@ var Authority = /** @class */ (function () {
6278
6366
  metadata = _b.sent();
6279
6367
  if (!metadata) return [3 /*break*/, 4];
6280
6368
  if (!((_a = this.authorityOptions.azureRegionConfiguration) === null || _a === void 0 ? void 0 : _a.azureRegion)) return [3 /*break*/, 3];
6281
- return [4 /*yield*/, this.regionDiscovery.detectRegion(this.authorityOptions.azureRegionConfiguration.environmentRegion, this.regionDiscoveryMetadata)];
6369
+ return [4 /*yield*/, this.regionDiscovery.detectRegion(this.authorityOptions.azureRegionConfiguration.environmentRegion, this.regionDiscoveryMetadata, this.proxyUrl)];
6282
6370
  case 2:
6283
6371
  autodetectedRegionName = _b.sent();
6284
6372
  azureRegion = this.authorityOptions.azureRegionConfiguration.azureRegion === Constants.AZURE_REGION_AUTO_DISCOVER_FLAG
@@ -6341,19 +6429,25 @@ var Authority = /** @class */ (function () {
6341
6429
  */
6342
6430
  Authority.prototype.getEndpointMetadataFromNetwork = function () {
6343
6431
  return __awaiter(this, void 0, void 0, function () {
6344
- var response;
6432
+ var options, response;
6345
6433
  return __generator(this, function (_a) {
6346
6434
  switch (_a.label) {
6347
6435
  case 0:
6348
- _a.trys.push([0, 2, , 3]);
6349
- return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(this.defaultOpenIdConfigurationEndpoint)];
6436
+ options = {};
6437
+ if (this.proxyUrl) {
6438
+ options.proxyUrl = this.proxyUrl;
6439
+ }
6440
+ _a.label = 1;
6350
6441
  case 1:
6442
+ _a.trys.push([1, 3, , 4]);
6443
+ return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(this.defaultOpenIdConfigurationEndpoint, options)];
6444
+ case 2:
6351
6445
  response = _a.sent();
6352
6446
  return [2 /*return*/, isOpenIdConfigResponse(response.body) ? response.body : null];
6353
- case 2:
6447
+ case 3:
6354
6448
  _a.sent();
6355
6449
  return [2 /*return*/, null];
6356
- case 3: return [2 /*return*/];
6450
+ case 4: return [2 /*return*/];
6357
6451
  }
6358
6452
  });
6359
6453
  });
@@ -6423,16 +6517,20 @@ var Authority = /** @class */ (function () {
6423
6517
  */
6424
6518
  Authority.prototype.getCloudDiscoveryMetadataFromNetwork = function () {
6425
6519
  return __awaiter(this, void 0, void 0, function () {
6426
- var instanceDiscoveryEndpoint, match, response, metadata;
6520
+ var instanceDiscoveryEndpoint, options, match, response, metadata;
6427
6521
  return __generator(this, function (_a) {
6428
6522
  switch (_a.label) {
6429
6523
  case 0:
6430
6524
  instanceDiscoveryEndpoint = "" + Constants.AAD_INSTANCE_DISCOVERY_ENDPT + this.canonicalAuthority + "oauth2/v2.0/authorize";
6525
+ options = {};
6526
+ if (this.proxyUrl) {
6527
+ options.proxyUrl = this.proxyUrl;
6528
+ }
6431
6529
  match = null;
6432
6530
  _a.label = 1;
6433
6531
  case 1:
6434
6532
  _a.trys.push([1, 3, , 4]);
6435
- return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(instanceDiscoveryEndpoint)];
6533
+ return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(instanceDiscoveryEndpoint, options)];
6436
6534
  case 2:
6437
6535
  response = _a.sent();
6438
6536
  metadata = isCloudInstanceDiscoveryResponse(response.body) ? response.body.metadata : [];
@@ -6447,7 +6545,7 @@ var Authority = /** @class */ (function () {
6447
6545
  return [2 /*return*/, null];
6448
6546
  case 4:
6449
6547
  if (!match) {
6450
- // Custom Domain scenario, host is trusted because Instance Discovery call succeeded
6548
+ // Custom Domain scenario, host is trusted because Instance Discovery call succeeded
6451
6549
  match = Authority.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);
6452
6550
  }
6453
6551
  return [2 /*return*/, match];
@@ -6465,6 +6563,19 @@ var Authority = /** @class */ (function () {
6465
6563
  });
6466
6564
  return matches.length > 0;
6467
6565
  };
6566
+ /**
6567
+ * helper function to populate the authority based on azureCloudOptions
6568
+ * @param authorityString
6569
+ * @param azureCloudOptions
6570
+ */
6571
+ Authority.generateAuthority = function (authorityString, azureCloudOptions) {
6572
+ var authorityAzureCloudInstance;
6573
+ if (azureCloudOptions && azureCloudOptions.azureCloudInstance !== exports.AzureCloudInstance.None) {
6574
+ var tenant = azureCloudOptions.tenant ? azureCloudOptions.tenant : Constants.DEFAULT_COMMON_TENANT;
6575
+ authorityAzureCloudInstance = azureCloudOptions.azureCloudInstance + "/" + tenant + "/";
6576
+ }
6577
+ return authorityAzureCloudInstance ? authorityAzureCloudInstance : authorityString;
6578
+ };
6468
6579
  /**
6469
6580
  * Creates cloud discovery metadata object from a given host
6470
6581
  * @param host
@@ -6557,7 +6668,7 @@ var Authority = /** @class */ (function () {
6557
6668
  return Authority;
6558
6669
  }());
6559
6670
 
6560
- /*! @azure/msal-common v5.2.0 2021-12-07 */
6671
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
6561
6672
 
6562
6673
  /*
6563
6674
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6576,13 +6687,13 @@ var AuthorityFactory = /** @class */ (function () {
6576
6687
  * @param networkClient
6577
6688
  * @param protocolMode
6578
6689
  */
6579
- AuthorityFactory.createDiscoveredInstance = function (authorityUri, networkClient, cacheManager, authorityOptions) {
6690
+ AuthorityFactory.createDiscoveredInstance = function (authorityUri, networkClient, cacheManager, authorityOptions, proxyUrl) {
6580
6691
  return __awaiter(this, void 0, void 0, function () {
6581
6692
  var acquireTokenAuthority, e_1;
6582
6693
  return __generator(this, function (_a) {
6583
6694
  switch (_a.label) {
6584
6695
  case 0:
6585
- acquireTokenAuthority = AuthorityFactory.createInstance(authorityUri, networkClient, cacheManager, authorityOptions);
6696
+ acquireTokenAuthority = AuthorityFactory.createInstance(authorityUri, networkClient, cacheManager, authorityOptions, proxyUrl);
6586
6697
  _a.label = 1;
6587
6698
  case 1:
6588
6699
  _a.trys.push([1, 3, , 4]);
@@ -6608,17 +6719,17 @@ var AuthorityFactory = /** @class */ (function () {
6608
6719
  * @param networkInterface
6609
6720
  * @param protocolMode
6610
6721
  */
6611
- AuthorityFactory.createInstance = function (authorityUrl, networkInterface, cacheManager, authorityOptions) {
6722
+ AuthorityFactory.createInstance = function (authorityUrl, networkInterface, cacheManager, authorityOptions, proxyUrl) {
6612
6723
  // Throw error if authority url is empty
6613
6724
  if (StringUtils.isEmpty(authorityUrl)) {
6614
6725
  throw ClientConfigurationError.createUrlEmptyError();
6615
6726
  }
6616
- return new Authority(authorityUrl, networkInterface, cacheManager, authorityOptions);
6727
+ return new Authority(authorityUrl, networkInterface, cacheManager, authorityOptions, proxyUrl);
6617
6728
  };
6618
6729
  return AuthorityFactory;
6619
6730
  }());
6620
6731
 
6621
- /*! @azure/msal-common v5.2.0 2021-12-07 */
6732
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
6622
6733
 
6623
6734
  /*
6624
6735
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6649,7 +6760,7 @@ var ServerTelemetryEntity = /** @class */ (function () {
6649
6760
  return ServerTelemetryEntity;
6650
6761
  }());
6651
6762
 
6652
- /*! @azure/msal-common v5.2.0 2021-12-07 */
6763
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
6653
6764
 
6654
6765
  /*
6655
6766
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6677,7 +6788,7 @@ var ThrottlingEntity = /** @class */ (function () {
6677
6788
  return ThrottlingEntity;
6678
6789
  }());
6679
6790
 
6680
- /*! @azure/msal-common v5.2.0 2021-12-07 */
6791
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
6681
6792
 
6682
6793
  /*
6683
6794
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6694,7 +6805,7 @@ var StubbedNetworkModule = {
6694
6805
  }
6695
6806
  };
6696
6807
 
6697
- /*! @azure/msal-common v5.2.0 2021-12-07 */
6808
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
6698
6809
 
6699
6810
  /*
6700
6811
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6753,7 +6864,7 @@ var AuthenticationHeaderParser = /** @class */ (function () {
6753
6864
  return AuthenticationHeaderParser;
6754
6865
  }());
6755
6866
 
6756
- /*! @azure/msal-common v5.2.0 2021-12-07 */
6867
+ /*! @azure/msal-common v6.1.0 2022-03-07 */
6757
6868
 
6758
6869
  /*
6759
6870
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6969,7 +7080,7 @@ var HTTP_REQUEST_TYPE;
6969
7080
  /**
6970
7081
  * Temporary cache keys for MSAL, deleted after any request.
6971
7082
  */
6972
- var TemporaryCacheKeys;
7083
+ exports.TemporaryCacheKeys = void 0;
6973
7084
  (function (TemporaryCacheKeys) {
6974
7085
  TemporaryCacheKeys["AUTHORITY"] = "authority";
6975
7086
  TemporaryCacheKeys["ACQUIRE_TOKEN_ACCOUNT"] = "acquireToken.account";
@@ -6984,7 +7095,7 @@ var TemporaryCacheKeys;
6984
7095
  TemporaryCacheKeys["INTERACTION_STATUS_KEY"] = "interaction.status";
6985
7096
  TemporaryCacheKeys["CCS_CREDENTIAL"] = "ccs.credential";
6986
7097
  TemporaryCacheKeys["CORRELATION_ID"] = "request.correlationId";
6987
- })(TemporaryCacheKeys || (TemporaryCacheKeys = {}));
7098
+ })(exports.TemporaryCacheKeys || (exports.TemporaryCacheKeys = {}));
6988
7099
  /**
6989
7100
  * Cache keys stored in-memory
6990
7101
  */
@@ -7019,6 +7130,7 @@ exports.InteractionType = void 0;
7019
7130
  InteractionType["Redirect"] = "redirect";
7020
7131
  InteractionType["Popup"] = "popup";
7021
7132
  InteractionType["Silent"] = "silent";
7133
+ InteractionType["None"] = "none";
7022
7134
  })(exports.InteractionType || (exports.InteractionType = {}));
7023
7135
  /**
7024
7136
  * Types of interaction currently in progress.
@@ -8695,7 +8807,7 @@ var CryptoOps = /** @class */ (function () {
8695
8807
  */
8696
8808
  CryptoOps.prototype.getPublicKeyThumbprint = function (request) {
8697
8809
  return __awaiter$1(this, void 0, void 0, function () {
8698
- var keyPair, publicKeyJwk, pubKeyThumprintObj, publicJwkString, publicJwkBuffer, publicJwkHash, privateKeyJwk, unextractablePrivateKey;
8810
+ var keyPair, publicKeyJwk, pubKeyThumprintObj, publicJwkString, publicJwkHash, privateKeyJwk, unextractablePrivateKey;
8699
8811
  return __generator$1(this, function (_a) {
8700
8812
  switch (_a.label) {
8701
8813
  case 0: return [4 /*yield*/, this.browserCrypto.generateKeyPair(CryptoOps.EXTRACTABLE, CryptoOps.POP_KEY_USAGES)];
@@ -8710,10 +8822,9 @@ var CryptoOps = /** @class */ (function () {
8710
8822
  n: publicKeyJwk.n
8711
8823
  };
8712
8824
  publicJwkString = BrowserCrypto.getJwkString(pubKeyThumprintObj);
8713
- return [4 /*yield*/, this.browserCrypto.sha256Digest(publicJwkString)];
8825
+ return [4 /*yield*/, this.hashString(publicJwkString)];
8714
8826
  case 3:
8715
- publicJwkBuffer = _a.sent();
8716
- publicJwkHash = this.b64Encode.urlEncodeArr(new Uint8Array(publicJwkBuffer));
8827
+ publicJwkHash = _a.sent();
8717
8828
  return [4 /*yield*/, this.browserCrypto.exportJwk(keyPair.privateKey)];
8718
8829
  case 4:
8719
8830
  privateKeyJwk = _a.sent();
@@ -8820,6 +8931,24 @@ var CryptoOps = /** @class */ (function () {
8820
8931
  });
8821
8932
  });
8822
8933
  };
8934
+ /**
8935
+ * Returns the SHA-256 hash of an input string
8936
+ * @param plainText
8937
+ */
8938
+ CryptoOps.prototype.hashString = function (plainText) {
8939
+ return __awaiter$1(this, void 0, void 0, function () {
8940
+ var hashBuffer, hashBytes;
8941
+ return __generator$1(this, function (_a) {
8942
+ switch (_a.label) {
8943
+ case 0: return [4 /*yield*/, this.browserCrypto.sha256Digest(plainText)];
8944
+ case 1:
8945
+ hashBuffer = _a.sent();
8946
+ hashBytes = new Uint8Array(hashBuffer);
8947
+ return [2 /*return*/, this.b64Encode.urlEncodeArr(hashBytes)];
8948
+ }
8949
+ });
8950
+ });
8951
+ };
8823
8952
  CryptoOps.POP_KEY_USAGES = ["sign", "verify"];
8824
8953
  CryptoOps.EXTRACTABLE = true;
8825
8954
  return CryptoOps;
@@ -9609,7 +9738,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
9609
9738
  */
9610
9739
  BrowserCacheManager.prototype.generateAuthorityKey = function (stateString) {
9611
9740
  var stateId = ProtocolUtils.parseRequestState(this.cryptoImpl, stateString).libraryState.id;
9612
- return this.generateCacheKey(TemporaryCacheKeys.AUTHORITY + "." + stateId);
9741
+ return this.generateCacheKey(exports.TemporaryCacheKeys.AUTHORITY + "." + stateId);
9613
9742
  };
9614
9743
  /**
9615
9744
  * Create Nonce key to cache nonce
@@ -9617,7 +9746,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
9617
9746
  */
9618
9747
  BrowserCacheManager.prototype.generateNonceKey = function (stateString) {
9619
9748
  var stateId = ProtocolUtils.parseRequestState(this.cryptoImpl, stateString).libraryState.id;
9620
- return this.generateCacheKey(TemporaryCacheKeys.NONCE_IDTOKEN + "." + stateId);
9749
+ return this.generateCacheKey(exports.TemporaryCacheKeys.NONCE_IDTOKEN + "." + stateId);
9621
9750
  };
9622
9751
  /**
9623
9752
  * Creates full cache key for the request state
@@ -9626,7 +9755,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
9626
9755
  BrowserCacheManager.prototype.generateStateKey = function (stateString) {
9627
9756
  // Use the library state id to key temp storage for uniqueness for multiple concurrent requests
9628
9757
  var stateId = ProtocolUtils.parseRequestState(this.cryptoImpl, stateString).libraryState.id;
9629
- return this.generateCacheKey(TemporaryCacheKeys.REQUEST_STATE + "." + stateId);
9758
+ return this.generateCacheKey(exports.TemporaryCacheKeys.REQUEST_STATE + "." + stateId);
9630
9759
  };
9631
9760
  /**
9632
9761
  * Gets the cached authority based on the cached state. Returns empty if no cached state found.
@@ -9661,14 +9790,14 @@ var BrowserCacheManager = /** @class */ (function (_super) {
9661
9790
  credential: account.homeAccountId,
9662
9791
  type: CcsCredentialType.HOME_ACCOUNT_ID
9663
9792
  };
9664
- this.setTemporaryCache(TemporaryCacheKeys.CCS_CREDENTIAL, JSON.stringify(ccsCredential), true);
9793
+ this.setTemporaryCache(exports.TemporaryCacheKeys.CCS_CREDENTIAL, JSON.stringify(ccsCredential), true);
9665
9794
  }
9666
9795
  else if (!StringUtils.isEmpty(loginHint)) {
9667
9796
  var ccsCredential = {
9668
9797
  credential: loginHint,
9669
9798
  type: CcsCredentialType.UPN
9670
9799
  };
9671
- this.setTemporaryCache(TemporaryCacheKeys.CCS_CREDENTIAL, JSON.stringify(ccsCredential), true);
9800
+ this.setTemporaryCache(exports.TemporaryCacheKeys.CCS_CREDENTIAL, JSON.stringify(ccsCredential), true);
9672
9801
  }
9673
9802
  };
9674
9803
  /**
@@ -9692,11 +9821,11 @@ var BrowserCacheManager = /** @class */ (function (_super) {
9692
9821
  this.removeItem(this.generateNonceKey(state));
9693
9822
  this.removeItem(this.generateAuthorityKey(state));
9694
9823
  }
9695
- this.removeItem(this.generateCacheKey(TemporaryCacheKeys.REQUEST_PARAMS));
9696
- this.removeItem(this.generateCacheKey(TemporaryCacheKeys.ORIGIN_URI));
9697
- this.removeItem(this.generateCacheKey(TemporaryCacheKeys.URL_HASH));
9698
- this.removeItem(this.generateCacheKey(TemporaryCacheKeys.CORRELATION_ID));
9699
- this.removeItem(this.generateCacheKey(TemporaryCacheKeys.CCS_CREDENTIAL));
9824
+ this.removeItem(this.generateCacheKey(exports.TemporaryCacheKeys.REQUEST_PARAMS));
9825
+ this.removeItem(this.generateCacheKey(exports.TemporaryCacheKeys.ORIGIN_URI));
9826
+ this.removeItem(this.generateCacheKey(exports.TemporaryCacheKeys.URL_HASH));
9827
+ this.removeItem(this.generateCacheKey(exports.TemporaryCacheKeys.CORRELATION_ID));
9828
+ this.removeItem(this.generateCacheKey(exports.TemporaryCacheKeys.CCS_CREDENTIAL));
9700
9829
  this.setInteractionInProgress(false);
9701
9830
  };
9702
9831
  /**
@@ -9725,7 +9854,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
9725
9854
  // Loop through all keys to find state key
9726
9855
  this.getKeys().forEach(function (key) {
9727
9856
  // If this key is not the state key, move on
9728
- if (key.indexOf(TemporaryCacheKeys.REQUEST_STATE) === -1) {
9857
+ if (key.indexOf(exports.TemporaryCacheKeys.REQUEST_STATE) === -1) {
9729
9858
  return;
9730
9859
  }
9731
9860
  // Retrieve state value, return if not a valid value
@@ -9741,11 +9870,12 @@ var BrowserCacheManager = /** @class */ (function (_super) {
9741
9870
  }
9742
9871
  });
9743
9872
  this.clearMsalCookies();
9873
+ this.setInteractionInProgress(false);
9744
9874
  };
9745
9875
  BrowserCacheManager.prototype.cacheCodeRequest = function (authCodeRequest, browserCrypto) {
9746
9876
  this.logger.trace("BrowserCacheManager.cacheCodeRequest called");
9747
9877
  var encodedValue = browserCrypto.base64Encode(JSON.stringify(authCodeRequest));
9748
- this.setTemporaryCache(TemporaryCacheKeys.REQUEST_PARAMS, encodedValue, true);
9878
+ this.setTemporaryCache(exports.TemporaryCacheKeys.REQUEST_PARAMS, encodedValue, true);
9749
9879
  };
9750
9880
  /**
9751
9881
  * Gets the token exchange parameters from the cache. Throws an error if nothing is found.
@@ -9753,7 +9883,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
9753
9883
  BrowserCacheManager.prototype.getCachedRequest = function (state, browserCrypto) {
9754
9884
  this.logger.trace("BrowserCacheManager.getCachedRequest called");
9755
9885
  // Get token request from cache and parse as TokenExchangeParameters.
9756
- var encodedTokenRequest = this.getTemporaryCache(TemporaryCacheKeys.REQUEST_PARAMS, true);
9886
+ var encodedTokenRequest = this.getTemporaryCache(exports.TemporaryCacheKeys.REQUEST_PARAMS, true);
9757
9887
  if (!encodedTokenRequest) {
9758
9888
  throw BrowserAuthError.createNoTokenRequestCacheError();
9759
9889
  }
@@ -9761,7 +9891,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
9761
9891
  if (!parsedRequest) {
9762
9892
  throw BrowserAuthError.createUnableToParseTokenRequestCacheError();
9763
9893
  }
9764
- this.removeItem(this.generateCacheKey(TemporaryCacheKeys.REQUEST_PARAMS));
9894
+ this.removeItem(this.generateCacheKey(exports.TemporaryCacheKeys.REQUEST_PARAMS));
9765
9895
  // Get cached authority and use if no authority is cached with request.
9766
9896
  if (StringUtils.isEmpty(parsedRequest.authority)) {
9767
9897
  var authorityCacheKey = this.generateAuthorityKey(state);
@@ -9783,18 +9913,22 @@ var BrowserCacheManager = /** @class */ (function (_super) {
9783
9913
  }
9784
9914
  };
9785
9915
  BrowserCacheManager.prototype.getInteractionInProgress = function () {
9786
- var key = Constants.CACHE_PREFIX + "." + TemporaryCacheKeys.INTERACTION_STATUS_KEY;
9916
+ var key = Constants.CACHE_PREFIX + "." + exports.TemporaryCacheKeys.INTERACTION_STATUS_KEY;
9787
9917
  return this.getTemporaryCache(key, false);
9788
9918
  };
9789
9919
  BrowserCacheManager.prototype.setInteractionInProgress = function (inProgress) {
9790
- var clientId = this.getInteractionInProgress();
9791
9920
  // Ensure we don't overwrite interaction in progress for a different clientId
9792
- var key = Constants.CACHE_PREFIX + "." + TemporaryCacheKeys.INTERACTION_STATUS_KEY;
9793
- if (inProgress && !clientId) {
9794
- // No interaction is in progress
9795
- this.setTemporaryCache(key, this.clientId, false);
9921
+ var key = Constants.CACHE_PREFIX + "." + exports.TemporaryCacheKeys.INTERACTION_STATUS_KEY;
9922
+ if (inProgress) {
9923
+ if (this.getInteractionInProgress()) {
9924
+ throw BrowserAuthError.createInteractionInProgressError();
9925
+ }
9926
+ else {
9927
+ // No interaction is in progress
9928
+ this.setTemporaryCache(key, this.clientId, false);
9929
+ }
9796
9930
  }
9797
- else if (!inProgress && clientId === this.clientId) {
9931
+ else if (!inProgress && this.getInteractionInProgress() === this.clientId) {
9798
9932
  this.removeItem(key);
9799
9933
  }
9800
9934
  };
@@ -9831,6 +9965,25 @@ var BrowserCacheManager = /** @class */ (function (_super) {
9831
9965
  }
9832
9966
  return null;
9833
9967
  };
9968
+ /**
9969
+ * Updates a credential's cache key if the current cache key is outdated
9970
+ */
9971
+ BrowserCacheManager.prototype.updateCredentialCacheKey = function (currentCacheKey, credential) {
9972
+ var updatedCacheKey = credential.generateCredentialKey();
9973
+ if (currentCacheKey !== updatedCacheKey) {
9974
+ var cacheItem = this.getItem(currentCacheKey);
9975
+ if (cacheItem) {
9976
+ this.removeItem(currentCacheKey);
9977
+ this.setItem(updatedCacheKey, cacheItem);
9978
+ this.logger.verbose("Updated an outdated " + credential.credentialType + " cache key");
9979
+ return updatedCacheKey;
9980
+ }
9981
+ else {
9982
+ this.logger.error("Attempted to update an outdated " + credential.credentialType + " cache key but no item matching the outdated key was found in storage");
9983
+ }
9984
+ }
9985
+ return currentCacheKey;
9986
+ };
9834
9987
  return BrowserCacheManager;
9835
9988
  }(CacheManager));
9836
9989
  var DEFAULT_BROWSER_CACHE_MANAGER = function (clientId, logger) {
@@ -10302,7 +10455,11 @@ function buildConfiguration(_a, isBrowserEnvironment) {
10302
10455
  postLogoutRedirectUri: "",
10303
10456
  navigateToLoginRequestUrl: true,
10304
10457
  clientCapabilities: [],
10305
- protocolMode: exports.ProtocolMode.AAD
10458
+ protocolMode: exports.ProtocolMode.AAD,
10459
+ azureCloudOptions: {
10460
+ azureCloudInstance: exports.AzureCloudInstance.None,
10461
+ tenant: ""
10462
+ },
10306
10463
  };
10307
10464
  // Default cache options for browser
10308
10465
  var DEFAULT_CACHE_OPTIONS = {
@@ -10331,7 +10488,7 @@ function buildConfiguration(_a, isBrowserEnvironment) {
10331
10488
 
10332
10489
  /* eslint-disable header/header */
10333
10490
  var name = "@azure/msal-browser";
10334
- var version = "2.20.0";
10491
+ var version = "2.22.1";
10335
10492
 
10336
10493
  /*
10337
10494
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10548,28 +10705,42 @@ var BaseInteractionClient = /** @class */ (function () {
10548
10705
  * @param request
10549
10706
  */
10550
10707
  BaseInteractionClient.prototype.initializeBaseRequest = function (request) {
10551
- this.logger.verbose("Initializing BaseAuthRequest");
10552
- var authority = request.authority || this.config.auth.authority;
10553
- var scopes = __spread(((request && request.scopes) || []));
10554
- // Set authenticationScheme to BEARER if not explicitly set in the request
10555
- if (!request.authenticationScheme) {
10556
- request.authenticationScheme = exports.AuthenticationScheme.BEARER;
10557
- this.logger.verbose("Authentication Scheme wasn't explicitly set in request, defaulting to \"Bearer\" request");
10558
- }
10559
- else {
10560
- if (request.authenticationScheme === exports.AuthenticationScheme.SSH) {
10561
- if (!request.sshJwk) {
10562
- throw ClientConfigurationError.createMissingSshJwkError();
10563
- }
10564
- if (!request.sshKid) {
10565
- throw ClientConfigurationError.createMissingSshKidError();
10708
+ return __awaiter$1(this, void 0, void 0, function () {
10709
+ var authority, scopes, validatedRequest, _a;
10710
+ return __generator$1(this, function (_b) {
10711
+ switch (_b.label) {
10712
+ case 0:
10713
+ this.logger.verbose("Initializing BaseAuthRequest");
10714
+ authority = request.authority || this.config.auth.authority;
10715
+ scopes = __spread(((request && request.scopes) || []));
10716
+ validatedRequest = __assign$1(__assign$1({}, request), { correlationId: this.correlationId, authority: authority,
10717
+ scopes: scopes });
10718
+ // Set authenticationScheme to BEARER if not explicitly set in the request
10719
+ if (!validatedRequest.authenticationScheme) {
10720
+ validatedRequest.authenticationScheme = exports.AuthenticationScheme.BEARER;
10721
+ this.logger.verbose("Authentication Scheme wasn't explicitly set in request, defaulting to \"Bearer\" request");
10722
+ }
10723
+ else {
10724
+ if (validatedRequest.authenticationScheme === exports.AuthenticationScheme.SSH) {
10725
+ if (!request.sshJwk) {
10726
+ throw ClientConfigurationError.createMissingSshJwkError();
10727
+ }
10728
+ if (!request.sshKid) {
10729
+ throw ClientConfigurationError.createMissingSshKidError();
10730
+ }
10731
+ }
10732
+ this.logger.verbose("Authentication Scheme set to \"" + validatedRequest.authenticationScheme + "\" as configured in Auth request");
10733
+ }
10734
+ if (!(request.claims && !StringUtils.isEmpty(request.claims))) return [3 /*break*/, 2];
10735
+ _a = validatedRequest;
10736
+ return [4 /*yield*/, this.browserCrypto.hashString(request.claims)];
10737
+ case 1:
10738
+ _a.requestedClaimsHash = _b.sent();
10739
+ _b.label = 2;
10740
+ case 2: return [2 /*return*/, validatedRequest];
10566
10741
  }
10567
- }
10568
- this.logger.verbose("Authentication Scheme set to \"" + request.authenticationScheme + "\" as configured in Auth request");
10569
- }
10570
- var validatedRequest = __assign$1(__assign$1({}, request), { correlationId: this.correlationId, authority: authority,
10571
- scopes: scopes });
10572
- return validatedRequest;
10742
+ });
10743
+ });
10573
10744
  };
10574
10745
  /**
10575
10746
  *
@@ -10646,11 +10817,32 @@ var StandardInteractionClient = /** @class */ (function (_super) {
10646
10817
  */
10647
10818
  StandardInteractionClient.prototype.initializeLogoutRequest = function (logoutRequest) {
10648
10819
  this.logger.verbose("initializeLogoutRequest called", logoutRequest === null || logoutRequest === void 0 ? void 0 : logoutRequest.correlationId);
10649
- // Check if interaction is in progress. Throw error if true.
10650
- if (this.browserStorage.isInteractionInProgress()) {
10651
- throw BrowserAuthError.createInteractionInProgressError();
10652
- }
10653
10820
  var validLogoutRequest = __assign$1({ correlationId: this.browserCrypto.createNewGuid() }, logoutRequest);
10821
+ /**
10822
+ * Set logout_hint to be login_hint from ID Token Claims if present
10823
+ * and logoutHint attribute wasn't manually set in logout request
10824
+ */
10825
+ if (logoutRequest) {
10826
+ // If logoutHint isn't set and an account was passed in, try to extract logoutHint from ID Token Claims
10827
+ if (!logoutRequest.logoutHint) {
10828
+ if (logoutRequest.account) {
10829
+ var logoutHint = this.getLogoutHintFromIdTokenClaims(logoutRequest.account);
10830
+ if (logoutHint) {
10831
+ this.logger.verbose("Setting logoutHint to login_hint ID Token Claim value for the account provided");
10832
+ validLogoutRequest.logoutHint = logoutHint;
10833
+ }
10834
+ }
10835
+ else {
10836
+ this.logger.verbose("logoutHint was not set and account was not passed into logout request, logoutHint will not be set");
10837
+ }
10838
+ }
10839
+ else {
10840
+ this.logger.verbose("logoutHint has already been set in logoutRequest");
10841
+ }
10842
+ }
10843
+ else {
10844
+ this.logger.verbose("logoutHint will not be set since no logout request was configured");
10845
+ }
10654
10846
  /*
10655
10847
  * Only set redirect uri if logout request isn't provided or the set uri isn't null.
10656
10848
  * Otherwise, use passed uri, config, or current page.
@@ -10677,17 +10869,37 @@ var StandardInteractionClient = /** @class */ (function (_super) {
10677
10869
  }
10678
10870
  return validLogoutRequest;
10679
10871
  };
10872
+ /**
10873
+ * Parses login_hint ID Token Claim out of AccountInfo object to be used as
10874
+ * logout_hint in end session request.
10875
+ * @param account
10876
+ */
10877
+ StandardInteractionClient.prototype.getLogoutHintFromIdTokenClaims = function (account) {
10878
+ var idTokenClaims = account.idTokenClaims;
10879
+ if (idTokenClaims) {
10880
+ if (idTokenClaims.login_hint) {
10881
+ return idTokenClaims.login_hint;
10882
+ }
10883
+ else {
10884
+ this.logger.verbose("The ID Token Claims tied to the provided account do not contain a login_hint claim, logoutHint will not be added to logout request");
10885
+ }
10886
+ }
10887
+ else {
10888
+ this.logger.verbose("The provided account does not contain ID Token Claims, logoutHint will not be added to logout request");
10889
+ }
10890
+ return null;
10891
+ };
10680
10892
  /**
10681
10893
  * Creates an Authorization Code Client with the given authority, or the default authority.
10682
10894
  * @param serverTelemetryManager
10683
10895
  * @param authorityUrl
10684
10896
  */
10685
- StandardInteractionClient.prototype.createAuthCodeClient = function (serverTelemetryManager, authorityUrl) {
10897
+ StandardInteractionClient.prototype.createAuthCodeClient = function (serverTelemetryManager, authorityUrl, requestAzureCloudOptions) {
10686
10898
  return __awaiter$1(this, void 0, void 0, function () {
10687
10899
  var clientConfig;
10688
10900
  return __generator$1(this, function (_a) {
10689
10901
  switch (_a.label) {
10690
- case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl)];
10902
+ case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl, requestAzureCloudOptions)];
10691
10903
  case 1:
10692
10904
  clientConfig = _a.sent();
10693
10905
  return [2 /*return*/, new AuthorizationCodeClient(clientConfig)];
@@ -10701,14 +10913,14 @@ var StandardInteractionClient = /** @class */ (function (_super) {
10701
10913
  * @param requestAuthority
10702
10914
  * @param requestCorrelationId
10703
10915
  */
10704
- StandardInteractionClient.prototype.getClientConfiguration = function (serverTelemetryManager, requestAuthority) {
10916
+ StandardInteractionClient.prototype.getClientConfiguration = function (serverTelemetryManager, requestAuthority, requestAzureCloudOptions) {
10705
10917
  return __awaiter$1(this, void 0, void 0, function () {
10706
10918
  var discoveredAuthority;
10707
10919
  return __generator$1(this, function (_a) {
10708
10920
  switch (_a.label) {
10709
10921
  case 0:
10710
10922
  this.logger.verbose("getClientConfiguration called");
10711
- return [4 /*yield*/, this.getDiscoveredAuthority(requestAuthority)];
10923
+ return [4 /*yield*/, this.getDiscoveredAuthority(requestAuthority, requestAzureCloudOptions)];
10712
10924
  case 1:
10713
10925
  discoveredAuthority = _a.sent();
10714
10926
  return [2 /*return*/, {
@@ -10768,9 +10980,9 @@ var StandardInteractionClient = /** @class */ (function (_super) {
10768
10980
  * @param requestAuthority
10769
10981
  * @param requestCorrelationId
10770
10982
  */
10771
- StandardInteractionClient.prototype.getDiscoveredAuthority = function (requestAuthority) {
10983
+ StandardInteractionClient.prototype.getDiscoveredAuthority = function (requestAuthority, requestAzureCloudOptions) {
10772
10984
  return __awaiter$1(this, void 0, void 0, function () {
10773
- var authorityOptions;
10985
+ var authorityOptions, userAuthority, builtAuthority;
10774
10986
  return __generator$1(this, function (_a) {
10775
10987
  switch (_a.label) {
10776
10988
  case 0:
@@ -10779,63 +10991,55 @@ var StandardInteractionClient = /** @class */ (function (_super) {
10779
10991
  protocolMode: this.config.auth.protocolMode,
10780
10992
  knownAuthorities: this.config.auth.knownAuthorities,
10781
10993
  cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
10782
- authorityMetadata: this.config.auth.authorityMetadata
10994
+ authorityMetadata: this.config.auth.authorityMetadata,
10783
10995
  };
10784
- if (!requestAuthority) return [3 /*break*/, 2];
10785
- this.logger.verbose("Creating discovered authority with request authority");
10786
- return [4 /*yield*/, AuthorityFactory.createDiscoveredInstance(requestAuthority, this.config.system.networkClient, this.browserStorage, authorityOptions)];
10787
- case 1: return [2 /*return*/, _a.sent()];
10788
- case 2:
10996
+ userAuthority = requestAuthority ? requestAuthority : this.config.auth.authority;
10997
+ builtAuthority = Authority.generateAuthority(userAuthority, requestAzureCloudOptions || this.config.auth.azureCloudOptions);
10789
10998
  this.logger.verbose("Creating discovered authority with configured authority");
10790
- return [4 /*yield*/, AuthorityFactory.createDiscoveredInstance(this.config.auth.authority, this.config.system.networkClient, this.browserStorage, authorityOptions)];
10791
- case 3: return [2 /*return*/, _a.sent()];
10999
+ return [4 /*yield*/, AuthorityFactory.createDiscoveredInstance(builtAuthority, this.config.system.networkClient, this.browserStorage, authorityOptions)];
11000
+ case 1: return [2 /*return*/, _a.sent()];
10792
11001
  }
10793
11002
  });
10794
11003
  });
10795
11004
  };
10796
- /**
10797
- * Helper to validate app environment before making a request.
10798
- * @param request
10799
- * @param interactionType
10800
- */
10801
- StandardInteractionClient.prototype.preflightInteractiveRequest = function (request, interactionType) {
10802
- this.logger.verbose("preflightInteractiveRequest called, validating app environment", request === null || request === void 0 ? void 0 : request.correlationId);
10803
- // block the reload if it occurred inside a hidden iframe
10804
- BrowserUtils.blockReloadInHiddenIframes();
10805
- // Check if interaction is in progress. Throw error if true.
10806
- if (this.browserStorage.isInteractionInProgress(false)) {
10807
- throw BrowserAuthError.createInteractionInProgressError();
10808
- }
10809
- return this.initializeAuthorizationRequest(request, interactionType);
10810
- };
10811
11005
  /**
10812
11006
  * Helper to initialize required request parameters for interactive APIs and ssoSilent()
10813
11007
  * @param request
10814
11008
  * @param interactionType
10815
11009
  */
10816
11010
  StandardInteractionClient.prototype.initializeAuthorizationRequest = function (request, interactionType) {
10817
- this.logger.verbose("initializeAuthorizationRequest called");
10818
- var redirectUri = this.getRedirectUri(request.redirectUri);
10819
- var browserState = {
10820
- interactionType: interactionType
10821
- };
10822
- var state = ProtocolUtils.setRequestState(this.browserCrypto, (request && request.state) || "", browserState);
10823
- var validatedRequest = __assign$1(__assign$1({}, this.initializeBaseRequest(request)), { redirectUri: redirectUri, state: state, nonce: request.nonce || this.browserCrypto.createNewGuid(), responseMode: ResponseMode.FRAGMENT });
10824
- var account = request.account || this.browserStorage.getActiveAccount();
10825
- if (account) {
10826
- this.logger.verbose("Setting validated request account");
10827
- this.logger.verbosePii("Setting validated request account: " + account);
10828
- validatedRequest.account = account;
10829
- }
10830
- // Check for ADAL/MSAL v1 SSO
10831
- if (StringUtils.isEmpty(validatedRequest.loginHint) && !account) {
10832
- var legacyLoginHint = this.browserStorage.getLegacyLoginHint();
10833
- if (legacyLoginHint) {
10834
- validatedRequest.loginHint = legacyLoginHint;
10835
- }
10836
- }
10837
- this.browserStorage.updateCacheEntries(validatedRequest.state, validatedRequest.nonce, validatedRequest.authority, validatedRequest.loginHint || "", validatedRequest.account || null);
10838
- return validatedRequest;
11011
+ return __awaiter$1(this, void 0, void 0, function () {
11012
+ var redirectUri, browserState, state, validatedRequest, _a, account, legacyLoginHint;
11013
+ return __generator$1(this, function (_b) {
11014
+ switch (_b.label) {
11015
+ case 0:
11016
+ this.logger.verbose("initializeAuthorizationRequest called");
11017
+ redirectUri = this.getRedirectUri(request.redirectUri);
11018
+ browserState = {
11019
+ interactionType: interactionType
11020
+ };
11021
+ state = ProtocolUtils.setRequestState(this.browserCrypto, (request && request.state) || Constants.EMPTY_STRING, browserState);
11022
+ _a = [{}];
11023
+ return [4 /*yield*/, this.initializeBaseRequest(request)];
11024
+ case 1:
11025
+ validatedRequest = __assign$1.apply(void 0, [__assign$1.apply(void 0, _a.concat([_b.sent()])), { redirectUri: redirectUri, state: state, nonce: request.nonce || this.browserCrypto.createNewGuid(), responseMode: ResponseMode.FRAGMENT }]);
11026
+ account = request.account || this.browserStorage.getActiveAccount();
11027
+ if (account) {
11028
+ this.logger.verbose("Setting validated request account");
11029
+ this.logger.verbosePii("Setting validated request account: " + account);
11030
+ validatedRequest.account = account;
11031
+ }
11032
+ // Check for ADAL/MSAL v1 SSO
11033
+ if (StringUtils.isEmpty(validatedRequest.loginHint) && !account) {
11034
+ legacyLoginHint = this.browserStorage.getLegacyLoginHint();
11035
+ if (legacyLoginHint) {
11036
+ validatedRequest.loginHint = legacyLoginHint;
11037
+ }
11038
+ }
11039
+ return [2 /*return*/, validatedRequest];
11040
+ }
11041
+ });
11042
+ });
10839
11043
  };
10840
11044
  return StandardInteractionClient;
10841
11045
  }(BaseInteractionClient));
@@ -11002,8 +11206,8 @@ var PopupUtils = /** @class */ (function () {
11002
11206
  * @param clientId
11003
11207
  * @param request
11004
11208
  */
11005
- PopupUtils.generatePopupName = function (clientId, request) {
11006
- return BrowserConstants.POPUP_NAME_PREFIX + "." + clientId + "." + request.scopes.join("-") + "." + request.authority + "." + request.correlationId;
11209
+ PopupUtils.generatePopupName = function (clientId, scopes, authority, correlationId) {
11210
+ return BrowserConstants.POPUP_NAME_PREFIX + "." + clientId + "." + scopes.join("-") + "." + authority + "." + correlationId;
11007
11211
  };
11008
11212
  /**
11009
11213
  * Generates the name for the popup based on the client id and request for logouts
@@ -11136,7 +11340,7 @@ var InteractionHandler = /** @class */ (function () {
11136
11340
  */
11137
11341
  InteractionHandler.prototype.checkCcsCredentials = function () {
11138
11342
  // Look up ccs credential in temp cache
11139
- var cachedCcsCred = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.CCS_CREDENTIAL, true);
11343
+ var cachedCcsCred = this.browserStorage.getTemporaryCache(exports.TemporaryCacheKeys.CCS_CREDENTIAL, true);
11140
11344
  if (cachedCcsCred) {
11141
11345
  try {
11142
11346
  return JSON.parse(cachedCcsCred);
@@ -11174,8 +11378,6 @@ var PopupHandler = /** @class */ (function (_super) {
11174
11378
  PopupHandler.prototype.initiateAuthRequest = function (requestUrl, params) {
11175
11379
  // Check that request url is not empty.
11176
11380
  if (!StringUtils.isEmpty(requestUrl)) {
11177
- // Set interaction status in the library.
11178
- this.browserStorage.setInteractionInProgress(true);
11179
11381
  this.browserRequestLogger.infoPii("Navigate to: " + requestUrl);
11180
11382
  // Open the popup window to requestUrl.
11181
11383
  return this.popupUtils.openPopup(requestUrl, params);
@@ -11226,20 +11428,19 @@ var PopupClient = /** @class */ (function (_super) {
11226
11428
  */
11227
11429
  PopupClient.prototype.acquireToken = function (request) {
11228
11430
  try {
11229
- var validRequest = this.preflightInteractiveRequest(request, exports.InteractionType.Popup);
11230
- var popupName = PopupUtils.generatePopupName(this.config.auth.clientId, validRequest);
11431
+ var popupName = PopupUtils.generatePopupName(this.config.auth.clientId, request.scopes || OIDC_DEFAULT_SCOPES, request.authority || this.config.auth.authority, this.correlationId);
11231
11432
  var popupWindowAttributes = request.popupWindowAttributes || {};
11232
11433
  // asyncPopups flag is true. Acquires token without first opening popup. Popup will be opened later asynchronously.
11233
11434
  if (this.config.system.asyncPopups) {
11234
11435
  this.logger.verbose("asyncPopups set to true, acquiring token");
11235
11436
  // Passes on popup position and dimensions if in request
11236
- return this.acquireTokenPopupAsync(validRequest, popupName, popupWindowAttributes);
11437
+ return this.acquireTokenPopupAsync(request, popupName, popupWindowAttributes);
11237
11438
  }
11238
11439
  else {
11239
11440
  // asyncPopups flag is set to false. Opens popup before acquiring token.
11240
11441
  this.logger.verbose("asyncPopup set to false, opening popup before acquiring token");
11241
11442
  var popup = PopupUtils.openSizedPopup("about:blank", popupName, popupWindowAttributes, this.logger);
11242
- return this.acquireTokenPopupAsync(validRequest, popupName, popupWindowAttributes, popup);
11443
+ return this.acquireTokenPopupAsync(request, popupName, popupWindowAttributes, popup);
11243
11444
  }
11244
11445
  }
11245
11446
  catch (e) {
@@ -11285,26 +11486,30 @@ var PopupClient = /** @class */ (function (_super) {
11285
11486
  *
11286
11487
  * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
11287
11488
  */
11288
- PopupClient.prototype.acquireTokenPopupAsync = function (validRequest, popupName, popupWindowAttributes, popup) {
11489
+ PopupClient.prototype.acquireTokenPopupAsync = function (request, popupName, popupWindowAttributes, popup) {
11289
11490
  return __awaiter$1(this, void 0, void 0, function () {
11290
- var serverTelemetryManager, authCodeRequest, authClient, navigateUrl, interactionHandler, popupParameters, popupWindow, hash, state, result, e_1;
11491
+ var serverTelemetryManager, validRequest, authCodeRequest, authClient, navigateUrl, interactionHandler, popupParameters, popupWindow, hash, state, result, e_1;
11291
11492
  return __generator$1(this, function (_a) {
11292
11493
  switch (_a.label) {
11293
11494
  case 0:
11294
11495
  this.logger.verbose("acquireTokenPopupAsync called");
11295
11496
  serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenPopup);
11296
- _a.label = 1;
11497
+ return [4 /*yield*/, this.initializeAuthorizationRequest(request, exports.InteractionType.Popup)];
11297
11498
  case 1:
11298
- _a.trys.push([1, 7, , 8]);
11299
- return [4 /*yield*/, this.initializeAuthorizationCodeRequest(validRequest)];
11499
+ validRequest = _a.sent();
11500
+ this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint || "", validRequest.account || null);
11501
+ _a.label = 2;
11300
11502
  case 2:
11301
- authCodeRequest = _a.sent();
11302
- return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, validRequest.authority)];
11503
+ _a.trys.push([2, 8, , 9]);
11504
+ return [4 /*yield*/, this.initializeAuthorizationCodeRequest(validRequest)];
11303
11505
  case 3:
11506
+ authCodeRequest = _a.sent();
11507
+ return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, validRequest.authority, validRequest.azureCloudOptions)];
11508
+ case 4:
11304
11509
  authClient = _a.sent();
11305
11510
  this.logger.verbose("Auth code client created");
11306
11511
  return [4 /*yield*/, authClient.getAuthCodeUrl(validRequest)];
11307
- case 4:
11512
+ case 5:
11308
11513
  navigateUrl = _a.sent();
11309
11514
  interactionHandler = new PopupHandler(authClient, this.browserStorage, authCodeRequest, this.logger);
11310
11515
  popupParameters = {
@@ -11315,16 +11520,16 @@ var PopupClient = /** @class */ (function (_super) {
11315
11520
  popupWindow = interactionHandler.initiateAuthRequest(navigateUrl, popupParameters);
11316
11521
  this.eventHandler.emitEvent(exports.EventType.POPUP_OPENED, exports.InteractionType.Popup, { popupWindow: popupWindow }, null);
11317
11522
  return [4 /*yield*/, interactionHandler.monitorPopupForHash(popupWindow)];
11318
- case 5:
11523
+ case 6:
11319
11524
  hash = _a.sent();
11320
11525
  state = this.validateAndExtractStateFromHash(hash, exports.InteractionType.Popup, validRequest.correlationId);
11321
11526
  // Remove throttle if it exists
11322
11527
  ThrottlingUtils.removeThrottle(this.browserStorage, this.config.auth.clientId, authCodeRequest);
11323
11528
  return [4 /*yield*/, interactionHandler.handleCodeResponseFromHash(hash, state, authClient.authority, this.networkClient)];
11324
- case 6:
11529
+ case 7:
11325
11530
  result = _a.sent();
11326
11531
  return [2 /*return*/, result];
11327
- case 7:
11532
+ case 8:
11328
11533
  e_1 = _a.sent();
11329
11534
  if (popup) {
11330
11535
  // Close the synchronous popup if an error is thrown before the window unload event is registered
@@ -11336,7 +11541,7 @@ var PopupClient = /** @class */ (function (_super) {
11336
11541
  serverTelemetryManager.cacheFailedRequest(e_1);
11337
11542
  this.browserStorage.cleanRequestByState(validRequest.state);
11338
11543
  throw e_1;
11339
- case 8: return [2 /*return*/];
11544
+ case 9: return [2 /*return*/];
11340
11545
  }
11341
11546
  });
11342
11547
  });
@@ -11367,7 +11572,6 @@ var PopupClient = /** @class */ (function (_super) {
11367
11572
  case 2:
11368
11573
  // Clear cache on logout
11369
11574
  _a.sent();
11370
- this.browserStorage.setInteractionInProgress(true);
11371
11575
  return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, requestAuthority)];
11372
11576
  case 3:
11373
11577
  authClient = _a.sent();
@@ -11401,7 +11605,7 @@ var PopupClient = /** @class */ (function (_super) {
11401
11605
  };
11402
11606
  absoluteUrl = UrlString.getAbsoluteUrl(mainWindowRedirectUri, BrowserUtils.getCurrentUri());
11403
11607
  this.logger.verbose("Redirecting main window to url specified in the request");
11404
- this.logger.verbosePii("Redirecing main window to: " + absoluteUrl);
11608
+ this.logger.verbosePii("Redirecting main window to: " + absoluteUrl);
11405
11609
  this.navigationClient.navigateInternal(absoluteUrl, navigationOptions);
11406
11610
  }
11407
11611
  else {
@@ -11458,11 +11662,10 @@ var RedirectHandler = /** @class */ (function (_super) {
11458
11662
  // Cache start page, returns to this page after redirectUri if navigateToLoginRequestUrl is true
11459
11663
  if (params.redirectStartPage) {
11460
11664
  this.browserRequestLogger.verbose("RedirectHandler.initiateAuthRequest: redirectStartPage set, caching start page");
11461
- this.browserStorage.setTemporaryCache(TemporaryCacheKeys.ORIGIN_URI, params.redirectStartPage, true);
11665
+ this.browserStorage.setTemporaryCache(exports.TemporaryCacheKeys.ORIGIN_URI, params.redirectStartPage, true);
11462
11666
  }
11463
11667
  // Set interaction status in the library.
11464
- this.browserStorage.setInteractionInProgress(true);
11465
- this.browserStorage.setTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, this.authCodeRequest.correlationId, true);
11668
+ this.browserStorage.setTemporaryCache(exports.TemporaryCacheKeys.CORRELATION_ID, this.authCodeRequest.correlationId, true);
11466
11669
  this.browserStorage.cacheCodeRequest(this.authCodeRequest, this.browserCrypto);
11467
11670
  this.browserRequestLogger.infoPii("RedirectHandler.initiateAuthRequest: Navigate to: " + requestUrl);
11468
11671
  navigationOptions = {
@@ -11576,46 +11779,59 @@ var RedirectClient = /** @class */ (function (_super) {
11576
11779
  */
11577
11780
  RedirectClient.prototype.acquireToken = function (request) {
11578
11781
  return __awaiter$1(this, void 0, void 0, function () {
11579
- var validRequest, serverTelemetryManager, authCodeRequest, authClient, interactionHandler, navigateUrl, redirectStartPage, e_1;
11782
+ var validRequest, serverTelemetryManager, handleBackButton, authCodeRequest, authClient, interactionHandler, navigateUrl, redirectStartPage, e_1;
11783
+ var _this = this;
11580
11784
  return __generator$1(this, function (_a) {
11581
11785
  switch (_a.label) {
11582
- case 0:
11583
- validRequest = this.preflightInteractiveRequest(request, exports.InteractionType.Redirect);
11584
- serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenRedirect);
11585
- _a.label = 1;
11786
+ case 0: return [4 /*yield*/, this.initializeAuthorizationRequest(request, exports.InteractionType.Redirect)];
11586
11787
  case 1:
11587
- _a.trys.push([1, 6, , 7]);
11588
- return [4 /*yield*/, this.initializeAuthorizationCodeRequest(validRequest)];
11788
+ validRequest = _a.sent();
11789
+ this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint || "", validRequest.account || null);
11790
+ serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenRedirect);
11791
+ handleBackButton = function (event) {
11792
+ // Clear temporary cache if the back button is clicked during the redirect flow.
11793
+ if (event.persisted) {
11794
+ _this.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache.");
11795
+ _this.browserStorage.cleanRequestByState(validRequest.state);
11796
+ }
11797
+ };
11798
+ _a.label = 2;
11589
11799
  case 2:
11590
- authCodeRequest = _a.sent();
11591
- return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, validRequest.authority)];
11800
+ _a.trys.push([2, 7, , 8]);
11801
+ return [4 /*yield*/, this.initializeAuthorizationCodeRequest(validRequest)];
11592
11802
  case 3:
11803
+ authCodeRequest = _a.sent();
11804
+ return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, validRequest.authority, validRequest.azureCloudOptions)];
11805
+ case 4:
11593
11806
  authClient = _a.sent();
11594
11807
  this.logger.verbose("Auth code client created");
11595
11808
  interactionHandler = new RedirectHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.browserCrypto);
11596
11809
  return [4 /*yield*/, authClient.getAuthCodeUrl(validRequest)];
11597
- case 4:
11810
+ case 5:
11598
11811
  navigateUrl = _a.sent();
11599
11812
  redirectStartPage = this.getRedirectStartPage(request.redirectStartPage);
11600
11813
  this.logger.verbosePii("Redirect start page: " + redirectStartPage);
11814
+ // Clear temporary cache if the back button is clicked during the redirect flow.
11815
+ window.addEventListener("pageshow", handleBackButton);
11601
11816
  return [4 /*yield*/, interactionHandler.initiateAuthRequest(navigateUrl, {
11602
11817
  navigationClient: this.navigationClient,
11603
11818
  redirectTimeout: this.config.system.redirectNavigationTimeout,
11604
11819
  redirectStartPage: redirectStartPage,
11605
11820
  onRedirectNavigate: request.onRedirectNavigate
11606
11821
  })];
11607
- case 5:
11822
+ case 6:
11608
11823
  // Show the UI once the url has been created. Response will come back in the hash, which will be handled in the handleRedirectCallback function.
11609
11824
  return [2 /*return*/, _a.sent()];
11610
- case 6:
11825
+ case 7:
11611
11826
  e_1 = _a.sent();
11612
11827
  if (e_1 instanceof AuthError) {
11613
11828
  e_1.setCorrelationId(this.correlationId);
11614
11829
  }
11830
+ window.removeEventListener("pageshow", handleBackButton);
11615
11831
  serverTelemetryManager.cacheFailedRequest(e_1);
11616
11832
  this.browserStorage.cleanRequestByState(validRequest.state);
11617
11833
  throw e_1;
11618
- case 7: return [2 /*return*/];
11834
+ case 8: return [2 /*return*/];
11619
11835
  }
11620
11836
  });
11621
11837
  });
@@ -11650,7 +11866,6 @@ var RedirectClient = /** @class */ (function (_super) {
11650
11866
  state = void 0;
11651
11867
  try {
11652
11868
  state = this.validateAndExtractStateFromHash(responseHash, exports.InteractionType.Redirect);
11653
- BrowserUtils.clearHash(window);
11654
11869
  this.logger.verbose("State extracted from hash");
11655
11870
  }
11656
11871
  catch (e) {
@@ -11658,7 +11873,7 @@ var RedirectClient = /** @class */ (function (_super) {
11658
11873
  this.browserStorage.cleanRequestByInteractionType(exports.InteractionType.Redirect);
11659
11874
  return [2 /*return*/, null];
11660
11875
  }
11661
- loginRequestUrl = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.ORIGIN_URI, true) || "";
11876
+ loginRequestUrl = this.browserStorage.getTemporaryCache(exports.TemporaryCacheKeys.ORIGIN_URI, true) || "";
11662
11877
  loginRequestUrlNormalized = UrlString.removeHashFromUrl(loginRequestUrl);
11663
11878
  currentUrlNormalized = UrlString.removeHashFromUrl(window.location.href);
11664
11879
  if (!(loginRequestUrlNormalized === currentUrlNormalized && this.config.auth.navigateToLoginRequestUrl)) return [3 /*break*/, 3];
@@ -11682,7 +11897,7 @@ var RedirectClient = /** @class */ (function (_super) {
11682
11897
  * Returned from authority using redirect - need to perform navigation before processing response
11683
11898
  * Cache the hash to be retrieved after the next redirect
11684
11899
  */
11685
- this.browserStorage.setTemporaryCache(TemporaryCacheKeys.URL_HASH, responseHash, true);
11900
+ this.browserStorage.setTemporaryCache(exports.TemporaryCacheKeys.URL_HASH, responseHash, true);
11686
11901
  navigationOptions = {
11687
11902
  apiId: exports.ApiId.handleRedirectPromise,
11688
11903
  timeout: this.config.system.redirectNavigationTimeout,
@@ -11692,7 +11907,7 @@ var RedirectClient = /** @class */ (function (_super) {
11692
11907
  if (!(!loginRequestUrl || loginRequestUrl === "null")) return [3 /*break*/, 6];
11693
11908
  homepage = BrowserUtils.getHomepage();
11694
11909
  // Cache the homepage under ORIGIN_URI to ensure cached hash is processed on homepage
11695
- this.browserStorage.setTemporaryCache(TemporaryCacheKeys.ORIGIN_URI, homepage, true);
11910
+ this.browserStorage.setTemporaryCache(exports.TemporaryCacheKeys.ORIGIN_URI, homepage, true);
11696
11911
  this.logger.warning("Unable to get valid login request url from cache, redirecting to home page");
11697
11912
  return [4 /*yield*/, this.navigationClient.navigateInternal(homepage, navigationOptions)];
11698
11913
  case 5:
@@ -11734,12 +11949,13 @@ var RedirectClient = /** @class */ (function (_super) {
11734
11949
  this.logger.verbose("getRedirectResponseHash called");
11735
11950
  // Get current location hash from window or cache.
11736
11951
  var isResponseHash = UrlString.hashContainsKnownProperties(hash);
11737
- var cachedHash = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.URL_HASH, true);
11738
- this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.URL_HASH));
11739
11952
  if (isResponseHash) {
11953
+ BrowserUtils.clearHash(window);
11740
11954
  this.logger.verbose("Hash contains known properties, returning response hash");
11741
11955
  return hash;
11742
11956
  }
11957
+ var cachedHash = this.browserStorage.getTemporaryCache(exports.TemporaryCacheKeys.URL_HASH, true);
11958
+ this.browserStorage.removeItem(this.browserStorage.generateCacheKey(exports.TemporaryCacheKeys.URL_HASH));
11743
11959
  this.logger.verbose("Hash does not contain known properties, returning cached hash");
11744
11960
  return cachedHash;
11745
11961
  };
@@ -12031,24 +12247,27 @@ var SilentIframeClient = /** @class */ (function (_super) {
12031
12247
  if (request.prompt && request.prompt !== PromptValue.NONE) {
12032
12248
  throw BrowserAuthError.createSilentPromptValueError(request.prompt);
12033
12249
  }
12034
- silentRequest = this.initializeAuthorizationRequest(__assign$1(__assign$1({}, request), { prompt: PromptValue.NONE }), exports.InteractionType.Silent);
12035
- serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
12036
- _a.label = 1;
12250
+ return [4 /*yield*/, this.initializeAuthorizationRequest(__assign$1(__assign$1({}, request), { prompt: PromptValue.NONE }), exports.InteractionType.Silent)];
12037
12251
  case 1:
12038
- _a.trys.push([1, 6, , 7]);
12039
- return [4 /*yield*/, this.initializeAuthorizationCodeRequest(silentRequest)];
12252
+ silentRequest = _a.sent();
12253
+ this.browserStorage.updateCacheEntries(silentRequest.state, silentRequest.nonce, silentRequest.authority, silentRequest.loginHint || "", silentRequest.account || null);
12254
+ serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
12255
+ _a.label = 2;
12040
12256
  case 2:
12041
- authCodeRequest = _a.sent();
12042
- return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, silentRequest.authority)];
12257
+ _a.trys.push([2, 7, , 8]);
12258
+ return [4 /*yield*/, this.initializeAuthorizationCodeRequest(silentRequest)];
12043
12259
  case 3:
12260
+ authCodeRequest = _a.sent();
12261
+ return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions)];
12262
+ case 4:
12044
12263
  authClient = _a.sent();
12045
12264
  this.logger.verbose("Auth code client created");
12046
12265
  return [4 /*yield*/, authClient.getAuthCodeUrl(silentRequest)];
12047
- case 4:
12266
+ case 5:
12048
12267
  navigateUrl = _a.sent();
12049
12268
  return [4 /*yield*/, this.silentTokenHelper(navigateUrl, authCodeRequest, authClient, this.logger)];
12050
- case 5: return [2 /*return*/, _a.sent()];
12051
- case 6:
12269
+ case 6: return [2 /*return*/, _a.sent()];
12270
+ case 7:
12052
12271
  e_1 = _a.sent();
12053
12272
  if (e_1 instanceof AuthError) {
12054
12273
  e_1.setCorrelationId(this.correlationId);
@@ -12056,7 +12275,7 @@ var SilentIframeClient = /** @class */ (function (_super) {
12056
12275
  serverTelemetryManager.cacheFailedRequest(e_1);
12057
12276
  this.browserStorage.cleanRequestByState(silentRequest.state);
12058
12277
  throw e_1;
12059
- case 7: return [2 /*return*/];
12278
+ case 8: return [2 /*return*/];
12060
12279
  }
12061
12280
  });
12062
12281
  });
@@ -12112,16 +12331,19 @@ var SilentRefreshClient = /** @class */ (function (_super) {
12112
12331
  */
12113
12332
  SilentRefreshClient.prototype.acquireToken = function (request) {
12114
12333
  return __awaiter$1(this, void 0, void 0, function () {
12115
- var silentRequest, serverTelemetryManager, refreshTokenClient;
12334
+ var silentRequest, _a, serverTelemetryManager, refreshTokenClient;
12116
12335
  var _this = this;
12117
- return __generator$1(this, function (_a) {
12118
- switch (_a.label) {
12336
+ return __generator$1(this, function (_b) {
12337
+ switch (_b.label) {
12119
12338
  case 0:
12120
- silentRequest = __assign$1(__assign$1({}, request), this.initializeBaseRequest(request));
12121
- serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenSilent_silentFlow);
12122
- return [4 /*yield*/, this.createRefreshTokenClient(serverTelemetryManager, silentRequest.authority)];
12339
+ _a = [__assign$1({}, request)];
12340
+ return [4 /*yield*/, this.initializeBaseRequest(request)];
12123
12341
  case 1:
12124
- refreshTokenClient = _a.sent();
12342
+ silentRequest = __assign$1.apply(void 0, _a.concat([_b.sent()]));
12343
+ serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenSilent_silentFlow);
12344
+ return [4 /*yield*/, this.createRefreshTokenClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions)];
12345
+ case 2:
12346
+ refreshTokenClient = _b.sent();
12125
12347
  this.logger.verbose("Refresh token client created");
12126
12348
  // Send request to renew token. Auth module will throw errors if token cannot be renewed.
12127
12349
  return [2 /*return*/, refreshTokenClient.acquireTokenByRefreshToken(silentRequest).catch(function (e) {
@@ -12147,12 +12369,12 @@ var SilentRefreshClient = /** @class */ (function (_super) {
12147
12369
  * @param serverTelemetryManager
12148
12370
  * @param authorityUrl
12149
12371
  */
12150
- SilentRefreshClient.prototype.createRefreshTokenClient = function (serverTelemetryManager, authorityUrl) {
12372
+ SilentRefreshClient.prototype.createRefreshTokenClient = function (serverTelemetryManager, authorityUrl, azureCloudOptions) {
12151
12373
  return __awaiter$1(this, void 0, void 0, function () {
12152
12374
  var clientConfig;
12153
12375
  return __generator$1(this, function (_a) {
12154
12376
  switch (_a.label) {
12155
- case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl)];
12377
+ case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl, azureCloudOptions)];
12156
12378
  case 1:
12157
12379
  clientConfig = _a.sent();
12158
12380
  return [2 /*return*/, new RefreshTokenClient(clientConfig)];
@@ -12195,13 +12417,14 @@ var TokenCache = /** @class */ (function () {
12195
12417
  this.loadAccessToken(request, response, request.account.homeAccountId, request.account.environment, request.account.tenantId, options);
12196
12418
  }
12197
12419
  else if (request.authority) {
12420
+ var authorityUrl = Authority.generateAuthority(request.authority, request.azureCloudOptions);
12198
12421
  var authorityOptions = {
12199
12422
  protocolMode: this.config.auth.protocolMode,
12200
12423
  knownAuthorities: this.config.auth.knownAuthorities,
12201
12424
  cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
12202
- authorityMetadata: this.config.auth.authorityMetadata
12425
+ authorityMetadata: this.config.auth.authorityMetadata,
12203
12426
  };
12204
- var authority = new Authority(request.authority, this.config.system.networkClient, this.storage, authorityOptions);
12427
+ var authority = new Authority(authorityUrl, this.config.system.networkClient, this.storage, authorityOptions);
12205
12428
  // "clientInfo" from options takes precedence over "clientInfo" in response
12206
12429
  if (options.clientInfo) {
12207
12430
  this.logger.trace("TokenCache - homeAccountId from options");
@@ -12320,14 +12543,17 @@ var SilentAuthCodeClient = /** @class */ (function (_super) {
12320
12543
  if (!request.code) {
12321
12544
  throw BrowserAuthError.createAuthCodeRequiredError();
12322
12545
  }
12323
- silentRequest = this.initializeAuthorizationRequest(request, exports.InteractionType.Silent);
12324
- serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
12325
- _a.label = 1;
12546
+ return [4 /*yield*/, this.initializeAuthorizationRequest(request, exports.InteractionType.Silent)];
12326
12547
  case 1:
12327
- _a.trys.push([1, 3, , 4]);
12548
+ silentRequest = _a.sent();
12549
+ this.browserStorage.updateCacheEntries(silentRequest.state, silentRequest.nonce, silentRequest.authority, silentRequest.loginHint || "", silentRequest.account || null);
12550
+ serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
12551
+ _a.label = 2;
12552
+ case 2:
12553
+ _a.trys.push([2, 4, , 5]);
12328
12554
  authCodeRequest = __assign$1(__assign$1({}, silentRequest), { code: request.code });
12329
12555
  return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, silentRequest.authority)];
12330
- case 2:
12556
+ case 3:
12331
12557
  clientConfig = _a.sent();
12332
12558
  authClient = new HybridSpaAuthorizationCodeClient(clientConfig);
12333
12559
  this.logger.verbose("Auth code client created");
@@ -12339,7 +12565,7 @@ var SilentAuthCodeClient = /** @class */ (function (_super) {
12339
12565
  cloud_graph_host_name: request.cloudGraphHostName,
12340
12566
  cloud_instance_host_name: request.cloudInstanceHostName
12341
12567
  }, silentRequest.state, authClient.authority, this.networkClient, false)];
12342
- case 3:
12568
+ case 4:
12343
12569
  e_1 = _a.sent();
12344
12570
  if (e_1 instanceof AuthError) {
12345
12571
  e_1.setCorrelationId(this.correlationId);
@@ -12347,7 +12573,7 @@ var SilentAuthCodeClient = /** @class */ (function (_super) {
12347
12573
  serverTelemetryManager.cacheFailedRequest(e_1);
12348
12574
  this.browserStorage.cleanRequestByState(silentRequest.state);
12349
12575
  throw e_1;
12350
- case 4: return [2 /*return*/];
12576
+ case 5: return [2 /*return*/];
12351
12577
  }
12352
12578
  });
12353
12579
  });
@@ -12438,7 +12664,7 @@ var ClientApplication = /** @class */ (function () {
12438
12664
  if (typeof response === "undefined") {
12439
12665
  this.eventHandler.emitEvent(exports.EventType.HANDLE_REDIRECT_START, exports.InteractionType.Redirect);
12440
12666
  this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise");
12441
- correlationId = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, true) || "";
12667
+ correlationId = this.browserStorage.getTemporaryCache(exports.TemporaryCacheKeys.CORRELATION_ID, true) || "";
12442
12668
  redirectClient = new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, correlationId);
12443
12669
  response = redirectClient.handleRedirectPromise(hash)
12444
12670
  .then(function (result) {
@@ -12495,8 +12721,8 @@ var ClientApplication = /** @class */ (function () {
12495
12721
  var _this = this;
12496
12722
  return __generator$1(this, function (_a) {
12497
12723
  // Preflight request
12498
- this.preflightBrowserEnvironmentCheck(exports.InteractionType.Redirect);
12499
12724
  this.logger.verbose("acquireTokenRedirect called");
12725
+ this.preflightBrowserEnvironmentCheck(exports.InteractionType.Redirect);
12500
12726
  isLoggedIn = this.getAllAccounts().length > 0;
12501
12727
  if (isLoggedIn) {
12502
12728
  this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Redirect, request);
@@ -12530,8 +12756,8 @@ var ClientApplication = /** @class */ (function () {
12530
12756
  ClientApplication.prototype.acquireTokenPopup = function (request) {
12531
12757
  var _this = this;
12532
12758
  try {
12533
- this.preflightBrowserEnvironmentCheck(exports.InteractionType.Popup);
12534
12759
  this.logger.verbose("acquireTokenPopup called", request.correlationId);
12760
+ this.preflightBrowserEnvironmentCheck(exports.InteractionType.Popup);
12535
12761
  }
12536
12762
  catch (e) {
12537
12763
  // Since this function is syncronous we need to reject
@@ -12866,6 +13092,21 @@ var ClientApplication = /** @class */ (function () {
12866
13092
  !this.config.cache.storeAuthStateInCookie) {
12867
13093
  throw BrowserConfigurationAuthError.createInMemoryRedirectUnavailableError();
12868
13094
  }
13095
+ if (interactionType === exports.InteractionType.Redirect || interactionType === exports.InteractionType.Popup) {
13096
+ this.preflightInteractiveRequest();
13097
+ }
13098
+ };
13099
+ /**
13100
+ * Helper to validate app environment before making a request.
13101
+ * @param request
13102
+ * @param interactionType
13103
+ */
13104
+ ClientApplication.prototype.preflightInteractiveRequest = function () {
13105
+ this.logger.verbose("preflightInteractiveRequest called, validating app environment");
13106
+ // block the reload if it occurred inside a hidden iframe
13107
+ BrowserUtils.blockReloadInHiddenIframes();
13108
+ // Set interaction in progress temporary cache or throw if alread set.
13109
+ this.browserStorage.setInteractionInProgress(true);
12869
13110
  };
12870
13111
  /**
12871
13112
  * Adds event callbacks to array
@@ -12957,7 +13198,7 @@ var SilentCacheClient = /** @class */ (function (_super) {
12957
13198
  switch (_a.label) {
12958
13199
  case 0:
12959
13200
  serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenSilent_silentFlow);
12960
- return [4 /*yield*/, this.createSilentFlowClient(serverTelemetryManager, silentRequest.authority)];
13201
+ return [4 /*yield*/, this.createSilentFlowClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions)];
12961
13202
  case 1:
12962
13203
  silentAuthClient = _a.sent();
12963
13204
  this.logger.verbose("Silent auth client created");
@@ -12992,12 +13233,12 @@ var SilentCacheClient = /** @class */ (function (_super) {
12992
13233
  * @param serverTelemetryManager
12993
13234
  * @param authorityUrl
12994
13235
  */
12995
- SilentCacheClient.prototype.createSilentFlowClient = function (serverTelemetryManager, authorityUrl) {
13236
+ SilentCacheClient.prototype.createSilentFlowClient = function (serverTelemetryManager, authorityUrl, azureCloudOptions) {
12996
13237
  return __awaiter$1(this, void 0, void 0, function () {
12997
13238
  var clientConfig;
12998
13239
  return __generator$1(this, function (_a) {
12999
13240
  switch (_a.label) {
13000
- case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl)];
13241
+ case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl, azureCloudOptions)];
13001
13242
  case 1:
13002
13243
  clientConfig = _a.sent();
13003
13244
  return [2 /*return*/, new SilentFlowClient(clientConfig)];
@@ -13006,7 +13247,17 @@ var SilentCacheClient = /** @class */ (function (_super) {
13006
13247
  });
13007
13248
  };
13008
13249
  SilentCacheClient.prototype.initializeSilentRequest = function (request, account) {
13009
- return __assign$1(__assign$1(__assign$1({}, request), this.initializeBaseRequest(request)), { account: account, forceRefresh: request.forceRefresh || false });
13250
+ return __awaiter$1(this, void 0, void 0, function () {
13251
+ var _a;
13252
+ return __generator$1(this, function (_b) {
13253
+ switch (_b.label) {
13254
+ case 0:
13255
+ _a = [__assign$1({}, request)];
13256
+ return [4 /*yield*/, this.initializeBaseRequest(request)];
13257
+ 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 }])];
13258
+ }
13259
+ });
13260
+ });
13010
13261
  };
13011
13262
  return SilentCacheClient;
13012
13263
  }(StandardInteractionClient));
@@ -13097,11 +13348,11 @@ var PublicClientApplication = /** @class */ (function (_super) {
13097
13348
  authority: request.authority || "",
13098
13349
  scopes: request.scopes,
13099
13350
  homeAccountIdentifier: account.homeAccountId,
13351
+ claims: request.claims,
13100
13352
  authenticationScheme: request.authenticationScheme,
13101
13353
  resourceRequestMethod: request.resourceRequestMethod,
13102
13354
  resourceRequestUri: request.resourceRequestUri,
13103
13355
  shrClaims: request.shrClaims,
13104
- sshJwk: request.sshJwk,
13105
13356
  sshKid: request.sshKid
13106
13357
  };
13107
13358
  silentRequestKey = JSON.stringify(thumbprint);
@@ -13138,28 +13389,33 @@ var PublicClientApplication = /** @class */ (function (_super) {
13138
13389
  var silentCacheClient, silentRequest;
13139
13390
  var _this = this;
13140
13391
  return __generator$1(this, function (_a) {
13141
- silentCacheClient = new SilentCacheClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, request.correlationId);
13142
- silentRequest = silentCacheClient.initializeSilentRequest(request, account);
13143
- this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Silent, request);
13144
- return [2 /*return*/, silentCacheClient.acquireToken(silentRequest).catch(function () { return __awaiter$1(_this, void 0, void 0, function () {
13145
- var tokenRenewalResult, tokenRenewalError_1;
13146
- return __generator$1(this, function (_a) {
13147
- switch (_a.label) {
13148
- case 0:
13149
- _a.trys.push([0, 2, , 3]);
13150
- return [4 /*yield*/, this.acquireTokenByRefreshToken(silentRequest)];
13151
- case 1:
13152
- tokenRenewalResult = _a.sent();
13153
- this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Silent, tokenRenewalResult);
13154
- return [2 /*return*/, tokenRenewalResult];
13155
- case 2:
13156
- tokenRenewalError_1 = _a.sent();
13157
- this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Silent, null, tokenRenewalError_1);
13158
- throw tokenRenewalError_1;
13159
- case 3: return [2 /*return*/];
13160
- }
13161
- });
13162
- }); })];
13392
+ switch (_a.label) {
13393
+ case 0:
13394
+ silentCacheClient = new SilentCacheClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, request.correlationId);
13395
+ return [4 /*yield*/, silentCacheClient.initializeSilentRequest(request, account)];
13396
+ case 1:
13397
+ silentRequest = _a.sent();
13398
+ this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Silent, request);
13399
+ return [2 /*return*/, silentCacheClient.acquireToken(silentRequest).catch(function () { return __awaiter$1(_this, void 0, void 0, function () {
13400
+ var tokenRenewalResult, tokenRenewalError_1;
13401
+ return __generator$1(this, function (_a) {
13402
+ switch (_a.label) {
13403
+ case 0:
13404
+ _a.trys.push([0, 2, , 3]);
13405
+ return [4 /*yield*/, this.acquireTokenByRefreshToken(silentRequest)];
13406
+ case 1:
13407
+ tokenRenewalResult = _a.sent();
13408
+ this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Silent, tokenRenewalResult);
13409
+ return [2 /*return*/, tokenRenewalResult];
13410
+ case 2:
13411
+ tokenRenewalError_1 = _a.sent();
13412
+ this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Silent, null, tokenRenewalError_1);
13413
+ throw tokenRenewalError_1;
13414
+ case 3: return [2 /*return*/];
13415
+ }
13416
+ });
13417
+ }); })];
13418
+ }
13163
13419
  });
13164
13420
  });
13165
13421
  };
@@ -13385,21 +13641,34 @@ exports.AuthErrorMessage = AuthErrorMessage;
13385
13641
  exports.AuthenticationHeaderParser = AuthenticationHeaderParser;
13386
13642
  exports.BrowserAuthError = BrowserAuthError;
13387
13643
  exports.BrowserAuthErrorMessage = BrowserAuthErrorMessage;
13644
+ exports.BrowserCacheManager = BrowserCacheManager;
13388
13645
  exports.BrowserConfigurationAuthError = BrowserConfigurationAuthError;
13389
13646
  exports.BrowserConfigurationAuthErrorMessage = BrowserConfigurationAuthErrorMessage;
13647
+ exports.BrowserConstants = BrowserConstants;
13390
13648
  exports.BrowserUtils = BrowserUtils;
13391
13649
  exports.ClientAuthError = ClientAuthError;
13392
13650
  exports.ClientAuthErrorMessage = ClientAuthErrorMessage;
13393
13651
  exports.ClientConfigurationError = ClientConfigurationError;
13394
13652
  exports.ClientConfigurationErrorMessage = ClientConfigurationErrorMessage;
13653
+ exports.DEFAULT_IFRAME_TIMEOUT_MS = DEFAULT_IFRAME_TIMEOUT_MS;
13654
+ exports.EventHandler = EventHandler;
13395
13655
  exports.EventMessageUtils = EventMessageUtils;
13396
13656
  exports.InteractionRequiredAuthError = InteractionRequiredAuthError;
13397
13657
  exports.InteractionRequiredAuthErrorMessage = InteractionRequiredAuthErrorMessage;
13398
13658
  exports.Logger = Logger;
13399
13659
  exports.NavigationClient = NavigationClient;
13660
+ exports.OIDC_DEFAULT_SCOPES = OIDC_DEFAULT_SCOPES;
13661
+ exports.PopupClient = PopupClient;
13662
+ exports.PopupUtils = PopupUtils;
13400
13663
  exports.PublicClientApplication = PublicClientApplication;
13664
+ exports.RedirectClient = RedirectClient;
13665
+ exports.RedirectHandler = RedirectHandler;
13401
13666
  exports.ServerError = ServerError;
13402
13667
  exports.SignedHttpRequest = SignedHttpRequest;
13668
+ exports.SilentCacheClient = SilentCacheClient;
13669
+ exports.SilentIframeClient = SilentIframeClient;
13670
+ exports.SilentRefreshClient = SilentRefreshClient;
13671
+ exports.StandardInteractionClient = StandardInteractionClient;
13403
13672
  exports.StringUtils = StringUtils;
13404
13673
  exports.UrlString = UrlString;
13405
13674
  exports.stubbedPublicClientApplication = stubbedPublicClientApplication;