@azure/msal-node 2.16.1 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/cache/NodeStorage.d.ts +5 -10
  2. package/dist/cache/NodeStorage.d.ts.map +1 -1
  3. package/dist/cache/NodeStorage.mjs +6 -17
  4. package/dist/cache/NodeStorage.mjs.map +1 -1
  5. package/dist/cache/TokenCache.mjs +1 -1
  6. package/dist/cache/distributed/DistributedCachePlugin.d.ts.map +1 -1
  7. package/dist/cache/distributed/DistributedCachePlugin.mjs +7 -3
  8. package/dist/cache/distributed/DistributedCachePlugin.mjs.map +1 -1
  9. package/dist/cache/serializer/Deserializer.mjs +1 -1
  10. package/dist/cache/serializer/Serializer.mjs +1 -1
  11. package/dist/client/ClientApplication.mjs +1 -1
  12. package/dist/client/ClientAssertion.mjs +1 -1
  13. package/dist/client/ClientCredentialClient.mjs +1 -1
  14. package/dist/client/ConfidentialClientApplication.mjs +1 -1
  15. package/dist/client/DeviceCodeClient.mjs +1 -1
  16. package/dist/client/ManagedIdentityApplication.mjs +1 -1
  17. package/dist/client/ManagedIdentityClient.mjs +1 -1
  18. package/dist/client/ManagedIdentitySources/AppService.mjs +1 -1
  19. package/dist/client/ManagedIdentitySources/AzureArc.mjs +1 -1
  20. package/dist/client/ManagedIdentitySources/AzureArc.mjs.map +1 -1
  21. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +1 -1
  22. package/dist/client/ManagedIdentitySources/CloudShell.mjs +1 -1
  23. package/dist/client/ManagedIdentitySources/Imds.mjs +1 -1
  24. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +1 -1
  25. package/dist/client/OnBehalfOfClient.mjs +1 -1
  26. package/dist/client/PublicClientApplication.mjs +1 -1
  27. package/dist/client/UsernamePasswordClient.mjs +1 -1
  28. package/dist/config/Configuration.mjs +1 -1
  29. package/dist/config/ManagedIdentityId.mjs +1 -1
  30. package/dist/config/ManagedIdentityRequestParameters.mjs +1 -1
  31. package/dist/crypto/CryptoProvider.mjs +1 -1
  32. package/dist/crypto/GuidGenerator.mjs +1 -1
  33. package/dist/crypto/HashUtils.d.ts +1 -0
  34. package/dist/crypto/HashUtils.d.ts.map +1 -1
  35. package/dist/crypto/HashUtils.mjs +1 -1
  36. package/dist/crypto/PkceGenerator.mjs +1 -1
  37. package/dist/error/ManagedIdentityError.mjs +1 -1
  38. package/dist/error/ManagedIdentityErrorCodes.mjs +1 -1
  39. package/dist/error/NodeAuthError.mjs +1 -1
  40. package/dist/index.d.ts +0 -1
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.mjs +1 -2
  43. package/dist/index.mjs.map +1 -1
  44. package/dist/internals.mjs +1 -1
  45. package/dist/network/HttpClient.mjs +1 -1
  46. package/dist/network/HttpClientWithRetries.mjs +1 -1
  47. package/dist/network/LoopbackClient.mjs +1 -1
  48. package/dist/packageMetadata.d.ts +1 -1
  49. package/dist/packageMetadata.d.ts.map +1 -1
  50. package/dist/packageMetadata.mjs +2 -2
  51. package/dist/request/InteractiveRequest.d.ts +1 -0
  52. package/dist/request/InteractiveRequest.d.ts.map +1 -1
  53. package/dist/retry/LinearRetryPolicy.mjs +1 -1
  54. package/dist/utils/Constants.mjs +1 -1
  55. package/dist/utils/EncodingUtils.mjs +1 -1
  56. package/dist/utils/NetworkUtils.mjs +1 -1
  57. package/dist/utils/NetworkUtils.mjs.map +1 -1
  58. package/lib/msal-node.cjs +102 -167
  59. package/lib/msal-node.cjs.map +1 -1
  60. package/lib/types/cache/NodeStorage.d.ts +5 -10
  61. package/lib/types/cache/NodeStorage.d.ts.map +1 -1
  62. package/lib/types/cache/distributed/DistributedCachePlugin.d.ts.map +1 -1
  63. package/lib/types/crypto/HashUtils.d.ts +1 -0
  64. package/lib/types/crypto/HashUtils.d.ts.map +1 -1
  65. package/lib/types/index.d.ts +0 -1
  66. package/lib/types/index.d.ts.map +1 -1
  67. package/lib/types/packageMetadata.d.ts +1 -1
  68. package/lib/types/packageMetadata.d.ts.map +1 -1
  69. package/lib/types/request/InteractiveRequest.d.ts +1 -0
  70. package/lib/types/request/InteractiveRequest.d.ts.map +1 -1
  71. package/package.json +2 -2
  72. package/src/cache/NodeStorage.ts +9 -17
  73. package/src/cache/distributed/DistributedCachePlugin.ts +9 -6
  74. package/src/index.ts +0 -1
  75. 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 v3.0.1 2025-01-15 */
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 v15.0.1 2025-01-15 */
156
156
  /*
157
157
  * Copyright (c) Microsoft Corporation. All rights reserved.
158
158
  * Licensed under the MIT License.
@@ -445,7 +445,7 @@ const CacheOutcome = {
445
445
  // Token renewal offset default in seconds
446
446
  const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
447
447
 
448
- /*! @azure/msal-common v14.16.0 2024-11-12 */
448
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
449
449
  /*
450
450
  * Copyright (c) Microsoft Corporation. All rights reserved.
451
451
  * Licensed under the MIT License.
@@ -462,7 +462,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
462
462
  unexpectedError: unexpectedError
463
463
  });
464
464
 
465
- /*! @azure/msal-common v14.16.0 2024-11-12 */
465
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
466
466
 
467
467
  /*
468
468
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -511,7 +511,7 @@ function createAuthError(code, additionalMessage) {
511
511
  : AuthErrorMessages[code]);
512
512
  }
513
513
 
514
- /*! @azure/msal-common v14.16.0 2024-11-12 */
514
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
515
515
  /*
516
516
  * Copyright (c) Microsoft Corporation. All rights reserved.
517
517
  * Licensed under the MIT License.
@@ -609,7 +609,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
609
609
  userTimeoutReached: userTimeoutReached
610
610
  });
611
611
 
612
- /*! @azure/msal-common v14.16.0 2024-11-12 */
612
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
613
613
 
614
614
  /*
615
615
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -861,7 +861,7 @@ function createClientAuthError(errorCode, additionalMessage) {
861
861
  return new ClientAuthError(errorCode, additionalMessage);
862
862
  }
863
863
 
864
- /*! @azure/msal-common v14.16.0 2024-11-12 */
864
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
865
865
 
866
866
  /*
867
867
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -900,7 +900,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
900
900
  },
901
901
  };
902
902
 
903
- /*! @azure/msal-common v14.16.0 2024-11-12 */
903
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
904
904
 
905
905
  /*
906
906
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1091,12 +1091,12 @@ class Logger {
1091
1091
  }
1092
1092
  }
1093
1093
 
1094
- /*! @azure/msal-common v14.16.0 2024-11-12 */
1094
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
1095
1095
  /* eslint-disable header/header */
1096
1096
  const name$1 = "@azure/msal-common";
1097
- const version$1 = "14.16.0";
1097
+ const version$1 = "15.0.1";
1098
1098
 
1099
- /*! @azure/msal-common v14.16.0 2024-11-12 */
1099
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
1100
1100
  /*
1101
1101
  * Copyright (c) Microsoft Corporation. All rights reserved.
1102
1102
  * Licensed under the MIT License.
@@ -1116,7 +1116,7 @@ const AzureCloudInstance = {
1116
1116
  AzureUsGovernment: "https://login.microsoftonline.us",
1117
1117
  };
1118
1118
 
1119
- /*! @azure/msal-common v14.16.0 2024-11-12 */
1119
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
1120
1120
 
1121
1121
  /*
1122
1122
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1177,7 +1177,7 @@ function checkMaxAge(authTime, maxAge) {
1177
1177
  }
1178
1178
  }
1179
1179
 
1180
- /*! @azure/msal-common v14.16.0 2024-11-12 */
1180
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
1181
1181
  /*
1182
1182
  * Copyright (c) Microsoft Corporation. All rights reserved.
1183
1183
  * Licensed under the MIT License.
@@ -1222,7 +1222,7 @@ function delay(t, value) {
1222
1222
  return new Promise((resolve) => setTimeout(() => resolve(value), t));
1223
1223
  }
1224
1224
 
1225
- /*! @azure/msal-common v14.16.0 2024-11-12 */
1225
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
1226
1226
 
1227
1227
  /*
1228
1228
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1549,7 +1549,7 @@ function isAuthorityMetadataExpired(metadata) {
1549
1549
  return metadata.expiresAt <= nowSeconds();
1550
1550
  }
1551
1551
 
1552
- /*! @azure/msal-common v14.16.0 2024-11-12 */
1552
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
1553
1553
  /*
1554
1554
  * Copyright (c) Microsoft Corporation. All rights reserved.
1555
1555
  * Licensed under the MIT License.
@@ -1574,14 +1574,14 @@ const missingSshKid = "missing_ssh_kid";
1574
1574
  const missingNonceAuthenticationHeader = "missing_nonce_authentication_header";
1575
1575
  const invalidAuthenticationHeader = "invalid_authentication_header";
1576
1576
  const cannotSetOIDCOptions = "cannot_set_OIDCOptions";
1577
- const cannotAllowNativeBroker = "cannot_allow_native_broker";
1577
+ const cannotAllowPlatformBroker = "cannot_allow_platform_broker";
1578
1578
  const authorityMismatch = "authority_mismatch";
1579
1579
 
1580
1580
  var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
1581
1581
  __proto__: null,
1582
1582
  authorityMismatch: authorityMismatch,
1583
1583
  authorityUriInsecure: authorityUriInsecure,
1584
- cannotAllowNativeBroker: cannotAllowNativeBroker,
1584
+ cannotAllowPlatformBroker: cannotAllowPlatformBroker,
1585
1585
  cannotSetOIDCOptions: cannotSetOIDCOptions,
1586
1586
  claimsRequestParsingError: claimsRequestParsingError,
1587
1587
  emptyInputScopesError: emptyInputScopesError,
@@ -1603,7 +1603,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
1603
1603
  urlParseError: urlParseError
1604
1604
  });
1605
1605
 
1606
- /*! @azure/msal-common v14.16.0 2024-11-12 */
1606
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
1607
1607
 
1608
1608
  /*
1609
1609
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1630,7 +1630,7 @@ const ClientConfigurationErrorMessages = {
1630
1630
  [missingNonceAuthenticationHeader]: "Unable to find an authentication header containing server nonce. Either the Authentication-Info or WWW-Authenticate headers must be present in order to obtain a server nonce.",
1631
1631
  [invalidAuthenticationHeader]: "Invalid authentication header provided",
1632
1632
  [cannotSetOIDCOptions]: "Cannot set OIDCOptions parameter. Please change the protocol mode to OIDC or use a non-Microsoft authority.",
1633
- [cannotAllowNativeBroker]: "Cannot set allowNativeBroker parameter to true when not in AAD protocol mode.",
1633
+ [cannotAllowPlatformBroker]: "Cannot set allowPlatformBroker parameter to true when not in AAD protocol mode.",
1634
1634
  [authorityMismatch]: "Authority mismatch error. Authority provided in login request or PublicClientApplication config does not match the environment of the provided account. Please use a matching account or make an interactive request to login to this authority.",
1635
1635
  };
1636
1636
  /**
@@ -1718,9 +1718,9 @@ const ClientConfigurationErrorMessage = {
1718
1718
  code: cannotSetOIDCOptions,
1719
1719
  desc: ClientConfigurationErrorMessages[cannotSetOIDCOptions],
1720
1720
  },
1721
- cannotAllowNativeBroker: {
1722
- code: cannotAllowNativeBroker,
1723
- desc: ClientConfigurationErrorMessages[cannotAllowNativeBroker],
1721
+ cannotAllowPlatformBroker: {
1722
+ code: cannotAllowPlatformBroker,
1723
+ desc: ClientConfigurationErrorMessages[cannotAllowPlatformBroker],
1724
1724
  },
1725
1725
  authorityMismatch: {
1726
1726
  code: authorityMismatch,
@@ -1741,7 +1741,7 @@ function createClientConfigurationError(errorCode) {
1741
1741
  return new ClientConfigurationError(errorCode);
1742
1742
  }
1743
1743
 
1744
- /*! @azure/msal-common v14.16.0 2024-11-12 */
1744
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
1745
1745
  /*
1746
1746
  * Copyright (c) Microsoft Corporation. All rights reserved.
1747
1747
  * Licensed under the MIT License.
@@ -1838,7 +1838,7 @@ class StringUtils {
1838
1838
  }
1839
1839
  }
1840
1840
 
1841
- /*! @azure/msal-common v14.16.0 2024-11-12 */
1841
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
1842
1842
 
1843
1843
  /*
1844
1844
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2038,7 +2038,7 @@ class ScopeSet {
2038
2038
  }
2039
2039
  }
2040
2040
 
2041
- /*! @azure/msal-common v14.16.0 2024-11-12 */
2041
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
2042
2042
 
2043
2043
  /*
2044
2044
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2078,7 +2078,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
2078
2078
  };
2079
2079
  }
2080
2080
 
2081
- /*! @azure/msal-common v14.16.0 2024-11-12 */
2081
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
2082
2082
  /*
2083
2083
  * Copyright (c) Microsoft Corporation. All rights reserved.
2084
2084
  * Licensed under the MIT License.
@@ -2157,7 +2157,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
2157
2157
  return updatedAccountInfo;
2158
2158
  }
2159
2159
 
2160
- /*! @azure/msal-common v14.16.0 2024-11-12 */
2160
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
2161
2161
  /*
2162
2162
  * Copyright (c) Microsoft Corporation. All rights reserved.
2163
2163
  * Licensed under the MIT License.
@@ -2172,7 +2172,7 @@ const AuthorityType = {
2172
2172
  Ciam: 3,
2173
2173
  };
2174
2174
 
2175
- /*! @azure/msal-common v14.16.0 2024-11-12 */
2175
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
2176
2176
  /*
2177
2177
  * Copyright (c) Microsoft Corporation. All rights reserved.
2178
2178
  * Licensed under the MIT License.
@@ -2194,7 +2194,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
2194
2194
  return null;
2195
2195
  }
2196
2196
 
2197
- /*! @azure/msal-common v14.16.0 2024-11-12 */
2197
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
2198
2198
  /*
2199
2199
  * Copyright (c) Microsoft Corporation. All rights reserved.
2200
2200
  * Licensed under the MIT License.
@@ -2207,7 +2207,7 @@ const ProtocolMode = {
2207
2207
  OIDC: "OIDC",
2208
2208
  };
2209
2209
 
2210
- /*! @azure/msal-common v14.16.0 2024-11-12 */
2210
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
2211
2211
 
2212
2212
  /*
2213
2213
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2450,7 +2450,7 @@ class AccountEntity {
2450
2450
  }
2451
2451
  }
2452
2452
 
2453
- /*! @azure/msal-common v14.16.0 2024-11-12 */
2453
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
2454
2454
 
2455
2455
  /*
2456
2456
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2497,7 +2497,7 @@ function getDeserializedResponse(responseString) {
2497
2497
  return null;
2498
2498
  }
2499
2499
 
2500
- /*! @azure/msal-common v14.16.0 2024-11-12 */
2500
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
2501
2501
 
2502
2502
  /*
2503
2503
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2661,7 +2661,7 @@ class UrlString {
2661
2661
  }
2662
2662
  }
2663
2663
 
2664
- /*! @azure/msal-common v14.16.0 2024-11-12 */
2664
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
2665
2665
 
2666
2666
  /*
2667
2667
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2801,7 +2801,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
2801
2801
  return null;
2802
2802
  }
2803
2803
 
2804
- /*! @azure/msal-common v14.16.0 2024-11-12 */
2804
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
2805
2805
  /*
2806
2806
  * Copyright (c) Microsoft Corporation. All rights reserved.
2807
2807
  * Licensed under the MIT License.
@@ -2809,7 +2809,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
2809
2809
  const cacheQuotaExceededErrorCode = "cache_quota_exceeded";
2810
2810
  const cacheUnknownErrorCode = "cache_error_unknown";
2811
2811
 
2812
- /*! @azure/msal-common v14.16.0 2024-11-12 */
2812
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
2813
2813
 
2814
2814
  /*
2815
2815
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2836,7 +2836,7 @@ class CacheError extends Error {
2836
2836
  }
2837
2837
  }
2838
2838
 
2839
- /*! @azure/msal-common v14.16.0 2024-11-12 */
2839
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
2840
2840
 
2841
2841
  /*
2842
2842
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3001,24 +3001,24 @@ class CacheManager {
3001
3001
  * @param storeInCache {?StoreInCache}
3002
3002
  * @param correlationId {?string} correlation id
3003
3003
  */
3004
- async saveCacheRecord(cacheRecord, storeInCache, correlationId) {
3004
+ async saveCacheRecord(cacheRecord, correlationId, storeInCache) {
3005
3005
  if (!cacheRecord) {
3006
3006
  throw createClientAuthError(invalidCacheRecord);
3007
3007
  }
3008
3008
  try {
3009
3009
  if (!!cacheRecord.account) {
3010
- this.setAccount(cacheRecord.account);
3010
+ await this.setAccount(cacheRecord.account, correlationId);
3011
3011
  }
3012
3012
  if (!!cacheRecord.idToken && storeInCache?.idToken !== false) {
3013
- this.setIdTokenCredential(cacheRecord.idToken);
3013
+ await this.setIdTokenCredential(cacheRecord.idToken, correlationId);
3014
3014
  }
3015
3015
  if (!!cacheRecord.accessToken &&
3016
3016
  storeInCache?.accessToken !== false) {
3017
- await this.saveAccessToken(cacheRecord.accessToken);
3017
+ await this.saveAccessToken(cacheRecord.accessToken, correlationId);
3018
3018
  }
3019
3019
  if (!!cacheRecord.refreshToken &&
3020
3020
  storeInCache?.refreshToken !== false) {
3021
- this.setRefreshTokenCredential(cacheRecord.refreshToken);
3021
+ await this.setRefreshTokenCredential(cacheRecord.refreshToken, correlationId);
3022
3022
  }
3023
3023
  if (!!cacheRecord.appMetadata) {
3024
3024
  this.setAppMetadata(cacheRecord.appMetadata);
@@ -3048,7 +3048,7 @@ class CacheManager {
3048
3048
  * saves access token credential
3049
3049
  * @param credential
3050
3050
  */
3051
- async saveAccessToken(credential) {
3051
+ async saveAccessToken(credential, correlationId) {
3052
3052
  const accessTokenFilter = {
3053
3053
  clientId: credential.clientId,
3054
3054
  credentialType: credential.credentialType,
@@ -3075,7 +3075,7 @@ class CacheManager {
3075
3075
  }
3076
3076
  });
3077
3077
  await Promise.all(removedAccessTokens);
3078
- this.setAccessTokenCredential(credential);
3078
+ await this.setAccessTokenCredential(credential, correlationId);
3079
3079
  }
3080
3080
  /**
3081
3081
  * Retrieve account entities matching all provided tenant-agnostic filters; if no filter is set, get all account entities in the cache
@@ -3361,61 +3361,6 @@ class CacheManager {
3361
3361
  });
3362
3362
  await Promise.all(removedCredentials);
3363
3363
  }
3364
- /**
3365
- * Migrates a single-tenant account and all it's associated alternate cross-tenant account objects in the
3366
- * cache into a condensed multi-tenant account object with tenant profiles.
3367
- * @param accountKey
3368
- * @param accountEntity
3369
- * @param logger
3370
- * @returns
3371
- */
3372
- updateOutdatedCachedAccount(accountKey, accountEntity, logger) {
3373
- // Only update if account entity is defined and has no tenantProfiles object (is outdated)
3374
- if (accountEntity && accountEntity.isSingleTenant()) {
3375
- this.commonLogger?.verbose("updateOutdatedCachedAccount: Found a single-tenant (outdated) account entity in the cache, migrating to multi-tenant account entity");
3376
- // Get keys of all accounts belonging to user
3377
- const matchingAccountKeys = this.getAccountKeys().filter((key) => {
3378
- return key.startsWith(accountEntity.homeAccountId);
3379
- });
3380
- // Get all account entities belonging to user
3381
- const accountsToMerge = [];
3382
- matchingAccountKeys.forEach((key) => {
3383
- const account = this.getCachedAccountEntity(key);
3384
- if (account) {
3385
- accountsToMerge.push(account);
3386
- }
3387
- });
3388
- // Set base account to home account if available, any account if not
3389
- const baseAccount = accountsToMerge.find((account) => {
3390
- return tenantIdMatchesHomeTenant(account.realm, account.homeAccountId);
3391
- }) || accountsToMerge[0];
3392
- // Populate tenant profiles built from each account entity belonging to the user
3393
- baseAccount.tenantProfiles = accountsToMerge.map((account) => {
3394
- return {
3395
- tenantId: account.realm,
3396
- localAccountId: account.localAccountId,
3397
- name: account.name,
3398
- isHomeTenant: tenantIdMatchesHomeTenant(account.realm, account.homeAccountId),
3399
- };
3400
- });
3401
- const updatedAccount = CacheManager.toObject(new AccountEntity(), {
3402
- ...baseAccount,
3403
- });
3404
- const newAccountKey = updatedAccount.generateAccountKey();
3405
- // Clear cache of legacy account objects that have been collpsed into tenant profiles
3406
- matchingAccountKeys.forEach((key) => {
3407
- if (key !== newAccountKey) {
3408
- this.removeOutdatedAccount(accountKey);
3409
- }
3410
- });
3411
- // Cache updated account object
3412
- this.setAccount(updatedAccount);
3413
- logger?.verbose("Updated an outdated account entity in the cache");
3414
- return updatedAccount;
3415
- }
3416
- // No update is necessary
3417
- return accountEntity;
3418
- }
3419
3364
  /**
3420
3365
  * returns a boolean if the given credential is removed
3421
3366
  * @param credential
@@ -3593,8 +3538,7 @@ class CacheManager {
3593
3538
  * Distinguish between Bearer and PoP/SSH token cache types
3594
3539
  * Cast to lowercase to handle "bearer" from ADFS
3595
3540
  */
3596
- const credentialType = authScheme &&
3597
- authScheme.toLowerCase() !==
3541
+ const credentialType = authScheme.toLowerCase() !==
3598
3542
  AuthenticationScheme.BEARER.toLowerCase()
3599
3543
  ? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME
3600
3544
  : CredentialType.ACCESS_TOKEN;
@@ -4011,28 +3955,25 @@ class CacheManager {
4011
3955
  }
4012
3956
  /** @internal */
4013
3957
  class DefaultStorageClass extends CacheManager {
4014
- setAccount() {
3958
+ async setAccount() {
4015
3959
  throw createClientAuthError(methodNotImplemented);
4016
3960
  }
4017
3961
  getAccount() {
4018
3962
  throw createClientAuthError(methodNotImplemented);
4019
3963
  }
4020
- getCachedAccountEntity() {
4021
- throw createClientAuthError(methodNotImplemented);
4022
- }
4023
- setIdTokenCredential() {
3964
+ async setIdTokenCredential() {
4024
3965
  throw createClientAuthError(methodNotImplemented);
4025
3966
  }
4026
3967
  getIdTokenCredential() {
4027
3968
  throw createClientAuthError(methodNotImplemented);
4028
3969
  }
4029
- setAccessTokenCredential() {
3970
+ async setAccessTokenCredential() {
4030
3971
  throw createClientAuthError(methodNotImplemented);
4031
3972
  }
4032
3973
  getAccessTokenCredential() {
4033
3974
  throw createClientAuthError(methodNotImplemented);
4034
3975
  }
4035
- setRefreshTokenCredential() {
3976
+ async setRefreshTokenCredential() {
4036
3977
  throw createClientAuthError(methodNotImplemented);
4037
3978
  }
4038
3979
  getRefreshTokenCredential() {
@@ -4077,15 +4018,9 @@ class DefaultStorageClass extends CacheManager {
4077
4018
  getTokenKeys() {
4078
4019
  throw createClientAuthError(methodNotImplemented);
4079
4020
  }
4080
- updateCredentialCacheKey() {
4081
- throw createClientAuthError(methodNotImplemented);
4082
- }
4083
- removeOutdatedAccount() {
4084
- throw createClientAuthError(methodNotImplemented);
4085
- }
4086
4021
  }
4087
4022
 
4088
- /*! @azure/msal-common v14.16.0 2024-11-12 */
4023
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
4089
4024
 
4090
4025
  /*
4091
4026
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4184,7 +4119,7 @@ function isOidcProtocolMode(config) {
4184
4119
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
4185
4120
  }
4186
4121
 
4187
- /*! @azure/msal-common v14.16.0 2024-11-12 */
4122
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
4188
4123
  /*
4189
4124
  * Copyright (c) Microsoft Corporation. All rights reserved.
4190
4125
  * Licensed under the MIT License.
@@ -4194,7 +4129,7 @@ const CcsCredentialType = {
4194
4129
  UPN: "UPN",
4195
4130
  };
4196
4131
 
4197
- /*! @azure/msal-common v14.16.0 2024-11-12 */
4132
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
4198
4133
  /*
4199
4134
  * Copyright (c) Microsoft Corporation. All rights reserved.
4200
4135
  * Licensed under the MIT License.
@@ -4245,7 +4180,7 @@ const X_CLIENT_EXTRA_SKU = "x-client-xtra-sku";
4245
4180
  const BROKER_CLIENT_ID = "brk_client_id";
4246
4181
  const BROKER_REDIRECT_URI = "brk_redirect_uri";
4247
4182
 
4248
- /*! @azure/msal-common v14.16.0 2024-11-12 */
4183
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
4249
4184
 
4250
4185
  /*
4251
4186
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4312,7 +4247,7 @@ class RequestValidator {
4312
4247
  }
4313
4248
  }
4314
4249
 
4315
- /*! @azure/msal-common v14.16.0 2024-11-12 */
4250
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
4316
4251
 
4317
4252
  /*
4318
4253
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4720,7 +4655,7 @@ class RequestParameterBuilder {
4720
4655
  }
4721
4656
  }
4722
4657
 
4723
- /*! @azure/msal-common v14.16.0 2024-11-12 */
4658
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
4724
4659
  /*
4725
4660
  * Copyright (c) Microsoft Corporation. All rights reserved.
4726
4661
  * Licensed under the MIT License.
@@ -4732,7 +4667,7 @@ function isOpenIdConfigResponse(response) {
4732
4667
  response.hasOwnProperty("jwks_uri"));
4733
4668
  }
4734
4669
 
4735
- /*! @azure/msal-common v14.16.0 2024-11-12 */
4670
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
4736
4671
  /*
4737
4672
  * Copyright (c) Microsoft Corporation. All rights reserved.
4738
4673
  * Licensed under the MIT License.
@@ -4742,7 +4677,7 @@ function isCloudInstanceDiscoveryResponse(response) {
4742
4677
  response.hasOwnProperty("metadata"));
4743
4678
  }
4744
4679
 
4745
- /*! @azure/msal-common v14.16.0 2024-11-12 */
4680
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
4746
4681
  /*
4747
4682
  * Copyright (c) Microsoft Corporation. All rights reserved.
4748
4683
  * Licensed under the MIT License.
@@ -4752,7 +4687,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
4752
4687
  response.hasOwnProperty("error_description"));
4753
4688
  }
4754
4689
 
4755
- /*! @azure/msal-common v14.16.0 2024-11-12 */
4690
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
4756
4691
  /*
4757
4692
  * Copyright (c) Microsoft Corporation. All rights reserved.
4758
4693
  * Licensed under the MIT License.
@@ -4910,6 +4845,7 @@ const PerformanceEvents = {
4910
4845
  */
4911
4846
  InitializeSilentRequest: "initializeSilentRequest",
4912
4847
  InitializeClientApplication: "initializeClientApplication",
4848
+ InitializeCache: "initializeCache",
4913
4849
  /**
4914
4850
  * Helper function in SilentIframeClient class (msal-browser).
4915
4851
  */
@@ -4987,6 +4923,8 @@ const PerformanceEvents = {
4987
4923
  */
4988
4924
  ClearTokensAndKeysWithClaims: "clearTokensAndKeysWithClaims",
4989
4925
  CacheManagerGetRefreshToken: "cacheManagerGetRefreshToken",
4926
+ ImportExistingCache: "importExistingCache",
4927
+ SetUserData: "setUserData",
4990
4928
  /**
4991
4929
  * Crypto Operations
4992
4930
  */
@@ -4995,9 +4933,15 @@ const PerformanceEvents = {
4995
4933
  GenerateCodeChallengeFromVerifier: "generateCodeChallengeFromVerifier",
4996
4934
  Sha256Digest: "sha256Digest",
4997
4935
  GetRandomValues: "getRandomValues",
4936
+ GenerateHKDF: "generateHKDF",
4937
+ GenerateBaseKey: "generateBaseKey",
4938
+ Base64Decode: "base64Decode",
4939
+ UrlEncodeArr: "urlEncodeArr",
4940
+ Encrypt: "encrypt",
4941
+ Decrypt: "decrypt",
4998
4942
  };
4999
4943
 
5000
- /*! @azure/msal-common v14.16.0 2024-11-12 */
4944
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
5001
4945
  /*
5002
4946
  * Copyright (c) Microsoft Corporation. All rights reserved.
5003
4947
  * Licensed under the MIT License.
@@ -5093,7 +5037,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
5093
5037
  };
5094
5038
  };
5095
5039
 
5096
- /*! @azure/msal-common v14.16.0 2024-11-12 */
5040
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
5097
5041
 
5098
5042
  /*
5099
5043
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5202,7 +5146,7 @@ RegionDiscovery.IMDS_OPTIONS = {
5202
5146
  },
5203
5147
  };
5204
5148
 
5205
- /*! @azure/msal-common v14.16.0 2024-11-12 */
5149
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
5206
5150
 
5207
5151
  /*
5208
5152
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6041,7 +5985,7 @@ function buildStaticAuthorityOptions(authOptions) {
6041
5985
  };
6042
5986
  }
6043
5987
 
6044
- /*! @azure/msal-common v14.16.0 2024-11-12 */
5988
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
6045
5989
 
6046
5990
  /*
6047
5991
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6072,7 +6016,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
6072
6016
  }
6073
6017
  }
6074
6018
 
6075
- /*! @azure/msal-common v14.16.0 2024-11-12 */
6019
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
6076
6020
 
6077
6021
  /*
6078
6022
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6091,7 +6035,7 @@ class ServerError extends AuthError {
6091
6035
  }
6092
6036
  }
6093
6037
 
6094
- /*! @azure/msal-common v14.16.0 2024-11-12 */
6038
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
6095
6039
 
6096
6040
  /*
6097
6041
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6189,7 +6133,7 @@ class ThrottlingUtils {
6189
6133
  }
6190
6134
  }
6191
6135
 
6192
- /*! @azure/msal-common v14.16.0 2024-11-12 */
6136
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
6193
6137
 
6194
6138
  /*
6195
6139
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6209,7 +6153,7 @@ class NetworkError extends AuthError {
6209
6153
  }
6210
6154
  }
6211
6155
 
6212
- /*! @azure/msal-common v14.16.0 2024-11-12 */
6156
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
6213
6157
 
6214
6158
  /*
6215
6159
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6359,7 +6303,7 @@ class BaseClient {
6359
6303
  }
6360
6304
  }
6361
6305
 
6362
- /*! @azure/msal-common v14.16.0 2024-11-12 */
6306
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
6363
6307
  /*
6364
6308
  * Copyright (c) Microsoft Corporation. All rights reserved.
6365
6309
  * Licensed under the MIT License.
@@ -6385,7 +6329,7 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
6385
6329
  refreshTokenExpired: refreshTokenExpired
6386
6330
  });
6387
6331
 
6388
- /*! @azure/msal-common v14.16.0 2024-11-12 */
6332
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
6389
6333
 
6390
6334
  /*
6391
6335
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6473,7 +6417,7 @@ function createInteractionRequiredAuthError(errorCode) {
6473
6417
  return new InteractionRequiredAuthError(errorCode, InteractionRequiredAuthErrorMessages[errorCode]);
6474
6418
  }
6475
6419
 
6476
- /*! @azure/msal-common v14.16.0 2024-11-12 */
6420
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
6477
6421
 
6478
6422
  /*
6479
6423
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6545,7 +6489,7 @@ class ProtocolUtils {
6545
6489
  }
6546
6490
  }
6547
6491
 
6548
- /*! @azure/msal-common v14.16.0 2024-11-12 */
6492
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
6549
6493
 
6550
6494
  /*
6551
6495
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6629,7 +6573,7 @@ class PopTokenGenerator {
6629
6573
  }
6630
6574
  }
6631
6575
 
6632
- /*! @azure/msal-common v14.16.0 2024-11-12 */
6576
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
6633
6577
  /*
6634
6578
  * Copyright (c) Microsoft Corporation. All rights reserved.
6635
6579
  * Licensed under the MIT License.
@@ -6656,7 +6600,7 @@ class PopTokenGenerator {
6656
6600
  }
6657
6601
  }
6658
6602
 
6659
- /*! @azure/msal-common v14.16.0 2024-11-12 */
6603
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
6660
6604
 
6661
6605
  /*
6662
6606
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6816,13 +6760,13 @@ class ResponseHandler {
6816
6760
  !forceCacheRefreshTokenResponse &&
6817
6761
  cacheRecord.account) {
6818
6762
  const key = cacheRecord.account.generateAccountKey();
6819
- const account = this.cacheStorage.getAccount(key, this.logger);
6763
+ const account = this.cacheStorage.getAccount(key);
6820
6764
  if (!account) {
6821
6765
  this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache");
6822
6766
  return await ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenClaims, requestStateObj, undefined, serverRequestId);
6823
6767
  }
6824
6768
  }
6825
- await this.cacheStorage.saveCacheRecord(cacheRecord, request.storeInCache, request.correlationId);
6769
+ await this.cacheStorage.saveCacheRecord(cacheRecord, request.correlationId, request.storeInCache);
6826
6770
  }
6827
6771
  finally {
6828
6772
  if (this.persistencePlugin &&
@@ -7008,7 +6952,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
7008
6952
  });
7009
6953
  let cachedAccount = null;
7010
6954
  if (baseAccountKey) {
7011
- cachedAccount = cacheStorage.getAccount(baseAccountKey, logger);
6955
+ cachedAccount = cacheStorage.getAccount(baseAccountKey);
7012
6956
  }
7013
6957
  const baseAccount = cachedAccount ||
7014
6958
  AccountEntity.createAccount({
@@ -7033,7 +6977,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
7033
6977
  return baseAccount;
7034
6978
  }
7035
6979
 
7036
- /*! @azure/msal-common v14.16.0 2024-11-12 */
6980
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
7037
6981
  /*
7038
6982
  * Copyright (c) Microsoft Corporation. All rights reserved.
7039
6983
  * Licensed under the MIT License.
@@ -7051,7 +6995,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint) {
7051
6995
  }
7052
6996
  }
7053
6997
 
7054
- /*! @azure/msal-common v14.16.0 2024-11-12 */
6998
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
7055
6999
 
7056
7000
  /*
7057
7001
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7425,7 +7369,7 @@ class AuthorizationCodeClient extends BaseClient {
7425
7369
  });
7426
7370
  }
7427
7371
  this.addExtraQueryParams(request, parameterBuilder);
7428
- if (request.nativeBroker) {
7372
+ if (request.platformBroker) {
7429
7373
  // signal ests that this is a WAM call
7430
7374
  parameterBuilder.addNativeBroker();
7431
7375
  // pass the req_cnf for POP
@@ -7493,7 +7437,7 @@ class AuthorizationCodeClient extends BaseClient {
7493
7437
  }
7494
7438
  }
7495
7439
 
7496
- /*! @azure/msal-common v14.16.0 2024-11-12 */
7440
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
7497
7441
 
7498
7442
  /*
7499
7443
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7713,7 +7657,7 @@ class RefreshTokenClient extends BaseClient {
7713
7657
  }
7714
7658
  }
7715
7659
 
7716
- /*! @azure/msal-common v14.16.0 2024-11-12 */
7660
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
7717
7661
 
7718
7662
  /*
7719
7663
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7849,7 +7793,7 @@ class SilentFlowClient extends BaseClient {
7849
7793
  }
7850
7794
  }
7851
7795
 
7852
- /*! @azure/msal-common v14.16.0 2024-11-12 */
7796
+ /*! @azure/msal-common v15.0.1 2025-01-15 */
7853
7797
 
7854
7798
  /*
7855
7799
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -9530,23 +9474,12 @@ class NodeStorage extends CacheManager {
9530
9474
  };
9531
9475
  return tokenKeys;
9532
9476
  }
9533
- /**
9534
- * fetch the account entity
9535
- * @param accountKey - lookup key to fetch cache type AccountEntity
9536
- */
9537
- getAccount(accountKey) {
9538
- const accountEntity = this.getCachedAccountEntity(accountKey);
9539
- if (accountEntity && AccountEntity.isAccountEntity(accountEntity)) {
9540
- return this.updateOutdatedCachedAccount(accountKey, accountEntity);
9541
- }
9542
- return null;
9543
- }
9544
9477
  /**
9545
9478
  * Reads account from cache, builds it into an account entity and returns it.
9546
9479
  * @param accountKey - lookup key to fetch cache type AccountEntity
9547
9480
  * @returns
9548
9481
  */
9549
- getCachedAccountEntity(accountKey) {
9482
+ getAccount(accountKey) {
9550
9483
  const cachedAccount = this.getItem(accountKey);
9551
9484
  return cachedAccount
9552
9485
  ? Object.assign(new AccountEntity(), this.getItem(accountKey))
@@ -9556,7 +9489,7 @@ class NodeStorage extends CacheManager {
9556
9489
  * set account entity
9557
9490
  * @param account - cache value to be set of type AccountEntity
9558
9491
  */
9559
- setAccount(account) {
9492
+ async setAccount(account) {
9560
9493
  const accountKey = account.generateAccountKey();
9561
9494
  this.setItem(accountKey, account);
9562
9495
  }
@@ -9575,7 +9508,7 @@ class NodeStorage extends CacheManager {
9575
9508
  * set idToken credential
9576
9509
  * @param idToken - cache value to be set of type IdTokenEntity
9577
9510
  */
9578
- setIdTokenCredential(idToken) {
9511
+ async setIdTokenCredential(idToken) {
9579
9512
  const idTokenKey = generateCredentialKey(idToken);
9580
9513
  this.setItem(idTokenKey, idToken);
9581
9514
  }
@@ -9594,7 +9527,7 @@ class NodeStorage extends CacheManager {
9594
9527
  * set accessToken credential
9595
9528
  * @param accessToken - cache value to be set of type AccessTokenEntity
9596
9529
  */
9597
- setAccessTokenCredential(accessToken) {
9530
+ async setAccessTokenCredential(accessToken) {
9598
9531
  const accessTokenKey = generateCredentialKey(accessToken);
9599
9532
  this.setItem(accessTokenKey, accessToken);
9600
9533
  }
@@ -9613,7 +9546,7 @@ class NodeStorage extends CacheManager {
9613
9546
  * set refreshToken credential
9614
9547
  * @param refreshToken - cache value to be set of type RefreshTokenEntity
9615
9548
  */
9616
- setRefreshTokenCredential(refreshToken) {
9549
+ async setRefreshTokenCredential(refreshToken) {
9617
9550
  const refreshTokenKey = generateCredentialKey(refreshToken);
9618
9551
  this.setItem(refreshTokenKey, refreshToken);
9619
9552
  }
@@ -10208,7 +10141,7 @@ class ClientAssertion {
10208
10141
 
10209
10142
  /* eslint-disable header/header */
10210
10143
  const name = "@azure/msal-node";
10211
- const version = "2.16.1";
10144
+ const version = "3.0.1";
10212
10145
 
10213
10146
  /*
10214
10147
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -11484,8 +11417,7 @@ class OnBehalfOfClient extends BaseClient {
11484
11417
  * Distinguish between Bearer and PoP/SSH token cache types
11485
11418
  * Cast to lowercase to handle "bearer" from ADFS
11486
11419
  */
11487
- const credentialType = authScheme &&
11488
- authScheme.toLowerCase() !==
11420
+ const credentialType = authScheme.toLowerCase() !==
11489
11421
  AuthenticationScheme.BEARER.toLowerCase()
11490
11422
  ? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME
11491
11423
  : CredentialType.ACCESS_TOKEN;
@@ -12425,11 +12357,15 @@ class DistributedCachePlugin {
12425
12357
  if (cacheContext.cacheHasChanged) {
12426
12358
  const kvStore = cacheContext.tokenCache.getKVStore();
12427
12359
  const accountEntities = Object.values(kvStore).filter((value) => AccountEntity.isAccountEntity(value));
12360
+ let partitionKey;
12428
12361
  if (accountEntities.length > 0) {
12429
12362
  const accountEntity = accountEntities[0];
12430
- const partitionKey = await this.partitionManager.extractKey(accountEntity);
12431
- await this.client.set(partitionKey, cacheContext.tokenCache.serialize());
12363
+ partitionKey = await this.partitionManager.extractKey(accountEntity);
12364
+ }
12365
+ else {
12366
+ partitionKey = await this.partitionManager.getKey();
12432
12367
  }
12368
+ await this.client.set(partitionKey, cacheContext.tokenCache.serialize());
12433
12369
  }
12434
12370
  }
12435
12371
  }
@@ -12457,7 +12393,6 @@ exports.InteractionRequiredAuthErrorMessage = InteractionRequiredAuthErrorMessag
12457
12393
  exports.Logger = Logger;
12458
12394
  exports.ManagedIdentityApplication = ManagedIdentityApplication;
12459
12395
  exports.ManagedIdentitySourceNames = ManagedIdentitySourceNames;
12460
- exports.NodeStorage = NodeStorage;
12461
12396
  exports.OnBehalfOfClient = OnBehalfOfClient;
12462
12397
  exports.PromptValue = PromptValue;
12463
12398
  exports.ProtocolMode = ProtocolMode;