@azure/msal-browser 2.21.0 → 2.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/CHANGELOG.json +73 -0
  2. package/CHANGELOG.md +18 -1
  3. package/README.md +1 -1
  4. package/dist/_virtual/_tslib.js +1 -1
  5. package/dist/app/ClientApplication.d.ts +7 -1
  6. package/dist/app/ClientApplication.d.ts.map +1 -1
  7. package/dist/app/ClientApplication.js +18 -3
  8. package/dist/app/ClientApplication.js.map +1 -1
  9. package/dist/app/IPublicClientApplication.js +1 -1
  10. package/dist/app/PublicClientApplication.d.ts +2 -2
  11. package/dist/app/PublicClientApplication.d.ts.map +1 -1
  12. package/dist/app/PublicClientApplication.js +1 -1
  13. package/dist/app/PublicClientApplication.js.map +1 -1
  14. package/dist/cache/AsyncMemoryStorage.js +1 -1
  15. package/dist/cache/BrowserCacheManager.d.ts +14 -12
  16. package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
  17. package/dist/cache/BrowserCacheManager.js +11 -7
  18. package/dist/cache/BrowserCacheManager.js.map +1 -1
  19. package/dist/cache/BrowserStorage.js +1 -1
  20. package/dist/cache/DatabaseStorage.js +1 -1
  21. package/dist/cache/MemoryStorage.js +1 -1
  22. package/dist/cache/TokenCache.d.ts.map +1 -1
  23. package/dist/cache/TokenCache.js +4 -3
  24. package/dist/cache/TokenCache.js.map +1 -1
  25. package/dist/config/Configuration.d.ts +10 -9
  26. package/dist/config/Configuration.d.ts.map +1 -1
  27. package/dist/config/Configuration.js +7 -3
  28. package/dist/config/Configuration.js.map +1 -1
  29. package/dist/crypto/BrowserCrypto.js +1 -1
  30. package/dist/crypto/CryptoOps.js +1 -1
  31. package/dist/crypto/GuidGenerator.js +1 -1
  32. package/dist/crypto/PkceGenerator.js +1 -1
  33. package/dist/crypto/SignedHttpRequest.js +1 -1
  34. package/dist/encode/Base64Decode.js +1 -1
  35. package/dist/encode/Base64Encode.js +1 -1
  36. package/dist/error/BrowserAuthError.js +1 -1
  37. package/dist/error/BrowserConfigurationAuthError.js +1 -1
  38. package/dist/event/EventHandler.js +1 -1
  39. package/dist/event/EventMessage.js +1 -1
  40. package/dist/event/EventType.js +1 -1
  41. package/dist/index.cjs.js +355 -234
  42. package/dist/index.cjs.js.map +1 -1
  43. package/dist/index.d.ts +14 -2
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +14 -3
  46. package/dist/index.js.map +1 -1
  47. package/dist/interaction_client/BaseInteractionClient.d.ts +1 -1
  48. package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
  49. package/dist/interaction_client/BaseInteractionClient.js +1 -1
  50. package/dist/interaction_client/BaseInteractionClient.js.map +1 -1
  51. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +1 -1
  52. package/dist/interaction_client/PopupClient.d.ts +4 -3
  53. package/dist/interaction_client/PopupClient.d.ts.map +1 -1
  54. package/dist/interaction_client/PopupClient.js +52 -60
  55. package/dist/interaction_client/PopupClient.js.map +1 -1
  56. package/dist/interaction_client/RedirectClient.d.ts +3 -3
  57. package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
  58. package/dist/interaction_client/RedirectClient.js +9 -8
  59. package/dist/interaction_client/RedirectClient.js.map +1 -1
  60. package/dist/interaction_client/SilentAuthCodeClient.d.ts.map +1 -1
  61. package/dist/interaction_client/SilentAuthCodeClient.js +2 -1
  62. package/dist/interaction_client/SilentAuthCodeClient.js.map +1 -1
  63. package/dist/interaction_client/SilentCacheClient.d.ts +2 -2
  64. package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
  65. package/dist/interaction_client/SilentCacheClient.js +4 -4
  66. package/dist/interaction_client/SilentCacheClient.js.map +1 -1
  67. package/dist/interaction_client/SilentIframeClient.d.ts +3 -3
  68. package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
  69. package/dist/interaction_client/SilentIframeClient.js +3 -2
  70. package/dist/interaction_client/SilentIframeClient.js.map +1 -1
  71. package/dist/interaction_client/SilentRefreshClient.d.ts +2 -2
  72. package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
  73. package/dist/interaction_client/SilentRefreshClient.js +4 -4
  74. package/dist/interaction_client/SilentRefreshClient.js.map +1 -1
  75. package/dist/interaction_client/StandardInteractionClient.d.ts +10 -10
  76. package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
  77. package/dist/interaction_client/StandardInteractionClient.js +58 -44
  78. package/dist/interaction_client/StandardInteractionClient.js.map +1 -1
  79. package/dist/interaction_handler/InteractionHandler.js +1 -1
  80. package/dist/interaction_handler/PopupHandler.d.ts.map +1 -1
  81. package/dist/interaction_handler/PopupHandler.js +1 -3
  82. package/dist/interaction_handler/PopupHandler.js.map +1 -1
  83. package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
  84. package/dist/interaction_handler/RedirectHandler.js +1 -2
  85. package/dist/interaction_handler/RedirectHandler.js.map +1 -1
  86. package/dist/interaction_handler/SilentHandler.js +1 -1
  87. package/dist/navigation/NavigationClient.js +1 -1
  88. package/dist/network/FetchClient.js +1 -1
  89. package/dist/network/XhrClient.js +1 -1
  90. package/dist/packageMetadata.d.ts +1 -1
  91. package/dist/packageMetadata.js +2 -2
  92. package/dist/packageMetadata.js.map +1 -1
  93. package/dist/request/EndSessionPopupRequest.d.ts +1 -0
  94. package/dist/request/EndSessionPopupRequest.d.ts.map +1 -1
  95. package/dist/request/EndSessionRequest.d.ts +1 -0
  96. package/dist/request/EndSessionRequest.d.ts.map +1 -1
  97. package/dist/utils/BrowserConstants.d.ts +2 -1
  98. package/dist/utils/BrowserConstants.d.ts.map +1 -1
  99. package/dist/utils/BrowserConstants.js +2 -1
  100. package/dist/utils/BrowserConstants.js.map +1 -1
  101. package/dist/utils/BrowserProtocolUtils.js +1 -1
  102. package/dist/utils/BrowserStringUtils.js +1 -1
  103. package/dist/utils/BrowserUtils.js +1 -1
  104. package/dist/utils/MathUtils.js +1 -1
  105. package/dist/utils/PopupUtils.d.ts +1 -2
  106. package/dist/utils/PopupUtils.d.ts.map +1 -1
  107. package/dist/utils/PopupUtils.js +3 -3
  108. package/dist/utils/PopupUtils.js.map +1 -1
  109. package/lib/msal-browser.js +355 -234
  110. package/lib/msal-browser.js.map +1 -1
  111. package/lib/msal-browser.min.js +35 -30
  112. package/package.json +2 -2
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v2.21.0 2022-01-04 */
1
+ /*! @azure/msal-browser v2.22.0 2022-02-08 */
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 v6.0.0 2022-01-04 */
108
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
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 v6.0.0 2022-01-04 */
195
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
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 v6.0.0 2022-01-04 */
559
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
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 v6.0.0 2022-01-04 */
603
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
602
604
 
603
605
  /*
604
606
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -673,7 +675,7 @@ var DEFAULT_CRYPTO_IMPLEMENTATION = {
673
675
  }
674
676
  };
675
677
 
676
- /*! @azure/msal-common v6.0.0 2022-01-04 */
678
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
677
679
 
678
680
  /*
679
681
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1135,7 +1137,7 @@ var ClientAuthError = /** @class */ (function (_super) {
1135
1137
  return ClientAuthError;
1136
1138
  }(AuthError));
1137
1139
 
1138
- /*! @azure/msal-common v6.0.0 2022-01-04 */
1140
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
1139
1141
 
1140
1142
  /*
1141
1143
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1260,7 +1262,7 @@ var StringUtils = /** @class */ (function () {
1260
1262
  return StringUtils;
1261
1263
  }());
1262
1264
 
1263
- /*! @azure/msal-common v6.0.0 2022-01-04 */
1265
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
1264
1266
 
1265
1267
  /*
1266
1268
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1440,12 +1442,31 @@ var Logger = /** @class */ (function () {
1440
1442
  return Logger;
1441
1443
  }());
1442
1444
 
1443
- /*! @azure/msal-common v6.0.0 2022-01-04 */
1445
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
1444
1446
  /* eslint-disable header/header */
1445
1447
  var name$1 = "@azure/msal-common";
1446
- var version$1 = "6.0.0";
1448
+ var version$1 = "6.1.0";
1447
1449
 
1448
- /*! @azure/msal-common v6.0.0 2022-01-04 */
1450
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
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-02-08 */
1449
1470
 
1450
1471
  /*
1451
1472
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1604,7 +1625,7 @@ var CredentialEntity = /** @class */ (function () {
1604
1625
  return CredentialEntity;
1605
1626
  }());
1606
1627
 
1607
- /*! @azure/msal-common v6.0.0 2022-01-04 */
1628
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
1608
1629
 
1609
1630
  /*
1610
1631
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1686,6 +1707,10 @@ var ClientConfigurationErrorMessage = {
1686
1707
  code: "untrusted_authority",
1687
1708
  desc: "The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter."
1688
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
+ },
1689
1714
  missingSshJwk: {
1690
1715
  code: "missing_ssh_jwk",
1691
1716
  desc: "Missing sshJwk in SSH certificate request. A stringified JSON Web Key is required when using the SSH authentication scheme."
@@ -1822,7 +1847,13 @@ var ClientConfigurationError = /** @class */ (function (_super) {
1822
1847
  ClientConfigurationError.createUntrustedAuthorityError = function () {
1823
1848
  return new ClientConfigurationError(ClientConfigurationErrorMessage.untrustedAuthority.code, ClientConfigurationErrorMessage.untrustedAuthority.desc);
1824
1849
  };
1825
- /*
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
+ /**
1826
1857
  * Throws an error when the authentication scheme is set to SSH but the SSH public key is omitted from the request
1827
1858
  */
1828
1859
  ClientConfigurationError.createMissingSshJwkError = function () {
@@ -1849,7 +1880,7 @@ var ClientConfigurationError = /** @class */ (function (_super) {
1849
1880
  return ClientConfigurationError;
1850
1881
  }(ClientAuthError));
1851
1882
 
1852
- /*! @azure/msal-common v6.0.0 2022-01-04 */
1883
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
1853
1884
 
1854
1885
  /*
1855
1886
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2033,7 +2064,7 @@ var ScopeSet = /** @class */ (function () {
2033
2064
  return ScopeSet;
2034
2065
  }());
2035
2066
 
2036
- /*! @azure/msal-common v6.0.0 2022-01-04 */
2067
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
2037
2068
 
2038
2069
  /*
2039
2070
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2071,7 +2102,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
2071
2102
  };
2072
2103
  }
2073
2104
 
2074
- /*! @azure/msal-common v6.0.0 2022-01-04 */
2105
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
2075
2106
  /*
2076
2107
  * Copyright (c) Microsoft Corporation. All rights reserved.
2077
2108
  * Licensed under the MIT License.
@@ -2085,7 +2116,7 @@ var AuthorityType;
2085
2116
  AuthorityType[AuthorityType["Adfs"] = 1] = "Adfs";
2086
2117
  })(AuthorityType || (AuthorityType = {}));
2087
2118
 
2088
- /*! @azure/msal-common v6.0.0 2022-01-04 */
2119
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
2089
2120
 
2090
2121
  /*
2091
2122
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2319,7 +2350,7 @@ var AccountEntity = /** @class */ (function () {
2319
2350
  return AccountEntity;
2320
2351
  }());
2321
2352
 
2322
- /*! @azure/msal-common v6.0.0 2022-01-04 */
2353
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
2323
2354
 
2324
2355
  /*
2325
2356
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2357,7 +2388,7 @@ var AuthToken = /** @class */ (function () {
2357
2388
  return AuthToken;
2358
2389
  }());
2359
2390
 
2360
- /*! @azure/msal-common v6.0.0 2022-01-04 */
2391
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
2361
2392
 
2362
2393
  /*
2363
2394
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3199,7 +3230,7 @@ var DefaultStorageClass = /** @class */ (function (_super) {
3199
3230
  return DefaultStorageClass;
3200
3231
  }(CacheManager));
3201
3232
 
3202
- /*! @azure/msal-common v6.0.0 2022-01-04 */
3233
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
3203
3234
 
3204
3235
  /*
3205
3236
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3209,7 +3240,8 @@ var DefaultStorageClass = /** @class */ (function (_super) {
3209
3240
  var DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
3210
3241
  var DEFAULT_SYSTEM_OPTIONS = {
3211
3242
  tokenRenewalOffsetSeconds: DEFAULT_TOKEN_RENEWAL_OFFSET_SEC,
3212
- preventCorsPreflight: false
3243
+ preventCorsPreflight: false,
3244
+ proxyUrl: "",
3213
3245
  };
3214
3246
  var DEFAULT_LOGGER_IMPLEMENTATION = {
3215
3247
  loggerCallback: function () {
@@ -3249,6 +3281,10 @@ var DEFAULT_CLIENT_CREDENTIALS = {
3249
3281
  clientSecret: "",
3250
3282
  clientAssertion: undefined
3251
3283
  };
3284
+ var DEFAULT_AZURE_CLOUD_OPTIONS = {
3285
+ azureCloudInstance: exports.AzureCloudInstance.None,
3286
+ tenant: "" + Constants.DEFAULT_COMMON_TENANT
3287
+ };
3252
3288
  /**
3253
3289
  * Function that sets the default options when not explicitly configured from app developer
3254
3290
  *
@@ -3278,10 +3314,10 @@ function buildClientConfiguration(_a) {
3278
3314
  * @param authOptions
3279
3315
  */
3280
3316
  function buildAuthOptions(authOptions) {
3281
- return __assign({ clientCapabilities: [] }, authOptions);
3317
+ return __assign({ clientCapabilities: [], azureCloudOptions: DEFAULT_AZURE_CLOUD_OPTIONS }, authOptions);
3282
3318
  }
3283
3319
 
3284
- /*! @azure/msal-common v6.0.0 2022-01-04 */
3320
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
3285
3321
 
3286
3322
  /*
3287
3323
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3301,7 +3337,7 @@ var ServerError = /** @class */ (function (_super) {
3301
3337
  return ServerError;
3302
3338
  }(AuthError));
3303
3339
 
3304
- /*! @azure/msal-common v6.0.0 2022-01-04 */
3340
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
3305
3341
 
3306
3342
  /*
3307
3343
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3397,7 +3433,7 @@ var ThrottlingUtils = /** @class */ (function () {
3397
3433
  return ThrottlingUtils;
3398
3434
  }());
3399
3435
 
3400
- /*! @azure/msal-common v6.0.0 2022-01-04 */
3436
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
3401
3437
 
3402
3438
  /*
3403
3439
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3446,7 +3482,7 @@ var NetworkManager = /** @class */ (function () {
3446
3482
  return NetworkManager;
3447
3483
  }());
3448
3484
 
3449
- /*! @azure/msal-common v6.0.0 2022-01-04 */
3485
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
3450
3486
  /*
3451
3487
  * Copyright (c) Microsoft Corporation. All rights reserved.
3452
3488
  * Licensed under the MIT License.
@@ -3457,7 +3493,7 @@ var CcsCredentialType;
3457
3493
  CcsCredentialType["UPN"] = "UPN";
3458
3494
  })(CcsCredentialType || (CcsCredentialType = {}));
3459
3495
 
3460
- /*! @azure/msal-common v6.0.0 2022-01-04 */
3496
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
3461
3497
 
3462
3498
  /*
3463
3499
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3521,7 +3557,7 @@ var BaseClient = /** @class */ (function () {
3521
3557
  var response;
3522
3558
  return __generator(this, function (_a) {
3523
3559
  switch (_a.label) {
3524
- 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 })];
3525
3561
  case 1:
3526
3562
  response = _a.sent();
3527
3563
  if (this.config.serverTelemetryManager && response.status < 500 && response.status !== 429) {
@@ -3546,7 +3582,7 @@ var BaseClient = /** @class */ (function () {
3546
3582
  return BaseClient;
3547
3583
  }());
3548
3584
 
3549
- /*! @azure/msal-common v6.0.0 2022-01-04 */
3585
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
3550
3586
 
3551
3587
  /*
3552
3588
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3632,7 +3668,7 @@ var RequestValidator = /** @class */ (function () {
3632
3668
  return RequestValidator;
3633
3669
  }());
3634
3670
 
3635
- /*! @azure/msal-common v6.0.0 2022-01-04 */
3671
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
3636
3672
 
3637
3673
  /*
3638
3674
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3959,6 +3995,12 @@ var RequestParameterBuilder = /** @class */ (function () {
3959
3995
  RequestParameterBuilder.prototype.addThrottling = function () {
3960
3996
  this.parameters.set(AADServerParamKeys.X_MS_LIB_CAPABILITY, ThrottlingConstants.X_MS_LIB_CAPABILITY_VALUE);
3961
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
+ };
3962
4004
  /**
3963
4005
  * Utility to create a URL from the params map
3964
4006
  */
@@ -3972,7 +4014,7 @@ var RequestParameterBuilder = /** @class */ (function () {
3972
4014
  return RequestParameterBuilder;
3973
4015
  }());
3974
4016
 
3975
- /*! @azure/msal-common v6.0.0 2022-01-04 */
4017
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
3976
4018
 
3977
4019
  /*
3978
4020
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4037,7 +4079,7 @@ var IdTokenEntity = /** @class */ (function (_super) {
4037
4079
  return IdTokenEntity;
4038
4080
  }(CredentialEntity));
4039
4081
 
4040
- /*! @azure/msal-common v6.0.0 2022-01-04 */
4082
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
4041
4083
  /*
4042
4084
  * Copyright (c) Microsoft Corporation. All rights reserved.
4043
4085
  * Licensed under the MIT License.
@@ -4087,7 +4129,7 @@ var TimeUtils = /** @class */ (function () {
4087
4129
  return TimeUtils;
4088
4130
  }());
4089
4131
 
4090
- /*! @azure/msal-common v6.0.0 2022-01-04 */
4132
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
4091
4133
 
4092
4134
  /*
4093
4135
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4201,7 +4243,7 @@ var AccessTokenEntity = /** @class */ (function (_super) {
4201
4243
  return AccessTokenEntity;
4202
4244
  }(CredentialEntity));
4203
4245
 
4204
- /*! @azure/msal-common v6.0.0 2022-01-04 */
4246
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
4205
4247
 
4206
4248
  /*
4207
4249
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4268,7 +4310,7 @@ var RefreshTokenEntity = /** @class */ (function (_super) {
4268
4310
  return RefreshTokenEntity;
4269
4311
  }(CredentialEntity));
4270
4312
 
4271
- /*! @azure/msal-common v6.0.0 2022-01-04 */
4313
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
4272
4314
 
4273
4315
  /*
4274
4316
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4332,7 +4374,7 @@ var InteractionRequiredAuthError = /** @class */ (function (_super) {
4332
4374
  return InteractionRequiredAuthError;
4333
4375
  }(AuthError));
4334
4376
 
4335
- /*! @azure/msal-common v6.0.0 2022-01-04 */
4377
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
4336
4378
  /*
4337
4379
  * Copyright (c) Microsoft Corporation. All rights reserved.
4338
4380
  * Licensed under the MIT License.
@@ -4348,7 +4390,7 @@ var CacheRecord = /** @class */ (function () {
4348
4390
  return CacheRecord;
4349
4391
  }());
4350
4392
 
4351
- /*! @azure/msal-common v6.0.0 2022-01-04 */
4393
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
4352
4394
 
4353
4395
  /*
4354
4396
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4419,7 +4461,7 @@ var ProtocolUtils = /** @class */ (function () {
4419
4461
  return ProtocolUtils;
4420
4462
  }());
4421
4463
 
4422
- /*! @azure/msal-common v6.0.0 2022-01-04 */
4464
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
4423
4465
 
4424
4466
  /*
4425
4467
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4620,7 +4662,7 @@ var UrlString = /** @class */ (function () {
4620
4662
  return UrlString;
4621
4663
  }());
4622
4664
 
4623
- /*! @azure/msal-common v6.0.0 2022-01-04 */
4665
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
4624
4666
 
4625
4667
  /*
4626
4668
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4695,7 +4737,7 @@ var PopTokenGenerator = /** @class */ (function () {
4695
4737
  return PopTokenGenerator;
4696
4738
  }());
4697
4739
 
4698
- /*! @azure/msal-common v6.0.0 2022-01-04 */
4740
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
4699
4741
 
4700
4742
  /*
4701
4743
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4765,7 +4807,7 @@ var AppMetadataEntity = /** @class */ (function () {
4765
4807
  return AppMetadataEntity;
4766
4808
  }());
4767
4809
 
4768
- /*! @azure/msal-common v6.0.0 2022-01-04 */
4810
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
4769
4811
  /*
4770
4812
  * Copyright (c) Microsoft Corporation. All rights reserved.
4771
4813
  * Licensed under the MIT License.
@@ -4801,7 +4843,7 @@ var AppMetadataEntity = /** @class */ (function () {
4801
4843
  return TokenCacheContext;
4802
4844
  }());
4803
4845
 
4804
- /*! @azure/msal-common v6.0.0 2022-01-04 */
4846
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
4805
4847
 
4806
4848
  /*
4807
4849
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5066,7 +5108,7 @@ var ResponseHandler = /** @class */ (function () {
5066
5108
  return ResponseHandler;
5067
5109
  }());
5068
5110
 
5069
- /*! @azure/msal-common v6.0.0 2022-01-04 */
5111
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
5070
5112
 
5071
5113
  /*
5072
5114
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5455,6 +5497,9 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5455
5497
  if (request.state) {
5456
5498
  parameterBuilder.addState(request.state);
5457
5499
  }
5500
+ if (request.logoutHint) {
5501
+ parameterBuilder.addLogoutHint(request.logoutHint);
5502
+ }
5458
5503
  if (request.extraQueryParameters) {
5459
5504
  parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);
5460
5505
  }
@@ -5474,7 +5519,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5474
5519
  return AuthorizationCodeClient;
5475
5520
  }(BaseClient));
5476
5521
 
5477
- /*! @azure/msal-common v6.0.0 2022-01-04 */
5522
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
5478
5523
 
5479
5524
  /*
5480
5525
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5685,7 +5730,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5685
5730
  return RefreshTokenClient;
5686
5731
  }(BaseClient));
5687
5732
 
5688
- /*! @azure/msal-common v6.0.0 2022-01-04 */
5733
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
5689
5734
 
5690
5735
  /*
5691
5736
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5801,7 +5846,7 @@ var SilentFlowClient = /** @class */ (function (_super) {
5801
5846
  return SilentFlowClient;
5802
5847
  }(BaseClient));
5803
5848
 
5804
- /*! @azure/msal-common v6.0.0 2022-01-04 */
5849
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
5805
5850
  /*
5806
5851
  * Copyright (c) Microsoft Corporation. All rights reserved.
5807
5852
  * Licensed under the MIT License.
@@ -5812,7 +5857,7 @@ function isOpenIdConfigResponse(response) {
5812
5857
  response.hasOwnProperty("issuer"));
5813
5858
  }
5814
5859
 
5815
- /*! @azure/msal-common v6.0.0 2022-01-04 */
5860
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
5816
5861
  /*
5817
5862
  * Copyright (c) Microsoft Corporation. All rights reserved.
5818
5863
  * Licensed under the MIT License.
@@ -5826,7 +5871,7 @@ exports.ProtocolMode = void 0;
5826
5871
  ProtocolMode["OIDC"] = "OIDC";
5827
5872
  })(exports.ProtocolMode || (exports.ProtocolMode = {}));
5828
5873
 
5829
- /*! @azure/msal-common v6.0.0 2022-01-04 */
5874
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
5830
5875
 
5831
5876
  /*
5832
5877
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5901,7 +5946,7 @@ var AuthorityMetadataEntity = /** @class */ (function () {
5901
5946
  return AuthorityMetadataEntity;
5902
5947
  }());
5903
5948
 
5904
- /*! @azure/msal-common v6.0.0 2022-01-04 */
5949
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
5905
5950
  /*
5906
5951
  * Copyright (c) Microsoft Corporation. All rights reserved.
5907
5952
  * Licensed under the MIT License.
@@ -5911,7 +5956,7 @@ function isCloudInstanceDiscoveryResponse(response) {
5911
5956
  response.hasOwnProperty("metadata"));
5912
5957
  }
5913
5958
 
5914
- /*! @azure/msal-common v6.0.0 2022-01-04 */
5959
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
5915
5960
 
5916
5961
  /*
5917
5962
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5926,18 +5971,22 @@ var RegionDiscovery = /** @class */ (function () {
5926
5971
  *
5927
5972
  * @returns Promise<string | null>
5928
5973
  */
5929
- RegionDiscovery.prototype.detectRegion = function (environmentRegion, regionDiscoveryMetadata) {
5974
+ RegionDiscovery.prototype.detectRegion = function (environmentRegion, regionDiscoveryMetadata, proxyUrl) {
5930
5975
  return __awaiter(this, void 0, void 0, function () {
5931
- var autodetectedRegionName, localIMDSVersionResponse, currentIMDSVersion, currentIMDSVersionResponse;
5976
+ var autodetectedRegionName, options, localIMDSVersionResponse, currentIMDSVersion, currentIMDSVersionResponse;
5932
5977
  return __generator(this, function (_a) {
5933
5978
  switch (_a.label) {
5934
5979
  case 0:
5935
5980
  autodetectedRegionName = environmentRegion;
5936
5981
  if (!!autodetectedRegionName) return [3 /*break*/, 8];
5982
+ options = RegionDiscovery.IMDS_OPTIONS;
5983
+ if (proxyUrl) {
5984
+ options.proxyUrl = proxyUrl;
5985
+ }
5937
5986
  _a.label = 1;
5938
5987
  case 1:
5939
5988
  _a.trys.push([1, 6, , 7]);
5940
- return [4 /*yield*/, this.getRegionFromIMDS(Constants.IMDS_VERSION)];
5989
+ return [4 /*yield*/, this.getRegionFromIMDS(Constants.IMDS_VERSION, options)];
5941
5990
  case 2:
5942
5991
  localIMDSVersionResponse = _a.sent();
5943
5992
  if (localIMDSVersionResponse.status === ResponseCodes.httpSuccess) {
@@ -5945,14 +5994,14 @@ var RegionDiscovery = /** @class */ (function () {
5945
5994
  regionDiscoveryMetadata.region_source = RegionDiscoverySources.IMDS;
5946
5995
  }
5947
5996
  if (!(localIMDSVersionResponse.status === ResponseCodes.httpBadRequest)) return [3 /*break*/, 5];
5948
- return [4 /*yield*/, this.getCurrentVersion()];
5997
+ return [4 /*yield*/, this.getCurrentVersion(options)];
5949
5998
  case 3:
5950
5999
  currentIMDSVersion = _a.sent();
5951
6000
  if (!currentIMDSVersion) {
5952
6001
  regionDiscoveryMetadata.region_source = RegionDiscoverySources.FAILED_AUTO_DETECTION;
5953
6002
  return [2 /*return*/, null];
5954
6003
  }
5955
- return [4 /*yield*/, this.getRegionFromIMDS(currentIMDSVersion)];
6004
+ return [4 /*yield*/, this.getRegionFromIMDS(currentIMDSVersion, options)];
5956
6005
  case 4:
5957
6006
  currentIMDSVersionResponse = _a.sent();
5958
6007
  if (currentIMDSVersionResponse.status === ResponseCodes.httpSuccess) {
@@ -5985,10 +6034,10 @@ var RegionDiscovery = /** @class */ (function () {
5985
6034
  * @param imdsEndpointUrl
5986
6035
  * @returns Promise<NetworkResponse<string>>
5987
6036
  */
5988
- RegionDiscovery.prototype.getRegionFromIMDS = function (version) {
6037
+ RegionDiscovery.prototype.getRegionFromIMDS = function (version, options) {
5989
6038
  return __awaiter(this, void 0, void 0, function () {
5990
6039
  return __generator(this, function (_a) {
5991
- 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)];
5992
6041
  });
5993
6042
  });
5994
6043
  };
@@ -5997,14 +6046,14 @@ var RegionDiscovery = /** @class */ (function () {
5997
6046
  *
5998
6047
  * @returns Promise<string | null>
5999
6048
  */
6000
- RegionDiscovery.prototype.getCurrentVersion = function () {
6049
+ RegionDiscovery.prototype.getCurrentVersion = function (options) {
6001
6050
  return __awaiter(this, void 0, void 0, function () {
6002
6051
  var response;
6003
6052
  return __generator(this, function (_a) {
6004
6053
  switch (_a.label) {
6005
6054
  case 0:
6006
6055
  _a.trys.push([0, 2, , 3]);
6007
- 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)];
6008
6057
  case 1:
6009
6058
  response = _a.sent();
6010
6059
  // When IMDS endpoint is called without the api version query param, bad request response comes back with latest version.
@@ -6021,11 +6070,15 @@ var RegionDiscovery = /** @class */ (function () {
6021
6070
  });
6022
6071
  };
6023
6072
  // Options for the IMDS endpoint request
6024
- RegionDiscovery.IMDS_OPTIONS = { headers: { "Metadata": "true" } };
6073
+ RegionDiscovery.IMDS_OPTIONS = {
6074
+ headers: {
6075
+ Metadata: "true",
6076
+ },
6077
+ };
6025
6078
  return RegionDiscovery;
6026
6079
  }());
6027
6080
 
6028
- /*! @azure/msal-common v6.0.0 2022-01-04 */
6081
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
6029
6082
 
6030
6083
  /*
6031
6084
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6036,7 +6089,7 @@ var RegionDiscovery = /** @class */ (function () {
6036
6089
  * endpoint. It will store the pertinent config data in this object for use during token calls.
6037
6090
  */
6038
6091
  var Authority = /** @class */ (function () {
6039
- function Authority(authority, networkInterface, cacheManager, authorityOptions) {
6092
+ function Authority(authority, networkInterface, cacheManager, authorityOptions, proxyUrl) {
6040
6093
  this.canonicalAuthority = authority;
6041
6094
  this._canonicalAuthority.validateAsUri();
6042
6095
  this.networkInterface = networkInterface;
@@ -6044,6 +6097,7 @@ var Authority = /** @class */ (function () {
6044
6097
  this.authorityOptions = authorityOptions;
6045
6098
  this.regionDiscovery = new RegionDiscovery(networkInterface);
6046
6099
  this.regionDiscoveryMetadata = { region_used: undefined, region_source: undefined, region_outcome: undefined };
6100
+ this.proxyUrl = proxyUrl || Constants.EMPTY_STRING;
6047
6101
  }
6048
6102
  Object.defineProperty(Authority.prototype, "authorityType", {
6049
6103
  // See above for AuthorityType
@@ -6312,7 +6366,7 @@ var Authority = /** @class */ (function () {
6312
6366
  metadata = _b.sent();
6313
6367
  if (!metadata) return [3 /*break*/, 4];
6314
6368
  if (!((_a = this.authorityOptions.azureRegionConfiguration) === null || _a === void 0 ? void 0 : _a.azureRegion)) return [3 /*break*/, 3];
6315
- 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)];
6316
6370
  case 2:
6317
6371
  autodetectedRegionName = _b.sent();
6318
6372
  azureRegion = this.authorityOptions.azureRegionConfiguration.azureRegion === Constants.AZURE_REGION_AUTO_DISCOVER_FLAG
@@ -6375,19 +6429,25 @@ var Authority = /** @class */ (function () {
6375
6429
  */
6376
6430
  Authority.prototype.getEndpointMetadataFromNetwork = function () {
6377
6431
  return __awaiter(this, void 0, void 0, function () {
6378
- var response;
6432
+ var options, response;
6379
6433
  return __generator(this, function (_a) {
6380
6434
  switch (_a.label) {
6381
6435
  case 0:
6382
- _a.trys.push([0, 2, , 3]);
6383
- return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(this.defaultOpenIdConfigurationEndpoint)];
6436
+ options = {};
6437
+ if (this.proxyUrl) {
6438
+ options.proxyUrl = this.proxyUrl;
6439
+ }
6440
+ _a.label = 1;
6384
6441
  case 1:
6442
+ _a.trys.push([1, 3, , 4]);
6443
+ return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(this.defaultOpenIdConfigurationEndpoint, options)];
6444
+ case 2:
6385
6445
  response = _a.sent();
6386
6446
  return [2 /*return*/, isOpenIdConfigResponse(response.body) ? response.body : null];
6387
- case 2:
6447
+ case 3:
6388
6448
  _a.sent();
6389
6449
  return [2 /*return*/, null];
6390
- case 3: return [2 /*return*/];
6450
+ case 4: return [2 /*return*/];
6391
6451
  }
6392
6452
  });
6393
6453
  });
@@ -6457,16 +6517,20 @@ var Authority = /** @class */ (function () {
6457
6517
  */
6458
6518
  Authority.prototype.getCloudDiscoveryMetadataFromNetwork = function () {
6459
6519
  return __awaiter(this, void 0, void 0, function () {
6460
- var instanceDiscoveryEndpoint, match, response, metadata;
6520
+ var instanceDiscoveryEndpoint, options, match, response, metadata;
6461
6521
  return __generator(this, function (_a) {
6462
6522
  switch (_a.label) {
6463
6523
  case 0:
6464
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
+ }
6465
6529
  match = null;
6466
6530
  _a.label = 1;
6467
6531
  case 1:
6468
6532
  _a.trys.push([1, 3, , 4]);
6469
- return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(instanceDiscoveryEndpoint)];
6533
+ return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(instanceDiscoveryEndpoint, options)];
6470
6534
  case 2:
6471
6535
  response = _a.sent();
6472
6536
  metadata = isCloudInstanceDiscoveryResponse(response.body) ? response.body.metadata : [];
@@ -6481,7 +6545,7 @@ var Authority = /** @class */ (function () {
6481
6545
  return [2 /*return*/, null];
6482
6546
  case 4:
6483
6547
  if (!match) {
6484
- // Custom Domain scenario, host is trusted because Instance Discovery call succeeded
6548
+ // Custom Domain scenario, host is trusted because Instance Discovery call succeeded
6485
6549
  match = Authority.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);
6486
6550
  }
6487
6551
  return [2 /*return*/, match];
@@ -6499,6 +6563,19 @@ var Authority = /** @class */ (function () {
6499
6563
  });
6500
6564
  return matches.length > 0;
6501
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
+ };
6502
6579
  /**
6503
6580
  * Creates cloud discovery metadata object from a given host
6504
6581
  * @param host
@@ -6591,7 +6668,7 @@ var Authority = /** @class */ (function () {
6591
6668
  return Authority;
6592
6669
  }());
6593
6670
 
6594
- /*! @azure/msal-common v6.0.0 2022-01-04 */
6671
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
6595
6672
 
6596
6673
  /*
6597
6674
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6610,13 +6687,13 @@ var AuthorityFactory = /** @class */ (function () {
6610
6687
  * @param networkClient
6611
6688
  * @param protocolMode
6612
6689
  */
6613
- AuthorityFactory.createDiscoveredInstance = function (authorityUri, networkClient, cacheManager, authorityOptions) {
6690
+ AuthorityFactory.createDiscoveredInstance = function (authorityUri, networkClient, cacheManager, authorityOptions, proxyUrl) {
6614
6691
  return __awaiter(this, void 0, void 0, function () {
6615
6692
  var acquireTokenAuthority, e_1;
6616
6693
  return __generator(this, function (_a) {
6617
6694
  switch (_a.label) {
6618
6695
  case 0:
6619
- acquireTokenAuthority = AuthorityFactory.createInstance(authorityUri, networkClient, cacheManager, authorityOptions);
6696
+ acquireTokenAuthority = AuthorityFactory.createInstance(authorityUri, networkClient, cacheManager, authorityOptions, proxyUrl);
6620
6697
  _a.label = 1;
6621
6698
  case 1:
6622
6699
  _a.trys.push([1, 3, , 4]);
@@ -6642,17 +6719,17 @@ var AuthorityFactory = /** @class */ (function () {
6642
6719
  * @param networkInterface
6643
6720
  * @param protocolMode
6644
6721
  */
6645
- AuthorityFactory.createInstance = function (authorityUrl, networkInterface, cacheManager, authorityOptions) {
6722
+ AuthorityFactory.createInstance = function (authorityUrl, networkInterface, cacheManager, authorityOptions, proxyUrl) {
6646
6723
  // Throw error if authority url is empty
6647
6724
  if (StringUtils.isEmpty(authorityUrl)) {
6648
6725
  throw ClientConfigurationError.createUrlEmptyError();
6649
6726
  }
6650
- return new Authority(authorityUrl, networkInterface, cacheManager, authorityOptions);
6727
+ return new Authority(authorityUrl, networkInterface, cacheManager, authorityOptions, proxyUrl);
6651
6728
  };
6652
6729
  return AuthorityFactory;
6653
6730
  }());
6654
6731
 
6655
- /*! @azure/msal-common v6.0.0 2022-01-04 */
6732
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
6656
6733
 
6657
6734
  /*
6658
6735
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6683,7 +6760,7 @@ var ServerTelemetryEntity = /** @class */ (function () {
6683
6760
  return ServerTelemetryEntity;
6684
6761
  }());
6685
6762
 
6686
- /*! @azure/msal-common v6.0.0 2022-01-04 */
6763
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
6687
6764
 
6688
6765
  /*
6689
6766
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6711,7 +6788,7 @@ var ThrottlingEntity = /** @class */ (function () {
6711
6788
  return ThrottlingEntity;
6712
6789
  }());
6713
6790
 
6714
- /*! @azure/msal-common v6.0.0 2022-01-04 */
6791
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
6715
6792
 
6716
6793
  /*
6717
6794
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6728,7 +6805,7 @@ var StubbedNetworkModule = {
6728
6805
  }
6729
6806
  };
6730
6807
 
6731
- /*! @azure/msal-common v6.0.0 2022-01-04 */
6808
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
6732
6809
 
6733
6810
  /*
6734
6811
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6787,7 +6864,7 @@ var AuthenticationHeaderParser = /** @class */ (function () {
6787
6864
  return AuthenticationHeaderParser;
6788
6865
  }());
6789
6866
 
6790
- /*! @azure/msal-common v6.0.0 2022-01-04 */
6867
+ /*! @azure/msal-common v6.1.0 2022-02-08 */
6791
6868
 
6792
6869
  /*
6793
6870
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7003,7 +7080,7 @@ var HTTP_REQUEST_TYPE;
7003
7080
  /**
7004
7081
  * Temporary cache keys for MSAL, deleted after any request.
7005
7082
  */
7006
- var TemporaryCacheKeys;
7083
+ exports.TemporaryCacheKeys = void 0;
7007
7084
  (function (TemporaryCacheKeys) {
7008
7085
  TemporaryCacheKeys["AUTHORITY"] = "authority";
7009
7086
  TemporaryCacheKeys["ACQUIRE_TOKEN_ACCOUNT"] = "acquireToken.account";
@@ -7018,7 +7095,7 @@ var TemporaryCacheKeys;
7018
7095
  TemporaryCacheKeys["INTERACTION_STATUS_KEY"] = "interaction.status";
7019
7096
  TemporaryCacheKeys["CCS_CREDENTIAL"] = "ccs.credential";
7020
7097
  TemporaryCacheKeys["CORRELATION_ID"] = "request.correlationId";
7021
- })(TemporaryCacheKeys || (TemporaryCacheKeys = {}));
7098
+ })(exports.TemporaryCacheKeys || (exports.TemporaryCacheKeys = {}));
7022
7099
  /**
7023
7100
  * Cache keys stored in-memory
7024
7101
  */
@@ -7053,6 +7130,7 @@ exports.InteractionType = void 0;
7053
7130
  InteractionType["Redirect"] = "redirect";
7054
7131
  InteractionType["Popup"] = "popup";
7055
7132
  InteractionType["Silent"] = "silent";
7133
+ InteractionType["None"] = "none";
7056
7134
  })(exports.InteractionType || (exports.InteractionType = {}));
7057
7135
  /**
7058
7136
  * Types of interaction currently in progress.
@@ -9660,7 +9738,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
9660
9738
  */
9661
9739
  BrowserCacheManager.prototype.generateAuthorityKey = function (stateString) {
9662
9740
  var stateId = ProtocolUtils.parseRequestState(this.cryptoImpl, stateString).libraryState.id;
9663
- return this.generateCacheKey(TemporaryCacheKeys.AUTHORITY + "." + stateId);
9741
+ return this.generateCacheKey(exports.TemporaryCacheKeys.AUTHORITY + "." + stateId);
9664
9742
  };
9665
9743
  /**
9666
9744
  * Create Nonce key to cache nonce
@@ -9668,7 +9746,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
9668
9746
  */
9669
9747
  BrowserCacheManager.prototype.generateNonceKey = function (stateString) {
9670
9748
  var stateId = ProtocolUtils.parseRequestState(this.cryptoImpl, stateString).libraryState.id;
9671
- return this.generateCacheKey(TemporaryCacheKeys.NONCE_IDTOKEN + "." + stateId);
9749
+ return this.generateCacheKey(exports.TemporaryCacheKeys.NONCE_IDTOKEN + "." + stateId);
9672
9750
  };
9673
9751
  /**
9674
9752
  * Creates full cache key for the request state
@@ -9677,7 +9755,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
9677
9755
  BrowserCacheManager.prototype.generateStateKey = function (stateString) {
9678
9756
  // Use the library state id to key temp storage for uniqueness for multiple concurrent requests
9679
9757
  var stateId = ProtocolUtils.parseRequestState(this.cryptoImpl, stateString).libraryState.id;
9680
- return this.generateCacheKey(TemporaryCacheKeys.REQUEST_STATE + "." + stateId);
9758
+ return this.generateCacheKey(exports.TemporaryCacheKeys.REQUEST_STATE + "." + stateId);
9681
9759
  };
9682
9760
  /**
9683
9761
  * Gets the cached authority based on the cached state. Returns empty if no cached state found.
@@ -9712,14 +9790,14 @@ var BrowserCacheManager = /** @class */ (function (_super) {
9712
9790
  credential: account.homeAccountId,
9713
9791
  type: CcsCredentialType.HOME_ACCOUNT_ID
9714
9792
  };
9715
- this.setTemporaryCache(TemporaryCacheKeys.CCS_CREDENTIAL, JSON.stringify(ccsCredential), true);
9793
+ this.setTemporaryCache(exports.TemporaryCacheKeys.CCS_CREDENTIAL, JSON.stringify(ccsCredential), true);
9716
9794
  }
9717
9795
  else if (!StringUtils.isEmpty(loginHint)) {
9718
9796
  var ccsCredential = {
9719
9797
  credential: loginHint,
9720
9798
  type: CcsCredentialType.UPN
9721
9799
  };
9722
- this.setTemporaryCache(TemporaryCacheKeys.CCS_CREDENTIAL, JSON.stringify(ccsCredential), true);
9800
+ this.setTemporaryCache(exports.TemporaryCacheKeys.CCS_CREDENTIAL, JSON.stringify(ccsCredential), true);
9723
9801
  }
9724
9802
  };
9725
9803
  /**
@@ -9743,11 +9821,11 @@ var BrowserCacheManager = /** @class */ (function (_super) {
9743
9821
  this.removeItem(this.generateNonceKey(state));
9744
9822
  this.removeItem(this.generateAuthorityKey(state));
9745
9823
  }
9746
- this.removeItem(this.generateCacheKey(TemporaryCacheKeys.REQUEST_PARAMS));
9747
- this.removeItem(this.generateCacheKey(TemporaryCacheKeys.ORIGIN_URI));
9748
- this.removeItem(this.generateCacheKey(TemporaryCacheKeys.URL_HASH));
9749
- this.removeItem(this.generateCacheKey(TemporaryCacheKeys.CORRELATION_ID));
9750
- 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));
9751
9829
  this.setInteractionInProgress(false);
9752
9830
  };
9753
9831
  /**
@@ -9776,7 +9854,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
9776
9854
  // Loop through all keys to find state key
9777
9855
  this.getKeys().forEach(function (key) {
9778
9856
  // If this key is not the state key, move on
9779
- if (key.indexOf(TemporaryCacheKeys.REQUEST_STATE) === -1) {
9857
+ if (key.indexOf(exports.TemporaryCacheKeys.REQUEST_STATE) === -1) {
9780
9858
  return;
9781
9859
  }
9782
9860
  // Retrieve state value, return if not a valid value
@@ -9797,7 +9875,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
9797
9875
  BrowserCacheManager.prototype.cacheCodeRequest = function (authCodeRequest, browserCrypto) {
9798
9876
  this.logger.trace("BrowserCacheManager.cacheCodeRequest called");
9799
9877
  var encodedValue = browserCrypto.base64Encode(JSON.stringify(authCodeRequest));
9800
- this.setTemporaryCache(TemporaryCacheKeys.REQUEST_PARAMS, encodedValue, true);
9878
+ this.setTemporaryCache(exports.TemporaryCacheKeys.REQUEST_PARAMS, encodedValue, true);
9801
9879
  };
9802
9880
  /**
9803
9881
  * Gets the token exchange parameters from the cache. Throws an error if nothing is found.
@@ -9805,7 +9883,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
9805
9883
  BrowserCacheManager.prototype.getCachedRequest = function (state, browserCrypto) {
9806
9884
  this.logger.trace("BrowserCacheManager.getCachedRequest called");
9807
9885
  // Get token request from cache and parse as TokenExchangeParameters.
9808
- var encodedTokenRequest = this.getTemporaryCache(TemporaryCacheKeys.REQUEST_PARAMS, true);
9886
+ var encodedTokenRequest = this.getTemporaryCache(exports.TemporaryCacheKeys.REQUEST_PARAMS, true);
9809
9887
  if (!encodedTokenRequest) {
9810
9888
  throw BrowserAuthError.createNoTokenRequestCacheError();
9811
9889
  }
@@ -9813,7 +9891,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
9813
9891
  if (!parsedRequest) {
9814
9892
  throw BrowserAuthError.createUnableToParseTokenRequestCacheError();
9815
9893
  }
9816
- this.removeItem(this.generateCacheKey(TemporaryCacheKeys.REQUEST_PARAMS));
9894
+ this.removeItem(this.generateCacheKey(exports.TemporaryCacheKeys.REQUEST_PARAMS));
9817
9895
  // Get cached authority and use if no authority is cached with request.
9818
9896
  if (StringUtils.isEmpty(parsedRequest.authority)) {
9819
9897
  var authorityCacheKey = this.generateAuthorityKey(state);
@@ -9835,18 +9913,22 @@ var BrowserCacheManager = /** @class */ (function (_super) {
9835
9913
  }
9836
9914
  };
9837
9915
  BrowserCacheManager.prototype.getInteractionInProgress = function () {
9838
- var key = Constants.CACHE_PREFIX + "." + TemporaryCacheKeys.INTERACTION_STATUS_KEY;
9916
+ var key = Constants.CACHE_PREFIX + "." + exports.TemporaryCacheKeys.INTERACTION_STATUS_KEY;
9839
9917
  return this.getTemporaryCache(key, false);
9840
9918
  };
9841
9919
  BrowserCacheManager.prototype.setInteractionInProgress = function (inProgress) {
9842
- var clientId = this.getInteractionInProgress();
9843
9920
  // Ensure we don't overwrite interaction in progress for a different clientId
9844
- var key = Constants.CACHE_PREFIX + "." + TemporaryCacheKeys.INTERACTION_STATUS_KEY;
9845
- if (inProgress && !clientId) {
9846
- // No interaction is in progress
9847
- 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
+ }
9848
9930
  }
9849
- else if (!inProgress && clientId === this.clientId) {
9931
+ else if (!inProgress && this.getInteractionInProgress() === this.clientId) {
9850
9932
  this.removeItem(key);
9851
9933
  }
9852
9934
  };
@@ -10373,7 +10455,11 @@ function buildConfiguration(_a, isBrowserEnvironment) {
10373
10455
  postLogoutRedirectUri: "",
10374
10456
  navigateToLoginRequestUrl: true,
10375
10457
  clientCapabilities: [],
10376
- protocolMode: exports.ProtocolMode.AAD
10458
+ protocolMode: exports.ProtocolMode.AAD,
10459
+ azureCloudOptions: {
10460
+ azureCloudInstance: exports.AzureCloudInstance.None,
10461
+ tenant: ""
10462
+ },
10377
10463
  };
10378
10464
  // Default cache options for browser
10379
10465
  var DEFAULT_CACHE_OPTIONS = {
@@ -10402,7 +10488,7 @@ function buildConfiguration(_a, isBrowserEnvironment) {
10402
10488
 
10403
10489
  /* eslint-disable header/header */
10404
10490
  var name = "@azure/msal-browser";
10405
- var version = "2.21.0";
10491
+ var version = "2.22.0";
10406
10492
 
10407
10493
  /*
10408
10494
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10732,11 +10818,32 @@ var StandardInteractionClient = /** @class */ (function (_super) {
10732
10818
  */
10733
10819
  StandardInteractionClient.prototype.initializeLogoutRequest = function (logoutRequest) {
10734
10820
  this.logger.verbose("initializeLogoutRequest called", logoutRequest === null || logoutRequest === void 0 ? void 0 : logoutRequest.correlationId);
10735
- // Check if interaction is in progress. Throw error if true.
10736
- if (this.browserStorage.isInteractionInProgress()) {
10737
- throw BrowserAuthError.createInteractionInProgressError();
10738
- }
10739
10821
  var validLogoutRequest = __assign$1({ correlationId: this.browserCrypto.createNewGuid() }, logoutRequest);
10822
+ /**
10823
+ * Set logout_hint to be login_hint from ID Token Claims if present
10824
+ * and logoutHint attribute wasn't manually set in logout request
10825
+ */
10826
+ if (logoutRequest) {
10827
+ // If logoutHint isn't set and an account was passed in, try to extract logoutHint from ID Token Claims
10828
+ if (!logoutRequest.logoutHint) {
10829
+ if (logoutRequest.account) {
10830
+ var logoutHint = this.getLogoutHintFromIdTokenClaims(logoutRequest.account);
10831
+ if (logoutHint) {
10832
+ this.logger.verbose("Setting logoutHint to login_hint ID Token Claim value for the account provided");
10833
+ validLogoutRequest.logoutHint = logoutHint;
10834
+ }
10835
+ }
10836
+ else {
10837
+ this.logger.verbose("logoutHint was not set and account was not passed into logout request, logoutHint will not be set");
10838
+ }
10839
+ }
10840
+ else {
10841
+ this.logger.verbose("logoutHint has already been set in logoutRequest");
10842
+ }
10843
+ }
10844
+ else {
10845
+ this.logger.verbose("logoutHint will not be set since no logout request was configured");
10846
+ }
10740
10847
  /*
10741
10848
  * Only set redirect uri if logout request isn't provided or the set uri isn't null.
10742
10849
  * Otherwise, use passed uri, config, or current page.
@@ -10763,17 +10870,37 @@ var StandardInteractionClient = /** @class */ (function (_super) {
10763
10870
  }
10764
10871
  return validLogoutRequest;
10765
10872
  };
10873
+ /**
10874
+ * Parses login_hint ID Token Claim out of AccountInfo object to be used as
10875
+ * logout_hint in end session request.
10876
+ * @param account
10877
+ */
10878
+ StandardInteractionClient.prototype.getLogoutHintFromIdTokenClaims = function (account) {
10879
+ var idTokenClaims = account.idTokenClaims;
10880
+ if (idTokenClaims) {
10881
+ if (idTokenClaims.login_hint) {
10882
+ return idTokenClaims.login_hint;
10883
+ }
10884
+ else {
10885
+ 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");
10886
+ }
10887
+ }
10888
+ else {
10889
+ this.logger.verbose("The provided account does not contain ID Token Claims, logoutHint will not be added to logout request");
10890
+ }
10891
+ return null;
10892
+ };
10766
10893
  /**
10767
10894
  * Creates an Authorization Code Client with the given authority, or the default authority.
10768
10895
  * @param serverTelemetryManager
10769
10896
  * @param authorityUrl
10770
10897
  */
10771
- StandardInteractionClient.prototype.createAuthCodeClient = function (serverTelemetryManager, authorityUrl) {
10898
+ StandardInteractionClient.prototype.createAuthCodeClient = function (serverTelemetryManager, authorityUrl, requestAzureCloudOptions) {
10772
10899
  return __awaiter$1(this, void 0, void 0, function () {
10773
10900
  var clientConfig;
10774
10901
  return __generator$1(this, function (_a) {
10775
10902
  switch (_a.label) {
10776
- case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl)];
10903
+ case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl, requestAzureCloudOptions)];
10777
10904
  case 1:
10778
10905
  clientConfig = _a.sent();
10779
10906
  return [2 /*return*/, new AuthorizationCodeClient(clientConfig)];
@@ -10787,14 +10914,14 @@ var StandardInteractionClient = /** @class */ (function (_super) {
10787
10914
  * @param requestAuthority
10788
10915
  * @param requestCorrelationId
10789
10916
  */
10790
- StandardInteractionClient.prototype.getClientConfiguration = function (serverTelemetryManager, requestAuthority) {
10917
+ StandardInteractionClient.prototype.getClientConfiguration = function (serverTelemetryManager, requestAuthority, requestAzureCloudOptions) {
10791
10918
  return __awaiter$1(this, void 0, void 0, function () {
10792
10919
  var discoveredAuthority;
10793
10920
  return __generator$1(this, function (_a) {
10794
10921
  switch (_a.label) {
10795
10922
  case 0:
10796
10923
  this.logger.verbose("getClientConfiguration called");
10797
- return [4 /*yield*/, this.getDiscoveredAuthority(requestAuthority)];
10924
+ return [4 /*yield*/, this.getDiscoveredAuthority(requestAuthority, requestAzureCloudOptions)];
10798
10925
  case 1:
10799
10926
  discoveredAuthority = _a.sent();
10800
10927
  return [2 /*return*/, {
@@ -10854,9 +10981,9 @@ var StandardInteractionClient = /** @class */ (function (_super) {
10854
10981
  * @param requestAuthority
10855
10982
  * @param requestCorrelationId
10856
10983
  */
10857
- StandardInteractionClient.prototype.getDiscoveredAuthority = function (requestAuthority) {
10984
+ StandardInteractionClient.prototype.getDiscoveredAuthority = function (requestAuthority, requestAzureCloudOptions) {
10858
10985
  return __awaiter$1(this, void 0, void 0, function () {
10859
- var authorityOptions;
10986
+ var authorityOptions, userAuthority, builtAuthority;
10860
10987
  return __generator$1(this, function (_a) {
10861
10988
  switch (_a.label) {
10862
10989
  case 0:
@@ -10865,38 +10992,12 @@ var StandardInteractionClient = /** @class */ (function (_super) {
10865
10992
  protocolMode: this.config.auth.protocolMode,
10866
10993
  knownAuthorities: this.config.auth.knownAuthorities,
10867
10994
  cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
10868
- authorityMetadata: this.config.auth.authorityMetadata
10995
+ authorityMetadata: this.config.auth.authorityMetadata,
10869
10996
  };
10870
- if (!requestAuthority) return [3 /*break*/, 2];
10871
- this.logger.verbose("Creating discovered authority with request authority");
10872
- return [4 /*yield*/, AuthorityFactory.createDiscoveredInstance(requestAuthority, this.config.system.networkClient, this.browserStorage, authorityOptions)];
10873
- case 1: return [2 /*return*/, _a.sent()];
10874
- case 2:
10997
+ userAuthority = requestAuthority ? requestAuthority : this.config.auth.authority;
10998
+ builtAuthority = Authority.generateAuthority(userAuthority, requestAzureCloudOptions || this.config.auth.azureCloudOptions);
10875
10999
  this.logger.verbose("Creating discovered authority with configured authority");
10876
- return [4 /*yield*/, AuthorityFactory.createDiscoveredInstance(this.config.auth.authority, this.config.system.networkClient, this.browserStorage, authorityOptions)];
10877
- case 3: return [2 /*return*/, _a.sent()];
10878
- }
10879
- });
10880
- });
10881
- };
10882
- /**
10883
- * Helper to validate app environment before making a request.
10884
- * @param request
10885
- * @param interactionType
10886
- */
10887
- StandardInteractionClient.prototype.preflightInteractiveRequest = function (request, interactionType) {
10888
- return __awaiter$1(this, void 0, void 0, function () {
10889
- return __generator$1(this, function (_a) {
10890
- switch (_a.label) {
10891
- case 0:
10892
- this.logger.verbose("preflightInteractiveRequest called, validating app environment", request === null || request === void 0 ? void 0 : request.correlationId);
10893
- // block the reload if it occurred inside a hidden iframe
10894
- BrowserUtils.blockReloadInHiddenIframes();
10895
- // Check if interaction is in progress. Throw error if true.
10896
- if (this.browserStorage.isInteractionInProgress(false)) {
10897
- throw BrowserAuthError.createInteractionInProgressError();
10898
- }
10899
- return [4 /*yield*/, this.initializeAuthorizationRequest(request, interactionType)];
11000
+ return [4 /*yield*/, AuthorityFactory.createDiscoveredInstance(builtAuthority, this.config.system.networkClient, this.browserStorage, authorityOptions)];
10900
11001
  case 1: return [2 /*return*/, _a.sent()];
10901
11002
  }
10902
11003
  });
@@ -10918,7 +11019,7 @@ var StandardInteractionClient = /** @class */ (function (_super) {
10918
11019
  browserState = {
10919
11020
  interactionType: interactionType
10920
11021
  };
10921
- state = ProtocolUtils.setRequestState(this.browserCrypto, (request && request.state) || "", browserState);
11022
+ state = ProtocolUtils.setRequestState(this.browserCrypto, (request && request.state) || Constants.EMPTY_STRING, browserState);
10922
11023
  _a = [{}];
10923
11024
  return [4 /*yield*/, this.initializeBaseRequest(request)];
10924
11025
  case 1:
@@ -10936,7 +11037,6 @@ var StandardInteractionClient = /** @class */ (function (_super) {
10936
11037
  validatedRequest.loginHint = legacyLoginHint;
10937
11038
  }
10938
11039
  }
10939
- this.browserStorage.updateCacheEntries(validatedRequest.state, validatedRequest.nonce, validatedRequest.authority, validatedRequest.loginHint || "", validatedRequest.account || null);
10940
11040
  return [2 /*return*/, validatedRequest];
10941
11041
  }
10942
11042
  });
@@ -11107,8 +11207,8 @@ var PopupUtils = /** @class */ (function () {
11107
11207
  * @param clientId
11108
11208
  * @param request
11109
11209
  */
11110
- PopupUtils.generatePopupName = function (clientId, request) {
11111
- return BrowserConstants.POPUP_NAME_PREFIX + "." + clientId + "." + request.scopes.join("-") + "." + request.authority + "." + request.correlationId;
11210
+ PopupUtils.generatePopupName = function (clientId, scopes, authority, correlationId) {
11211
+ return BrowserConstants.POPUP_NAME_PREFIX + "." + clientId + "." + scopes.join("-") + "." + authority + "." + correlationId;
11112
11212
  };
11113
11213
  /**
11114
11214
  * Generates the name for the popup based on the client id and request for logouts
@@ -11241,7 +11341,7 @@ var InteractionHandler = /** @class */ (function () {
11241
11341
  */
11242
11342
  InteractionHandler.prototype.checkCcsCredentials = function () {
11243
11343
  // Look up ccs credential in temp cache
11244
- var cachedCcsCred = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.CCS_CREDENTIAL, true);
11344
+ var cachedCcsCred = this.browserStorage.getTemporaryCache(exports.TemporaryCacheKeys.CCS_CREDENTIAL, true);
11245
11345
  if (cachedCcsCred) {
11246
11346
  try {
11247
11347
  return JSON.parse(cachedCcsCred);
@@ -11279,8 +11379,6 @@ var PopupHandler = /** @class */ (function (_super) {
11279
11379
  PopupHandler.prototype.initiateAuthRequest = function (requestUrl, params) {
11280
11380
  // Check that request url is not empty.
11281
11381
  if (!StringUtils.isEmpty(requestUrl)) {
11282
- // Set interaction status in the library.
11283
- this.browserStorage.setInteractionInProgress(true);
11284
11382
  this.browserRequestLogger.infoPii("Navigate to: " + requestUrl);
11285
11383
  // Open the popup window to requestUrl.
11286
11384
  return this.popupUtils.openPopup(requestUrl, params);
@@ -11330,36 +11428,25 @@ var PopupClient = /** @class */ (function (_super) {
11330
11428
  * @param request
11331
11429
  */
11332
11430
  PopupClient.prototype.acquireToken = function (request) {
11333
- return __awaiter$1(this, void 0, void 0, function () {
11334
- var validRequest, popupName, popupWindowAttributes, popup, e_1;
11335
- return __generator$1(this, function (_a) {
11336
- switch (_a.label) {
11337
- case 0:
11338
- _a.trys.push([0, 2, , 3]);
11339
- return [4 /*yield*/, this.preflightInteractiveRequest(request, exports.InteractionType.Popup)];
11340
- case 1:
11341
- validRequest = _a.sent();
11342
- popupName = PopupUtils.generatePopupName(this.config.auth.clientId, validRequest);
11343
- popupWindowAttributes = request.popupWindowAttributes || {};
11344
- // asyncPopups flag is true. Acquires token without first opening popup. Popup will be opened later asynchronously.
11345
- if (this.config.system.asyncPopups) {
11346
- this.logger.verbose("asyncPopups set to true, acquiring token");
11347
- // Passes on popup position and dimensions if in request
11348
- return [2 /*return*/, this.acquireTokenPopupAsync(validRequest, popupName, popupWindowAttributes)];
11349
- }
11350
- else {
11351
- // asyncPopups flag is set to false. Opens popup before acquiring token.
11352
- this.logger.verbose("asyncPopup set to false, opening popup before acquiring token");
11353
- popup = PopupUtils.openSizedPopup("about:blank", popupName, popupWindowAttributes, this.logger);
11354
- return [2 /*return*/, this.acquireTokenPopupAsync(validRequest, popupName, popupWindowAttributes, popup)];
11355
- }
11356
- case 2:
11357
- e_1 = _a.sent();
11358
- return [2 /*return*/, Promise.reject(e_1)];
11359
- case 3: return [2 /*return*/];
11360
- }
11361
- });
11362
- });
11431
+ try {
11432
+ var popupName = PopupUtils.generatePopupName(this.config.auth.clientId, request.scopes || OIDC_DEFAULT_SCOPES, request.authority || this.config.auth.authority, this.correlationId);
11433
+ var popupWindowAttributes = request.popupWindowAttributes || {};
11434
+ // asyncPopups flag is true. Acquires token without first opening popup. Popup will be opened later asynchronously.
11435
+ if (this.config.system.asyncPopups) {
11436
+ this.logger.verbose("asyncPopups set to true, acquiring token");
11437
+ // Passes on popup position and dimensions if in request
11438
+ return this.acquireTokenPopupAsync(request, popupName, popupWindowAttributes);
11439
+ }
11440
+ else {
11441
+ // asyncPopups flag is set to false. Opens popup before acquiring token.
11442
+ this.logger.verbose("asyncPopup set to false, opening popup before acquiring token");
11443
+ var popup = PopupUtils.openSizedPopup("about:blank", popupName, popupWindowAttributes, this.logger);
11444
+ return this.acquireTokenPopupAsync(request, popupName, popupWindowAttributes, popup);
11445
+ }
11446
+ }
11447
+ catch (e) {
11448
+ return Promise.reject(e);
11449
+ }
11363
11450
  };
11364
11451
  /**
11365
11452
  * Clears local cache for the current user then opens a popup window prompting the user to sign-out of the server
@@ -11400,26 +11487,30 @@ var PopupClient = /** @class */ (function (_super) {
11400
11487
  *
11401
11488
  * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
11402
11489
  */
11403
- PopupClient.prototype.acquireTokenPopupAsync = function (validRequest, popupName, popupWindowAttributes, popup) {
11490
+ PopupClient.prototype.acquireTokenPopupAsync = function (request, popupName, popupWindowAttributes, popup) {
11404
11491
  return __awaiter$1(this, void 0, void 0, function () {
11405
- var serverTelemetryManager, authCodeRequest, authClient, navigateUrl, interactionHandler, popupParameters, popupWindow, hash, state, result, e_2;
11492
+ var serverTelemetryManager, validRequest, authCodeRequest, authClient, navigateUrl, interactionHandler, popupParameters, popupWindow, hash, state, result, e_1;
11406
11493
  return __generator$1(this, function (_a) {
11407
11494
  switch (_a.label) {
11408
11495
  case 0:
11409
11496
  this.logger.verbose("acquireTokenPopupAsync called");
11410
11497
  serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenPopup);
11411
- _a.label = 1;
11498
+ return [4 /*yield*/, this.initializeAuthorizationRequest(request, exports.InteractionType.Popup)];
11412
11499
  case 1:
11413
- _a.trys.push([1, 7, , 8]);
11414
- return [4 /*yield*/, this.initializeAuthorizationCodeRequest(validRequest)];
11500
+ validRequest = _a.sent();
11501
+ this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint || "", validRequest.account || null);
11502
+ _a.label = 2;
11415
11503
  case 2:
11416
- authCodeRequest = _a.sent();
11417
- return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, validRequest.authority)];
11504
+ _a.trys.push([2, 8, , 9]);
11505
+ return [4 /*yield*/, this.initializeAuthorizationCodeRequest(validRequest)];
11418
11506
  case 3:
11507
+ authCodeRequest = _a.sent();
11508
+ return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, validRequest.authority, validRequest.azureCloudOptions)];
11509
+ case 4:
11419
11510
  authClient = _a.sent();
11420
11511
  this.logger.verbose("Auth code client created");
11421
11512
  return [4 /*yield*/, authClient.getAuthCodeUrl(validRequest)];
11422
- case 4:
11513
+ case 5:
11423
11514
  navigateUrl = _a.sent();
11424
11515
  interactionHandler = new PopupHandler(authClient, this.browserStorage, authCodeRequest, this.logger);
11425
11516
  popupParameters = {
@@ -11430,28 +11521,28 @@ var PopupClient = /** @class */ (function (_super) {
11430
11521
  popupWindow = interactionHandler.initiateAuthRequest(navigateUrl, popupParameters);
11431
11522
  this.eventHandler.emitEvent(exports.EventType.POPUP_OPENED, exports.InteractionType.Popup, { popupWindow: popupWindow }, null);
11432
11523
  return [4 /*yield*/, interactionHandler.monitorPopupForHash(popupWindow)];
11433
- case 5:
11524
+ case 6:
11434
11525
  hash = _a.sent();
11435
11526
  state = this.validateAndExtractStateFromHash(hash, exports.InteractionType.Popup, validRequest.correlationId);
11436
11527
  // Remove throttle if it exists
11437
11528
  ThrottlingUtils.removeThrottle(this.browserStorage, this.config.auth.clientId, authCodeRequest);
11438
11529
  return [4 /*yield*/, interactionHandler.handleCodeResponseFromHash(hash, state, authClient.authority, this.networkClient)];
11439
- case 6:
11530
+ case 7:
11440
11531
  result = _a.sent();
11441
11532
  return [2 /*return*/, result];
11442
- case 7:
11443
- e_2 = _a.sent();
11533
+ case 8:
11534
+ e_1 = _a.sent();
11444
11535
  if (popup) {
11445
11536
  // Close the synchronous popup if an error is thrown before the window unload event is registered
11446
11537
  popup.close();
11447
11538
  }
11448
- if (e_2 instanceof AuthError) {
11449
- e_2.setCorrelationId(this.correlationId);
11539
+ if (e_1 instanceof AuthError) {
11540
+ e_1.setCorrelationId(this.correlationId);
11450
11541
  }
11451
- serverTelemetryManager.cacheFailedRequest(e_2);
11542
+ serverTelemetryManager.cacheFailedRequest(e_1);
11452
11543
  this.browserStorage.cleanRequestByState(validRequest.state);
11453
- throw e_2;
11454
- case 8: return [2 /*return*/];
11544
+ throw e_1;
11545
+ case 9: return [2 /*return*/];
11455
11546
  }
11456
11547
  });
11457
11548
  });
@@ -11467,7 +11558,7 @@ var PopupClient = /** @class */ (function (_super) {
11467
11558
  */
11468
11559
  PopupClient.prototype.logoutPopupAsync = function (validRequest, popupName, popupWindowAttributes, requestAuthority, popup, mainWindowRedirectUri) {
11469
11560
  return __awaiter$1(this, void 0, void 0, function () {
11470
- var serverTelemetryManager, authClient, logoutUri, popupUtils, popupWindow, e_3, navigationOptions, absoluteUrl, e_4;
11561
+ var serverTelemetryManager, authClient, logoutUri, popupUtils, popupWindow, e_2, navigationOptions, absoluteUrl, e_3;
11471
11562
  return __generator$1(this, function (_a) {
11472
11563
  switch (_a.label) {
11473
11564
  case 0:
@@ -11482,7 +11573,6 @@ var PopupClient = /** @class */ (function (_super) {
11482
11573
  case 2:
11483
11574
  // Clear cache on logout
11484
11575
  _a.sent();
11485
- this.browserStorage.setInteractionInProgress(true);
11486
11576
  return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, requestAuthority)];
11487
11577
  case 3:
11488
11578
  authClient = _a.sent();
@@ -11503,8 +11593,8 @@ var PopupClient = /** @class */ (function (_super) {
11503
11593
  this.logger.verbose("Popup successfully redirected to postLogoutRedirectUri");
11504
11594
  return [3 /*break*/, 7];
11505
11595
  case 6:
11506
- e_3 = _a.sent();
11507
- this.logger.verbose("Error occurred while monitoring popup for same origin. Session on server may remain active. Error: " + e_3);
11596
+ e_2 = _a.sent();
11597
+ this.logger.verbose("Error occurred while monitoring popup for same origin. Session on server may remain active. Error: " + e_2);
11508
11598
  return [3 /*break*/, 7];
11509
11599
  case 7:
11510
11600
  popupUtils.cleanPopup(popupWindow);
@@ -11516,7 +11606,7 @@ var PopupClient = /** @class */ (function (_super) {
11516
11606
  };
11517
11607
  absoluteUrl = UrlString.getAbsoluteUrl(mainWindowRedirectUri, BrowserUtils.getCurrentUri());
11518
11608
  this.logger.verbose("Redirecting main window to url specified in the request");
11519
- this.logger.verbosePii("Redirecing main window to: " + absoluteUrl);
11609
+ this.logger.verbosePii("Redirecting main window to: " + absoluteUrl);
11520
11610
  this.navigationClient.navigateInternal(absoluteUrl, navigationOptions);
11521
11611
  }
11522
11612
  else {
@@ -11524,19 +11614,19 @@ var PopupClient = /** @class */ (function (_super) {
11524
11614
  }
11525
11615
  return [3 /*break*/, 9];
11526
11616
  case 8:
11527
- e_4 = _a.sent();
11617
+ e_3 = _a.sent();
11528
11618
  if (popup) {
11529
11619
  // Close the synchronous popup if an error is thrown before the window unload event is registered
11530
11620
  popup.close();
11531
11621
  }
11532
- if (e_4 instanceof AuthError) {
11533
- e_4.setCorrelationId(this.correlationId);
11622
+ if (e_3 instanceof AuthError) {
11623
+ e_3.setCorrelationId(this.correlationId);
11534
11624
  }
11535
11625
  this.browserStorage.setInteractionInProgress(false);
11536
- this.eventHandler.emitEvent(exports.EventType.LOGOUT_FAILURE, exports.InteractionType.Popup, null, e_4);
11626
+ this.eventHandler.emitEvent(exports.EventType.LOGOUT_FAILURE, exports.InteractionType.Popup, null, e_3);
11537
11627
  this.eventHandler.emitEvent(exports.EventType.LOGOUT_END, exports.InteractionType.Popup);
11538
- serverTelemetryManager.cacheFailedRequest(e_4);
11539
- throw e_4;
11628
+ serverTelemetryManager.cacheFailedRequest(e_3);
11629
+ throw e_3;
11540
11630
  case 9:
11541
11631
  this.eventHandler.emitEvent(exports.EventType.LOGOUT_END, exports.InteractionType.Popup);
11542
11632
  return [2 /*return*/];
@@ -11573,11 +11663,10 @@ var RedirectHandler = /** @class */ (function (_super) {
11573
11663
  // Cache start page, returns to this page after redirectUri if navigateToLoginRequestUrl is true
11574
11664
  if (params.redirectStartPage) {
11575
11665
  this.browserRequestLogger.verbose("RedirectHandler.initiateAuthRequest: redirectStartPage set, caching start page");
11576
- this.browserStorage.setTemporaryCache(TemporaryCacheKeys.ORIGIN_URI, params.redirectStartPage, true);
11666
+ this.browserStorage.setTemporaryCache(exports.TemporaryCacheKeys.ORIGIN_URI, params.redirectStartPage, true);
11577
11667
  }
11578
11668
  // Set interaction status in the library.
11579
- this.browserStorage.setInteractionInProgress(true);
11580
- this.browserStorage.setTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, this.authCodeRequest.correlationId, true);
11669
+ this.browserStorage.setTemporaryCache(exports.TemporaryCacheKeys.CORRELATION_ID, this.authCodeRequest.correlationId, true);
11581
11670
  this.browserStorage.cacheCodeRequest(this.authCodeRequest, this.browserCrypto);
11582
11671
  this.browserRequestLogger.infoPii("RedirectHandler.initiateAuthRequest: Navigate to: " + requestUrl);
11583
11672
  navigationOptions = {
@@ -11694,9 +11783,10 @@ var RedirectClient = /** @class */ (function (_super) {
11694
11783
  var validRequest, serverTelemetryManager, authCodeRequest, authClient, interactionHandler, navigateUrl, redirectStartPage, e_1;
11695
11784
  return __generator$1(this, function (_a) {
11696
11785
  switch (_a.label) {
11697
- case 0: return [4 /*yield*/, this.preflightInteractiveRequest(request, exports.InteractionType.Redirect)];
11786
+ case 0: return [4 /*yield*/, this.initializeAuthorizationRequest(request, exports.InteractionType.Redirect)];
11698
11787
  case 1:
11699
11788
  validRequest = _a.sent();
11789
+ this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint || "", validRequest.account || null);
11700
11790
  serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenRedirect);
11701
11791
  _a.label = 2;
11702
11792
  case 2:
@@ -11704,7 +11794,7 @@ var RedirectClient = /** @class */ (function (_super) {
11704
11794
  return [4 /*yield*/, this.initializeAuthorizationCodeRequest(validRequest)];
11705
11795
  case 3:
11706
11796
  authCodeRequest = _a.sent();
11707
- return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, validRequest.authority)];
11797
+ return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, validRequest.authority, validRequest.azureCloudOptions)];
11708
11798
  case 4:
11709
11799
  authClient = _a.sent();
11710
11800
  this.logger.verbose("Auth code client created");
@@ -11766,7 +11856,6 @@ var RedirectClient = /** @class */ (function (_super) {
11766
11856
  state = void 0;
11767
11857
  try {
11768
11858
  state = this.validateAndExtractStateFromHash(responseHash, exports.InteractionType.Redirect);
11769
- BrowserUtils.clearHash(window);
11770
11859
  this.logger.verbose("State extracted from hash");
11771
11860
  }
11772
11861
  catch (e) {
@@ -11774,7 +11863,7 @@ var RedirectClient = /** @class */ (function (_super) {
11774
11863
  this.browserStorage.cleanRequestByInteractionType(exports.InteractionType.Redirect);
11775
11864
  return [2 /*return*/, null];
11776
11865
  }
11777
- loginRequestUrl = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.ORIGIN_URI, true) || "";
11866
+ loginRequestUrl = this.browserStorage.getTemporaryCache(exports.TemporaryCacheKeys.ORIGIN_URI, true) || "";
11778
11867
  loginRequestUrlNormalized = UrlString.removeHashFromUrl(loginRequestUrl);
11779
11868
  currentUrlNormalized = UrlString.removeHashFromUrl(window.location.href);
11780
11869
  if (!(loginRequestUrlNormalized === currentUrlNormalized && this.config.auth.navigateToLoginRequestUrl)) return [3 /*break*/, 3];
@@ -11798,7 +11887,7 @@ var RedirectClient = /** @class */ (function (_super) {
11798
11887
  * Returned from authority using redirect - need to perform navigation before processing response
11799
11888
  * Cache the hash to be retrieved after the next redirect
11800
11889
  */
11801
- this.browserStorage.setTemporaryCache(TemporaryCacheKeys.URL_HASH, responseHash, true);
11890
+ this.browserStorage.setTemporaryCache(exports.TemporaryCacheKeys.URL_HASH, responseHash, true);
11802
11891
  navigationOptions = {
11803
11892
  apiId: exports.ApiId.handleRedirectPromise,
11804
11893
  timeout: this.config.system.redirectNavigationTimeout,
@@ -11808,7 +11897,7 @@ var RedirectClient = /** @class */ (function (_super) {
11808
11897
  if (!(!loginRequestUrl || loginRequestUrl === "null")) return [3 /*break*/, 6];
11809
11898
  homepage = BrowserUtils.getHomepage();
11810
11899
  // Cache the homepage under ORIGIN_URI to ensure cached hash is processed on homepage
11811
- this.browserStorage.setTemporaryCache(TemporaryCacheKeys.ORIGIN_URI, homepage, true);
11900
+ this.browserStorage.setTemporaryCache(exports.TemporaryCacheKeys.ORIGIN_URI, homepage, true);
11812
11901
  this.logger.warning("Unable to get valid login request url from cache, redirecting to home page");
11813
11902
  return [4 /*yield*/, this.navigationClient.navigateInternal(homepage, navigationOptions)];
11814
11903
  case 5:
@@ -11850,12 +11939,13 @@ var RedirectClient = /** @class */ (function (_super) {
11850
11939
  this.logger.verbose("getRedirectResponseHash called");
11851
11940
  // Get current location hash from window or cache.
11852
11941
  var isResponseHash = UrlString.hashContainsKnownProperties(hash);
11853
- var cachedHash = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.URL_HASH, true);
11854
- this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.URL_HASH));
11855
11942
  if (isResponseHash) {
11943
+ BrowserUtils.clearHash(window);
11856
11944
  this.logger.verbose("Hash contains known properties, returning response hash");
11857
11945
  return hash;
11858
11946
  }
11947
+ var cachedHash = this.browserStorage.getTemporaryCache(exports.TemporaryCacheKeys.URL_HASH, true);
11948
+ this.browserStorage.removeItem(this.browserStorage.generateCacheKey(exports.TemporaryCacheKeys.URL_HASH));
11859
11949
  this.logger.verbose("Hash does not contain known properties, returning cached hash");
11860
11950
  return cachedHash;
11861
11951
  };
@@ -12150,6 +12240,7 @@ var SilentIframeClient = /** @class */ (function (_super) {
12150
12240
  return [4 /*yield*/, this.initializeAuthorizationRequest(__assign$1(__assign$1({}, request), { prompt: PromptValue.NONE }), exports.InteractionType.Silent)];
12151
12241
  case 1:
12152
12242
  silentRequest = _a.sent();
12243
+ this.browserStorage.updateCacheEntries(silentRequest.state, silentRequest.nonce, silentRequest.authority, silentRequest.loginHint || "", silentRequest.account || null);
12153
12244
  serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
12154
12245
  _a.label = 2;
12155
12246
  case 2:
@@ -12157,7 +12248,7 @@ var SilentIframeClient = /** @class */ (function (_super) {
12157
12248
  return [4 /*yield*/, this.initializeAuthorizationCodeRequest(silentRequest)];
12158
12249
  case 3:
12159
12250
  authCodeRequest = _a.sent();
12160
- return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, silentRequest.authority)];
12251
+ return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions)];
12161
12252
  case 4:
12162
12253
  authClient = _a.sent();
12163
12254
  this.logger.verbose("Auth code client created");
@@ -12240,7 +12331,7 @@ var SilentRefreshClient = /** @class */ (function (_super) {
12240
12331
  case 1:
12241
12332
  silentRequest = __assign$1.apply(void 0, _a.concat([_b.sent()]));
12242
12333
  serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenSilent_silentFlow);
12243
- return [4 /*yield*/, this.createRefreshTokenClient(serverTelemetryManager, silentRequest.authority)];
12334
+ return [4 /*yield*/, this.createRefreshTokenClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions)];
12244
12335
  case 2:
12245
12336
  refreshTokenClient = _b.sent();
12246
12337
  this.logger.verbose("Refresh token client created");
@@ -12268,12 +12359,12 @@ var SilentRefreshClient = /** @class */ (function (_super) {
12268
12359
  * @param serverTelemetryManager
12269
12360
  * @param authorityUrl
12270
12361
  */
12271
- SilentRefreshClient.prototype.createRefreshTokenClient = function (serverTelemetryManager, authorityUrl) {
12362
+ SilentRefreshClient.prototype.createRefreshTokenClient = function (serverTelemetryManager, authorityUrl, azureCloudOptions) {
12272
12363
  return __awaiter$1(this, void 0, void 0, function () {
12273
12364
  var clientConfig;
12274
12365
  return __generator$1(this, function (_a) {
12275
12366
  switch (_a.label) {
12276
- case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl)];
12367
+ case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl, azureCloudOptions)];
12277
12368
  case 1:
12278
12369
  clientConfig = _a.sent();
12279
12370
  return [2 /*return*/, new RefreshTokenClient(clientConfig)];
@@ -12316,13 +12407,14 @@ var TokenCache = /** @class */ (function () {
12316
12407
  this.loadAccessToken(request, response, request.account.homeAccountId, request.account.environment, request.account.tenantId, options);
12317
12408
  }
12318
12409
  else if (request.authority) {
12410
+ var authorityUrl = Authority.generateAuthority(request.authority, request.azureCloudOptions);
12319
12411
  var authorityOptions = {
12320
12412
  protocolMode: this.config.auth.protocolMode,
12321
12413
  knownAuthorities: this.config.auth.knownAuthorities,
12322
12414
  cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
12323
- authorityMetadata: this.config.auth.authorityMetadata
12415
+ authorityMetadata: this.config.auth.authorityMetadata,
12324
12416
  };
12325
- var authority = new Authority(request.authority, this.config.system.networkClient, this.storage, authorityOptions);
12417
+ var authority = new Authority(authorityUrl, this.config.system.networkClient, this.storage, authorityOptions);
12326
12418
  // "clientInfo" from options takes precedence over "clientInfo" in response
12327
12419
  if (options.clientInfo) {
12328
12420
  this.logger.trace("TokenCache - homeAccountId from options");
@@ -12444,6 +12536,7 @@ var SilentAuthCodeClient = /** @class */ (function (_super) {
12444
12536
  return [4 /*yield*/, this.initializeAuthorizationRequest(request, exports.InteractionType.Silent)];
12445
12537
  case 1:
12446
12538
  silentRequest = _a.sent();
12539
+ this.browserStorage.updateCacheEntries(silentRequest.state, silentRequest.nonce, silentRequest.authority, silentRequest.loginHint || "", silentRequest.account || null);
12447
12540
  serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
12448
12541
  _a.label = 2;
12449
12542
  case 2:
@@ -12561,7 +12654,7 @@ var ClientApplication = /** @class */ (function () {
12561
12654
  if (typeof response === "undefined") {
12562
12655
  this.eventHandler.emitEvent(exports.EventType.HANDLE_REDIRECT_START, exports.InteractionType.Redirect);
12563
12656
  this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise");
12564
- correlationId = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, true) || "";
12657
+ correlationId = this.browserStorage.getTemporaryCache(exports.TemporaryCacheKeys.CORRELATION_ID, true) || "";
12565
12658
  redirectClient = new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, correlationId);
12566
12659
  response = redirectClient.handleRedirectPromise(hash)
12567
12660
  .then(function (result) {
@@ -12618,8 +12711,8 @@ var ClientApplication = /** @class */ (function () {
12618
12711
  var _this = this;
12619
12712
  return __generator$1(this, function (_a) {
12620
12713
  // Preflight request
12621
- this.preflightBrowserEnvironmentCheck(exports.InteractionType.Redirect);
12622
12714
  this.logger.verbose("acquireTokenRedirect called");
12715
+ this.preflightBrowserEnvironmentCheck(exports.InteractionType.Redirect);
12623
12716
  isLoggedIn = this.getAllAccounts().length > 0;
12624
12717
  if (isLoggedIn) {
12625
12718
  this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Redirect, request);
@@ -12653,8 +12746,8 @@ var ClientApplication = /** @class */ (function () {
12653
12746
  ClientApplication.prototype.acquireTokenPopup = function (request) {
12654
12747
  var _this = this;
12655
12748
  try {
12656
- this.preflightBrowserEnvironmentCheck(exports.InteractionType.Popup);
12657
12749
  this.logger.verbose("acquireTokenPopup called", request.correlationId);
12750
+ this.preflightBrowserEnvironmentCheck(exports.InteractionType.Popup);
12658
12751
  }
12659
12752
  catch (e) {
12660
12753
  // Since this function is syncronous we need to reject
@@ -12989,6 +13082,21 @@ var ClientApplication = /** @class */ (function () {
12989
13082
  !this.config.cache.storeAuthStateInCookie) {
12990
13083
  throw BrowserConfigurationAuthError.createInMemoryRedirectUnavailableError();
12991
13084
  }
13085
+ if (interactionType === exports.InteractionType.Redirect || interactionType === exports.InteractionType.Popup) {
13086
+ this.preflightInteractiveRequest();
13087
+ }
13088
+ };
13089
+ /**
13090
+ * Helper to validate app environment before making a request.
13091
+ * @param request
13092
+ * @param interactionType
13093
+ */
13094
+ ClientApplication.prototype.preflightInteractiveRequest = function () {
13095
+ this.logger.verbose("preflightInteractiveRequest called, validating app environment");
13096
+ // block the reload if it occurred inside a hidden iframe
13097
+ BrowserUtils.blockReloadInHiddenIframes();
13098
+ // Set interaction in progress temporary cache or throw if alread set.
13099
+ this.browserStorage.setInteractionInProgress(true);
12992
13100
  };
12993
13101
  /**
12994
13102
  * Adds event callbacks to array
@@ -13080,7 +13188,7 @@ var SilentCacheClient = /** @class */ (function (_super) {
13080
13188
  switch (_a.label) {
13081
13189
  case 0:
13082
13190
  serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenSilent_silentFlow);
13083
- return [4 /*yield*/, this.createSilentFlowClient(serverTelemetryManager, silentRequest.authority)];
13191
+ return [4 /*yield*/, this.createSilentFlowClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions)];
13084
13192
  case 1:
13085
13193
  silentAuthClient = _a.sent();
13086
13194
  this.logger.verbose("Silent auth client created");
@@ -13115,12 +13223,12 @@ var SilentCacheClient = /** @class */ (function (_super) {
13115
13223
  * @param serverTelemetryManager
13116
13224
  * @param authorityUrl
13117
13225
  */
13118
- SilentCacheClient.prototype.createSilentFlowClient = function (serverTelemetryManager, authorityUrl) {
13226
+ SilentCacheClient.prototype.createSilentFlowClient = function (serverTelemetryManager, authorityUrl, azureCloudOptions) {
13119
13227
  return __awaiter$1(this, void 0, void 0, function () {
13120
13228
  var clientConfig;
13121
13229
  return __generator$1(this, function (_a) {
13122
13230
  switch (_a.label) {
13123
- case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl)];
13231
+ case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl, azureCloudOptions)];
13124
13232
  case 1:
13125
13233
  clientConfig = _a.sent();
13126
13234
  return [2 /*return*/, new SilentFlowClient(clientConfig)];
@@ -13523,21 +13631,34 @@ exports.AuthErrorMessage = AuthErrorMessage;
13523
13631
  exports.AuthenticationHeaderParser = AuthenticationHeaderParser;
13524
13632
  exports.BrowserAuthError = BrowserAuthError;
13525
13633
  exports.BrowserAuthErrorMessage = BrowserAuthErrorMessage;
13634
+ exports.BrowserCacheManager = BrowserCacheManager;
13526
13635
  exports.BrowserConfigurationAuthError = BrowserConfigurationAuthError;
13527
13636
  exports.BrowserConfigurationAuthErrorMessage = BrowserConfigurationAuthErrorMessage;
13637
+ exports.BrowserConstants = BrowserConstants;
13528
13638
  exports.BrowserUtils = BrowserUtils;
13529
13639
  exports.ClientAuthError = ClientAuthError;
13530
13640
  exports.ClientAuthErrorMessage = ClientAuthErrorMessage;
13531
13641
  exports.ClientConfigurationError = ClientConfigurationError;
13532
13642
  exports.ClientConfigurationErrorMessage = ClientConfigurationErrorMessage;
13643
+ exports.DEFAULT_IFRAME_TIMEOUT_MS = DEFAULT_IFRAME_TIMEOUT_MS;
13644
+ exports.EventHandler = EventHandler;
13533
13645
  exports.EventMessageUtils = EventMessageUtils;
13534
13646
  exports.InteractionRequiredAuthError = InteractionRequiredAuthError;
13535
13647
  exports.InteractionRequiredAuthErrorMessage = InteractionRequiredAuthErrorMessage;
13536
13648
  exports.Logger = Logger;
13537
13649
  exports.NavigationClient = NavigationClient;
13650
+ exports.OIDC_DEFAULT_SCOPES = OIDC_DEFAULT_SCOPES;
13651
+ exports.PopupClient = PopupClient;
13652
+ exports.PopupUtils = PopupUtils;
13538
13653
  exports.PublicClientApplication = PublicClientApplication;
13654
+ exports.RedirectClient = RedirectClient;
13655
+ exports.RedirectHandler = RedirectHandler;
13539
13656
  exports.ServerError = ServerError;
13540
13657
  exports.SignedHttpRequest = SignedHttpRequest;
13658
+ exports.SilentCacheClient = SilentCacheClient;
13659
+ exports.SilentIframeClient = SilentIframeClient;
13660
+ exports.SilentRefreshClient = SilentRefreshClient;
13661
+ exports.StandardInteractionClient = StandardInteractionClient;
13541
13662
  exports.StringUtils = StringUtils;
13542
13663
  exports.UrlString = UrlString;
13543
13664
  exports.stubbedPublicClientApplication = stubbedPublicClientApplication;