@azure/msal-browser 3.4.0 → 3.5.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 (124) hide show
  1. package/dist/app/IPublicClientApplication.mjs +1 -1
  2. package/dist/app/PublicClientApplication.mjs +1 -1
  3. package/dist/app/PublicClientNext.mjs +1 -1
  4. package/dist/broker/nativeBroker/NativeMessageHandler.mjs +1 -1
  5. package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
  6. package/dist/cache/AsyncMemoryStorage.mjs +1 -1
  7. package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
  8. package/dist/cache/BrowserCacheManager.mjs +8 -8
  9. package/dist/cache/BrowserCacheManager.mjs.map +1 -1
  10. package/dist/cache/BrowserStorage.mjs +1 -1
  11. package/dist/cache/CryptoKeyStore.mjs +1 -1
  12. package/dist/cache/DatabaseStorage.mjs +1 -1
  13. package/dist/cache/MemoryStorage.mjs +1 -1
  14. package/dist/cache/TokenCache.mjs +1 -1
  15. package/dist/config/Configuration.mjs +1 -1
  16. package/dist/controllers/ControllerFactory.mjs +1 -1
  17. package/dist/controllers/NestedAppAuthController.mjs +1 -1
  18. package/dist/controllers/StandardController.d.ts.map +1 -1
  19. package/dist/controllers/StandardController.mjs +23 -22
  20. package/dist/controllers/StandardController.mjs.map +1 -1
  21. package/dist/controllers/UnknownOperatingContextController.mjs +1 -1
  22. package/dist/crypto/BrowserCrypto.mjs +1 -1
  23. package/dist/crypto/CryptoOps.d.ts +2 -2
  24. package/dist/crypto/CryptoOps.d.ts.map +1 -1
  25. package/dist/crypto/CryptoOps.mjs +4 -3
  26. package/dist/crypto/CryptoOps.mjs.map +1 -1
  27. package/dist/crypto/PkceGenerator.mjs +1 -1
  28. package/dist/crypto/SignedHttpRequest.mjs +1 -1
  29. package/dist/encode/Base64Decode.mjs +1 -1
  30. package/dist/encode/Base64Encode.mjs +1 -1
  31. package/dist/error/BrowserAuthError.mjs +1 -1
  32. package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
  33. package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
  34. package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
  35. package/dist/error/NativeAuthError.mjs +1 -1
  36. package/dist/error/NativeAuthErrorCodes.mjs +1 -1
  37. package/dist/error/NestedAppAuthError.mjs +1 -1
  38. package/dist/event/EventHandler.mjs +1 -1
  39. package/dist/event/EventMessage.mjs +1 -1
  40. package/dist/event/EventType.mjs +1 -1
  41. package/dist/index.d.ts +1 -1
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.mjs +2 -2
  44. package/dist/interaction_client/BaseInteractionClient.d.ts +0 -1
  45. package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
  46. package/dist/interaction_client/BaseInteractionClient.mjs +2 -3
  47. package/dist/interaction_client/BaseInteractionClient.mjs.map +1 -1
  48. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
  49. package/dist/interaction_client/NativeInteractionClient.mjs +1 -1
  50. package/dist/interaction_client/PopupClient.d.ts +0 -10
  51. package/dist/interaction_client/PopupClient.d.ts.map +1 -1
  52. package/dist/interaction_client/PopupClient.mjs +22 -92
  53. package/dist/interaction_client/PopupClient.mjs.map +1 -1
  54. package/dist/interaction_client/RedirectClient.d.ts +3 -3
  55. package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
  56. package/dist/interaction_client/RedirectClient.mjs +51 -34
  57. package/dist/interaction_client/RedirectClient.mjs.map +1 -1
  58. package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
  59. package/dist/interaction_client/SilentCacheClient.mjs +1 -1
  60. package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
  61. package/dist/interaction_client/SilentIframeClient.mjs +8 -17
  62. package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
  63. package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
  64. package/dist/interaction_client/StandardInteractionClient.d.ts +1 -6
  65. package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
  66. package/dist/interaction_client/StandardInteractionClient.mjs +2 -24
  67. package/dist/interaction_client/StandardInteractionClient.mjs.map +1 -1
  68. package/dist/interaction_handler/InteractionHandler.d.ts +2 -2
  69. package/dist/interaction_handler/InteractionHandler.d.ts.map +1 -1
  70. package/dist/interaction_handler/InteractionHandler.mjs +5 -9
  71. package/dist/interaction_handler/InteractionHandler.mjs.map +1 -1
  72. package/dist/interaction_handler/RedirectHandler.d.ts +2 -2
  73. package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
  74. package/dist/interaction_handler/RedirectHandler.mjs +4 -8
  75. package/dist/interaction_handler/RedirectHandler.mjs.map +1 -1
  76. package/dist/interaction_handler/SilentHandler.d.ts +2 -2
  77. package/dist/interaction_handler/SilentHandler.d.ts.map +1 -1
  78. package/dist/interaction_handler/SilentHandler.mjs +13 -7
  79. package/dist/interaction_handler/SilentHandler.mjs.map +1 -1
  80. package/dist/naa/BridgeError.mjs +1 -1
  81. package/dist/naa/BridgeProxy.mjs +1 -1
  82. package/dist/naa/BridgeStatusCode.mjs +1 -1
  83. package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
  84. package/dist/navigation/NavigationClient.mjs +1 -1
  85. package/dist/network/FetchClient.mjs +1 -1
  86. package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
  87. package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
  88. package/dist/operatingcontext/TeamsAppOperatingContext.mjs +1 -1
  89. package/dist/operatingcontext/UnknownOperatingContext.mjs +1 -1
  90. package/dist/packageMetadata.d.ts +1 -1
  91. package/dist/packageMetadata.mjs +2 -2
  92. package/dist/response/ResponseHandler.d.ts +8 -0
  93. package/dist/response/ResponseHandler.d.ts.map +1 -0
  94. package/dist/response/ResponseHandler.mjs +46 -0
  95. package/dist/response/ResponseHandler.mjs.map +1 -0
  96. package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
  97. package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
  98. package/dist/utils/BrowserConstants.mjs +1 -1
  99. package/dist/utils/BrowserProtocolUtils.d.ts +7 -14
  100. package/dist/utils/BrowserProtocolUtils.d.ts.map +1 -1
  101. package/dist/utils/BrowserProtocolUtils.mjs +17 -30
  102. package/dist/utils/BrowserProtocolUtils.mjs.map +1 -1
  103. package/dist/utils/BrowserUtils.mjs +1 -1
  104. package/lib/msal-browser.cjs +360 -490
  105. package/lib/msal-browser.cjs.map +1 -1
  106. package/lib/msal-browser.js +360 -490
  107. package/lib/msal-browser.js.map +1 -1
  108. package/lib/msal-browser.min.js +66 -65
  109. package/package.json +2 -2
  110. package/src/cache/BrowserCacheManager.ts +7 -10
  111. package/src/controllers/StandardController.ts +28 -39
  112. package/src/crypto/CryptoOps.ts +5 -3
  113. package/src/index.ts +1 -0
  114. package/src/interaction_client/BaseInteractionClient.ts +1 -2
  115. package/src/interaction_client/PopupClient.ts +34 -137
  116. package/src/interaction_client/RedirectClient.ts +71 -55
  117. package/src/interaction_client/SilentIframeClient.ts +16 -27
  118. package/src/interaction_client/StandardInteractionClient.ts +2 -48
  119. package/src/interaction_handler/InteractionHandler.ts +5 -8
  120. package/src/interaction_handler/RedirectHandler.ts +4 -8
  121. package/src/interaction_handler/SilentHandler.ts +12 -5
  122. package/src/packageMetadata.ts +1 -1
  123. package/src/response/ResponseHandler.ts +73 -0
  124. package/src/utils/BrowserProtocolUtils.ts +17 -36
@@ -1,8 +1,8 @@
1
- /*! @azure/msal-browser v3.4.0 2023-10-30 */
1
+ /*! @azure/msal-browser v3.5.0 2023-11-07 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
5
- /*! @azure/msal-common v14.3.0 2023-10-30 */
5
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
6
6
  /*
7
7
  * Copyright (c) Microsoft Corporation. All rights reserved.
8
8
  * Licensed under the MIT License.
@@ -54,7 +54,6 @@ const Constants = {
54
54
  IMDS_TIMEOUT: 2000,
55
55
  AZURE_REGION_AUTO_DISCOVER_FLAG: "TryAutoDetect",
56
56
  REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX: "login.microsoft.com",
57
- REGIONAL_AUTH_NON_MSI_QUERY_STRING: "allowestsrnonmsi=true",
58
57
  KNOWN_PUBLIC_CLOUDS: [
59
58
  "login.microsoftonline.com",
60
59
  "login.windows.net",
@@ -359,13 +358,13 @@ const CacheOutcome = {
359
358
  // When the token request goes to the identity provider because refresh_in was used and the existing token needs to be refreshed
360
359
  PROACTIVELY_REFRESHED: "4",
361
360
  };
362
- const JsonTypes = {
361
+ const JsonWebTokenTypes = {
363
362
  Jwt: "JWT",
364
363
  Jwk: "JWK",
365
364
  Pop: "pop",
366
365
  };
367
366
 
368
- /*! @azure/msal-common v14.3.0 2023-10-30 */
367
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
369
368
  /*
370
369
  * Copyright (c) Microsoft Corporation. All rights reserved.
371
370
  * Licensed under the MIT License.
@@ -382,7 +381,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
382
381
  unexpectedError: unexpectedError
383
382
  });
384
383
 
385
- /*! @azure/msal-common v14.3.0 2023-10-30 */
384
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
386
385
 
387
386
  /*
388
387
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -431,7 +430,7 @@ function createAuthError(code, additionalMessage) {
431
430
  : AuthErrorMessages[code]);
432
431
  }
433
432
 
434
- /*! @azure/msal-common v14.3.0 2023-10-30 */
433
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
435
434
  /*
436
435
  * Copyright (c) Microsoft Corporation. All rights reserved.
437
436
  * Licensed under the MIT License.
@@ -529,7 +528,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
529
528
  userTimeoutReached: userTimeoutReached
530
529
  });
531
530
 
532
- /*! @azure/msal-common v14.3.0 2023-10-30 */
531
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
533
532
 
534
533
  /*
535
534
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -781,7 +780,7 @@ function createClientAuthError(errorCode, additionalMessage) {
781
780
  return new ClientAuthError(errorCode, additionalMessage);
782
781
  }
783
782
 
784
- /*! @azure/msal-common v14.3.0 2023-10-30 */
783
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
785
784
 
786
785
  /*
787
786
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -814,7 +813,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
814
813
  },
815
814
  };
816
815
 
817
- /*! @azure/msal-common v14.3.0 2023-10-30 */
816
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
818
817
 
819
818
  /*
820
819
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1005,12 +1004,12 @@ class Logger {
1005
1004
  }
1006
1005
  }
1007
1006
 
1008
- /*! @azure/msal-common v14.3.0 2023-10-30 */
1007
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
1009
1008
  /* eslint-disable header/header */
1010
1009
  const name$1 = "@azure/msal-common";
1011
- const version$1 = "14.3.0";
1010
+ const version$1 = "14.4.0";
1012
1011
 
1013
- /*! @azure/msal-common v14.3.0 2023-10-30 */
1012
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
1014
1013
  /*
1015
1014
  * Copyright (c) Microsoft Corporation. All rights reserved.
1016
1015
  * Licensed under the MIT License.
@@ -1030,7 +1029,7 @@ const AzureCloudInstance = {
1030
1029
  AzureUsGovernment: "https://login.microsoftonline.us",
1031
1030
  };
1032
1031
 
1033
- /*! @azure/msal-common v14.3.0 2023-10-30 */
1032
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
1034
1033
 
1035
1034
  /*
1036
1035
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1091,7 +1090,7 @@ function checkMaxAge(authTime, maxAge) {
1091
1090
  }
1092
1091
  }
1093
1092
 
1094
- /*! @azure/msal-common v14.3.0 2023-10-30 */
1093
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
1095
1094
  /*
1096
1095
  * Copyright (c) Microsoft Corporation. All rights reserved.
1097
1096
  * Licensed under the MIT License.
@@ -1138,7 +1137,7 @@ class TimeUtils {
1138
1137
  }
1139
1138
  }
1140
1139
 
1141
- /*! @azure/msal-common v14.3.0 2023-10-30 */
1140
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
1142
1141
 
1143
1142
  /*
1144
1143
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1355,8 +1354,24 @@ function generateScheme(credentialEntity) {
1355
1354
  ? credentialEntity.tokenType.toLowerCase()
1356
1355
  : "";
1357
1356
  }
1357
+ /**
1358
+ * validates if a given cache entry is "Telemetry", parses <key,value>
1359
+ * @param key
1360
+ * @param entity
1361
+ */
1362
+ function isServerTelemetryEntity(key, entity) {
1363
+ const validateKey = key.indexOf(SERVER_TELEM_CONSTANTS.CACHE_KEY) === 0;
1364
+ let validateEntity = true;
1365
+ if (entity) {
1366
+ validateEntity =
1367
+ entity.hasOwnProperty("failedRequests") &&
1368
+ entity.hasOwnProperty("errors") &&
1369
+ entity.hasOwnProperty("cacheHits");
1370
+ }
1371
+ return validateKey && validateEntity;
1372
+ }
1358
1373
 
1359
- /*! @azure/msal-common v14.3.0 2023-10-30 */
1374
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
1360
1375
  /*
1361
1376
  * Copyright (c) Microsoft Corporation. All rights reserved.
1362
1377
  * Licensed under the MIT License.
@@ -1410,7 +1425,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
1410
1425
  urlParseError: urlParseError
1411
1426
  });
1412
1427
 
1413
- /*! @azure/msal-common v14.3.0 2023-10-30 */
1428
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
1414
1429
 
1415
1430
  /*
1416
1431
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1548,7 +1563,7 @@ function createClientConfigurationError(errorCode) {
1548
1563
  return new ClientConfigurationError(errorCode);
1549
1564
  }
1550
1565
 
1551
- /*! @azure/msal-common v14.3.0 2023-10-30 */
1566
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
1552
1567
  /*
1553
1568
  * Copyright (c) Microsoft Corporation. All rights reserved.
1554
1569
  * Licensed under the MIT License.
@@ -1645,7 +1660,7 @@ class StringUtils {
1645
1660
  }
1646
1661
  }
1647
1662
 
1648
- /*! @azure/msal-common v14.3.0 2023-10-30 */
1663
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
1649
1664
 
1650
1665
  /*
1651
1666
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1845,7 +1860,7 @@ class ScopeSet {
1845
1860
  }
1846
1861
  }
1847
1862
 
1848
- /*! @azure/msal-common v14.3.0 2023-10-30 */
1863
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
1849
1864
 
1850
1865
  /*
1851
1866
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1885,7 +1900,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
1885
1900
  };
1886
1901
  }
1887
1902
 
1888
- /*! @azure/msal-common v14.3.0 2023-10-30 */
1903
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
1889
1904
  /*
1890
1905
  * Copyright (c) Microsoft Corporation. All rights reserved.
1891
1906
  * Licensed under the MIT License.
@@ -1900,7 +1915,7 @@ const AuthorityType = {
1900
1915
  Ciam: 3,
1901
1916
  };
1902
1917
 
1903
- /*! @azure/msal-common v14.3.0 2023-10-30 */
1918
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
1904
1919
  /*
1905
1920
  * Copyright (c) Microsoft Corporation. All rights reserved.
1906
1921
  * Licensed under the MIT License.
@@ -1913,7 +1928,7 @@ const ProtocolMode = {
1913
1928
  OIDC: "OIDC",
1914
1929
  };
1915
1930
 
1916
- /*! @azure/msal-common v14.3.0 2023-10-30 */
1931
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
1917
1932
 
1918
1933
  /*
1919
1934
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2134,7 +2149,54 @@ class AccountEntity {
2134
2149
  }
2135
2150
  }
2136
2151
 
2137
- /*! @azure/msal-common v14.3.0 2023-10-30 */
2152
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
2153
+
2154
+ /*
2155
+ * Copyright (c) Microsoft Corporation. All rights reserved.
2156
+ * Licensed under the MIT License.
2157
+ */
2158
+ /**
2159
+ * Parses hash string from given string. Returns empty string if no hash symbol is found.
2160
+ * @param hashString
2161
+ */
2162
+ function stripLeadingHashOrQuery(responseString) {
2163
+ if (responseString.startsWith("#/")) {
2164
+ return responseString.substring(2);
2165
+ }
2166
+ else if (responseString.startsWith("#") ||
2167
+ responseString.startsWith("?")) {
2168
+ return responseString.substring(1);
2169
+ }
2170
+ return responseString;
2171
+ }
2172
+ /**
2173
+ * Returns URL hash as server auth code response object.
2174
+ */
2175
+ function getDeserializedResponse(responseString) {
2176
+ // Check if given hash is empty
2177
+ if (!responseString || responseString.indexOf("=") < 0) {
2178
+ return null;
2179
+ }
2180
+ try {
2181
+ // Strip the # or ? symbol if present
2182
+ const normalizedResponse = stripLeadingHashOrQuery(responseString);
2183
+ // If # symbol was not present, above will return empty string, so give original hash value
2184
+ const deserializedHash = Object.fromEntries(new URLSearchParams(normalizedResponse));
2185
+ // Check for known response properties
2186
+ if (deserializedHash.code ||
2187
+ deserializedHash.error ||
2188
+ deserializedHash.error_description ||
2189
+ deserializedHash.state) {
2190
+ return deserializedHash;
2191
+ }
2192
+ }
2193
+ catch (e) {
2194
+ throw createClientAuthError(hashNotDeserialized);
2195
+ }
2196
+ return null;
2197
+ }
2198
+
2199
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
2138
2200
 
2139
2201
  /*
2140
2202
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2153,7 +2215,7 @@ class UrlString {
2153
2215
  // Throws error if url is empty
2154
2216
  throw createClientConfigurationError(urlEmptyError);
2155
2217
  }
2156
- if (!this.getHash()) {
2218
+ if (!url.includes("#")) {
2157
2219
  this._urlString = UrlString.canonicalizeUri(url);
2158
2220
  }
2159
2221
  }
@@ -2235,12 +2297,6 @@ class UrlString {
2235
2297
  }
2236
2298
  return UrlString.constructAuthorityUriFromObject(urlObject);
2237
2299
  }
2238
- /**
2239
- * Returns the anchor part(#) of the URL
2240
- */
2241
- getHash() {
2242
- return UrlString.parseHash(this.urlString);
2243
- }
2244
2300
  /**
2245
2301
  * Parses out the components from a url string.
2246
2302
  * @returns An object with the various components. Please cache this value insted of calling this multiple times on the same url.
@@ -2288,60 +2344,6 @@ class UrlString {
2288
2344
  }
2289
2345
  return relativeUrl;
2290
2346
  }
2291
- /**
2292
- * Parses hash string from given string. Returns empty string if no hash symbol is found.
2293
- * @param hashString
2294
- */
2295
- static parseHash(hashString) {
2296
- const hashIndex1 = hashString.indexOf("#");
2297
- const hashIndex2 = hashString.indexOf("#/");
2298
- if (hashIndex2 > -1) {
2299
- return hashString.substring(hashIndex2 + 2);
2300
- }
2301
- else if (hashIndex1 > -1) {
2302
- return hashString.substring(hashIndex1 + 1);
2303
- }
2304
- return Constants.EMPTY_STRING;
2305
- }
2306
- /**
2307
- * Parses query string from given string. Returns empty string if no query symbol is found.
2308
- * @param queryString
2309
- */
2310
- static parseQueryString(queryString) {
2311
- const queryIndex1 = queryString.indexOf("?");
2312
- const queryIndex2 = queryString.indexOf("/?");
2313
- if (queryIndex2 > -1) {
2314
- return queryString.substring(queryIndex2 + 2);
2315
- }
2316
- else if (queryIndex1 > -1) {
2317
- return queryString.substring(queryIndex1 + 1);
2318
- }
2319
- return Constants.EMPTY_STRING;
2320
- }
2321
- /**
2322
- * Parses query server response string from given string.
2323
- * Extract hash between '?code=' and '#' if trailing '# is present.
2324
- * Returns empty string if no query symbol is found.
2325
- * @param queryString
2326
- */
2327
- static parseQueryServerResponse(queryString) {
2328
- const queryIndex1 = queryString.indexOf("?code");
2329
- const queryIndex2 = queryString.indexOf("/?code");
2330
- const hashIndex = queryString.indexOf("#");
2331
- if (queryIndex2 > -1 && hashIndex > -1) {
2332
- return queryString.substring(queryIndex2 + 2, hashIndex);
2333
- }
2334
- else if (queryIndex2 > -1) {
2335
- return queryString.substring(queryIndex2 + 2);
2336
- }
2337
- else if (queryIndex1 > -1 && hashIndex > -1) {
2338
- return queryString.substring(queryIndex1 + 1, hashIndex);
2339
- }
2340
- else if (queryIndex1 > -1) {
2341
- return queryString.substring(queryIndex1 + 1);
2342
- }
2343
- return Constants.EMPTY_STRING;
2344
- }
2345
2347
  static constructAuthorityUriFromObject(urlObject) {
2346
2348
  return new UrlString(urlObject.Protocol +
2347
2349
  "//" +
@@ -2349,74 +2351,16 @@ class UrlString {
2349
2351
  "/" +
2350
2352
  urlObject.PathSegments.join("/"));
2351
2353
  }
2352
- /**
2353
- * Returns URL hash as server auth code response object.
2354
- */
2355
- static getDeserializedHash(hash) {
2356
- // Check if given hash is empty
2357
- if (!hash) {
2358
- return {};
2359
- }
2360
- // Strip the # symbol if present
2361
- const parsedHash = UrlString.parseHash(hash);
2362
- // If # symbol was not present, above will return empty string, so give original hash value
2363
- const deserializedHash = StringUtils.queryStringToObject(parsedHash || hash);
2364
- // Check if deserialization didn't work
2365
- if (!deserializedHash) {
2366
- throw createClientAuthError(hashNotDeserialized);
2367
- }
2368
- return deserializedHash;
2369
- }
2370
- /**
2371
- * Returns URL query string as server auth code response object.
2372
- */
2373
- static getDeserializedQueryString(query) {
2374
- // Check if given query is empty
2375
- if (!query) {
2376
- return {};
2377
- }
2378
- // Strip the ? symbol if present
2379
- const parsedQueryString = UrlString.parseQueryString(query);
2380
- // If ? symbol was not present, above will return empty string, so give original query value
2381
- const deserializedQueryString = StringUtils.queryStringToObject(parsedQueryString || query);
2382
- // Check if deserialization didn't work
2383
- if (!deserializedQueryString) {
2384
- throw createClientAuthError(hashNotDeserialized);
2385
- }
2386
- return deserializedQueryString;
2387
- }
2388
- /**
2389
- * Returns either deserialized query string or deserialized hash, depending on the serverResponseType
2390
- * as a server auth code response object.
2391
- */
2392
- static getDeserializedCodeResponse(serverResponseType, hashFragment) {
2393
- const hashUrlString = new UrlString(hashFragment);
2394
- let serverParams;
2395
- if (serverResponseType === ServerResponseType.QUERY) {
2396
- serverParams = UrlString.getDeserializedQueryString(hashFragment);
2397
- }
2398
- else {
2399
- serverParams = UrlString.getDeserializedHash(hashUrlString.getHash());
2400
- }
2401
- return serverParams;
2402
- }
2403
2354
  /**
2404
2355
  * Check if the hash of the URL string contains known properties
2356
+ * @deprecated This API will be removed in a future version
2405
2357
  */
2406
- static hashContainsKnownProperties(hash) {
2407
- if (!hash || hash.indexOf("=") < 0) {
2408
- // Hash doesn't contain key/value pairs
2409
- return false;
2410
- }
2411
- const parameters = UrlString.getDeserializedHash(hash);
2412
- return !!(parameters.code ||
2413
- parameters.error_description ||
2414
- parameters.error ||
2415
- parameters.state);
2358
+ static hashContainsKnownProperties(response) {
2359
+ return !!getDeserializedResponse(response);
2416
2360
  }
2417
2361
  }
2418
2362
 
2419
- /*! @azure/msal-common v14.3.0 2023-10-30 */
2363
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
2420
2364
 
2421
2365
  /*
2422
2366
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3022,7 +2966,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
3022
2966
  return null;
3023
2967
  }
3024
2968
 
3025
- /*! @azure/msal-common v14.3.0 2023-10-30 */
2969
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
3026
2970
 
3027
2971
  /*
3028
2972
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3502,18 +3446,18 @@ class CacheManager {
3502
3446
  }
3503
3447
  /**
3504
3448
  * Retrieve the cached credentials into a cacherecord
3505
- * @param account
3506
- * @param clientId
3507
- * @param scopes
3508
- * @param environment
3509
- * @param authScheme
3449
+ * @param account {AccountInfo}
3450
+ * @param request {BaseAuthRequest}
3451
+ * @param environment {string}
3452
+ * @param performanceClient {?IPerformanceClient}
3453
+ * @param correlationId {?string}
3510
3454
  */
3511
- readCacheRecord(account, request, environment) {
3455
+ readCacheRecord(account, request, environment, performanceClient, correlationId) {
3512
3456
  const tokenKeys = this.getTokenKeys();
3513
3457
  const cachedAccount = this.readAccountFromCache(account);
3514
- const cachedIdToken = this.getIdToken(account, tokenKeys);
3515
- const cachedAccessToken = this.getAccessToken(account, request, tokenKeys);
3516
- const cachedRefreshToken = this.getRefreshToken(account, false, tokenKeys);
3458
+ const cachedIdToken = this.getIdToken(account, tokenKeys, performanceClient, correlationId);
3459
+ const cachedAccessToken = this.getAccessToken(account, request, tokenKeys, performanceClient, correlationId);
3460
+ const cachedRefreshToken = this.getRefreshToken(account, false, tokenKeys, performanceClient, correlationId);
3517
3461
  const cachedAppMetadata = this.readAppMetadataFromCache(environment);
3518
3462
  if (cachedAccount && cachedIdToken) {
3519
3463
  cachedAccount.idTokenClaims = extractTokenClaims(cachedIdToken.secret, this.cryptoImpl.base64Decode);
@@ -3536,11 +3480,12 @@ class CacheManager {
3536
3480
  }
3537
3481
  /**
3538
3482
  * Retrieve IdTokenEntity from cache
3539
- * @param clientId
3540
- * @param account
3541
- * @param inputRealm
3483
+ * @param account {AccountInfo}
3484
+ * @param tokenKeys {?TokenKeys}
3485
+ * @param performanceClient {?IPerformanceClient}
3486
+ * @param correlationId {?string}
3542
3487
  */
3543
- getIdToken(account, tokenKeys) {
3488
+ getIdToken(account, tokenKeys, performanceClient, correlationId) {
3544
3489
  this.commonLogger.trace("CacheManager - getIdToken called");
3545
3490
  const idTokenFilter = {
3546
3491
  homeAccountId: account.homeAccountId,
@@ -3560,6 +3505,9 @@ class CacheManager {
3560
3505
  idTokens.forEach((idToken) => {
3561
3506
  this.removeIdToken(generateCredentialKey(idToken));
3562
3507
  });
3508
+ if (performanceClient && correlationId) {
3509
+ performanceClient.addFields({ multiMatchedID: idTokens.length }, correlationId);
3510
+ }
3563
3511
  return null;
3564
3512
  }
3565
3513
  this.commonLogger.info("CacheManager:getIdToken - Returning id token");
@@ -3621,12 +3569,13 @@ class CacheManager {
3621
3569
  }
3622
3570
  /**
3623
3571
  * Retrieve AccessTokenEntity from cache
3624
- * @param clientId
3625
- * @param account
3626
- * @param scopes
3627
- * @param authScheme
3572
+ * @param account {AccountInfo}
3573
+ * @param request {BaseAuthRequest}
3574
+ * @param tokenKeys {?TokenKeys}
3575
+ * @param performanceClient {?IPerformanceClient}
3576
+ * @param correlationId {?string}
3628
3577
  */
3629
- getAccessToken(account, request, tokenKeys) {
3578
+ getAccessToken(account, request, tokenKeys, performanceClient, correlationId) {
3630
3579
  this.commonLogger.trace("CacheManager - getAccessToken called");
3631
3580
  const scopes = ScopeSet.createSearchScopes(request.scopes);
3632
3581
  const authScheme = request.authenticationScheme || AuthenticationScheme.BEARER;
@@ -3674,6 +3623,9 @@ class CacheManager {
3674
3623
  accessTokens.forEach((accessToken) => {
3675
3624
  void this.removeAccessToken(generateCredentialKey(accessToken));
3676
3625
  });
3626
+ if (performanceClient && correlationId) {
3627
+ performanceClient.addFields({ multiMatchedAT: accessTokens.length }, correlationId);
3628
+ }
3677
3629
  return null;
3678
3630
  }
3679
3631
  this.commonLogger.info("CacheManager:getAccessToken - Returning access token");
@@ -3742,11 +3694,13 @@ class CacheManager {
3742
3694
  }
3743
3695
  /**
3744
3696
  * Helper to retrieve the appropriate refresh token from cache
3745
- * @param clientId
3746
- * @param account
3747
- * @param familyRT
3697
+ * @param account {AccountInfo}
3698
+ * @param familyRT {boolean}
3699
+ * @param tokenKeys {?TokenKeys}
3700
+ * @param performanceClient {?IPerformanceClient}
3701
+ * @param correlationId {?string}
3748
3702
  */
3749
- getRefreshToken(account, familyRT, tokenKeys) {
3703
+ getRefreshToken(account, familyRT, tokenKeys, performanceClient, correlationId) {
3750
3704
  this.commonLogger.trace("CacheManager - getRefreshToken called");
3751
3705
  const id = familyRT ? THE_FAMILY_ID : undefined;
3752
3706
  const refreshTokenFilter = {
@@ -3776,6 +3730,9 @@ class CacheManager {
3776
3730
  return null;
3777
3731
  }
3778
3732
  // address the else case after remove functions address environment aliases
3733
+ if (numRefreshTokens > 1 && performanceClient && correlationId) {
3734
+ performanceClient.addFields({ multiMatchedRT: numRefreshTokens }, correlationId);
3735
+ }
3779
3736
  this.commonLogger.info("CacheManager:getRefreshToken - returning refresh token");
3780
3737
  return refreshTokens[0];
3781
3738
  }
@@ -4114,7 +4071,7 @@ class DefaultStorageClass extends CacheManager {
4114
4071
  }
4115
4072
  }
4116
4073
 
4117
- /*! @azure/msal-common v14.3.0 2023-10-30 */
4074
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
4118
4075
 
4119
4076
  /*
4120
4077
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4214,7 +4171,7 @@ function isOidcProtocolMode(config) {
4214
4171
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
4215
4172
  }
4216
4173
 
4217
- /*! @azure/msal-common v14.3.0 2023-10-30 */
4174
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
4218
4175
 
4219
4176
  /*
4220
4177
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4231,7 +4188,7 @@ class ServerError extends AuthError {
4231
4188
  }
4232
4189
  }
4233
4190
 
4234
- /*! @azure/msal-common v14.3.0 2023-10-30 */
4191
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
4235
4192
 
4236
4193
  /*
4237
4194
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4329,7 +4286,7 @@ class ThrottlingUtils {
4329
4286
  }
4330
4287
  }
4331
4288
 
4332
- /*! @azure/msal-common v14.3.0 2023-10-30 */
4289
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
4333
4290
 
4334
4291
  /*
4335
4292
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4366,7 +4323,7 @@ class NetworkManager {
4366
4323
  }
4367
4324
  }
4368
4325
 
4369
- /*! @azure/msal-common v14.3.0 2023-10-30 */
4326
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
4370
4327
  /*
4371
4328
  * Copyright (c) Microsoft Corporation. All rights reserved.
4372
4329
  * Licensed under the MIT License.
@@ -4376,7 +4333,7 @@ const CcsCredentialType = {
4376
4333
  UPN: "UPN",
4377
4334
  };
4378
4335
 
4379
- /*! @azure/msal-common v14.3.0 2023-10-30 */
4336
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
4380
4337
 
4381
4338
  /*
4382
4339
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4460,7 +4417,7 @@ class RequestValidator {
4460
4417
  }
4461
4418
  }
4462
4419
 
4463
- /*! @azure/msal-common v14.3.0 2023-10-30 */
4420
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
4464
4421
 
4465
4422
  /*
4466
4423
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4844,7 +4801,7 @@ class RequestParameterBuilder {
4844
4801
  }
4845
4802
  }
4846
4803
 
4847
- /*! @azure/msal-common v14.3.0 2023-10-30 */
4804
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
4848
4805
  /*
4849
4806
  * Copyright (c) Microsoft Corporation. All rights reserved.
4850
4807
  * Licensed under the MIT License.
@@ -4856,7 +4813,7 @@ function isOpenIdConfigResponse(response) {
4856
4813
  response.hasOwnProperty("jwks_uri"));
4857
4814
  }
4858
4815
 
4859
- /*! @azure/msal-common v14.3.0 2023-10-30 */
4816
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
4860
4817
 
4861
4818
  /*
4862
4819
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4937,7 +4894,7 @@ class AuthorityMetadataEntity {
4937
4894
  }
4938
4895
  }
4939
4896
 
4940
- /*! @azure/msal-common v14.3.0 2023-10-30 */
4897
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
4941
4898
  /*
4942
4899
  * Copyright (c) Microsoft Corporation. All rights reserved.
4943
4900
  * Licensed under the MIT License.
@@ -4947,7 +4904,7 @@ function isCloudInstanceDiscoveryResponse(response) {
4947
4904
  response.hasOwnProperty("metadata"));
4948
4905
  }
4949
4906
 
4950
- /*! @azure/msal-common v14.3.0 2023-10-30 */
4907
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
4951
4908
  /*
4952
4909
  * Copyright (c) Microsoft Corporation. All rights reserved.
4953
4910
  * Licensed under the MIT License.
@@ -4957,7 +4914,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
4957
4914
  response.hasOwnProperty("error_description"));
4958
4915
  }
4959
4916
 
4960
- /*! @azure/msal-common v14.3.0 2023-10-30 */
4917
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
4961
4918
  /*
4962
4919
  * Copyright (c) Microsoft Corporation. All rights reserved.
4963
4920
  * Licensed under the MIT License.
@@ -5127,7 +5084,7 @@ const PerformanceEvents = {
5127
5084
  * Functions from InteractionHandler (msal-browser)
5128
5085
  */
5129
5086
  HandleCodeResponseFromServer: "handleCodeResponseFromServer",
5130
- HandleCodeResponseFromHash: "handleCodeResponseFromHash",
5087
+ HandleCodeResponse: "handleCodeResponse",
5131
5088
  UpdateTokenEndpointAuthority: "updateTokenEndpointAuthority",
5132
5089
  /**
5133
5090
  * APIs in Authorization Code Client (msal-common)
@@ -5145,6 +5102,7 @@ const PerformanceEvents = {
5145
5102
  * handleServerTokenResponse API in ResponseHandler (msal-common)
5146
5103
  */
5147
5104
  HandleServerTokenResponse: "handleServerTokenResponse",
5105
+ DeserializeResponse: "deserializeResponse",
5148
5106
  /**
5149
5107
  * Authority functions
5150
5108
  */
@@ -5206,9 +5164,12 @@ const IntFields = new Set([
5206
5164
  "queuedTimeMs",
5207
5165
  "startTimeMs",
5208
5166
  "status",
5167
+ "multiMatchedAT",
5168
+ "multiMatchedID",
5169
+ "multiMatchedRT",
5209
5170
  ]);
5210
5171
 
5211
- /*! @azure/msal-common v14.3.0 2023-10-30 */
5172
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
5212
5173
  /*
5213
5174
  * Copyright (c) Microsoft Corporation. All rights reserved.
5214
5175
  * Licensed under the MIT License.
@@ -5294,7 +5255,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
5294
5255
  };
5295
5256
  };
5296
5257
 
5297
- /*! @azure/msal-common v14.3.0 2023-10-30 */
5258
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
5298
5259
 
5299
5260
  /*
5300
5261
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5403,7 +5364,7 @@ RegionDiscovery.IMDS_OPTIONS = {
5403
5364
  },
5404
5365
  };
5405
5366
 
5406
- /*! @azure/msal-common v14.3.0 2023-10-30 */
5367
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
5407
5368
 
5408
5369
  /*
5409
5370
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6131,9 +6092,8 @@ class Authority {
6131
6092
  const regionalMetadata = { ...metadata };
6132
6093
  regionalMetadata.authorization_endpoint =
6133
6094
  Authority.buildRegionalAuthorityString(regionalMetadata.authorization_endpoint, azureRegion);
6134
- // TODO: Enquire on whether we should leave the query string or remove it before releasing the feature
6135
6095
  regionalMetadata.token_endpoint =
6136
- Authority.buildRegionalAuthorityString(regionalMetadata.token_endpoint, azureRegion, Constants.REGIONAL_AUTH_NON_MSI_QUERY_STRING);
6096
+ Authority.buildRegionalAuthorityString(regionalMetadata.token_endpoint, azureRegion);
6137
6097
  if (regionalMetadata.end_session_endpoint) {
6138
6098
  regionalMetadata.end_session_endpoint =
6139
6099
  Authority.buildRegionalAuthorityString(regionalMetadata.end_session_endpoint, azureRegion);
@@ -6195,7 +6155,7 @@ function buildStaticAuthorityOptions(authOptions) {
6195
6155
  };
6196
6156
  }
6197
6157
 
6198
- /*! @azure/msal-common v14.3.0 2023-10-30 */
6158
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
6199
6159
 
6200
6160
  /*
6201
6161
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6245,7 +6205,7 @@ class AuthorityFactory {
6245
6205
  }
6246
6206
  }
6247
6207
 
6248
- /*! @azure/msal-common v14.3.0 2023-10-30 */
6208
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
6249
6209
 
6250
6210
  /*
6251
6211
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6348,7 +6308,7 @@ class BaseClient {
6348
6308
  }
6349
6309
  }
6350
6310
 
6351
- /*! @azure/msal-common v14.3.0 2023-10-30 */
6311
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
6352
6312
  /*
6353
6313
  * Copyright (c) Microsoft Corporation. All rights reserved.
6354
6314
  * Licensed under the MIT License.
@@ -6370,7 +6330,7 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
6370
6330
  noTokensFound: noTokensFound
6371
6331
  });
6372
6332
 
6373
- /*! @azure/msal-common v14.3.0 2023-10-30 */
6333
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
6374
6334
 
6375
6335
  /*
6376
6336
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6449,7 +6409,7 @@ function createInteractionRequiredAuthError(errorCode) {
6449
6409
  return new InteractionRequiredAuthError(errorCode, InteractionRequiredAuthErrorMessages[errorCode]);
6450
6410
  }
6451
6411
 
6452
- /*! @azure/msal-common v14.3.0 2023-10-30 */
6412
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
6453
6413
  /*
6454
6414
  * Copyright (c) Microsoft Corporation. All rights reserved.
6455
6415
  * Licensed under the MIT License.
@@ -6465,7 +6425,7 @@ class CacheRecord {
6465
6425
  }
6466
6426
  }
6467
6427
 
6468
- /*! @azure/msal-common v14.3.0 2023-10-30 */
6428
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
6469
6429
 
6470
6430
  /*
6471
6431
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6537,7 +6497,7 @@ class ProtocolUtils {
6537
6497
  }
6538
6498
  }
6539
6499
 
6540
- /*! @azure/msal-common v14.3.0 2023-10-30 */
6500
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
6541
6501
 
6542
6502
  /*
6543
6503
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6601,7 +6561,7 @@ class PopTokenGenerator {
6601
6561
  */
6602
6562
  async signPayload(payload, keyId, request, claims) {
6603
6563
  // Deconstruct request to extract SHR parameters
6604
- const { resourceRequestMethod, resourceRequestUri, shrClaims, shrNonce, } = request;
6564
+ const { resourceRequestMethod, resourceRequestUri, shrClaims, shrNonce, shrOptions, } = request;
6605
6565
  const resourceUrlString = resourceRequestUri
6606
6566
  ? new UrlString(resourceRequestUri)
6607
6567
  : undefined;
@@ -6618,11 +6578,11 @@ class PopTokenGenerator {
6618
6578
  : undefined,
6619
6579
  client_claims: shrClaims || undefined,
6620
6580
  ...claims,
6621
- }, keyId, request.correlationId);
6581
+ }, keyId, shrOptions, request.correlationId);
6622
6582
  }
6623
6583
  }
6624
6584
 
6625
- /*! @azure/msal-common v14.3.0 2023-10-30 */
6585
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
6626
6586
 
6627
6587
  /*
6628
6588
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6691,7 +6651,7 @@ class AppMetadataEntity {
6691
6651
  }
6692
6652
  }
6693
6653
 
6694
- /*! @azure/msal-common v14.3.0 2023-10-30 */
6654
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
6695
6655
  /*
6696
6656
  * Copyright (c) Microsoft Corporation. All rights reserved.
6697
6657
  * Licensed under the MIT License.
@@ -6718,7 +6678,7 @@ class AppMetadataEntity {
6718
6678
  }
6719
6679
  }
6720
6680
 
6721
- /*! @azure/msal-common v14.3.0 2023-10-30 */
6681
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
6722
6682
 
6723
6683
  /*
6724
6684
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7033,7 +6993,7 @@ class ResponseHandler {
7033
6993
  }
7034
6994
  }
7035
6995
 
7036
- /*! @azure/msal-common v14.3.0 2023-10-30 */
6996
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
7037
6997
 
7038
6998
  /*
7039
6999
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7090,22 +7050,16 @@ class AuthorizationCodeClient extends BaseClient {
7090
7050
  * the client to exchange for a token in acquireToken.
7091
7051
  * @param hashFragment
7092
7052
  */
7093
- handleFragmentResponse(hashFragment, cachedState) {
7053
+ handleFragmentResponse(serverParams, cachedState) {
7094
7054
  // Handle responses.
7095
7055
  const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, null, null);
7096
- const serverParams = UrlString.getDeserializedCodeResponse(this.config.authOptions.authority.options.OIDCOptions
7097
- ?.serverResponseType, hashFragment);
7098
7056
  // Get code response
7099
7057
  responseHandler.validateServerAuthorizationCodeResponse(serverParams, cachedState);
7100
7058
  // throw when there is no auth code in the response
7101
7059
  if (!serverParams.code) {
7102
7060
  throw createClientAuthError(authorizationCodeMissingFromServerResponse);
7103
7061
  }
7104
- return {
7105
- ...serverParams,
7106
- // Code param is optional in ServerAuthorizationCodeResponse but required in AuthorizationCodePaylod
7107
- code: serverParams.code,
7108
- };
7062
+ return serverParams;
7109
7063
  }
7110
7064
  /**
7111
7065
  * Used to log out the current user, and redirect the user to the postLogoutRedirectUri.
@@ -7444,7 +7398,7 @@ class AuthorizationCodeClient extends BaseClient {
7444
7398
  }
7445
7399
  }
7446
7400
 
7447
- /*! @azure/msal-common v14.3.0 2023-10-30 */
7401
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
7448
7402
 
7449
7403
  /*
7450
7404
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7516,7 +7470,7 @@ class RefreshTokenClient extends BaseClient {
7516
7470
  async acquireTokenWithCachedRefreshToken(request, foci) {
7517
7471
  this.performanceClient?.addQueueMeasurement(PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
7518
7472
  // fetches family RT or application RT based on FOCI value
7519
- const refreshToken = invoke(this.cacheManager.getRefreshToken.bind(this.cacheManager), PerformanceEvents.CacheManagerGetRefreshToken, this.logger, this.performanceClient, request.correlationId)(request.account, foci);
7473
+ const refreshToken = invoke(this.cacheManager.getRefreshToken.bind(this.cacheManager), PerformanceEvents.CacheManagerGetRefreshToken, this.logger, this.performanceClient, request.correlationId)(request.account, foci, undefined, this.performanceClient, request.correlationId);
7520
7474
  if (!refreshToken) {
7521
7475
  throw createInteractionRequiredAuthError(noTokensFound);
7522
7476
  }
@@ -7633,7 +7587,7 @@ class RefreshTokenClient extends BaseClient {
7633
7587
  }
7634
7588
  }
7635
7589
 
7636
- /*! @azure/msal-common v14.3.0 2023-10-30 */
7590
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
7637
7591
 
7638
7592
  /*
7639
7593
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7696,7 +7650,7 @@ class SilentFlowClient extends BaseClient {
7696
7650
  throw createClientAuthError(noAccountInSilentRequest);
7697
7651
  }
7698
7652
  const environment = request.authority || this.authority.getPreferredCache();
7699
- const cacheRecord = this.cacheManager.readCacheRecord(request.account, request, environment);
7653
+ const cacheRecord = this.cacheManager.readCacheRecord(request.account, request, environment, this.performanceClient, request.correlationId);
7700
7654
  if (!cacheRecord.accessToken) {
7701
7655
  // must refresh due to non-existent access_token
7702
7656
  this.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN, request.correlationId);
@@ -7728,7 +7682,9 @@ class SilentFlowClient extends BaseClient {
7728
7682
  this.performanceClient?.addFields({
7729
7683
  cacheOutcome: cacheOutcome,
7730
7684
  }, correlationId);
7731
- this.logger.info(`Token refresh is required due to cache outcome: ${cacheOutcome}`);
7685
+ if (cacheOutcome !== CacheOutcome.NOT_APPLICABLE) {
7686
+ this.logger.info(`Token refresh is required due to cache outcome: ${cacheOutcome}`);
7687
+ }
7732
7688
  }
7733
7689
  /**
7734
7690
  * Helper function to build response object from the CacheRecord
@@ -7752,37 +7708,7 @@ class SilentFlowClient extends BaseClient {
7752
7708
  }
7753
7709
  }
7754
7710
 
7755
- /*! @azure/msal-common v14.3.0 2023-10-30 */
7756
-
7757
- /*
7758
- * Copyright (c) Microsoft Corporation. All rights reserved.
7759
- * Licensed under the MIT License.
7760
- */
7761
- class ServerTelemetryEntity {
7762
- constructor() {
7763
- this.failedRequests = [];
7764
- this.errors = [];
7765
- this.cacheHits = 0;
7766
- }
7767
- /**
7768
- * validates if a given cache entry is "Telemetry", parses <key,value>
7769
- * @param key
7770
- * @param entity
7771
- */
7772
- static isServerTelemetryEntity(key, entity) {
7773
- const validateKey = key.indexOf(SERVER_TELEM_CONSTANTS.CACHE_KEY) === 0;
7774
- let validateEntity = true;
7775
- if (entity) {
7776
- validateEntity =
7777
- entity.hasOwnProperty("failedRequests") &&
7778
- entity.hasOwnProperty("errors") &&
7779
- entity.hasOwnProperty("cacheHits");
7780
- }
7781
- return validateKey && validateEntity;
7782
- }
7783
- }
7784
-
7785
- /*! @azure/msal-common v14.3.0 2023-10-30 */
7711
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
7786
7712
 
7787
7713
  /*
7788
7714
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7808,7 +7734,7 @@ class ThrottlingEntity {
7808
7734
  }
7809
7735
  }
7810
7736
 
7811
- /*! @azure/msal-common v14.3.0 2023-10-30 */
7737
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
7812
7738
 
7813
7739
  /*
7814
7740
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7823,7 +7749,7 @@ const StubbedNetworkModule = {
7823
7749
  },
7824
7750
  };
7825
7751
 
7826
- /*! @azure/msal-common v14.3.0 2023-10-30 */
7752
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
7827
7753
  /*
7828
7754
  * Copyright (c) Microsoft Corporation. All rights reserved.
7829
7755
  * Licensed under the MIT License.
@@ -7831,7 +7757,7 @@ const StubbedNetworkModule = {
7831
7757
  const missingKidError = "missing_kid_error";
7832
7758
  const missingAlgError = "missing_alg_error";
7833
7759
 
7834
- /*! @azure/msal-common v14.3.0 2023-10-30 */
7760
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
7835
7761
 
7836
7762
  /*
7837
7763
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7856,7 +7782,7 @@ function createJoseHeaderError(code) {
7856
7782
  return new JoseHeaderError(code, JoseHeaderErrorMessages[code]);
7857
7783
  }
7858
7784
 
7859
- /*! @azure/msal-common v14.3.0 2023-10-30 */
7785
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
7860
7786
 
7861
7787
  /*
7862
7788
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7888,7 +7814,7 @@ class JoseHeader {
7888
7814
  }
7889
7815
  const shrHeader = new JoseHeader({
7890
7816
  // Access Token PoP headers must have type pop, but the type header can be overriden for special cases
7891
- typ: shrHeaderOptions.typ || JsonTypes.Pop,
7817
+ typ: shrHeaderOptions.typ || JsonWebTokenTypes.Pop,
7892
7818
  kid: shrHeaderOptions.kid,
7893
7819
  alg: shrHeaderOptions.alg,
7894
7820
  });
@@ -7896,7 +7822,7 @@ class JoseHeader {
7896
7822
  }
7897
7823
  }
7898
7824
 
7899
- /*! @azure/msal-common v14.3.0 2023-10-30 */
7825
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
7900
7826
 
7901
7827
  /*
7902
7828
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7954,7 +7880,7 @@ class AuthenticationHeaderParser {
7954
7880
  }
7955
7881
  }
7956
7882
 
7957
- /*! @azure/msal-common v14.3.0 2023-10-30 */
7883
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
7958
7884
 
7959
7885
  /*
7960
7886
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8066,7 +7992,11 @@ class ServerTelemetryManager {
8066
7992
  * Get the server telemetry entity from cache or initialize a new one
8067
7993
  */
8068
7994
  getLastRequests() {
8069
- const initialValue = new ServerTelemetryEntity();
7995
+ const initialValue = {
7996
+ failedRequests: [],
7997
+ errors: [],
7998
+ cacheHits: 0,
7999
+ };
8070
8000
  const lastRequests = this.cacheManager.getServerTelemetry(this.telemetryCacheKey);
8071
8001
  return lastRequests || initialValue;
8072
8002
  }
@@ -8083,11 +8013,11 @@ class ServerTelemetryManager {
8083
8013
  }
8084
8014
  else {
8085
8015
  // Partial data was flushed to server, construct a new telemetry cache item with errors that were not flushed
8086
- const serverTelemEntity = new ServerTelemetryEntity();
8087
- serverTelemEntity.failedRequests =
8088
- lastRequests.failedRequests.slice(numErrorsFlushed * 2); // failedRequests contains 2 items for each error
8089
- serverTelemEntity.errors =
8090
- lastRequests.errors.slice(numErrorsFlushed);
8016
+ const serverTelemEntity = {
8017
+ failedRequests: lastRequests.failedRequests.slice(numErrorsFlushed * 2),
8018
+ errors: lastRequests.errors.slice(numErrorsFlushed),
8019
+ cacheHits: 0,
8020
+ };
8091
8021
  this.cacheManager.setServerTelemetry(this.telemetryCacheKey, serverTelemEntity);
8092
8022
  }
8093
8023
  }
@@ -8154,7 +8084,7 @@ class ServerTelemetryManager {
8154
8084
  }
8155
8085
  }
8156
8086
 
8157
- /*! @azure/msal-common v14.3.0 2023-10-30 */
8087
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
8158
8088
 
8159
8089
  /*
8160
8090
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8566,7 +8496,7 @@ class PerformanceClient {
8566
8496
  }
8567
8497
  }
8568
8498
 
8569
- /*! @azure/msal-common v14.3.0 2023-10-30 */
8499
+ /*! @azure/msal-common v14.4.0 2023-11-07 */
8570
8500
 
8571
8501
  /*
8572
8502
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -9622,7 +9552,7 @@ function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system
9622
9552
 
9623
9553
  /* eslint-disable header/header */
9624
9554
  const name = "@azure/msal-browser";
9625
- const version = "3.4.0";
9555
+ const version = "3.5.0";
9626
9556
 
9627
9557
  /*
9628
9558
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10640,7 +10570,7 @@ class CryptoOps {
10640
10570
  * @param payload
10641
10571
  * @param kid
10642
10572
  */
10643
- async signJwt(payload, kid, correlationId) {
10573
+ async signJwt(payload, kid, shrOptions, correlationId) {
10644
10574
  const signJwtMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.CryptoOptsSignJwt, correlationId);
10645
10575
  const cachedKeyPair = await this.cache.asymmetricKeys.getItem(kid);
10646
10576
  if (!cachedKeyPair) {
@@ -10653,8 +10583,9 @@ class CryptoOps {
10653
10583
  const encodedKeyIdThumbprint = urlEncode(JSON.stringify({ kid: kid }));
10654
10584
  // Generate header
10655
10585
  const shrHeader = JoseHeader.getShrHeaderString({
10656
- kid: encodedKeyIdThumbprint,
10586
+ ...shrOptions?.header,
10657
10587
  alg: publicKeyJwk.alg,
10588
+ kid: encodedKeyIdThumbprint,
10658
10589
  });
10659
10590
  const encodedShrHeader = urlEncode(shrHeader);
10660
10591
  // Generate payload
@@ -10786,34 +10717,21 @@ class BrowserStorage {
10786
10717
  * Copyright (c) Microsoft Corporation. All rights reserved.
10787
10718
  * Licensed under the MIT License.
10788
10719
  */
10789
- class BrowserProtocolUtils {
10790
- /**
10791
- * Extracts the BrowserStateObject from the state string.
10792
- * @param browserCrypto
10793
- * @param state
10794
- */
10795
- static extractBrowserRequestState(browserCrypto, state) {
10796
- if (!state) {
10797
- return null;
10798
- }
10799
- try {
10800
- const requestStateObj = ProtocolUtils.parseRequestState(browserCrypto, state);
10801
- return requestStateObj.libraryState.meta;
10802
- }
10803
- catch (e) {
10804
- throw createClientAuthError(invalidState);
10805
- }
10720
+ /**
10721
+ * Extracts the BrowserStateObject from the state string.
10722
+ * @param browserCrypto
10723
+ * @param state
10724
+ */
10725
+ function extractBrowserRequestState(browserCrypto, state) {
10726
+ if (!state) {
10727
+ return null;
10806
10728
  }
10807
- /**
10808
- * Parses properties of server response from url hash
10809
- * @param locationHash Hash from url
10810
- */
10811
- static parseServerResponseFromHash(locationHash) {
10812
- if (!locationHash) {
10813
- return {};
10814
- }
10815
- const hashUrlString = new UrlString(locationHash);
10816
- return UrlString.getDeserializedHash(hashUrlString.getHash());
10729
+ try {
10730
+ const requestStateObj = ProtocolUtils.parseRequestState(browserCrypto, state);
10731
+ return requestStateObj.libraryState.meta;
10732
+ }
10733
+ catch (e) {
10734
+ throw createClientAuthError(invalidState);
10817
10735
  }
10818
10736
  }
10819
10737
 
@@ -11392,14 +11310,14 @@ class BrowserCacheManager extends CacheManager {
11392
11310
  this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit");
11393
11311
  return null;
11394
11312
  }
11395
- const parsedMetadata = this.validateAndParseJson(value);
11396
- if (!parsedMetadata ||
11397
- !ServerTelemetryEntity.isServerTelemetryEntity(serverTelemetryKey, parsedMetadata)) {
11313
+ const parsedEntity = this.validateAndParseJson(value);
11314
+ if (!parsedEntity ||
11315
+ !isServerTelemetryEntity(serverTelemetryKey, parsedEntity)) {
11398
11316
  this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit");
11399
11317
  return null;
11400
11318
  }
11401
11319
  this.logger.trace("BrowserCacheManager.getServerTelemetry: cache hit");
11402
- return CacheManager.toObject(new ServerTelemetryEntity(), parsedMetadata);
11320
+ return parsedEntity;
11403
11321
  }
11404
11322
  /**
11405
11323
  * set server telemetry entity to the platform cache
@@ -11892,7 +11810,7 @@ class BrowserCacheManager extends CacheManager {
11892
11810
  return;
11893
11811
  }
11894
11812
  // Extract state and ensure it matches given InteractionType, then clean request cache
11895
- const parsedState = BrowserProtocolUtils.extractBrowserRequestState(this.cryptoImpl, stateValue);
11813
+ const parsedState = extractBrowserRequestState(this.cryptoImpl, stateValue);
11896
11814
  if (parsedState &&
11897
11815
  parsedState.interactionType === interactionType) {
11898
11816
  this.logger.infoPii(`BrowserCacheManager.cleanRequestByInteractionType: Removing temporary cache items for state: ${stateValue}`);
@@ -12283,7 +12201,7 @@ class BaseInteractionClient {
12283
12201
  * @param request
12284
12202
  */
12285
12203
  async initializeBaseRequest(request, account) {
12286
- this.performanceClient.addQueueMeasurement(PerformanceEvents.InitializeBaseRequest, request.correlationId);
12204
+ this.performanceClient.addQueueMeasurement(PerformanceEvents.InitializeBaseRequest, this.correlationId);
12287
12205
  const authority = request.authority || this.config.auth.authority;
12288
12206
  if (account) {
12289
12207
  await this.validateRequestAuthority(authority, account);
@@ -12367,7 +12285,6 @@ class BaseInteractionClient {
12367
12285
  /**
12368
12286
  * Used to get a discovered version of the default authority.
12369
12287
  * @param requestAuthority
12370
- * @param requestCorrelationId
12371
12288
  */
12372
12289
  async getDiscoveredAuthority(requestAuthority) {
12373
12290
  this.logger.verbose("getDiscoveredAuthority called");
@@ -12455,7 +12372,7 @@ class StandardInteractionClient extends BaseInteractionClient {
12455
12372
  * @param request
12456
12373
  */
12457
12374
  async initializeAuthorizationCodeRequest(request) {
12458
- this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, request.correlationId);
12375
+ this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, this.correlationId);
12459
12376
  const generatedPkceParams = await invokeAsync(generatePkceCodes, PerformanceEvents.GeneratePkceCodes, this.logger, this.performanceClient, this.correlationId)(this.performanceClient, this.logger, this.correlationId);
12460
12377
  const authCodeRequest = {
12461
12378
  ...request,
@@ -12604,25 +12521,6 @@ class StandardInteractionClient extends BaseInteractionClient {
12604
12521
  telemetry: this.config.telemetry,
12605
12522
  };
12606
12523
  }
12607
- /**
12608
- * @param hash
12609
- * @param interactionType
12610
- */
12611
- validateAndExtractStateFromHash(serverParams, interactionType, requestCorrelationId) {
12612
- this.logger.verbose("validateAndExtractStateFromHash called", requestCorrelationId);
12613
- if (!serverParams.state) {
12614
- throw createBrowserAuthError(noStateInHash);
12615
- }
12616
- const platformStateObj = BrowserProtocolUtils.extractBrowserRequestState(this.browserCrypto, serverParams.state);
12617
- if (!platformStateObj) {
12618
- throw createBrowserAuthError(unableToParseState);
12619
- }
12620
- if (platformStateObj.interactionType !== interactionType) {
12621
- throw createBrowserAuthError(stateInteractionTypeMismatch);
12622
- }
12623
- this.logger.verbose("Returning state from hash", requestCorrelationId);
12624
- return serverParams.state;
12625
- }
12626
12524
  /**
12627
12525
  * Used to get a discovered version of the default authority.
12628
12526
  * @param requestAuthority
@@ -13649,15 +13547,11 @@ class InteractionHandler {
13649
13547
  * Function to handle response parameters from hash.
13650
13548
  * @param locationHash
13651
13549
  */
13652
- async handleCodeResponseFromHash(locationHash, request) {
13653
- this.performanceClient.addQueueMeasurement(PerformanceEvents.HandleCodeResponseFromHash, request.correlationId);
13654
- // Check that location hash isn't empty.
13655
- if (!locationHash) {
13656
- throw createBrowserAuthError(hashEmptyError);
13657
- }
13550
+ async handleCodeResponse(response, request) {
13551
+ this.performanceClient.addQueueMeasurement(PerformanceEvents.HandleCodeResponse, request.correlationId);
13658
13552
  let authCodeResponse;
13659
13553
  try {
13660
- authCodeResponse = this.authModule.handleFragmentResponse(locationHash, request.state);
13554
+ authCodeResponse = this.authModule.handleFragmentResponse(response, request.state);
13661
13555
  }
13662
13556
  catch (e) {
13663
13557
  if (e instanceof ServerError &&
@@ -13728,6 +13622,43 @@ class InteractionHandler {
13728
13622
  }
13729
13623
  }
13730
13624
 
13625
+ /*
13626
+ * Copyright (c) Microsoft Corporation. All rights reserved.
13627
+ * Licensed under the MIT License.
13628
+ */
13629
+ function deserializeResponse(responseString, responseLocation, logger) {
13630
+ // Deserialize hash fragment response parameters.
13631
+ const serverParams = getDeserializedResponse(responseString);
13632
+ if (!serverParams) {
13633
+ if (!stripLeadingHashOrQuery(responseString)) {
13634
+ // Hash or Query string is empty
13635
+ logger.error(`The request has returned to the redirectUri but a ${responseLocation} is not present. It's likely that the ${responseLocation} has been removed or the page has been redirected by code running on the redirectUri page.`);
13636
+ throw createBrowserAuthError(hashEmptyError);
13637
+ }
13638
+ else {
13639
+ logger.error(`A ${responseLocation} is present in the iframe but it does not contain known properties. It's likely that the ${responseLocation} has been replaced by code running on the redirectUri page.`);
13640
+ logger.errorPii(`The ${responseLocation} detected is: ${responseString}`);
13641
+ throw createBrowserAuthError(hashDoesNotContainKnownProperties);
13642
+ }
13643
+ }
13644
+ return serverParams;
13645
+ }
13646
+ /**
13647
+ * Returns the interaction type that the response object belongs to
13648
+ */
13649
+ function validateInteractionType(response, browserCrypto, interactionType) {
13650
+ if (!response.state) {
13651
+ throw createBrowserAuthError(noStateInHash);
13652
+ }
13653
+ const platformStateObj = extractBrowserRequestState(browserCrypto, response.state);
13654
+ if (!platformStateObj) {
13655
+ throw createBrowserAuthError(unableToParseState);
13656
+ }
13657
+ if (platformStateObj.interactionType !== interactionType) {
13658
+ throw createBrowserAuthError(stateInteractionTypeMismatch);
13659
+ }
13660
+ }
13661
+
13731
13662
  /*
13732
13663
  * Copyright (c) Microsoft Corporation. All rights reserved.
13733
13664
  * Licensed under the MIT License.
@@ -13836,9 +13767,8 @@ class PopupClient extends StandardInteractionClient {
13836
13767
  const popupWindow = this.initiateAuthRequest(navigateUrl, popupParameters);
13837
13768
  this.eventHandler.emitEvent(EventType.POPUP_OPENED, exports.InteractionType.Popup, { popupWindow }, null);
13838
13769
  // Monitor the window for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
13839
- const hash = await this.monitorPopupForHash(popupWindow);
13840
- // Deserialize hash fragment response parameters.
13841
- const serverParams = UrlString.getDeserializedHash(hash);
13770
+ const responseString = await this.monitorPopupForHash(popupWindow);
13771
+ const serverParams = invoke(deserializeResponse, PerformanceEvents.DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.serverResponseType, this.logger);
13842
13772
  // Remove throttle if it exists
13843
13773
  ThrottlingUtils.removeThrottle(this.browserStorage, this.config.auth.clientId, authCodeRequest);
13844
13774
  if (serverParams.accountId) {
@@ -13862,7 +13792,7 @@ class PopupClient extends StandardInteractionClient {
13862
13792
  });
13863
13793
  }
13864
13794
  // Handle response from hash string.
13865
- const result = await interactionHandler.handleCodeResponseFromHash(hash, validRequest);
13795
+ const result = await interactionHandler.handleCodeResponse(serverParams, validRequest);
13866
13796
  return result;
13867
13797
  }
13868
13798
  catch (e) {
@@ -13929,7 +13859,9 @@ class PopupClient extends StandardInteractionClient {
13929
13859
  popup,
13930
13860
  });
13931
13861
  this.eventHandler.emitEvent(EventType.POPUP_OPENED, exports.InteractionType.Popup, { popupWindow }, null);
13932
- await this.waitForLogoutPopup(popupWindow);
13862
+ await this.monitorPopupForHash(popupWindow).catch(() => {
13863
+ // Swallow any errors related to monitoring the window. Server logout is best effort
13864
+ });
13933
13865
  if (mainWindowRedirectUri) {
13934
13866
  const navigationOptions = {
13935
13867
  apiId: ApiId.logoutPopup,
@@ -13985,25 +13917,16 @@ class PopupClient extends StandardInteractionClient {
13985
13917
  */
13986
13918
  monitorPopupForHash(popupWindow) {
13987
13919
  return new Promise((resolve, reject) => {
13988
- /*
13989
- * Polling for popups needs to be tick-based,
13990
- * since a non-trivial amount of time can be spent on interaction (which should not count against the timeout).
13991
- */
13992
- const maxTicks = this.config.system.windowHashTimeout /
13993
- this.config.system.pollIntervalMilliseconds;
13994
- let ticks = 0;
13995
13920
  this.logger.verbose("PopupHandler.monitorPopupForHash - polling started");
13996
13921
  const intervalId = setInterval(() => {
13997
13922
  // Window is closed
13998
13923
  if (popupWindow.closed) {
13999
13924
  this.logger.error("PopupHandler.monitorPopupForHash - window closed");
14000
- this.cleanPopup();
14001
13925
  clearInterval(intervalId);
14002
13926
  reject(createBrowserAuthError(userCancelled));
14003
13927
  return;
14004
13928
  }
14005
- let href = Constants.EMPTY_STRING;
14006
- let serverResponseString = Constants.EMPTY_STRING;
13929
+ let href = "";
14007
13930
  try {
14008
13931
  /*
14009
13932
  * Will throw if cross origin,
@@ -14011,77 +13934,28 @@ class PopupClient extends StandardInteractionClient {
14011
13934
  * since we need the interval to keep running while on STS UI.
14012
13935
  */
14013
13936
  href = popupWindow.location.href;
14014
- serverResponseString =
14015
- this.extractServerResponseStringFromPopup(popupWindow, href);
14016
13937
  }
14017
13938
  catch (e) { }
14018
13939
  // Don't process blank pages or cross domain
14019
13940
  if (!href || href === "about:blank") {
14020
13941
  return;
14021
13942
  }
14022
- this.logger.verbose("PopupHandler.monitorPopupForHash - popup window is on same origin as caller");
14023
- /*
14024
- * Only run clock when we are on same domain for popups
14025
- * as popup operations can take a long time.
14026
- */
14027
- ticks++;
14028
- if (serverResponseString) {
14029
- this.logger.verbose("PopupHandler.monitorPopupForHash - found hash in url");
14030
- clearInterval(intervalId);
14031
- this.cleanPopup(popupWindow);
14032
- if (UrlString.hashContainsKnownProperties(serverResponseString)) {
14033
- this.logger.verbose("PopupHandler.monitorPopupForHash - hash contains known properties, returning.");
14034
- resolve(serverResponseString);
13943
+ clearInterval(intervalId);
13944
+ let responseString = "";
13945
+ const responseType = this.config.auth.OIDCOptions.serverResponseType;
13946
+ if (popupWindow) {
13947
+ if (responseType === ServerResponseType.QUERY) {
13948
+ responseString = popupWindow.location.search;
14035
13949
  }
14036
13950
  else {
14037
- this.logger.error("PopupHandler.monitorPopupForHash - found hash in url but it does not contain known properties. Check that your router is not changing the hash prematurely.");
14038
- this.logger.errorPii(`PopupHandler.monitorPopupForHash - hash found: ${serverResponseString}`);
14039
- reject(createBrowserAuthError(hashDoesNotContainKnownProperties));
13951
+ responseString = popupWindow.location.hash;
14040
13952
  }
14041
13953
  }
14042
- else if (ticks > maxTicks) {
14043
- this.logger.error("PopupHandler.monitorPopupForHash - unable to find hash in url, timing out");
14044
- clearInterval(intervalId);
14045
- reject(createBrowserAuthError(monitorPopupTimeout));
14046
- }
14047
- }, this.config.system.pollIntervalMilliseconds);
14048
- });
14049
- }
14050
- /**
14051
- * Waits for user interaction in logout popup window
14052
- * @param popupWindow
14053
- * @returns
14054
- */
14055
- waitForLogoutPopup(popupWindow) {
14056
- return new Promise((resolve) => {
14057
- this.logger.verbose("PopupHandler.waitForLogoutPopup - polling started");
14058
- const intervalId = setInterval(() => {
14059
- // Window is closed
14060
- if (popupWindow.closed) {
14061
- this.logger.error("PopupHandler.waitForLogoutPopup - window closed");
14062
- this.cleanPopup();
14063
- clearInterval(intervalId);
14064
- resolve();
14065
- }
14066
- let href = Constants.EMPTY_STRING;
14067
- try {
14068
- /*
14069
- * Will throw if cross origin,
14070
- * which should be caught and ignored
14071
- * since we need the interval to keep running while on STS UI.
14072
- */
14073
- href = popupWindow.location.href;
14074
- }
14075
- catch (e) { }
14076
- // Don't process blank pages or cross domain
14077
- if (!href || href === "about:blank") {
14078
- return;
14079
- }
14080
- this.logger.verbose("PopupHandler.waitForLogoutPopup - popup window is on same origin as caller, closing.");
14081
- clearInterval(intervalId);
14082
- this.cleanPopup(popupWindow);
14083
- resolve();
13954
+ this.logger.verbose("PopupHandler.monitorPopupForHash - popup window is on same origin as caller");
13955
+ resolve(responseString);
14084
13956
  }, this.config.system.pollIntervalMilliseconds);
13957
+ }).finally(() => {
13958
+ this.cleanPopup(popupWindow);
14085
13959
  });
14086
13960
  }
14087
13961
  /**
@@ -14216,20 +14090,6 @@ class PopupClient extends StandardInteractionClient {
14216
14090
  const homeAccountId = request.account && request.account.homeAccountId;
14217
14091
  return `${BrowserConstants.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${homeAccountId}.${this.correlationId}`;
14218
14092
  }
14219
- /**
14220
- * Extracts the server response from the popup window
14221
- */
14222
- extractServerResponseStringFromPopup(popupWindow, href) {
14223
- let serverResponseString;
14224
- if (this.config.auth.OIDCOptions?.serverResponseType ===
14225
- ServerResponseType.QUERY) {
14226
- serverResponseString = UrlString.parseQueryServerResponse(href);
14227
- }
14228
- else {
14229
- serverResponseString = popupWindow.location.hash;
14230
- }
14231
- return serverResponseString;
14232
- }
14233
14093
  }
14234
14094
 
14235
14095
  /*
@@ -14298,12 +14158,8 @@ class RedirectHandler {
14298
14158
  * Handle authorization code response in the window.
14299
14159
  * @param hash
14300
14160
  */
14301
- async handleCodeResponseFromHash(locationHash, state) {
14161
+ async handleCodeResponse(response, state) {
14302
14162
  this.logger.verbose("RedirectHandler.handleCodeResponse called");
14303
- // Check that location hash isn't empty.
14304
- if (!locationHash) {
14305
- throw createBrowserAuthError(hashEmptyError);
14306
- }
14307
14163
  // Interaction is completed - remove interaction status.
14308
14164
  this.browserStorage.setInteractionInProgress(false);
14309
14165
  // Handle code response.
@@ -14314,7 +14170,7 @@ class RedirectHandler {
14314
14170
  }
14315
14171
  let authCodeResponse;
14316
14172
  try {
14317
- authCodeResponse = this.authModule.handleFragmentResponse(locationHash, requestState);
14173
+ authCodeResponse = this.authModule.handleFragmentResponse(response, requestState);
14318
14174
  }
14319
14175
  catch (e) {
14320
14176
  if (e instanceof ServerError &&
@@ -14443,22 +14299,10 @@ class RedirectClient extends StandardInteractionClient {
14443
14299
  this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null.");
14444
14300
  return null;
14445
14301
  }
14446
- const responseHash = this.getRedirectResponseHash(hash || window.location.hash);
14447
- if (!responseHash) {
14302
+ const [serverParams, responseString] = this.getRedirectResponse(hash || "");
14303
+ if (!serverParams) {
14448
14304
  // Not a recognized server response hash or hash not associated with a redirect request
14449
- this.logger.info("handleRedirectPromise did not detect a response hash as a result of a redirect. Cleaning temporary cache.");
14450
- this.browserStorage.cleanRequestByInteractionType(exports.InteractionType.Redirect);
14451
- return null;
14452
- }
14453
- let state;
14454
- try {
14455
- // Deserialize hash fragment response parameters.
14456
- const serverParams = UrlString.getDeserializedHash(responseHash);
14457
- state = this.validateAndExtractStateFromHash(serverParams, exports.InteractionType.Redirect);
14458
- this.logger.verbose("State extracted from hash");
14459
- }
14460
- catch (e) {
14461
- this.logger.info(`handleRedirectPromise was unable to extract state due to: ${e}`);
14305
+ this.logger.info("handleRedirectPromise did not detect a response as a result of a redirect. Cleaning temporary cache.");
14462
14306
  this.browserStorage.cleanRequestByInteractionType(exports.InteractionType.Redirect);
14463
14307
  return null;
14464
14308
  }
@@ -14469,17 +14313,17 @@ class RedirectClient extends StandardInteractionClient {
14469
14313
  if (loginRequestUrlNormalized === currentUrlNormalized &&
14470
14314
  this.config.auth.navigateToLoginRequestUrl) {
14471
14315
  // We are on the page we need to navigate to - handle hash
14472
- this.logger.verbose("Current page is loginRequestUrl, handling hash");
14473
- const handleHashResult = await this.handleHash(responseHash, state, serverTelemetryManager);
14316
+ this.logger.verbose("Current page is loginRequestUrl, handling response");
14474
14317
  if (loginRequestUrl.indexOf("#") > -1) {
14475
14318
  // Replace current hash with non-msal hash, if present
14476
14319
  replaceHash(loginRequestUrl);
14477
14320
  }
14321
+ const handleHashResult = await this.handleResponse(serverParams, serverTelemetryManager);
14478
14322
  return handleHashResult;
14479
14323
  }
14480
14324
  else if (!this.config.auth.navigateToLoginRequestUrl) {
14481
- this.logger.verbose("NavigateToLoginRequestUrl set to false, handling hash");
14482
- return this.handleHash(responseHash, state, serverTelemetryManager);
14325
+ this.logger.verbose("NavigateToLoginRequestUrl set to false, handling response");
14326
+ return this.handleResponse(serverParams, serverTelemetryManager);
14483
14327
  }
14484
14328
  else if (!isInIframe() ||
14485
14329
  this.config.system.allowRedirectInIframe) {
@@ -14487,7 +14331,7 @@ class RedirectClient extends StandardInteractionClient {
14487
14331
  * Returned from authority using redirect - need to perform navigation before processing response
14488
14332
  * Cache the hash to be retrieved after the next redirect
14489
14333
  */
14490
- this.browserStorage.setTemporaryCache(TemporaryCacheKeys.URL_HASH, responseHash, true);
14334
+ this.browserStorage.setTemporaryCache(TemporaryCacheKeys.URL_HASH, responseString, true);
14491
14335
  const navigationOptions = {
14492
14336
  apiId: ApiId.handleRedirectPromise,
14493
14337
  timeout: this.config.system.redirectNavigationTimeout,
@@ -14515,7 +14359,7 @@ class RedirectClient extends StandardInteractionClient {
14515
14359
  }
14516
14360
  // If navigateInternal implementation returns false, handle the hash now
14517
14361
  if (!processHashOnRedirect) {
14518
- return this.handleHash(responseHash, state, serverTelemetryManager);
14362
+ return this.handleResponse(serverParams, serverTelemetryManager);
14519
14363
  }
14520
14364
  }
14521
14365
  return null;
@@ -14534,29 +14378,57 @@ class RedirectClient extends StandardInteractionClient {
14534
14378
  * Returns null if interactionType in the state value is not "redirect" or the hash does not contain known properties
14535
14379
  * @param hash
14536
14380
  */
14537
- getRedirectResponseHash(hash) {
14381
+ getRedirectResponse(userProvidedResponse) {
14538
14382
  this.logger.verbose("getRedirectResponseHash called");
14539
14383
  // Get current location hash from window or cache.
14540
- const isResponseHash = UrlString.hashContainsKnownProperties(hash);
14541
- if (isResponseHash) {
14384
+ let responseString = userProvidedResponse;
14385
+ if (!responseString) {
14386
+ if (this.config.auth.OIDCOptions.serverResponseType ===
14387
+ ServerResponseType.QUERY) {
14388
+ responseString = window.location.search;
14389
+ }
14390
+ else {
14391
+ responseString = window.location.hash;
14392
+ }
14393
+ }
14394
+ let response = getDeserializedResponse(responseString);
14395
+ if (response) {
14396
+ try {
14397
+ validateInteractionType(response, this.browserCrypto, exports.InteractionType.Redirect);
14398
+ }
14399
+ catch (e) {
14400
+ if (e instanceof AuthError) {
14401
+ this.logger.error(`Interaction type validation failed due to ${e.errorCode}: ${e.errorMessage}`);
14402
+ }
14403
+ return [null, ""];
14404
+ }
14542
14405
  clearHash(window);
14543
14406
  this.logger.verbose("Hash contains known properties, returning response hash");
14544
- return hash;
14407
+ return [response, responseString];
14545
14408
  }
14546
14409
  const cachedHash = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.URL_HASH, true);
14547
14410
  this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.URL_HASH));
14548
- this.logger.verbose("Hash does not contain known properties, returning cached hash");
14549
- return cachedHash;
14411
+ if (cachedHash) {
14412
+ response = getDeserializedResponse(cachedHash);
14413
+ if (response) {
14414
+ this.logger.verbose("Hash does not contain known properties, returning cached hash");
14415
+ return [response, cachedHash];
14416
+ }
14417
+ }
14418
+ return [null, ""];
14550
14419
  }
14551
14420
  /**
14552
14421
  * Checks if hash exists and handles in window.
14553
14422
  * @param hash
14554
14423
  * @param state
14555
14424
  */
14556
- async handleHash(hash, state, serverTelemetryManager) {
14425
+ async handleResponse(serverParams, serverTelemetryManager) {
14426
+ const state = serverParams.state;
14427
+ if (!state) {
14428
+ throw createBrowserAuthError(noStateInHash);
14429
+ }
14557
14430
  const cachedRequest = this.browserStorage.getCachedRequest(state);
14558
- this.logger.verbose("handleHash called, retrieved cached request");
14559
- const serverParams = UrlString.getDeserializedHash(hash);
14431
+ this.logger.verbose("handleResponse called, retrieved cached request");
14560
14432
  if (serverParams.accountId) {
14561
14433
  this.logger.verbose("Account id found in hash, calling WAM for token");
14562
14434
  if (!this.nativeMessageHandler) {
@@ -14582,7 +14454,7 @@ class RedirectClient extends StandardInteractionClient {
14582
14454
  const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, this.correlationId)(serverTelemetryManager, currentAuthority);
14583
14455
  ThrottlingUtils.removeThrottle(this.browserStorage, this.config.auth.clientId, cachedRequest);
14584
14456
  const interactionHandler = new RedirectHandler(authClient, this.browserStorage, cachedRequest, this.logger, this.performanceClient);
14585
- return await interactionHandler.handleCodeResponseFromHash(hash, state);
14457
+ return await interactionHandler.handleCodeResponse(serverParams, state);
14586
14458
  }
14587
14459
  /**
14588
14460
  * Use to log out the current user, and redirect the user to the postLogoutRedirectUri.
@@ -14693,7 +14565,7 @@ async function initiateAuthRequest(requestUrl, performanceClient, logger, correl
14693
14565
  * @param iframe
14694
14566
  * @param timeout
14695
14567
  */
14696
- async function monitorIframeForHash(iframe, timeout, pollIntervalMilliseconds, performanceClient, logger, correlationId) {
14568
+ async function monitorIframeForHash(iframe, timeout, pollIntervalMilliseconds, performanceClient, logger, correlationId, responseType) {
14697
14569
  performanceClient.addQueueMeasurement(PerformanceEvents.SilentHandlerMonitorIframeForHash, correlationId);
14698
14570
  return new Promise((resolve, reject) => {
14699
14571
  if (timeout < DEFAULT_IFRAME_TIMEOUT_MS) {
@@ -14722,12 +14594,18 @@ async function monitorIframeForHash(iframe, timeout, pollIntervalMilliseconds, p
14722
14594
  if (!href || href === "about:blank") {
14723
14595
  return;
14724
14596
  }
14725
- const contentHash = contentWindow
14726
- ? contentWindow.location.hash
14727
- : "";
14597
+ let responseString = "";
14598
+ if (contentWindow) {
14599
+ if (responseType === ServerResponseType.QUERY) {
14600
+ responseString = contentWindow.location.search;
14601
+ }
14602
+ else {
14603
+ responseString = contentWindow.location.hash;
14604
+ }
14605
+ }
14728
14606
  window.clearTimeout(timeoutId);
14729
14607
  window.clearInterval(intervalId);
14730
- resolve(contentHash);
14608
+ resolve(responseString);
14731
14609
  }, pollIntervalMilliseconds);
14732
14610
  }).finally(() => {
14733
14611
  invoke(removeHiddenIframe, PerformanceEvents.RemoveHiddenIframe, logger, performanceClient, correlationId)(iframe);
@@ -14870,20 +14748,10 @@ class SilentIframeClient extends StandardInteractionClient {
14870
14748
  const interactionHandler = new InteractionHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.performanceClient);
14871
14749
  // Get the frame handle for the silent request
14872
14750
  const msalFrame = await invokeAsync(initiateAuthRequest, PerformanceEvents.SilentHandlerInitiateAuthRequest, this.logger, this.performanceClient, correlationId)(navigateUrl, this.performanceClient, this.logger, correlationId, this.config.system.navigateFrameWait);
14751
+ const responseType = this.config.auth.OIDCOptions.serverResponseType;
14873
14752
  // Monitor the window for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
14874
- const hash = await invokeAsync(monitorIframeForHash, PerformanceEvents.SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(msalFrame, this.config.system.iframeHashTimeout, this.config.system.pollIntervalMilliseconds, this.performanceClient, this.logger, correlationId);
14875
- if (!hash) {
14876
- // No hash is present
14877
- this.logger.error("The request has returned to the redirectUri but a hash is not present in the iframe. It's likely that the hash has been removed or the page has been redirected by code running on the redirectUri page.");
14878
- throw createBrowserAuthError(hashEmptyError);
14879
- }
14880
- else if (!UrlString.hashContainsKnownProperties(hash)) {
14881
- this.logger.error("A hash is present in the iframe but it does not contain known properties. It's likely that the hash has been replaced by code running on the redirectUri page.");
14882
- this.logger.errorPii(`The hash detected in the iframe is: ${hash}`);
14883
- throw createBrowserAuthError(hashDoesNotContainKnownProperties);
14884
- }
14885
- // Deserialize hash fragment response parameters.
14886
- const serverParams = UrlString.getDeserializedHash(hash);
14753
+ const responseString = await invokeAsync(monitorIframeForHash, PerformanceEvents.SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(msalFrame, this.config.system.iframeHashTimeout, this.config.system.pollIntervalMilliseconds, this.performanceClient, this.logger, correlationId, responseType);
14754
+ const serverParams = invoke(deserializeResponse, PerformanceEvents.DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, responseType, this.logger);
14887
14755
  if (serverParams.accountId) {
14888
14756
  this.logger.verbose("Account id found in hash, calling WAM for token");
14889
14757
  if (!this.nativeMessageHandler) {
@@ -14898,7 +14766,7 @@ class SilentIframeClient extends StandardInteractionClient {
14898
14766
  });
14899
14767
  }
14900
14768
  // Handle response from hash string
14901
- return invokeAsync(interactionHandler.handleCodeResponseFromHash.bind(interactionHandler), PerformanceEvents.HandleCodeResponseFromHash, this.logger, this.performanceClient, correlationId)(hash, silentRequest);
14769
+ return invokeAsync(interactionHandler.handleCodeResponse.bind(interactionHandler), PerformanceEvents.HandleCodeResponse, this.logger, this.performanceClient, correlationId)(serverParams, silentRequest);
14902
14770
  }
14903
14771
  }
14904
14772
 
@@ -15369,12 +15237,6 @@ class StandardController {
15369
15237
  this.logger.verbose("handleRedirectPromise called");
15370
15238
  // Block token acquisition before initialize has been called
15371
15239
  blockAPICallsBeforeInitialize(this.initialized);
15372
- let foundServerResponse = hash;
15373
- if (this.config.auth.OIDCOptions?.serverResponseType ===
15374
- ServerResponseType.QUERY) {
15375
- const url = window.location.href;
15376
- foundServerResponse = UrlString.parseQueryServerResponse(url);
15377
- }
15378
15240
  const loggedInAccounts = this.getAllAccounts();
15379
15241
  if (this.isBrowserEnvironment) {
15380
15242
  /**
@@ -15382,7 +15244,7 @@ class StandardController {
15382
15244
  * otherwise return the promise from the first invocation. Prevents race conditions when handleRedirectPromise is called
15383
15245
  * several times concurrently.
15384
15246
  */
15385
- const redirectResponseKey = foundServerResponse || Constants.EMPTY_STRING;
15247
+ const redirectResponseKey = hash || "";
15386
15248
  let response = this.redirectResponse.get(redirectResponseKey);
15387
15249
  if (typeof response === "undefined") {
15388
15250
  this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_START, exports.InteractionType.Redirect);
@@ -15392,7 +15254,7 @@ class StandardController {
15392
15254
  if (request &&
15393
15255
  NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider) &&
15394
15256
  this.nativeExtensionProvider &&
15395
- !foundServerResponse) {
15257
+ !hash) {
15396
15258
  this.logger.trace("handleRedirectPromise - acquiring token from native platform");
15397
15259
  const nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.handleRedirectPromise, this.performanceClient, this.nativeExtensionProvider, request.accountId, this.nativeInternalStorage, request.correlationId);
15398
15260
  redirectResponse = nativeClient.handleRedirectPromise();
@@ -15402,7 +15264,7 @@ class StandardController {
15402
15264
  const correlationId = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, true) || Constants.EMPTY_STRING;
15403
15265
  const redirectClient = this.createRedirectClient(correlationId);
15404
15266
  redirectResponse =
15405
- redirectClient.handleRedirectPromise(foundServerResponse);
15267
+ redirectClient.handleRedirectPromise(hash);
15406
15268
  }
15407
15269
  response = redirectResponse
15408
15270
  .then((result) => {
@@ -15467,19 +15329,19 @@ class StandardController {
15467
15329
  }
15468
15330
  let result;
15469
15331
  if (this.nativeExtensionProvider && this.canUseNative(request)) {
15470
- const nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenRedirect, this.performanceClient, this.nativeExtensionProvider, this.getNativeAccountId(request), this.nativeInternalStorage, request.correlationId);
15332
+ const nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenRedirect, this.performanceClient, this.nativeExtensionProvider, this.getNativeAccountId(request), this.nativeInternalStorage, correlationId);
15471
15333
  result = nativeClient
15472
15334
  .acquireTokenRedirect(request)
15473
15335
  .catch((e) => {
15474
15336
  if (e instanceof NativeAuthError &&
15475
15337
  isFatalNativeAuthError(e)) {
15476
15338
  this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt
15477
- const redirectClient = this.createRedirectClient(request.correlationId);
15339
+ const redirectClient = this.createRedirectClient(correlationId);
15478
15340
  return redirectClient.acquireToken(request);
15479
15341
  }
15480
15342
  else if (e instanceof InteractionRequiredAuthError) {
15481
15343
  this.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow");
15482
- const redirectClient = this.createRedirectClient(request.correlationId);
15344
+ const redirectClient = this.createRedirectClient(correlationId);
15483
15345
  return redirectClient.acquireToken(request);
15484
15346
  }
15485
15347
  this.getBrowserStorage().setInteractionInProgress(false);
@@ -15487,7 +15349,7 @@ class StandardController {
15487
15349
  });
15488
15350
  }
15489
15351
  else {
15490
- const redirectClient = this.createRedirectClient(request.correlationId);
15352
+ const redirectClient = this.createRedirectClient(correlationId);
15491
15353
  result = redirectClient.acquireToken(request);
15492
15354
  }
15493
15355
  return result.catch((e) => {
@@ -15531,7 +15393,10 @@ class StandardController {
15531
15393
  }
15532
15394
  let result;
15533
15395
  if (this.canUseNative(request)) {
15534
- result = this.acquireTokenNative(request, ApiId.acquireTokenPopup)
15396
+ result = this.acquireTokenNative({
15397
+ ...request,
15398
+ correlationId,
15399
+ }, ApiId.acquireTokenPopup)
15535
15400
  .then((response) => {
15536
15401
  this.getBrowserStorage().setInteractionInProgress(false);
15537
15402
  atPopupMeasurement.end({
@@ -15545,12 +15410,12 @@ class StandardController {
15545
15410
  if (e instanceof NativeAuthError &&
15546
15411
  isFatalNativeAuthError(e)) {
15547
15412
  this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt
15548
- const popupClient = this.createPopupClient(request.correlationId);
15413
+ const popupClient = this.createPopupClient(correlationId);
15549
15414
  return popupClient.acquireToken(request);
15550
15415
  }
15551
15416
  else if (e instanceof InteractionRequiredAuthError) {
15552
15417
  this.logger.verbose("acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow");
15553
- const popupClient = this.createPopupClient(request.correlationId);
15418
+ const popupClient = this.createPopupClient(correlationId);
15554
15419
  return popupClient.acquireToken(request);
15555
15420
  }
15556
15421
  this.getBrowserStorage().setInteractionInProgress(false);
@@ -15558,7 +15423,7 @@ class StandardController {
15558
15423
  });
15559
15424
  }
15560
15425
  else {
15561
- const popupClient = this.createPopupClient(request.correlationId);
15426
+ const popupClient = this.createPopupClient(correlationId);
15562
15427
  result = popupClient.acquireToken(request);
15563
15428
  }
15564
15429
  return result
@@ -15701,7 +15566,7 @@ class StandardController {
15701
15566
  this.preflightBrowserEnvironmentCheck(exports.InteractionType.Silent);
15702
15567
  this.logger.trace("acquireTokenByCode called", correlationId);
15703
15568
  this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_START, exports.InteractionType.Silent, request);
15704
- const atbcMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenByCode, request.correlationId);
15569
+ const atbcMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenByCode, correlationId);
15705
15570
  try {
15706
15571
  if (request.code && request.nativeAccountId) {
15707
15572
  // Throw error in case server returns both spa_code and spa_accountid in exchange for auth code.
@@ -15743,14 +15608,17 @@ class StandardController {
15743
15608
  this.hybridAuthCodeResponses.set(hybridAuthCode, response);
15744
15609
  }
15745
15610
  else {
15746
- this.logger.verbose("Existing acquireTokenByCode request found", request.correlationId);
15611
+ this.logger.verbose("Existing acquireTokenByCode request found", correlationId);
15747
15612
  atbcMeasurement.discard();
15748
15613
  }
15749
15614
  return response;
15750
15615
  }
15751
15616
  else if (request.nativeAccountId) {
15752
15617
  if (this.canUseNative(request, request.nativeAccountId)) {
15753
- return this.acquireTokenNative(request, ApiId.acquireTokenByCode, request.nativeAccountId).catch((e) => {
15618
+ return this.acquireTokenNative({
15619
+ ...request,
15620
+ correlationId,
15621
+ }, ApiId.acquireTokenByCode, request.nativeAccountId).catch((e) => {
15754
15622
  // If native token acquisition fails for availability reasons fallback to standard flow
15755
15623
  if (e instanceof NativeAuthError &&
15756
15624
  isFatalNativeAuthError(e)) {
@@ -16391,6 +16259,7 @@ class StandardController {
16391
16259
  resourceRequestUri: request.resourceRequestUri,
16392
16260
  shrClaims: request.shrClaims,
16393
16261
  sshKid: request.sshKid,
16262
+ shrOptions: request.shrOptions,
16394
16263
  };
16395
16264
  const silentRequestKey = JSON.stringify(thumbprint);
16396
16265
  const cachedResponse = this.activeSilentTokenRequests.get(silentRequestKey);
@@ -18550,6 +18419,7 @@ exports.InteractionRequiredAuthError = InteractionRequiredAuthError;
18550
18419
  exports.InteractionRequiredAuthErrorCodes = InteractionRequiredAuthErrorCodes;
18551
18420
  exports.InteractionRequiredAuthErrorMessage = InteractionRequiredAuthErrorMessage;
18552
18421
  exports.InteractionStatus = InteractionStatus;
18422
+ exports.JsonWebTokenTypes = JsonWebTokenTypes;
18553
18423
  exports.Logger = Logger;
18554
18424
  exports.MemoryStorage = MemoryStorage;
18555
18425
  exports.NavigationClient = NavigationClient;