@azure/msal-node 2.16.1 → 2.16.3

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 (85) hide show
  1. package/dist/cache/NodeStorage.d.ts.map +1 -1
  2. package/dist/cache/NodeStorage.mjs +2 -2
  3. package/dist/cache/NodeStorage.mjs.map +1 -1
  4. package/dist/cache/TokenCache.d.ts +2 -2
  5. package/dist/cache/TokenCache.d.ts.map +1 -1
  6. package/dist/cache/TokenCache.mjs +6 -5
  7. package/dist/cache/TokenCache.mjs.map +1 -1
  8. package/dist/cache/distributed/DistributedCachePlugin.d.ts.map +1 -1
  9. package/dist/cache/distributed/DistributedCachePlugin.mjs +7 -3
  10. package/dist/cache/distributed/DistributedCachePlugin.mjs.map +1 -1
  11. package/dist/cache/serializer/Deserializer.mjs +1 -1
  12. package/dist/cache/serializer/Serializer.mjs +1 -1
  13. package/dist/client/ClientApplication.mjs +7 -7
  14. package/dist/client/ClientApplication.mjs.map +1 -1
  15. package/dist/client/ClientAssertion.mjs +1 -1
  16. package/dist/client/ClientCredentialClient.d.ts.map +1 -1
  17. package/dist/client/ClientCredentialClient.mjs +5 -5
  18. package/dist/client/ClientCredentialClient.mjs.map +1 -1
  19. package/dist/client/ConfidentialClientApplication.mjs +1 -1
  20. package/dist/client/DeviceCodeClient.mjs +1 -1
  21. package/dist/client/ManagedIdentityApplication.mjs +2 -2
  22. package/dist/client/ManagedIdentityClient.mjs +1 -1
  23. package/dist/client/ManagedIdentitySources/AppService.mjs +1 -1
  24. package/dist/client/ManagedIdentitySources/AzureArc.mjs +1 -1
  25. package/dist/client/ManagedIdentitySources/AzureArc.mjs.map +1 -1
  26. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +2 -2
  27. package/dist/client/ManagedIdentitySources/CloudShell.mjs +1 -1
  28. package/dist/client/ManagedIdentitySources/Imds.mjs +1 -1
  29. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +1 -1
  30. package/dist/client/OnBehalfOfClient.d.ts.map +1 -1
  31. package/dist/client/OnBehalfOfClient.mjs +7 -7
  32. package/dist/client/OnBehalfOfClient.mjs.map +1 -1
  33. package/dist/client/PublicClientApplication.d.ts.map +1 -1
  34. package/dist/client/PublicClientApplication.mjs +3 -3
  35. package/dist/client/PublicClientApplication.mjs.map +1 -1
  36. package/dist/client/UsernamePasswordClient.mjs +1 -1
  37. package/dist/config/Configuration.mjs +2 -2
  38. package/dist/config/ManagedIdentityId.mjs +1 -1
  39. package/dist/config/ManagedIdentityRequestParameters.mjs +1 -1
  40. package/dist/crypto/CryptoProvider.mjs +1 -1
  41. package/dist/crypto/GuidGenerator.mjs +1 -1
  42. package/dist/crypto/HashUtils.d.ts +1 -0
  43. package/dist/crypto/HashUtils.d.ts.map +1 -1
  44. package/dist/crypto/HashUtils.mjs +1 -1
  45. package/dist/crypto/PkceGenerator.mjs +1 -1
  46. package/dist/error/ManagedIdentityError.mjs +2 -2
  47. package/dist/error/ManagedIdentityErrorCodes.mjs +1 -1
  48. package/dist/error/NodeAuthError.mjs +1 -1
  49. package/dist/index.mjs +1 -1
  50. package/dist/internals.mjs +1 -1
  51. package/dist/network/HttpClient.mjs +1 -1
  52. package/dist/network/HttpClientWithRetries.mjs +1 -1
  53. package/dist/network/LoopbackClient.mjs +1 -1
  54. package/dist/packageMetadata.d.ts +1 -1
  55. package/dist/packageMetadata.mjs +2 -2
  56. package/dist/request/InteractiveRequest.d.ts +1 -0
  57. package/dist/request/InteractiveRequest.d.ts.map +1 -1
  58. package/dist/retry/LinearRetryPolicy.mjs +1 -1
  59. package/dist/utils/Constants.mjs +1 -3
  60. package/dist/utils/Constants.mjs.map +1 -1
  61. package/dist/utils/EncodingUtils.mjs +1 -1
  62. package/dist/utils/NetworkUtils.mjs +1 -1
  63. package/dist/utils/NetworkUtils.mjs.map +1 -1
  64. package/lib/msal-node.cjs +209 -219
  65. package/lib/msal-node.cjs.map +1 -1
  66. package/lib/types/cache/NodeStorage.d.ts.map +1 -1
  67. package/lib/types/cache/TokenCache.d.ts +2 -2
  68. package/lib/types/cache/TokenCache.d.ts.map +1 -1
  69. package/lib/types/cache/distributed/DistributedCachePlugin.d.ts.map +1 -1
  70. package/lib/types/client/ClientCredentialClient.d.ts.map +1 -1
  71. package/lib/types/client/OnBehalfOfClient.d.ts.map +1 -1
  72. package/lib/types/client/PublicClientApplication.d.ts.map +1 -1
  73. package/lib/types/crypto/HashUtils.d.ts +1 -0
  74. package/lib/types/crypto/HashUtils.d.ts.map +1 -1
  75. package/lib/types/packageMetadata.d.ts +1 -1
  76. package/lib/types/request/InteractiveRequest.d.ts +1 -0
  77. package/lib/types/request/InteractiveRequest.d.ts.map +1 -1
  78. package/package.json +2 -2
  79. package/src/cache/NodeStorage.ts +5 -1
  80. package/src/cache/TokenCache.ts +11 -4
  81. package/src/cache/distributed/DistributedCachePlugin.ts +9 -6
  82. package/src/client/ClientCredentialClient.ts +8 -4
  83. package/src/client/OnBehalfOfClient.ts +13 -6
  84. package/src/client/PublicClientApplication.ts +4 -1
  85. package/src/packageMetadata.ts +1 -1
package/lib/msal-node.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-node v2.16.1 2024-11-12 */
1
+ /*! @azure/msal-node v2.16.3 2025-08-05 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
@@ -152,7 +152,7 @@ class Serializer {
152
152
  }
153
153
  }
154
154
 
155
- /*! @azure/msal-common v14.16.0 2024-11-12 */
155
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
156
156
  /*
157
157
  * Copyright (c) Microsoft Corporation. All rights reserved.
158
158
  * Licensed under the MIT License.
@@ -217,13 +217,10 @@ const Constants$1 = {
217
217
  INVALID_INSTANCE: "invalid_instance",
218
218
  };
219
219
  const HttpStatus = {
220
- SUCCESS: 200,
221
220
  SUCCESS_RANGE_START: 200,
222
221
  SUCCESS_RANGE_END: 299,
223
222
  REDIRECT: 302,
224
- CLIENT_ERROR: 400,
225
223
  CLIENT_ERROR_RANGE_START: 400,
226
- BAD_REQUEST: 400,
227
224
  UNAUTHORIZED: 401,
228
225
  NOT_FOUND: 404,
229
226
  REQUEST_TIMEOUT: 408,
@@ -233,9 +230,7 @@ const HttpStatus = {
233
230
  SERVER_ERROR_RANGE_START: 500,
234
231
  SERVICE_UNAVAILABLE: 503,
235
232
  GATEWAY_TIMEOUT: 504,
236
- SERVER_ERROR_RANGE_END: 599,
237
- MULTI_SIDED_ERROR: 600,
238
- };
233
+ SERVER_ERROR_RANGE_END: 599};
239
234
  const OIDC_DEFAULT_SCOPES = [
240
235
  Constants$1.OPENID_SCOPE,
241
236
  Constants$1.PROFILE_SCOPE,
@@ -308,7 +303,6 @@ const ResponseMode = {
308
303
  * allowed grant_type
309
304
  */
310
305
  const GrantType = {
311
- IMPLICIT_GRANT: "implicit",
312
306
  AUTHORIZATION_CODE_GRANT: "authorization_code",
313
307
  CLIENT_CREDENTIALS_GRANT: "client_credentials",
314
308
  RESOURCE_OWNER_PASSWORD_GRANT: "password",
@@ -322,7 +316,6 @@ const GrantType = {
322
316
  const CacheAccountType = {
323
317
  MSSTS_ACCOUNT_TYPE: "MSSTS",
324
318
  ADFS_ACCOUNT_TYPE: "ADFS",
325
- MSAV1_ACCOUNT_TYPE: "MSA",
326
319
  GENERIC_ACCOUNT_TYPE: "Generic", // NTLM, Kerberos, FBA, Basic etc
327
320
  };
328
321
  /**
@@ -359,7 +352,6 @@ const AuthorityMetadataSource = {
359
352
  };
360
353
  const SERVER_TELEM_CONSTANTS = {
361
354
  SCHEMA_VERSION: 5,
362
- MAX_CUR_HEADER_BYTES: 80,
363
355
  MAX_LAST_HEADER_BYTES: 330,
364
356
  MAX_CACHED_ERRORS: 50,
365
357
  CACHE_KEY: "server-telemetry",
@@ -421,9 +413,7 @@ const RegionDiscoverySources = {
421
413
  * Region Discovery Outcomes
422
414
  */
423
415
  const RegionDiscoveryOutcomes = {
424
- CONFIGURED_MATCHES_DETECTED: "1",
425
416
  CONFIGURED_NO_AUTO_DETECTION: "2",
426
- CONFIGURED_NOT_DETECTED: "3",
427
417
  AUTO_DETECTION_REQUESTED_SUCCESSFUL: "4",
428
418
  AUTO_DETECTION_REQUESTED_FAILED: "5",
429
419
  };
@@ -445,7 +435,7 @@ const CacheOutcome = {
445
435
  // Token renewal offset default in seconds
446
436
  const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
447
437
 
448
- /*! @azure/msal-common v14.16.0 2024-11-12 */
438
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
449
439
  /*
450
440
  * Copyright (c) Microsoft Corporation. All rights reserved.
451
441
  * Licensed under the MIT License.
@@ -462,7 +452,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
462
452
  unexpectedError: unexpectedError
463
453
  });
464
454
 
465
- /*! @azure/msal-common v14.16.0 2024-11-12 */
455
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
466
456
 
467
457
  /*
468
458
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -511,7 +501,7 @@ function createAuthError(code, additionalMessage) {
511
501
  : AuthErrorMessages[code]);
512
502
  }
513
503
 
514
- /*! @azure/msal-common v14.16.0 2024-11-12 */
504
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
515
505
  /*
516
506
  * Copyright (c) Microsoft Corporation. All rights reserved.
517
507
  * Licensed under the MIT License.
@@ -609,7 +599,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
609
599
  userTimeoutReached: userTimeoutReached
610
600
  });
611
601
 
612
- /*! @azure/msal-common v14.16.0 2024-11-12 */
602
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
613
603
 
614
604
  /*
615
605
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -861,7 +851,7 @@ function createClientAuthError(errorCode, additionalMessage) {
861
851
  return new ClientAuthError(errorCode, additionalMessage);
862
852
  }
863
853
 
864
- /*! @azure/msal-common v14.16.0 2024-11-12 */
854
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
865
855
 
866
856
  /*
867
857
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -900,7 +890,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
900
890
  },
901
891
  };
902
892
 
903
- /*! @azure/msal-common v14.16.0 2024-11-12 */
893
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
904
894
 
905
895
  /*
906
896
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1091,12 +1081,12 @@ class Logger {
1091
1081
  }
1092
1082
  }
1093
1083
 
1094
- /*! @azure/msal-common v14.16.0 2024-11-12 */
1084
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
1095
1085
  /* eslint-disable header/header */
1096
1086
  const name$1 = "@azure/msal-common";
1097
- const version$1 = "14.16.0";
1087
+ const version$1 = "14.16.1";
1098
1088
 
1099
- /*! @azure/msal-common v14.16.0 2024-11-12 */
1089
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
1100
1090
  /*
1101
1091
  * Copyright (c) Microsoft Corporation. All rights reserved.
1102
1092
  * Licensed under the MIT License.
@@ -1116,7 +1106,7 @@ const AzureCloudInstance = {
1116
1106
  AzureUsGovernment: "https://login.microsoftonline.us",
1117
1107
  };
1118
1108
 
1119
- /*! @azure/msal-common v14.16.0 2024-11-12 */
1109
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
1120
1110
 
1121
1111
  /*
1122
1112
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1177,7 +1167,7 @@ function checkMaxAge(authTime, maxAge) {
1177
1167
  }
1178
1168
  }
1179
1169
 
1180
- /*! @azure/msal-common v14.16.0 2024-11-12 */
1170
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
1181
1171
  /*
1182
1172
  * Copyright (c) Microsoft Corporation. All rights reserved.
1183
1173
  * Licensed under the MIT License.
@@ -1222,7 +1212,7 @@ function delay(t, value) {
1222
1212
  return new Promise((resolve) => setTimeout(() => resolve(value), t));
1223
1213
  }
1224
1214
 
1225
- /*! @azure/msal-common v14.16.0 2024-11-12 */
1215
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
1226
1216
 
1227
1217
  /*
1228
1218
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1549,7 +1539,7 @@ function isAuthorityMetadataExpired(metadata) {
1549
1539
  return metadata.expiresAt <= nowSeconds();
1550
1540
  }
1551
1541
 
1552
- /*! @azure/msal-common v14.16.0 2024-11-12 */
1542
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
1553
1543
  /*
1554
1544
  * Copyright (c) Microsoft Corporation. All rights reserved.
1555
1545
  * Licensed under the MIT License.
@@ -1603,7 +1593,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
1603
1593
  urlParseError: urlParseError
1604
1594
  });
1605
1595
 
1606
- /*! @azure/msal-common v14.16.0 2024-11-12 */
1596
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
1607
1597
 
1608
1598
  /*
1609
1599
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1741,7 +1731,7 @@ function createClientConfigurationError(errorCode) {
1741
1731
  return new ClientConfigurationError(errorCode);
1742
1732
  }
1743
1733
 
1744
- /*! @azure/msal-common v14.16.0 2024-11-12 */
1734
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
1745
1735
  /*
1746
1736
  * Copyright (c) Microsoft Corporation. All rights reserved.
1747
1737
  * Licensed under the MIT License.
@@ -1838,7 +1828,7 @@ class StringUtils {
1838
1828
  }
1839
1829
  }
1840
1830
 
1841
- /*! @azure/msal-common v14.16.0 2024-11-12 */
1831
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
1842
1832
 
1843
1833
  /*
1844
1834
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2038,7 +2028,7 @@ class ScopeSet {
2038
2028
  }
2039
2029
  }
2040
2030
 
2041
- /*! @azure/msal-common v14.16.0 2024-11-12 */
2031
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
2042
2032
 
2043
2033
  /*
2044
2034
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2078,7 +2068,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
2078
2068
  };
2079
2069
  }
2080
2070
 
2081
- /*! @azure/msal-common v14.16.0 2024-11-12 */
2071
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
2082
2072
  /*
2083
2073
  * Copyright (c) Microsoft Corporation. All rights reserved.
2084
2074
  * Licensed under the MIT License.
@@ -2157,7 +2147,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
2157
2147
  return updatedAccountInfo;
2158
2148
  }
2159
2149
 
2160
- /*! @azure/msal-common v14.16.0 2024-11-12 */
2150
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
2161
2151
  /*
2162
2152
  * Copyright (c) Microsoft Corporation. All rights reserved.
2163
2153
  * Licensed under the MIT License.
@@ -2172,7 +2162,7 @@ const AuthorityType = {
2172
2162
  Ciam: 3,
2173
2163
  };
2174
2164
 
2175
- /*! @azure/msal-common v14.16.0 2024-11-12 */
2165
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
2176
2166
  /*
2177
2167
  * Copyright (c) Microsoft Corporation. All rights reserved.
2178
2168
  * Licensed under the MIT License.
@@ -2194,7 +2184,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
2194
2184
  return null;
2195
2185
  }
2196
2186
 
2197
- /*! @azure/msal-common v14.16.0 2024-11-12 */
2187
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
2198
2188
  /*
2199
2189
  * Copyright (c) Microsoft Corporation. All rights reserved.
2200
2190
  * Licensed under the MIT License.
@@ -2207,7 +2197,7 @@ const ProtocolMode = {
2207
2197
  OIDC: "OIDC",
2208
2198
  };
2209
2199
 
2210
- /*! @azure/msal-common v14.16.0 2024-11-12 */
2200
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
2211
2201
 
2212
2202
  /*
2213
2203
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2450,7 +2440,7 @@ class AccountEntity {
2450
2440
  }
2451
2441
  }
2452
2442
 
2453
- /*! @azure/msal-common v14.16.0 2024-11-12 */
2443
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
2454
2444
 
2455
2445
  /*
2456
2446
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2497,7 +2487,7 @@ function getDeserializedResponse(responseString) {
2497
2487
  return null;
2498
2488
  }
2499
2489
 
2500
- /*! @azure/msal-common v14.16.0 2024-11-12 */
2490
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
2501
2491
 
2502
2492
  /*
2503
2493
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2661,7 +2651,7 @@ class UrlString {
2661
2651
  }
2662
2652
  }
2663
2653
 
2664
- /*! @azure/msal-common v14.16.0 2024-11-12 */
2654
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
2665
2655
 
2666
2656
  /*
2667
2657
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2692,7 +2682,6 @@ const rawMetdataJSON = {
2692
2682
  },
2693
2683
  },
2694
2684
  instanceDiscoveryMetadata: {
2695
- tenant_discovery_endpoint: "https://{canonicalAuthority}/v2.0/.well-known/openid-configuration",
2696
2685
  metadata: [
2697
2686
  {
2698
2687
  preferred_network: "login.microsoftonline.com",
@@ -2801,23 +2790,23 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
2801
2790
  return null;
2802
2791
  }
2803
2792
 
2804
- /*! @azure/msal-common v14.16.0 2024-11-12 */
2793
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
2805
2794
  /*
2806
2795
  * Copyright (c) Microsoft Corporation. All rights reserved.
2807
2796
  * Licensed under the MIT License.
2808
2797
  */
2809
- const cacheQuotaExceededErrorCode = "cache_quota_exceeded";
2810
- const cacheUnknownErrorCode = "cache_error_unknown";
2798
+ const cacheQuotaExceeded = "cache_quota_exceeded";
2799
+ const cacheErrorUnknown = "cache_error_unknown";
2811
2800
 
2812
- /*! @azure/msal-common v14.16.0 2024-11-12 */
2801
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
2813
2802
 
2814
2803
  /*
2815
2804
  * Copyright (c) Microsoft Corporation. All rights reserved.
2816
2805
  * Licensed under the MIT License.
2817
2806
  */
2818
2807
  const CacheErrorMessages = {
2819
- [cacheQuotaExceededErrorCode]: "Exceeded cache storage capacity.",
2820
- [cacheUnknownErrorCode]: "Unexpected error occurred when using cache storage.",
2808
+ [cacheQuotaExceeded]: "Exceeded cache storage capacity.",
2809
+ [cacheErrorUnknown]: "Unexpected error occurred when using cache storage.",
2821
2810
  };
2822
2811
  /**
2823
2812
  * Error thrown when there is an error with the cache
@@ -2827,16 +2816,34 @@ class CacheError extends Error {
2827
2816
  const message = errorMessage ||
2828
2817
  (CacheErrorMessages[errorCode]
2829
2818
  ? CacheErrorMessages[errorCode]
2830
- : CacheErrorMessages[cacheUnknownErrorCode]);
2819
+ : CacheErrorMessages[cacheErrorUnknown]);
2831
2820
  super(`${errorCode}: ${message}`);
2832
2821
  Object.setPrototypeOf(this, CacheError.prototype);
2833
2822
  this.name = "CacheError";
2834
2823
  this.errorCode = errorCode;
2835
2824
  this.errorMessage = message;
2836
2825
  }
2826
+ }
2827
+ /**
2828
+ * Helper function to wrap browser errors in a CacheError object
2829
+ * @param e
2830
+ * @returns
2831
+ */
2832
+ function createCacheError(e) {
2833
+ if (!(e instanceof Error)) {
2834
+ return new CacheError(cacheErrorUnknown);
2835
+ }
2836
+ if (e.name === "QuotaExceededError" ||
2837
+ e.name === "NS_ERROR_DOM_QUOTA_REACHED" ||
2838
+ e.message.includes("exceeded the quota")) {
2839
+ return new CacheError(cacheQuotaExceeded);
2840
+ }
2841
+ else {
2842
+ return new CacheError(e.name, e.message);
2843
+ }
2837
2844
  }
2838
2845
 
2839
- /*! @azure/msal-common v14.16.0 2024-11-12 */
2846
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
2840
2847
 
2841
2848
  /*
2842
2849
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2858,14 +2865,14 @@ class CacheManager {
2858
2865
  * @param accountFilter - (Optional) filter to narrow down the accounts returned
2859
2866
  * @returns Array of AccountInfo objects in cache
2860
2867
  */
2861
- getAllAccounts(accountFilter) {
2862
- return this.buildTenantProfiles(this.getAccountsFilteredBy(accountFilter || {}), accountFilter);
2868
+ getAllAccounts(correlationId, accountFilter) {
2869
+ return this.buildTenantProfiles(this.getAccountsFilteredBy(accountFilter || {}, correlationId), correlationId, accountFilter);
2863
2870
  }
2864
2871
  /**
2865
2872
  * Gets first tenanted AccountInfo object found based on provided filters
2866
2873
  */
2867
- getAccountInfoFilteredBy(accountFilter) {
2868
- const allAccounts = this.getAllAccounts(accountFilter);
2874
+ getAccountInfoFilteredBy(accountFilter, correlationId) {
2875
+ const allAccounts = this.getAllAccounts(correlationId, accountFilter);
2869
2876
  if (allAccounts.length > 1) {
2870
2877
  // If one or more accounts are found, prioritize accounts that have an ID token
2871
2878
  const sortedAccounts = allAccounts.sort((account) => {
@@ -2886,8 +2893,8 @@ class CacheManager {
2886
2893
  * @param accountFilter
2887
2894
  * @returns
2888
2895
  */
2889
- getBaseAccountInfo(accountFilter) {
2890
- const accountEntities = this.getAccountsFilteredBy(accountFilter);
2896
+ getBaseAccountInfo(accountFilter, correlationId) {
2897
+ const accountEntities = this.getAccountsFilteredBy(accountFilter, correlationId);
2891
2898
  if (accountEntities.length > 0) {
2892
2899
  return accountEntities[0].getAccountInfo();
2893
2900
  }
@@ -2902,12 +2909,12 @@ class CacheManager {
2902
2909
  * @param accountFilter
2903
2910
  * @returns Array of AccountInfo objects that match account and tenant profile filters
2904
2911
  */
2905
- buildTenantProfiles(cachedAccounts, accountFilter) {
2912
+ buildTenantProfiles(cachedAccounts, correlationId, accountFilter) {
2906
2913
  return cachedAccounts.flatMap((accountEntity) => {
2907
- return this.getTenantProfilesFromAccountEntity(accountEntity, accountFilter?.tenantId, accountFilter);
2914
+ return this.getTenantProfilesFromAccountEntity(accountEntity, correlationId, accountFilter?.tenantId, accountFilter);
2908
2915
  });
2909
2916
  }
2910
- getTenantedAccountInfoByFilter(accountInfo, tokenKeys, tenantProfile, tenantProfileFilter) {
2917
+ getTenantedAccountInfoByFilter(accountInfo, tokenKeys, tenantProfile, correlationId, tenantProfileFilter) {
2911
2918
  let tenantedAccountInfo = null;
2912
2919
  let idTokenClaims;
2913
2920
  if (tenantProfileFilter) {
@@ -2915,7 +2922,7 @@ class CacheManager {
2915
2922
  return null;
2916
2923
  }
2917
2924
  }
2918
- const idToken = this.getIdToken(accountInfo, tokenKeys, tenantProfile.tenantId);
2925
+ const idToken = this.getIdToken(accountInfo, correlationId, tokenKeys, tenantProfile.tenantId);
2919
2926
  if (idToken) {
2920
2927
  idTokenClaims = extractTokenClaims(idToken.secret, this.cryptoImpl.base64Decode);
2921
2928
  if (!this.idTokenClaimsMatchTenantProfileFilter(idTokenClaims, tenantProfileFilter)) {
@@ -2927,7 +2934,7 @@ class CacheManager {
2927
2934
  tenantedAccountInfo = updateAccountTenantProfileData(accountInfo, tenantProfile, idTokenClaims, idToken?.secret);
2928
2935
  return tenantedAccountInfo;
2929
2936
  }
2930
- getTenantProfilesFromAccountEntity(accountEntity, targetTenantId, tenantProfileFilter) {
2937
+ getTenantProfilesFromAccountEntity(accountEntity, correlationId, targetTenantId, tenantProfileFilter) {
2931
2938
  const accountInfo = accountEntity.getAccountInfo();
2932
2939
  let searchTenantProfiles = accountInfo.tenantProfiles || new Map();
2933
2940
  const tokenKeys = this.getTokenKeys();
@@ -2947,7 +2954,7 @@ class CacheManager {
2947
2954
  }
2948
2955
  const matchingTenantProfiles = [];
2949
2956
  searchTenantProfiles.forEach((tenantProfile) => {
2950
- const tenantedAccountInfo = this.getTenantedAccountInfoByFilter(accountInfo, tokenKeys, tenantProfile, tenantProfileFilter);
2957
+ const tenantedAccountInfo = this.getTenantedAccountInfoByFilter(accountInfo, tokenKeys, tenantProfile, correlationId, tenantProfileFilter);
2951
2958
  if (tenantedAccountInfo) {
2952
2959
  matchingTenantProfiles.push(tenantedAccountInfo);
2953
2960
  }
@@ -3001,46 +3008,36 @@ class CacheManager {
3001
3008
  * @param storeInCache {?StoreInCache}
3002
3009
  * @param correlationId {?string} correlation id
3003
3010
  */
3004
- async saveCacheRecord(cacheRecord, storeInCache, correlationId) {
3011
+ async saveCacheRecord(cacheRecord, correlationId, storeInCache) {
3005
3012
  if (!cacheRecord) {
3006
3013
  throw createClientAuthError(invalidCacheRecord);
3007
3014
  }
3008
3015
  try {
3009
3016
  if (!!cacheRecord.account) {
3010
- this.setAccount(cacheRecord.account);
3017
+ this.setAccount(cacheRecord.account, correlationId);
3011
3018
  }
3012
3019
  if (!!cacheRecord.idToken && storeInCache?.idToken !== false) {
3013
- this.setIdTokenCredential(cacheRecord.idToken);
3020
+ this.setIdTokenCredential(cacheRecord.idToken, correlationId);
3014
3021
  }
3015
3022
  if (!!cacheRecord.accessToken &&
3016
3023
  storeInCache?.accessToken !== false) {
3017
- await this.saveAccessToken(cacheRecord.accessToken);
3024
+ await this.saveAccessToken(cacheRecord.accessToken, correlationId);
3018
3025
  }
3019
3026
  if (!!cacheRecord.refreshToken &&
3020
3027
  storeInCache?.refreshToken !== false) {
3021
- this.setRefreshTokenCredential(cacheRecord.refreshToken);
3028
+ this.setRefreshTokenCredential(cacheRecord.refreshToken, correlationId);
3022
3029
  }
3023
3030
  if (!!cacheRecord.appMetadata) {
3024
- this.setAppMetadata(cacheRecord.appMetadata);
3031
+ this.setAppMetadata(cacheRecord.appMetadata, correlationId);
3025
3032
  }
3026
3033
  }
3027
3034
  catch (e) {
3028
3035
  this.commonLogger?.error(`CacheManager.saveCacheRecord: failed`);
3029
- if (e instanceof Error) {
3030
- this.commonLogger?.errorPii(`CacheManager.saveCacheRecord: ${e.message}`, correlationId);
3031
- if (e.name === "QuotaExceededError" ||
3032
- e.name === "NS_ERROR_DOM_QUOTA_REACHED" ||
3033
- e.message.includes("exceeded the quota")) {
3034
- this.commonLogger?.error(`CacheManager.saveCacheRecord: exceeded storage quota`, correlationId);
3035
- throw new CacheError(cacheQuotaExceededErrorCode);
3036
- }
3037
- else {
3038
- throw new CacheError(e.name, e.message);
3039
- }
3036
+ if (e instanceof AuthError) {
3037
+ throw e;
3040
3038
  }
3041
3039
  else {
3042
- this.commonLogger?.errorPii(`CacheManager.saveCacheRecord: ${e}`, correlationId);
3043
- throw new CacheError(cacheUnknownErrorCode);
3040
+ throw createCacheError(e);
3044
3041
  }
3045
3042
  }
3046
3043
  }
@@ -3048,7 +3045,7 @@ class CacheManager {
3048
3045
  * saves access token credential
3049
3046
  * @param credential
3050
3047
  */
3051
- async saveAccessToken(credential) {
3048
+ async saveAccessToken(credential, correlationId) {
3052
3049
  const accessTokenFilter = {
3053
3050
  clientId: credential.clientId,
3054
3051
  credentialType: credential.credentialType,
@@ -3060,29 +3057,27 @@ class CacheManager {
3060
3057
  };
3061
3058
  const tokenKeys = this.getTokenKeys();
3062
3059
  const currentScopes = ScopeSet.fromString(credential.target);
3063
- const removedAccessTokens = [];
3064
3060
  tokenKeys.accessToken.forEach((key) => {
3065
3061
  if (!this.accessTokenKeyMatchesFilter(key, accessTokenFilter, false)) {
3066
3062
  return;
3067
3063
  }
3068
- const tokenEntity = this.getAccessTokenCredential(key);
3064
+ const tokenEntity = this.getAccessTokenCredential(key, correlationId);
3069
3065
  if (tokenEntity &&
3070
3066
  this.credentialMatchesFilter(tokenEntity, accessTokenFilter)) {
3071
3067
  const tokenScopeSet = ScopeSet.fromString(tokenEntity.target);
3072
3068
  if (tokenScopeSet.intersectingScopeSets(currentScopes)) {
3073
- removedAccessTokens.push(this.removeAccessToken(key));
3069
+ this.removeAccessToken(key, correlationId);
3074
3070
  }
3075
3071
  }
3076
3072
  });
3077
- await Promise.all(removedAccessTokens);
3078
- this.setAccessTokenCredential(credential);
3073
+ this.setAccessTokenCredential(credential, correlationId);
3079
3074
  }
3080
3075
  /**
3081
3076
  * Retrieve account entities matching all provided tenant-agnostic filters; if no filter is set, get all account entities in the cache
3082
3077
  * Not checking for casing as keys are all generated in lower case, remember to convert to lower case if object properties are compared
3083
3078
  * @param accountFilter - An object containing Account properties to filter by
3084
3079
  */
3085
- getAccountsFilteredBy(accountFilter) {
3080
+ getAccountsFilteredBy(accountFilter, correlationId) {
3086
3081
  const allAccountKeys = this.getAccountKeys();
3087
3082
  const matchingAccounts = [];
3088
3083
  allAccountKeys.forEach((cacheKey) => {
@@ -3090,7 +3085,7 @@ class CacheManager {
3090
3085
  // Don't parse value if the key doesn't match the account filters
3091
3086
  return;
3092
3087
  }
3093
- const entity = this.getAccount(cacheKey, this.commonLogger);
3088
+ const entity = this.getAccount(cacheKey, correlationId, this.commonLogger);
3094
3089
  // Match base account fields
3095
3090
  if (!entity) {
3096
3091
  return;
@@ -3316,11 +3311,11 @@ class CacheManager {
3316
3311
  /**
3317
3312
  * Removes all accounts and related tokens from cache.
3318
3313
  */
3319
- async removeAllAccounts() {
3314
+ async removeAllAccounts(correlationId) {
3320
3315
  const allAccountKeys = this.getAccountKeys();
3321
3316
  const removedAccounts = [];
3322
3317
  allAccountKeys.forEach((cacheKey) => {
3323
- removedAccounts.push(this.removeAccount(cacheKey));
3318
+ removedAccounts.push(this.removeAccount(cacheKey, correlationId));
3324
3319
  });
3325
3320
  await Promise.all(removedAccounts);
3326
3321
  }
@@ -3328,38 +3323,41 @@ class CacheManager {
3328
3323
  * Removes the account and related tokens for a given account key
3329
3324
  * @param account
3330
3325
  */
3331
- async removeAccount(accountKey) {
3332
- const account = this.getAccount(accountKey, this.commonLogger);
3326
+ async removeAccount(accountKey, correlationId) {
3327
+ const account = this.getAccount(accountKey, correlationId, this.commonLogger);
3333
3328
  if (!account) {
3334
3329
  return;
3335
3330
  }
3336
- await this.removeAccountContext(account);
3337
- this.removeItem(accountKey);
3331
+ await this.removeAccountContext(account, correlationId);
3332
+ this.removeItem(accountKey, correlationId);
3338
3333
  }
3339
3334
  /**
3340
3335
  * Removes credentials associated with the provided account
3341
3336
  * @param account
3342
3337
  */
3343
- async removeAccountContext(account) {
3338
+ async removeAccountContext(account, correlationId) {
3344
3339
  const allTokenKeys = this.getTokenKeys();
3345
3340
  const accountId = account.generateAccountId();
3346
- const removedCredentials = [];
3347
3341
  allTokenKeys.idToken.forEach((key) => {
3348
3342
  if (key.indexOf(accountId) === 0) {
3349
- this.removeIdToken(key);
3343
+ this.removeIdToken(key, correlationId);
3350
3344
  }
3351
3345
  });
3352
3346
  allTokenKeys.accessToken.forEach((key) => {
3353
3347
  if (key.indexOf(accountId) === 0) {
3354
- removedCredentials.push(this.removeAccessToken(key));
3348
+ this.removeAccessToken(key, correlationId);
3355
3349
  }
3356
3350
  });
3357
3351
  allTokenKeys.refreshToken.forEach((key) => {
3358
3352
  if (key.indexOf(accountId) === 0) {
3359
- this.removeRefreshToken(key);
3353
+ this.removeRefreshToken(key, correlationId);
3354
+ }
3355
+ });
3356
+ this.getKeys().forEach((key) => {
3357
+ if (key.includes(accountId)) {
3358
+ this.removeItem(key, correlationId);
3360
3359
  }
3361
3360
  });
3362
- await Promise.all(removedCredentials);
3363
3361
  }
3364
3362
  /**
3365
3363
  * Migrates a single-tenant account and all it's associated alternate cross-tenant account objects in the
@@ -3369,7 +3367,7 @@ class CacheManager {
3369
3367
  * @param logger
3370
3368
  * @returns
3371
3369
  */
3372
- updateOutdatedCachedAccount(accountKey, accountEntity, logger) {
3370
+ updateOutdatedCachedAccount(accountKey, accountEntity, correlationId, logger) {
3373
3371
  // Only update if account entity is defined and has no tenantProfiles object (is outdated)
3374
3372
  if (accountEntity && accountEntity.isSingleTenant()) {
3375
3373
  this.commonLogger?.verbose("updateOutdatedCachedAccount: Found a single-tenant (outdated) account entity in the cache, migrating to multi-tenant account entity");
@@ -3380,7 +3378,7 @@ class CacheManager {
3380
3378
  // Get all account entities belonging to user
3381
3379
  const accountsToMerge = [];
3382
3380
  matchingAccountKeys.forEach((key) => {
3383
- const account = this.getCachedAccountEntity(key);
3381
+ const account = this.getCachedAccountEntity(key, correlationId);
3384
3382
  if (account) {
3385
3383
  accountsToMerge.push(account);
3386
3384
  }
@@ -3405,11 +3403,11 @@ class CacheManager {
3405
3403
  // Clear cache of legacy account objects that have been collpsed into tenant profiles
3406
3404
  matchingAccountKeys.forEach((key) => {
3407
3405
  if (key !== newAccountKey) {
3408
- this.removeOutdatedAccount(accountKey);
3406
+ this.removeOutdatedAccount(accountKey, correlationId);
3409
3407
  }
3410
3408
  });
3411
3409
  // Cache updated account object
3412
- this.setAccount(updatedAccount);
3410
+ this.setAccount(updatedAccount, correlationId);
3413
3411
  logger?.verbose("Updated an outdated account entity in the cache");
3414
3412
  return updatedAccount;
3415
3413
  }
@@ -3420,37 +3418,31 @@ class CacheManager {
3420
3418
  * returns a boolean if the given credential is removed
3421
3419
  * @param credential
3422
3420
  */
3423
- async removeAccessToken(key) {
3424
- const credential = this.getAccessTokenCredential(key);
3425
- if (!credential) {
3421
+ removeAccessToken(key, correlationId) {
3422
+ const credential = this.getAccessTokenCredential(key, correlationId);
3423
+ this.removeItem(key, correlationId);
3424
+ if (!credential ||
3425
+ credential.credentialType.toLowerCase() !==
3426
+ CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase() ||
3427
+ credential.tokenType !== AuthenticationScheme.POP) {
3426
3428
  return;
3427
3429
  }
3428
3430
  // Remove Token Binding Key from key store for PoP Tokens Credentials
3429
- if (credential.credentialType.toLowerCase() ===
3430
- CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()) {
3431
- if (credential.tokenType === AuthenticationScheme.POP) {
3432
- const accessTokenWithAuthSchemeEntity = credential;
3433
- const kid = accessTokenWithAuthSchemeEntity.keyId;
3434
- if (kid) {
3435
- try {
3436
- await this.cryptoImpl.removeTokenBindingKey(kid);
3437
- }
3438
- catch (error) {
3439
- throw createClientAuthError(bindingKeyNotRemoved);
3440
- }
3441
- }
3442
- }
3431
+ const kid = credential.keyId;
3432
+ if (kid) {
3433
+ void this.cryptoImpl.removeTokenBindingKey(kid).catch(() => {
3434
+ this.commonLogger.error("Binding key could not be removed");
3435
+ });
3443
3436
  }
3444
- return this.removeItem(key);
3445
3437
  }
3446
3438
  /**
3447
3439
  * Removes all app metadata objects from cache.
3448
3440
  */
3449
- removeAppMetadata() {
3441
+ removeAppMetadata(correlationId) {
3450
3442
  const allCacheKeys = this.getKeys();
3451
3443
  allCacheKeys.forEach((cacheKey) => {
3452
3444
  if (this.isAppMetadata(cacheKey)) {
3453
- this.removeItem(cacheKey);
3445
+ this.removeItem(cacheKey, correlationId);
3454
3446
  }
3455
3447
  });
3456
3448
  return true;
@@ -3459,9 +3451,9 @@ class CacheManager {
3459
3451
  * Retrieve AccountEntity from cache
3460
3452
  * @param account
3461
3453
  */
3462
- readAccountFromCache(account) {
3454
+ readAccountFromCache(account, correlationId) {
3463
3455
  const accountKey = AccountEntity.generateAccountCacheKey(account);
3464
- return this.getAccount(accountKey, this.commonLogger);
3456
+ return this.getAccount(accountKey, correlationId, this.commonLogger);
3465
3457
  }
3466
3458
  /**
3467
3459
  * Retrieve IdTokenEntity from cache
@@ -3471,7 +3463,7 @@ class CacheManager {
3471
3463
  * @param performanceClient {?IPerformanceClient}
3472
3464
  * @param correlationId {?string}
3473
3465
  */
3474
- getIdToken(account, tokenKeys, targetRealm, performanceClient, correlationId) {
3466
+ getIdToken(account, correlationId, tokenKeys, targetRealm, performanceClient) {
3475
3467
  this.commonLogger.trace("CacheManager - getIdToken called");
3476
3468
  const idTokenFilter = {
3477
3469
  homeAccountId: account.homeAccountId,
@@ -3480,7 +3472,7 @@ class CacheManager {
3480
3472
  clientId: this.clientId,
3481
3473
  realm: targetRealm,
3482
3474
  };
3483
- const idTokenMap = this.getIdTokensByFilter(idTokenFilter, tokenKeys);
3475
+ const idTokenMap = this.getIdTokensByFilter(idTokenFilter, correlationId, tokenKeys);
3484
3476
  const numIdTokens = idTokenMap.size;
3485
3477
  if (numIdTokens < 1) {
3486
3478
  this.commonLogger.info("CacheManager:getIdToken - No token found");
@@ -3513,7 +3505,7 @@ class CacheManager {
3513
3505
  // Multiple tokens for a single tenant profile, remove all and return null
3514
3506
  this.commonLogger.info("CacheManager:getIdToken - Multiple matching ID tokens found, clearing them");
3515
3507
  tokensToBeRemoved.forEach((idToken, key) => {
3516
- this.removeIdToken(key);
3508
+ this.removeIdToken(key, correlationId);
3517
3509
  });
3518
3510
  if (performanceClient && correlationId) {
3519
3511
  performanceClient.addFields({ multiMatchedID: idTokenMap.size }, correlationId);
@@ -3528,7 +3520,7 @@ class CacheManager {
3528
3520
  * @param filter
3529
3521
  * @returns
3530
3522
  */
3531
- getIdTokensByFilter(filter, tokenKeys) {
3523
+ getIdTokensByFilter(filter, correlationId, tokenKeys) {
3532
3524
  const idTokenKeys = (tokenKeys && tokenKeys.idToken) || this.getTokenKeys().idToken;
3533
3525
  const idTokens = new Map();
3534
3526
  idTokenKeys.forEach((key) => {
@@ -3538,7 +3530,7 @@ class CacheManager {
3538
3530
  })) {
3539
3531
  return;
3540
3532
  }
3541
- const idToken = this.getIdTokenCredential(key);
3533
+ const idToken = this.getIdTokenCredential(key, correlationId);
3542
3534
  if (idToken && this.credentialMatchesFilter(idToken, filter)) {
3543
3535
  idTokens.set(key, idToken);
3544
3536
  }
@@ -3567,15 +3559,15 @@ class CacheManager {
3567
3559
  * Removes idToken from the cache
3568
3560
  * @param key
3569
3561
  */
3570
- removeIdToken(key) {
3571
- this.removeItem(key);
3562
+ removeIdToken(key, correlationId) {
3563
+ this.removeItem(key, correlationId);
3572
3564
  }
3573
3565
  /**
3574
3566
  * Removes refresh token from the cache
3575
3567
  * @param key
3576
3568
  */
3577
- removeRefreshToken(key) {
3578
- this.removeItem(key);
3569
+ removeRefreshToken(key, correlationId) {
3570
+ this.removeItem(key, correlationId);
3579
3571
  }
3580
3572
  /**
3581
3573
  * Retrieve AccessTokenEntity from cache
@@ -3585,7 +3577,7 @@ class CacheManager {
3585
3577
  * @param performanceClient {?IPerformanceClient}
3586
3578
  * @param correlationId {?string}
3587
3579
  */
3588
- getAccessToken(account, request, tokenKeys, targetRealm, performanceClient, correlationId) {
3580
+ getAccessToken(account, request, tokenKeys, targetRealm, performanceClient) {
3589
3581
  this.commonLogger.trace("CacheManager - getAccessToken called");
3590
3582
  const scopes = ScopeSet.createSearchScopes(request.scopes);
3591
3583
  const authScheme = request.authenticationScheme || AuthenticationScheme.BEARER;
@@ -3593,8 +3585,7 @@ class CacheManager {
3593
3585
  * Distinguish between Bearer and PoP/SSH token cache types
3594
3586
  * Cast to lowercase to handle "bearer" from ADFS
3595
3587
  */
3596
- const credentialType = authScheme &&
3597
- authScheme.toLowerCase() !==
3588
+ const credentialType = authScheme.toLowerCase() !==
3598
3589
  AuthenticationScheme.BEARER.toLowerCase()
3599
3590
  ? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME
3600
3591
  : CredentialType.ACCESS_TOKEN;
@@ -3615,7 +3606,7 @@ class CacheManager {
3615
3606
  accessTokenKeys.forEach((key) => {
3616
3607
  // Validate key
3617
3608
  if (this.accessTokenKeyMatchesFilter(key, accessTokenFilter, true)) {
3618
- const accessToken = this.getAccessTokenCredential(key);
3609
+ const accessToken = this.getAccessTokenCredential(key, request.correlationId);
3619
3610
  // Validate value
3620
3611
  if (accessToken &&
3621
3612
  this.credentialMatchesFilter(accessToken, accessTokenFilter)) {
@@ -3631,10 +3622,10 @@ class CacheManager {
3631
3622
  else if (numAccessTokens > 1) {
3632
3623
  this.commonLogger.info("CacheManager:getAccessToken - Multiple access tokens found, clearing them");
3633
3624
  accessTokens.forEach((accessToken) => {
3634
- void this.removeAccessToken(generateCredentialKey(accessToken));
3625
+ void this.removeAccessToken(generateCredentialKey(accessToken), request.correlationId);
3635
3626
  });
3636
- if (performanceClient && correlationId) {
3637
- performanceClient.addFields({ multiMatchedAT: accessTokens.length }, correlationId);
3627
+ if (performanceClient && request.correlationId) {
3628
+ performanceClient.addFields({ multiMatchedAT: accessTokens.length }, request.correlationId);
3638
3629
  }
3639
3630
  return null;
3640
3631
  }
@@ -3687,14 +3678,14 @@ class CacheManager {
3687
3678
  * @param filter
3688
3679
  * @returns
3689
3680
  */
3690
- getAccessTokensByFilter(filter) {
3681
+ getAccessTokensByFilter(filter, correlationId) {
3691
3682
  const tokenKeys = this.getTokenKeys();
3692
3683
  const accessTokens = [];
3693
3684
  tokenKeys.accessToken.forEach((key) => {
3694
3685
  if (!this.accessTokenKeyMatchesFilter(key, filter, true)) {
3695
3686
  return;
3696
3687
  }
3697
- const accessToken = this.getAccessTokenCredential(key);
3688
+ const accessToken = this.getAccessTokenCredential(key, correlationId);
3698
3689
  if (accessToken &&
3699
3690
  this.credentialMatchesFilter(accessToken, filter)) {
3700
3691
  accessTokens.push(accessToken);
@@ -3710,7 +3701,7 @@ class CacheManager {
3710
3701
  * @param performanceClient {?IPerformanceClient}
3711
3702
  * @param correlationId {?string}
3712
3703
  */
3713
- getRefreshToken(account, familyRT, tokenKeys, performanceClient, correlationId) {
3704
+ getRefreshToken(account, familyRT, correlationId, tokenKeys, performanceClient) {
3714
3705
  this.commonLogger.trace("CacheManager - getRefreshToken called");
3715
3706
  const id = familyRT ? THE_FAMILY_ID : undefined;
3716
3707
  const refreshTokenFilter = {
@@ -3726,7 +3717,7 @@ class CacheManager {
3726
3717
  refreshTokenKeys.forEach((key) => {
3727
3718
  // Validate key
3728
3719
  if (this.refreshTokenKeyMatchesFilter(key, refreshTokenFilter)) {
3729
- const refreshToken = this.getRefreshTokenCredential(key);
3720
+ const refreshToken = this.getRefreshTokenCredential(key, correlationId);
3730
3721
  // Validate value
3731
3722
  if (refreshToken &&
3732
3723
  this.credentialMatchesFilter(refreshToken, refreshTokenFilter)) {
@@ -4085,7 +4076,7 @@ class DefaultStorageClass extends CacheManager {
4085
4076
  }
4086
4077
  }
4087
4078
 
4088
- /*! @azure/msal-common v14.16.0 2024-11-12 */
4079
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
4089
4080
 
4090
4081
  /*
4091
4082
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4184,7 +4175,7 @@ function isOidcProtocolMode(config) {
4184
4175
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
4185
4176
  }
4186
4177
 
4187
- /*! @azure/msal-common v14.16.0 2024-11-12 */
4178
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
4188
4179
  /*
4189
4180
  * Copyright (c) Microsoft Corporation. All rights reserved.
4190
4181
  * Licensed under the MIT License.
@@ -4194,7 +4185,7 @@ const CcsCredentialType = {
4194
4185
  UPN: "UPN",
4195
4186
  };
4196
4187
 
4197
- /*! @azure/msal-common v14.16.0 2024-11-12 */
4188
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
4198
4189
  /*
4199
4190
  * Copyright (c) Microsoft Corporation. All rights reserved.
4200
4191
  * Licensed under the MIT License.
@@ -4245,7 +4236,7 @@ const X_CLIENT_EXTRA_SKU = "x-client-xtra-sku";
4245
4236
  const BROKER_CLIENT_ID = "brk_client_id";
4246
4237
  const BROKER_REDIRECT_URI = "brk_redirect_uri";
4247
4238
 
4248
- /*! @azure/msal-common v14.16.0 2024-11-12 */
4239
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
4249
4240
 
4250
4241
  /*
4251
4242
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4312,7 +4303,7 @@ class RequestValidator {
4312
4303
  }
4313
4304
  }
4314
4305
 
4315
- /*! @azure/msal-common v14.16.0 2024-11-12 */
4306
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
4316
4307
 
4317
4308
  /*
4318
4309
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4720,7 +4711,7 @@ class RequestParameterBuilder {
4720
4711
  }
4721
4712
  }
4722
4713
 
4723
- /*! @azure/msal-common v14.16.0 2024-11-12 */
4714
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
4724
4715
  /*
4725
4716
  * Copyright (c) Microsoft Corporation. All rights reserved.
4726
4717
  * Licensed under the MIT License.
@@ -4732,7 +4723,7 @@ function isOpenIdConfigResponse(response) {
4732
4723
  response.hasOwnProperty("jwks_uri"));
4733
4724
  }
4734
4725
 
4735
- /*! @azure/msal-common v14.16.0 2024-11-12 */
4726
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
4736
4727
  /*
4737
4728
  * Copyright (c) Microsoft Corporation. All rights reserved.
4738
4729
  * Licensed under the MIT License.
@@ -4742,7 +4733,7 @@ function isCloudInstanceDiscoveryResponse(response) {
4742
4733
  response.hasOwnProperty("metadata"));
4743
4734
  }
4744
4735
 
4745
- /*! @azure/msal-common v14.16.0 2024-11-12 */
4736
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
4746
4737
  /*
4747
4738
  * Copyright (c) Microsoft Corporation. All rights reserved.
4748
4739
  * Licensed under the MIT License.
@@ -4752,7 +4743,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
4752
4743
  response.hasOwnProperty("error_description"));
4753
4744
  }
4754
4745
 
4755
- /*! @azure/msal-common v14.16.0 2024-11-12 */
4746
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
4756
4747
  /*
4757
4748
  * Copyright (c) Microsoft Corporation. All rights reserved.
4758
4749
  * Licensed under the MIT License.
@@ -4997,7 +4988,7 @@ const PerformanceEvents = {
4997
4988
  GetRandomValues: "getRandomValues",
4998
4989
  };
4999
4990
 
5000
- /*! @azure/msal-common v14.16.0 2024-11-12 */
4991
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
5001
4992
  /*
5002
4993
  * Copyright (c) Microsoft Corporation. All rights reserved.
5003
4994
  * Licensed under the MIT License.
@@ -5093,7 +5084,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
5093
5084
  };
5094
5085
  };
5095
5086
 
5096
- /*! @azure/msal-common v14.16.0 2024-11-12 */
5087
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
5097
5088
 
5098
5089
  /*
5099
5090
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5202,7 +5193,7 @@ RegionDiscovery.IMDS_OPTIONS = {
5202
5193
  },
5203
5194
  };
5204
5195
 
5205
- /*! @azure/msal-common v14.16.0 2024-11-12 */
5196
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
5206
5197
 
5207
5198
  /*
5208
5199
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6041,7 +6032,7 @@ function buildStaticAuthorityOptions(authOptions) {
6041
6032
  };
6042
6033
  }
6043
6034
 
6044
- /*! @azure/msal-common v14.16.0 2024-11-12 */
6035
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
6045
6036
 
6046
6037
  /*
6047
6038
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6072,7 +6063,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
6072
6063
  }
6073
6064
  }
6074
6065
 
6075
- /*! @azure/msal-common v14.16.0 2024-11-12 */
6066
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
6076
6067
 
6077
6068
  /*
6078
6069
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6091,7 +6082,7 @@ class ServerError extends AuthError {
6091
6082
  }
6092
6083
  }
6093
6084
 
6094
- /*! @azure/msal-common v14.16.0 2024-11-12 */
6085
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
6095
6086
 
6096
6087
  /*
6097
6088
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6111,12 +6102,12 @@ class ThrottlingUtils {
6111
6102
  * @param cacheManager
6112
6103
  * @param thumbprint
6113
6104
  */
6114
- static preProcess(cacheManager, thumbprint) {
6105
+ static preProcess(cacheManager, thumbprint, correlationId) {
6115
6106
  const key = ThrottlingUtils.generateThrottlingStorageKey(thumbprint);
6116
6107
  const value = cacheManager.getThrottlingCache(key);
6117
6108
  if (value) {
6118
6109
  if (value.throttleTime < Date.now()) {
6119
- cacheManager.removeItem(key);
6110
+ cacheManager.removeItem(key, correlationId);
6120
6111
  return;
6121
6112
  }
6122
6113
  throw new ServerError(value.errorCodes?.join(" ") || Constants$1.EMPTY_STRING, value.errorMessage, value.subError);
@@ -6128,7 +6119,7 @@ class ThrottlingUtils {
6128
6119
  * @param thumbprint
6129
6120
  * @param response
6130
6121
  */
6131
- static postProcess(cacheManager, thumbprint, response) {
6122
+ static postProcess(cacheManager, thumbprint, response, correlationId) {
6132
6123
  if (ThrottlingUtils.checkResponseStatus(response) ||
6133
6124
  ThrottlingUtils.checkResponseForRetryAfter(response)) {
6134
6125
  const thumbprintValue = {
@@ -6138,7 +6129,7 @@ class ThrottlingUtils {
6138
6129
  errorMessage: response.body.error_description,
6139
6130
  subError: response.body.suberror,
6140
6131
  };
6141
- cacheManager.setThrottlingCache(ThrottlingUtils.generateThrottlingStorageKey(thumbprint), thumbprintValue);
6132
+ cacheManager.setThrottlingCache(ThrottlingUtils.generateThrottlingStorageKey(thumbprint), thumbprintValue, correlationId);
6142
6133
  }
6143
6134
  }
6144
6135
  /**
@@ -6185,11 +6176,11 @@ class ThrottlingUtils {
6185
6176
  sshKid: request.sshKid,
6186
6177
  };
6187
6178
  const key = this.generateThrottlingStorageKey(thumbprint);
6188
- cacheManager.removeItem(key);
6179
+ cacheManager.removeItem(key, request.correlationId);
6189
6180
  }
6190
6181
  }
6191
6182
 
6192
- /*! @azure/msal-common v14.16.0 2024-11-12 */
6183
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
6193
6184
 
6194
6185
  /*
6195
6186
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6209,7 +6200,7 @@ class NetworkError extends AuthError {
6209
6200
  }
6210
6201
  }
6211
6202
 
6212
- /*! @azure/msal-common v14.16.0 2024-11-12 */
6203
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
6213
6204
 
6214
6205
  /*
6215
6206
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6291,7 +6282,7 @@ class BaseClient {
6291
6282
  * @param correlationId - CorrelationId for telemetry
6292
6283
  */
6293
6284
  async sendPostRequest(thumbprint, tokenEndpoint, options, correlationId) {
6294
- ThrottlingUtils.preProcess(this.cacheManager, thumbprint);
6285
+ ThrottlingUtils.preProcess(this.cacheManager, thumbprint, correlationId);
6295
6286
  let response;
6296
6287
  try {
6297
6288
  response = await invokeAsync((this.networkClient.sendPostRequestAsync.bind(this.networkClient)), PerformanceEvents.NetworkClientSendPostRequestAsync, this.logger, this.performanceClient, correlationId)(tokenEndpoint, options);
@@ -6326,7 +6317,7 @@ class BaseClient {
6326
6317
  throw createClientAuthError(networkError);
6327
6318
  }
6328
6319
  }
6329
- ThrottlingUtils.postProcess(this.cacheManager, thumbprint, response);
6320
+ ThrottlingUtils.postProcess(this.cacheManager, thumbprint, response, correlationId);
6330
6321
  return response;
6331
6322
  }
6332
6323
  /**
@@ -6359,7 +6350,7 @@ class BaseClient {
6359
6350
  }
6360
6351
  }
6361
6352
 
6362
- /*! @azure/msal-common v14.16.0 2024-11-12 */
6353
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
6363
6354
  /*
6364
6355
  * Copyright (c) Microsoft Corporation. All rights reserved.
6365
6356
  * Licensed under the MIT License.
@@ -6385,7 +6376,7 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
6385
6376
  refreshTokenExpired: refreshTokenExpired
6386
6377
  });
6387
6378
 
6388
- /*! @azure/msal-common v14.16.0 2024-11-12 */
6379
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
6389
6380
 
6390
6381
  /*
6391
6382
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6473,7 +6464,7 @@ function createInteractionRequiredAuthError(errorCode) {
6473
6464
  return new InteractionRequiredAuthError(errorCode, InteractionRequiredAuthErrorMessages[errorCode]);
6474
6465
  }
6475
6466
 
6476
- /*! @azure/msal-common v14.16.0 2024-11-12 */
6467
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
6477
6468
 
6478
6469
  /*
6479
6470
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6545,16 +6536,14 @@ class ProtocolUtils {
6545
6536
  }
6546
6537
  }
6547
6538
 
6548
- /*! @azure/msal-common v14.16.0 2024-11-12 */
6539
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
6549
6540
 
6550
6541
  /*
6551
6542
  * Copyright (c) Microsoft Corporation. All rights reserved.
6552
6543
  * Licensed under the MIT License.
6553
6544
  */
6554
6545
  const KeyLocation = {
6555
- SW: "sw",
6556
- UHW: "uhw",
6557
- };
6546
+ SW: "sw"};
6558
6547
  /** @internal */
6559
6548
  class PopTokenGenerator {
6560
6549
  constructor(cryptoUtils, performanceClient) {
@@ -6629,7 +6618,7 @@ class PopTokenGenerator {
6629
6618
  }
6630
6619
  }
6631
6620
 
6632
- /*! @azure/msal-common v14.16.0 2024-11-12 */
6621
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
6633
6622
  /*
6634
6623
  * Copyright (c) Microsoft Corporation. All rights reserved.
6635
6624
  * Licensed under the MIT License.
@@ -6656,7 +6645,7 @@ class PopTokenGenerator {
6656
6645
  }
6657
6646
  }
6658
6647
 
6659
- /*! @azure/msal-common v14.16.0 2024-11-12 */
6648
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
6660
6649
 
6661
6650
  /*
6662
6651
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6816,13 +6805,13 @@ class ResponseHandler {
6816
6805
  !forceCacheRefreshTokenResponse &&
6817
6806
  cacheRecord.account) {
6818
6807
  const key = cacheRecord.account.generateAccountKey();
6819
- const account = this.cacheStorage.getAccount(key, this.logger);
6808
+ const account = this.cacheStorage.getAccount(key, request.correlationId, this.logger);
6820
6809
  if (!account) {
6821
6810
  this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache");
6822
6811
  return await ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenClaims, requestStateObj, undefined, serverRequestId);
6823
6812
  }
6824
6813
  }
6825
- await this.cacheStorage.saveCacheRecord(cacheRecord, request.storeInCache, request.correlationId);
6814
+ await this.cacheStorage.saveCacheRecord(cacheRecord, request.correlationId, request.storeInCache);
6826
6815
  }
6827
6816
  finally {
6828
6817
  if (this.persistencePlugin &&
@@ -6851,7 +6840,7 @@ class ResponseHandler {
6851
6840
  let cachedAccount;
6852
6841
  if (serverTokenResponse.id_token && !!idTokenClaims) {
6853
6842
  cachedIdToken = createIdTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.id_token, this.clientId, claimsTenantId || "");
6854
- cachedAccount = buildAccountToCache(this.cacheStorage, authority, this.homeAccountIdentifier, this.cryptoObj.base64Decode, idTokenClaims, serverTokenResponse.client_info, env, claimsTenantId, authCodePayload, undefined, // nativeAccountId
6843
+ cachedAccount = buildAccountToCache(this.cacheStorage, authority, this.homeAccountIdentifier, this.cryptoObj.base64Decode, request.correlationId, idTokenClaims, serverTokenResponse.client_info, env, claimsTenantId, authCodePayload, undefined, // nativeAccountId
6855
6844
  this.logger);
6856
6845
  }
6857
6846
  // AccessToken
@@ -6999,7 +6988,7 @@ class ResponseHandler {
6999
6988
  };
7000
6989
  }
7001
6990
  }
7002
- function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decode, idTokenClaims, clientInfo, environment, claimsTenantId, authCodePayload, nativeAccountId, logger) {
6991
+ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decode, correlationId, idTokenClaims, clientInfo, environment, claimsTenantId, authCodePayload, nativeAccountId, logger) {
7003
6992
  logger?.verbose("setCachedAccount called");
7004
6993
  // Check if base account is already cached
7005
6994
  const accountKeys = cacheStorage.getAccountKeys();
@@ -7008,7 +6997,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
7008
6997
  });
7009
6998
  let cachedAccount = null;
7010
6999
  if (baseAccountKey) {
7011
- cachedAccount = cacheStorage.getAccount(baseAccountKey, logger);
7000
+ cachedAccount = cacheStorage.getAccount(baseAccountKey, correlationId, logger);
7012
7001
  }
7013
7002
  const baseAccount = cachedAccount ||
7014
7003
  AccountEntity.createAccount({
@@ -7033,7 +7022,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
7033
7022
  return baseAccount;
7034
7023
  }
7035
7024
 
7036
- /*! @azure/msal-common v14.16.0 2024-11-12 */
7025
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
7037
7026
  /*
7038
7027
  * Copyright (c) Microsoft Corporation. All rights reserved.
7039
7028
  * Licensed under the MIT License.
@@ -7051,7 +7040,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint) {
7051
7040
  }
7052
7041
  }
7053
7042
 
7054
- /*! @azure/msal-common v14.16.0 2024-11-12 */
7043
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
7055
7044
 
7056
7045
  /*
7057
7046
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7493,7 +7482,7 @@ class AuthorizationCodeClient extends BaseClient {
7493
7482
  }
7494
7483
  }
7495
7484
 
7496
- /*! @azure/msal-common v14.16.0 2024-11-12 */
7485
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
7497
7486
 
7498
7487
  /*
7499
7488
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7566,7 +7555,7 @@ class RefreshTokenClient extends BaseClient {
7566
7555
  async acquireTokenWithCachedRefreshToken(request, foci) {
7567
7556
  this.performanceClient?.addQueueMeasurement(PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
7568
7557
  // fetches family RT or application RT based on FOCI value
7569
- 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);
7558
+ const refreshToken = invoke(this.cacheManager.getRefreshToken.bind(this.cacheManager), PerformanceEvents.CacheManagerGetRefreshToken, this.logger, this.performanceClient, request.correlationId)(request.account, foci, request.correlationId, undefined, this.performanceClient);
7570
7559
  if (!refreshToken) {
7571
7560
  throw createInteractionRequiredAuthError(noTokensFound);
7572
7561
  }
@@ -7594,7 +7583,7 @@ class RefreshTokenClient extends BaseClient {
7594
7583
  // Remove bad refresh token from cache
7595
7584
  this.logger.verbose("acquireTokenWithRefreshToken: bad refresh token, removing from cache");
7596
7585
  const badRefreshTokenKey = generateCredentialKey(refreshToken);
7597
- this.cacheManager.removeRefreshToken(badRefreshTokenKey);
7586
+ this.cacheManager.removeRefreshToken(badRefreshTokenKey, request.correlationId);
7598
7587
  }
7599
7588
  throw e;
7600
7589
  }
@@ -7713,7 +7702,7 @@ class RefreshTokenClient extends BaseClient {
7713
7702
  }
7714
7703
  }
7715
7704
 
7716
- /*! @azure/msal-common v14.16.0 2024-11-12 */
7705
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
7717
7706
 
7718
7707
  /*
7719
7708
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7783,7 +7772,7 @@ class SilentFlowClient extends BaseClient {
7783
7772
  const requestTenantId = request.account.tenantId ||
7784
7773
  getTenantFromAuthorityString(request.authority);
7785
7774
  const tokenKeys = this.cacheManager.getTokenKeys();
7786
- const cachedAccessToken = this.cacheManager.getAccessToken(request.account, request, tokenKeys, requestTenantId, this.performanceClient, request.correlationId);
7775
+ const cachedAccessToken = this.cacheManager.getAccessToken(request.account, request, tokenKeys, requestTenantId, this.performanceClient);
7787
7776
  if (!cachedAccessToken) {
7788
7777
  // must refresh due to non-existent access_token
7789
7778
  this.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN, request.correlationId);
@@ -7803,9 +7792,9 @@ class SilentFlowClient extends BaseClient {
7803
7792
  }
7804
7793
  const environment = request.authority || this.authority.getPreferredCache();
7805
7794
  const cacheRecord = {
7806
- account: this.cacheManager.readAccountFromCache(request.account),
7795
+ account: this.cacheManager.readAccountFromCache(request.account, request.correlationId),
7807
7796
  accessToken: cachedAccessToken,
7808
- idToken: this.cacheManager.getIdToken(request.account, tokenKeys, requestTenantId, this.performanceClient, request.correlationId),
7797
+ idToken: this.cacheManager.getIdToken(request.account, request.correlationId, tokenKeys, requestTenantId, this.performanceClient),
7809
7798
  refreshToken: null,
7810
7799
  appMetadata: this.cacheManager.readAppMetadataFromCache(environment),
7811
7800
  };
@@ -7849,7 +7838,7 @@ class SilentFlowClient extends BaseClient {
7849
7838
  }
7850
7839
  }
7851
7840
 
7852
- /*! @azure/msal-common v14.16.0 2024-11-12 */
7841
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
7853
7842
 
7854
7843
  /*
7855
7844
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7988,7 +7977,7 @@ class ServerTelemetryManager {
7988
7977
  else {
7989
7978
  lastRequests.errors.push(SERVER_TELEM_CONSTANTS.UNKNOWN_ERROR);
7990
7979
  }
7991
- this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests);
7980
+ this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests, this.correlationId);
7992
7981
  return;
7993
7982
  }
7994
7983
  /**
@@ -7997,7 +7986,7 @@ class ServerTelemetryManager {
7997
7986
  incrementCacheHits() {
7998
7987
  const lastRequests = this.getLastRequests();
7999
7988
  lastRequests.cacheHits += 1;
8000
- this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests);
7989
+ this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests, this.correlationId);
8001
7990
  return lastRequests.cacheHits;
8002
7991
  }
8003
7992
  /**
@@ -8021,7 +8010,7 @@ class ServerTelemetryManager {
8021
8010
  const errorCount = lastRequests.errors.length;
8022
8011
  if (numErrorsFlushed === errorCount) {
8023
8012
  // All errors were sent on last request, clear Telemetry cache
8024
- this.cacheManager.removeItem(this.telemetryCacheKey);
8013
+ this.cacheManager.removeItem(this.telemetryCacheKey, this.correlationId);
8025
8014
  }
8026
8015
  else {
8027
8016
  // Partial data was flushed to server, construct a new telemetry cache item with errors that were not flushed
@@ -8030,7 +8019,7 @@ class ServerTelemetryManager {
8030
8019
  errors: lastRequests.errors.slice(numErrorsFlushed),
8031
8020
  cacheHits: 0,
8032
8021
  };
8033
- this.cacheManager.setServerTelemetry(this.telemetryCacheKey, serverTelemEntity);
8022
+ this.cacheManager.setServerTelemetry(this.telemetryCacheKey, serverTelemEntity, this.correlationId);
8034
8023
  }
8035
8024
  }
8036
8025
  /**
@@ -8097,7 +8086,7 @@ class ServerTelemetryManager {
8097
8086
  setNativeBrokerErrorCode(errorCode) {
8098
8087
  const lastRequests = this.getLastRequests();
8099
8088
  lastRequests.nativeBrokerErrorCode = errorCode;
8100
- this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests);
8089
+ this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests, this.correlationId);
8101
8090
  }
8102
8091
  getNativeBrokerErrorCode() {
8103
8092
  return this.getLastRequests().nativeBrokerErrorCode;
@@ -8105,7 +8094,7 @@ class ServerTelemetryManager {
8105
8094
  clearNativeBrokerErrorCode() {
8106
8095
  const lastRequests = this.getLastRequests();
8107
8096
  delete lastRequests.nativeBrokerErrorCode;
8108
- this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests);
8097
+ this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests, this.correlationId);
8109
8098
  }
8110
8099
  static makeExtraSkuString(params) {
8111
8100
  return makeExtraSkuString(params);
@@ -8350,7 +8339,6 @@ const HttpMethod = {
8350
8339
  POST: "post",
8351
8340
  };
8352
8341
  const ProxyStatus = {
8353
- SUCCESS: HttpStatus.SUCCESS,
8354
8342
  SUCCESS_RANGE_START: HttpStatus.SUCCESS_RANGE_START,
8355
8343
  SUCCESS_RANGE_END: HttpStatus.SUCCESS_RANGE_END,
8356
8344
  SERVER_ERROR: HttpStatus.SERVER_ERROR,
@@ -8405,7 +8393,6 @@ const ApiId = {
8405
8393
  * JWT constants
8406
8394
  */
8407
8395
  const JwtConstants = {
8408
- ALGORITHM: "alg",
8409
8396
  RSA_256: "RS256",
8410
8397
  PSS_256: "PS256",
8411
8398
  X5T_256: "x5t#S256",
@@ -9537,7 +9524,7 @@ class NodeStorage extends CacheManager {
9537
9524
  getAccount(accountKey) {
9538
9525
  const accountEntity = this.getCachedAccountEntity(accountKey);
9539
9526
  if (accountEntity && AccountEntity.isAccountEntity(accountEntity)) {
9540
- return this.updateOutdatedCachedAccount(accountKey, accountEntity);
9527
+ return this.updateOutdatedCachedAccount(accountKey, accountEntity, "");
9541
9528
  }
9542
9529
  return null;
9543
9530
  }
@@ -9869,7 +9856,7 @@ class TokenCache {
9869
9856
  /**
9870
9857
  * API that retrieves all accounts currently in cache to the user
9871
9858
  */
9872
- async getAllAccounts() {
9859
+ async getAllAccounts(correlationId = new CryptoProvider().createNewGuid()) {
9873
9860
  this.logger.trace("getAllAccounts called");
9874
9861
  let cacheContext;
9875
9862
  try {
@@ -9877,7 +9864,7 @@ class TokenCache {
9877
9864
  cacheContext = new TokenCacheContext(this, false);
9878
9865
  await this.persistence.beforeCacheAccess(cacheContext);
9879
9866
  }
9880
- return this.storage.getAllAccounts();
9867
+ return this.storage.getAllAccounts(correlationId);
9881
9868
  }
9882
9869
  finally {
9883
9870
  if (this.persistence && cacheContext) {
@@ -9919,7 +9906,7 @@ class TokenCache {
9919
9906
  * API to remove a specific account and the relevant data from cache
9920
9907
  * @param account - AccountInfo passed by the user
9921
9908
  */
9922
- async removeAccount(account) {
9909
+ async removeAccount(account, correlationId = new CryptoProvider().createNewGuid()) {
9923
9910
  this.logger.trace("removeAccount called");
9924
9911
  let cacheContext;
9925
9912
  try {
@@ -9927,7 +9914,7 @@ class TokenCache {
9927
9914
  cacheContext = new TokenCacheContext(this, true);
9928
9915
  await this.persistence.beforeCacheAccess(cacheContext);
9929
9916
  }
9930
- await this.storage.removeAccount(AccountEntity.generateAccountCacheKey(account));
9917
+ await this.storage.removeAccount(AccountEntity.generateAccountCacheKey(account), correlationId);
9931
9918
  }
9932
9919
  finally {
9933
9920
  if (this.persistence && cacheContext) {
@@ -10208,7 +10195,7 @@ class ClientAssertion {
10208
10195
 
10209
10196
  /* eslint-disable header/header */
10210
10197
  const name = "@azure/msal-node";
10211
- const version = "2.16.1";
10198
+ const version = "2.16.3";
10212
10199
 
10213
10200
  /*
10214
10201
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -11123,7 +11110,7 @@ class PublicClientApplication extends ClientApplication {
11123
11110
  };
11124
11111
  await this.nativeBrokerPlugin.signOut(signoutRequest);
11125
11112
  }
11126
- await this.getTokenCache().removeAccount(request.account);
11113
+ await this.getTokenCache().removeAccount(request.account, request.correlationId);
11127
11114
  }
11128
11115
  /**
11129
11116
  * Returns all cached accounts for this application. If brokering is enabled this request will be serviced by the broker.
@@ -11227,7 +11214,7 @@ class ClientCredentialClient extends BaseClient {
11227
11214
  await clientConfiguration.persistencePlugin.beforeCacheAccess(cacheContext);
11228
11215
  }
11229
11216
  const cachedAccessToken = this.readAccessTokenFromCache(authority, managedIdentityConfiguration.managedIdentityId?.id ||
11230
- clientConfiguration.authOptions.clientId, new ScopeSet(request.scopes || []), cacheManager);
11217
+ clientConfiguration.authOptions.clientId, new ScopeSet(request.scopes || []), cacheManager, request.correlationId);
11231
11218
  if (clientConfiguration.serializableCache &&
11232
11219
  clientConfiguration.persistencePlugin &&
11233
11220
  cacheContext) {
@@ -11264,7 +11251,7 @@ class ClientCredentialClient extends BaseClient {
11264
11251
  /**
11265
11252
  * Reads access token from the cache
11266
11253
  */
11267
- readAccessTokenFromCache(authority, id, scopeSet, cacheManager) {
11254
+ readAccessTokenFromCache(authority, id, scopeSet, cacheManager, correlationId) {
11268
11255
  const accessTokenFilter = {
11269
11256
  homeAccountId: Constants$1.EMPTY_STRING,
11270
11257
  environment: authority.canonicalAuthorityUrlComponents.HostNameAndPort,
@@ -11273,7 +11260,7 @@ class ClientCredentialClient extends BaseClient {
11273
11260
  realm: authority.tenant,
11274
11261
  target: ScopeSet.createSearchScopes(scopeSet.asArray()),
11275
11262
  };
11276
- const accessTokens = cacheManager.getAccessTokensByFilter(accessTokenFilter);
11263
+ const accessTokens = cacheManager.getAccessTokensByFilter(accessTokenFilter, correlationId);
11277
11264
  if (accessTokens.length < 1) {
11278
11265
  return null;
11279
11266
  }
@@ -11426,7 +11413,7 @@ class OnBehalfOfClient extends BaseClient {
11426
11413
  throw createClientAuthError(tokenRefreshRequired);
11427
11414
  }
11428
11415
  // fetch the idToken from cache
11429
- const cachedIdToken = this.readIdTokenFromCacheForOBO(cachedAccessToken.homeAccountId);
11416
+ const cachedIdToken = this.readIdTokenFromCacheForOBO(cachedAccessToken.homeAccountId, request.correlationId);
11430
11417
  let idTokenClaims;
11431
11418
  let cachedAccount = null;
11432
11419
  if (cachedIdToken) {
@@ -11439,7 +11426,7 @@ class OnBehalfOfClient extends BaseClient {
11439
11426
  username: Constants$1.EMPTY_STRING,
11440
11427
  localAccountId: localAccountId || Constants$1.EMPTY_STRING,
11441
11428
  };
11442
- cachedAccount = this.cacheManager.readAccountFromCache(accountInfo);
11429
+ cachedAccount = this.cacheManager.readAccountFromCache(accountInfo, request.correlationId);
11443
11430
  }
11444
11431
  // increment telemetry cache hit counter
11445
11432
  if (this.config.serverTelemetryManager) {
@@ -11458,7 +11445,7 @@ class OnBehalfOfClient extends BaseClient {
11458
11445
  * Certain use cases of OBO flow do not expect an idToken in the cache/or from the service
11459
11446
  * @param atHomeAccountId - account id
11460
11447
  */
11461
- readIdTokenFromCacheForOBO(atHomeAccountId) {
11448
+ readIdTokenFromCacheForOBO(atHomeAccountId, correlationId) {
11462
11449
  const idTokenFilter = {
11463
11450
  homeAccountId: atHomeAccountId,
11464
11451
  environment: this.authority.canonicalAuthorityUrlComponents.HostNameAndPort,
@@ -11466,7 +11453,7 @@ class OnBehalfOfClient extends BaseClient {
11466
11453
  clientId: this.config.authOptions.clientId,
11467
11454
  realm: this.authority.tenant,
11468
11455
  };
11469
- const idTokenMap = this.cacheManager.getIdTokensByFilter(idTokenFilter);
11456
+ const idTokenMap = this.cacheManager.getIdTokensByFilter(idTokenFilter, correlationId);
11470
11457
  // When acquiring a token on behalf of an application, there might not be an id token in the cache
11471
11458
  if (Object.values(idTokenMap).length < 1) {
11472
11459
  return null;
@@ -11484,8 +11471,7 @@ class OnBehalfOfClient extends BaseClient {
11484
11471
  * Distinguish between Bearer and PoP/SSH token cache types
11485
11472
  * Cast to lowercase to handle "bearer" from ADFS
11486
11473
  */
11487
- const credentialType = authScheme &&
11488
- authScheme.toLowerCase() !==
11474
+ const credentialType = authScheme.toLowerCase() !==
11489
11475
  AuthenticationScheme.BEARER.toLowerCase()
11490
11476
  ? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME
11491
11477
  : CredentialType.ACCESS_TOKEN;
@@ -11498,7 +11484,7 @@ class OnBehalfOfClient extends BaseClient {
11498
11484
  requestedClaimsHash: request.requestedClaimsHash,
11499
11485
  userAssertionHash: this.userAssertionHash,
11500
11486
  };
11501
- const accessTokens = this.cacheManager.getAccessTokensByFilter(accessTokenFilter);
11487
+ const accessTokens = this.cacheManager.getAccessTokensByFilter(accessTokenFilter, request.correlationId);
11502
11488
  const numAccessTokens = accessTokens.length;
11503
11489
  if (numAccessTokens < 1) {
11504
11490
  return null;
@@ -12425,11 +12411,15 @@ class DistributedCachePlugin {
12425
12411
  if (cacheContext.cacheHasChanged) {
12426
12412
  const kvStore = cacheContext.tokenCache.getKVStore();
12427
12413
  const accountEntities = Object.values(kvStore).filter((value) => AccountEntity.isAccountEntity(value));
12414
+ let partitionKey;
12428
12415
  if (accountEntities.length > 0) {
12429
12416
  const accountEntity = accountEntities[0];
12430
- const partitionKey = await this.partitionManager.extractKey(accountEntity);
12431
- await this.client.set(partitionKey, cacheContext.tokenCache.serialize());
12417
+ partitionKey = await this.partitionManager.extractKey(accountEntity);
12418
+ }
12419
+ else {
12420
+ partitionKey = await this.partitionManager.getKey();
12432
12421
  }
12422
+ await this.client.set(partitionKey, cacheContext.tokenCache.serialize());
12433
12423
  }
12434
12424
  }
12435
12425
  }