@azure/msal-node 5.4.3 → 5.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/cache/CacheHelpers.mjs +32 -6
  2. package/dist/cache/CacheHelpers.mjs.map +1 -1
  3. package/dist/cache/NodeStorage.mjs +10 -7
  4. package/dist/cache/NodeStorage.mjs.map +1 -1
  5. package/dist/cache/TokenCache.mjs +1 -1
  6. package/dist/cache/distributed/DistributedCachePlugin.mjs +1 -1
  7. package/dist/cache/serializer/Deserializer.mjs +1 -1
  8. package/dist/cache/serializer/Serializer.mjs +1 -1
  9. package/dist/client/BaseClient.mjs +1 -1
  10. package/dist/client/ClientApplication.mjs +1 -1
  11. package/dist/client/ClientAssertion.mjs +1 -1
  12. package/dist/client/ClientCredentialClient.mjs +26 -5
  13. package/dist/client/ClientCredentialClient.mjs.map +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/BaseManagedIdentitySource.mjs +1 -1
  21. package/dist/client/ManagedIdentitySources/CloudShell.mjs +1 -1
  22. package/dist/client/ManagedIdentitySources/Imds.mjs +1 -1
  23. package/dist/client/ManagedIdentitySources/MachineLearning.mjs +1 -1
  24. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +1 -1
  25. package/dist/client/OnBehalfOfClient.mjs +39 -13
  26. package/dist/client/OnBehalfOfClient.mjs.map +1 -1
  27. package/dist/client/PublicClientApplication.mjs +1 -1
  28. package/dist/client/UserFederatedIdentityCredentialClient.mjs +10 -4
  29. package/dist/client/UserFederatedIdentityCredentialClient.mjs.map +1 -1
  30. package/dist/client/UsernamePasswordClient.mjs +1 -1
  31. package/dist/config/Configuration.mjs +1 -1
  32. package/dist/config/ManagedIdentityId.mjs +1 -1
  33. package/dist/config/ManagedIdentityRequestParameters.mjs +1 -1
  34. package/dist/crypto/CryptoProvider.mjs +1 -1
  35. package/dist/crypto/GuidGenerator.mjs +1 -1
  36. package/dist/crypto/HashUtils.mjs +1 -1
  37. package/dist/crypto/PkceGenerator.mjs +1 -1
  38. package/dist/error/ClientAuthErrorCodes.mjs +1 -1
  39. package/dist/error/ManagedIdentityError.mjs +1 -1
  40. package/dist/error/ManagedIdentityErrorCodes.mjs +1 -1
  41. package/dist/error/NodeAuthError.mjs +1 -1
  42. package/dist/index.mjs +1 -1
  43. package/dist/internals.mjs +1 -1
  44. package/dist/network/HttpClient.mjs +1 -1
  45. package/dist/network/HttpClientWithRetries.mjs +1 -1
  46. package/dist/network/LoopbackClient.mjs +1 -1
  47. package/dist/packageMetadata.mjs +2 -2
  48. package/dist/protocol/Authorize.mjs +1 -1
  49. package/dist/retry/DefaultManagedIdentityRetryPolicy.mjs +1 -1
  50. package/dist/retry/ExponentialRetryStrategy.mjs +1 -1
  51. package/dist/retry/ImdsRetryPolicy.mjs +1 -1
  52. package/dist/retry/LinearRetryStrategy.mjs +1 -1
  53. package/dist/utils/Constants.mjs +1 -1
  54. package/dist/utils/EncodingUtils.mjs +1 -1
  55. package/dist/utils/TimeUtils.mjs +1 -1
  56. package/lib/msal-node.cjs +325 -122
  57. package/lib/msal-node.cjs.map +1 -1
  58. package/package.json +2 -2
  59. package/src/cache/CacheHelpers.ts +36 -7
  60. package/src/cache/NodeStorage.ts +18 -6
  61. package/src/client/ClientCredentialClient.ts +28 -3
  62. package/src/client/OnBehalfOfClient.ts +52 -12
  63. package/src/client/UserFederatedIdentityCredentialClient.ts +11 -2
  64. package/src/packageMetadata.ts +1 -1
  65. package/src/request/CommonClientCredentialRequest.ts +7 -0
  66. package/src/request/CommonOnBehalfOfRequest.ts +7 -0
  67. package/src/request/CommonUserFederatedIdentityCredentialRequest.ts +7 -0
  68. package/types/cache/CacheHelpers.d.ts +1 -1
  69. package/types/cache/CacheHelpers.d.ts.map +1 -1
  70. package/types/cache/NodeStorage.d.ts +7 -4
  71. package/types/cache/NodeStorage.d.ts.map +1 -1
  72. package/types/client/ClientCredentialClient.d.ts.map +1 -1
  73. package/types/client/OnBehalfOfClient.d.ts.map +1 -1
  74. package/types/client/UserFederatedIdentityCredentialClient.d.ts.map +1 -1
  75. package/types/packageMetadata.d.ts +1 -1
  76. package/types/request/CommonClientCredentialRequest.d.ts +7 -0
  77. package/types/request/CommonClientCredentialRequest.d.ts.map +1 -1
  78. package/types/request/CommonOnBehalfOfRequest.d.ts +7 -0
  79. package/types/request/CommonOnBehalfOfRequest.d.ts.map +1 -1
  80. package/types/request/CommonUserFederatedIdentityCredentialRequest.d.ts +7 -0
  81. package/types/request/CommonUserFederatedIdentityCredentialRequest.d.ts.map +1 -1
package/lib/msal-node.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-node v5.4.3 2026-07-29 */
1
+ /*! @azure/msal-node v5.5.0 2026-08-04 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
@@ -151,7 +151,7 @@ class Serializer {
151
151
  }
152
152
  }
153
153
 
154
- /*! @azure/msal-common v16.11.3 2026-07-29 */
154
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
155
155
  /*
156
156
  * Copyright (c) Microsoft Corporation. All rights reserved.
157
157
  * Licensed under the MIT License.
@@ -206,9 +206,10 @@ const CLI_DATA = "clidata";
206
206
  const USER_FEDERATED_IDENTITY_CREDENTIAL = "user_federated_identity_credential";
207
207
  const USERNAME = "username";
208
208
  const USER_ID = "user_id";
209
- const FMI_PATH = "fmi_path";
209
+ const FMI_PATH = "fmi_path";
210
+ const ATTRIBUTE_TOKENS = "attribute_tokens";
210
211
 
211
- /*! @azure/msal-common v16.11.3 2026-07-29 */
212
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
212
213
  /*
213
214
  * Copyright (c) Microsoft Corporation. All rights reserved.
214
215
  * Licensed under the MIT License.
@@ -461,7 +462,7 @@ const EncodingTypes = {
461
462
  UTF8: "utf-8",
462
463
  };
463
464
 
464
- /*! @azure/msal-common v16.11.3 2026-07-29 */
465
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
465
466
  /*
466
467
  * Copyright (c) Microsoft Corporation. All rights reserved.
467
468
  * Licensed under the MIT License.
@@ -490,7 +491,7 @@ function createAuthError(code, correlationId, additionalMessage) {
490
491
  return new AuthError(code, correlationId, additionalMessage || getDefaultErrorMessage(code));
491
492
  }
492
493
 
493
- /*! @azure/msal-common v16.11.3 2026-07-29 */
494
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
494
495
 
495
496
  /*
496
497
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -513,7 +514,7 @@ function createClientAuthError(errorCode, correlationId, additionalMessage) {
513
514
  return new ClientAuthError(errorCode, correlationId, additionalMessage);
514
515
  }
515
516
 
516
- /*! @azure/msal-common v16.11.3 2026-07-29 */
517
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
517
518
  /*
518
519
  * Copyright (c) Microsoft Corporation. All rights reserved.
519
520
  * Licensed under the MIT License.
@@ -597,7 +598,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
597
598
  userCanceled: userCanceled
598
599
  });
599
600
 
600
- /*! @azure/msal-common v16.11.3 2026-07-29 */
601
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
601
602
 
602
603
  /*
603
604
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -635,7 +636,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
635
636
  };
636
637
  }
637
638
 
638
- /*! @azure/msal-common v16.11.3 2026-07-29 */
639
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
639
640
 
640
641
  /*
641
642
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -701,7 +702,7 @@ function getJWSPayload(authToken, correlationId) {
701
702
  return matches[2];
702
703
  }
703
704
 
704
- /*! @azure/msal-common v16.11.3 2026-07-29 */
705
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
705
706
 
706
707
  /*
707
708
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -789,7 +790,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
789
790
  return updatedAccountInfo;
790
791
  }
791
792
 
792
- /*! @azure/msal-common v16.11.3 2026-07-29 */
793
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
793
794
  /*
794
795
  * Copyright (c) Microsoft Corporation. All rights reserved.
795
796
  * Licensed under the MIT License.
@@ -804,7 +805,7 @@ const AuthorityType = {
804
805
  Ciam: 3,
805
806
  };
806
807
 
807
- /*! @azure/msal-common v16.11.3 2026-07-29 */
808
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
808
809
  /*
809
810
  * Copyright (c) Microsoft Corporation. All rights reserved.
810
811
  * Licensed under the MIT License.
@@ -826,7 +827,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
826
827
  return null;
827
828
  }
828
829
 
829
- /*! @azure/msal-common v16.11.3 2026-07-29 */
830
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
830
831
  /*
831
832
  * Copyright (c) Microsoft Corporation. All rights reserved.
832
833
  * Licensed under the MIT License.
@@ -850,7 +851,7 @@ const ProtocolMode = {
850
851
  EAR: "EAR",
851
852
  };
852
853
 
853
- /*! @azure/msal-common v16.11.3 2026-07-29 */
854
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
854
855
  /**
855
856
  * Returns the AccountInfo interface for this account.
856
857
  * @internal
@@ -999,7 +1000,7 @@ function isAccountEntity(entity) {
999
1000
  entity.hasOwnProperty("authorityType"));
1000
1001
  }
1001
1002
 
1002
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1003
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
1003
1004
  /*
1004
1005
  * Copyright (c) Microsoft Corporation. All rights reserved.
1005
1006
  * Licensed under the MIT License.
@@ -1016,7 +1017,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
1016
1017
  unexpectedError: unexpectedError
1017
1018
  });
1018
1019
 
1019
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1020
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
1020
1021
 
1021
1022
  /*
1022
1023
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1036,7 +1037,7 @@ function createClientConfigurationError(errorCode, correlationId) {
1036
1037
  return new ClientConfigurationError(errorCode, correlationId);
1037
1038
  }
1038
1039
 
1039
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1040
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
1040
1041
  /*
1041
1042
  * Copyright (c) Microsoft Corporation. All rights reserved.
1042
1043
  * Licensed under the MIT License.
@@ -1100,7 +1101,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
1100
1101
  urlParseError: urlParseError
1101
1102
  });
1102
1103
 
1103
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1104
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
1104
1105
  /*
1105
1106
  * Copyright (c) Microsoft Corporation. All rights reserved.
1106
1107
  * Licensed under the MIT License.
@@ -1112,7 +1113,7 @@ function isOpenIdConfigResponse(response) {
1112
1113
  response.hasOwnProperty("jwks_uri"));
1113
1114
  }
1114
1115
 
1115
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1116
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
1116
1117
  /*
1117
1118
  * Copyright (c) Microsoft Corporation. All rights reserved.
1118
1119
  * Licensed under the MIT License.
@@ -1192,7 +1193,7 @@ class StringUtils {
1192
1193
  }
1193
1194
  }
1194
1195
 
1195
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1196
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
1196
1197
 
1197
1198
  /*
1198
1199
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1350,7 +1351,7 @@ class UrlString {
1350
1351
  }
1351
1352
  }
1352
1353
 
1353
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1354
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
1354
1355
 
1355
1356
  /*
1356
1357
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1516,7 +1517,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
1516
1517
  return null;
1517
1518
  }
1518
1519
 
1519
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1520
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
1520
1521
  /*
1521
1522
  * Copyright (c) Microsoft Corporation. All rights reserved.
1522
1523
  * Licensed under the MIT License.
@@ -1536,7 +1537,7 @@ const AzureCloudInstance = {
1536
1537
  AzureUsGovernment: "https://login.microsoftonline.us",
1537
1538
  };
1538
1539
 
1539
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1540
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
1540
1541
  /*
1541
1542
  * Copyright (c) Microsoft Corporation. All rights reserved.
1542
1543
  * Licensed under the MIT License.
@@ -1546,7 +1547,7 @@ function isCloudInstanceDiscoveryResponse(response) {
1546
1547
  response.hasOwnProperty("metadata"));
1547
1548
  }
1548
1549
 
1549
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1550
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
1550
1551
  /*
1551
1552
  * Copyright (c) Microsoft Corporation. All rights reserved.
1552
1553
  * Licensed under the MIT License.
@@ -1556,7 +1557,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
1556
1557
  response.hasOwnProperty("error_description"));
1557
1558
  }
1558
1559
 
1559
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1560
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
1560
1561
  /*
1561
1562
  * Copyright (c) Microsoft Corporation. All rights reserved.
1562
1563
  * Licensed under the MIT License.
@@ -1618,7 +1619,7 @@ const RegionDiscoveryGetCurrentVersion = "regionDiscoveryGetCurrentVersion";
1618
1619
  */
1619
1620
  const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
1620
1621
 
1621
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1622
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
1622
1623
  /*
1623
1624
  * Copyright (c) Microsoft Corporation. All rights reserved.
1624
1625
  * Licensed under the MIT License.
@@ -1711,7 +1712,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
1711
1712
  };
1712
1713
  };
1713
1714
 
1714
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1715
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
1715
1716
 
1716
1717
  /*
1717
1718
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1822,7 +1823,7 @@ RegionDiscovery.IMDS_OPTIONS = {
1822
1823
  },
1823
1824
  };
1824
1825
 
1825
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1826
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
1826
1827
  /*
1827
1828
  * Copyright (c) Microsoft Corporation. All rights reserved.
1828
1829
  * Licensed under the MIT License.
@@ -1877,7 +1878,7 @@ function delay(t, value) {
1877
1878
  return new Promise((resolve) => setTimeout(() => resolve(value), t));
1878
1879
  }
1879
1880
 
1880
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1881
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
1881
1882
 
1882
1883
  /*
1883
1884
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2142,9 +2143,22 @@ function updateCloudDiscoveryMetadata(authorityMetadata, updatedValues, fromNetw
2142
2143
  */
2143
2144
  function isAuthorityMetadataExpired(metadata) {
2144
2145
  return metadata.expiresAt <= nowSeconds();
2146
+ }
2147
+ /**
2148
+ * Serialize attribute tokens synchronously (sort and join).
2149
+ * This is a sync-only operation for use at request construction time.
2150
+ * @param attributeTokens - array of tokens
2151
+ * @returns serialized partition string or undefined if no tokens
2152
+ */
2153
+ function serializeAttributeTokens(attributeTokens) {
2154
+ if (!attributeTokens || attributeTokens.length === 0) {
2155
+ return undefined;
2156
+ }
2157
+ // Serialize: sort and join tokens
2158
+ return [...attributeTokens].sort().join(" ");
2145
2159
  }
2146
2160
 
2147
- /*! @azure/msal-common v16.11.3 2026-07-29 */
2161
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
2148
2162
 
2149
2163
  /*
2150
2164
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3114,7 +3128,7 @@ function buildStaticAuthorityOptions(authOptions) {
3114
3128
  };
3115
3129
  }
3116
3130
 
3117
- /*! @azure/msal-common v16.11.3 2026-07-29 */
3131
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
3118
3132
 
3119
3133
  /*
3120
3134
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3148,7 +3162,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
3148
3162
  }
3149
3163
  }
3150
3164
 
3151
- /*! @azure/msal-common v16.11.3 2026-07-29 */
3165
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
3152
3166
 
3153
3167
  /*
3154
3168
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3344,7 +3358,7 @@ class ScopeSet {
3344
3358
  }
3345
3359
  }
3346
3360
 
3347
- /*! @azure/msal-common v16.11.3 2026-07-29 */
3361
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
3348
3362
 
3349
3363
  /*
3350
3364
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3466,13 +3480,14 @@ function addSid(parameters, sid) {
3466
3480
  * @param claims - The claims string from the request
3467
3481
  * @param clientCapabilities - The client capabilities from configuration
3468
3482
  * @param skipBrokerClaims - When true and BROKER_CLIENT_ID is present, excludes clientCapabilities from claims
3483
+ * @param claimsToMerge - Optional client-originated claims JSON string (e.g. `claimsFromClient`) deep-merged into `claims` with precedence on conflicts
3469
3484
  */
3470
- function addClaims(parameters, correlationId, claims, clientCapabilities, skipBrokerClaims) {
3485
+ function addClaims(parameters, correlationId, claims, clientCapabilities, skipBrokerClaims, claimsToMerge) {
3471
3486
  // Skip clientCapabilities if skipBrokerClaims is set to true and this is a brokered authentication flow
3472
3487
  const configClaims = skipBrokerClaims && parameters.has(BROKER_CLIENT_ID)
3473
3488
  ? undefined
3474
3489
  : clientCapabilities;
3475
- const mergedClaims = buildMergedClaims(claims, configClaims, correlationId);
3490
+ const mergedClaims = buildMergedClaims(claims, configClaims, correlationId, claimsToMerge);
3476
3491
  parameters.set(CLAIMS, mergedClaims);
3477
3492
  }
3478
3493
  /**
@@ -3659,32 +3674,79 @@ const DEFAULT_ID_TOKEN_CLAIMS = {
3659
3674
  [ClaimsRequestKeys.LOGIN_HINT]: { essential: false },
3660
3675
  };
3661
3676
  /**
3662
- * Parses claims JSON, merges default optional idToken claims (signin_state, login_hint),
3663
- * and appends client capabilities (xms_cc) to the access_token section.
3677
+ * Parses a claims JSON string into an object, throwing a ClientConfigurationError
3678
+ * (error code `invalid_claims`) if the value is not a valid JSON object. The raw
3679
+ * claims value is never included in the error - it may contain sensitive data.
3680
+ * @param claims - Claims JSON string. Must be valid JSON representing an object.
3681
+ * @param correlationId - The request correlation id
3682
+ * @returns The parsed claims object
3683
+ */
3684
+ function parseClaims(claims, correlationId = "") {
3685
+ let parsed;
3686
+ try {
3687
+ parsed = JSON.parse(claims);
3688
+ }
3689
+ catch (e) {
3690
+ // Malformed JSON
3691
+ throw createClientConfigurationError(invalidClaims, correlationId);
3692
+ }
3693
+ if (!isPlainObject(parsed)) {
3694
+ // Valid JSON, but not an object (e.g. an array, a scalar, or the literal `null`).
3695
+ throw createClientConfigurationError(invalidClaims, correlationId);
3696
+ }
3697
+ return parsed;
3698
+ }
3699
+ /**
3700
+ * Type guard for a non-null, non-array object (a JSON "object" value).
3701
+ * @param value - The value to test
3702
+ * @returns True when value is a plain object that can be deep-merged
3703
+ */
3704
+ function isPlainObject(value) {
3705
+ return typeof value === "object" && value !== null && !Array.isArray(value);
3706
+ }
3707
+ /**
3708
+ * Recursively deep-merges two parsed claims objects. Nested objects are merged key-by-key;
3709
+ * for any other value type (arrays, scalars, null) the value from `claimsToMerge` replaces
3710
+ * the base. This mirrors the deep merge used by msal-dotnet so that, for example, a server
3711
+ * `access_token` challenge and a client-originated `access_token` claim are combined rather
3712
+ * than one clobbering the other.
3713
+ * @param baseClaims - The parsed base claims object
3714
+ * @param claimsToMerge - The parsed claims object merged in with precedence
3715
+ * @returns The deep-merged claims object
3716
+ */
3717
+ function deepMergeClaims(baseClaims, claimsToMerge) {
3718
+ const merged = { ...baseClaims };
3719
+ for (const [key, mergeInValue] of Object.entries(claimsToMerge)) {
3720
+ const baseValue = merged[key];
3721
+ if (isPlainObject(baseValue) && isPlainObject(mergeInValue)) {
3722
+ merged[key] = deepMergeClaims(baseValue, mergeInValue);
3723
+ }
3724
+ else {
3725
+ merged[key] = mergeInValue;
3726
+ }
3727
+ }
3728
+ return merged;
3729
+ }
3730
+ /**
3731
+ * Parses claims JSON, optionally deep-merges a second client-originated claims string
3732
+ * (`claimsToMerge`, e.g. `claimsFromClient`) with precedence on conflicting keys, merges
3733
+ * default optional idToken claims (signin_state, login_hint), and appends client
3734
+ * capabilities (xms_cc) to the access_token section.
3664
3735
  * Does not overwrite idToken claims already specified by the caller.
3665
3736
  * @param claims - Existing claims JSON string from the request (may be undefined)
3666
3737
  * @param clientCapabilities - Client capabilities array from configuration
3738
+ * @param correlationId - The request correlation id
3739
+ * @param claimsToMerge - Optional second claims JSON string (e.g. client-originated `claimsFromClient`)
3740
+ * deep-merged into `claims` with precedence on conflicts; parsed and validated when present. Nested
3741
+ * objects are merged recursively; arrays and scalar values are replaced.
3667
3742
  * @returns Merged claims JSON string
3668
3743
  */
3669
- function buildMergedClaims(claims, clientCapabilities, correlationId = "") {
3670
- let mergedClaims;
3744
+ function buildMergedClaims(claims, clientCapabilities, correlationId = "", claimsToMerge) {
3671
3745
  // Parse provided claims into JSON object or initialize empty object
3672
- if (!claims) {
3673
- mergedClaims = {};
3674
- }
3675
- else {
3676
- try {
3677
- const parsed = JSON.parse(claims);
3678
- if (typeof parsed !== "object" ||
3679
- parsed === null ||
3680
- Array.isArray(parsed)) {
3681
- throw new Error("Claims must be a JSON object");
3682
- }
3683
- mergedClaims = parsed;
3684
- }
3685
- catch (e) {
3686
- throw createClientConfigurationError(invalidClaims, correlationId);
3687
- }
3746
+ let mergedClaims = claims ? parseClaims(claims, correlationId) : {};
3747
+ // Deep-merge client-originated claims (e.g. `claimsFromClient`) with precedence on conflicts
3748
+ if (claimsToMerge?.trim()) {
3749
+ mergedClaims = deepMergeClaims(mergedClaims, parseClaims(claimsToMerge, correlationId));
3688
3750
  }
3689
3751
  // Add default optional idToken claims
3690
3752
  if (!Object.prototype.hasOwnProperty.call(mergedClaims, ClaimsRequestKeys.ID_TOKEN)) {
@@ -3775,9 +3837,28 @@ function addResource(parameters, resource) {
3775
3837
  if (resource) {
3776
3838
  parameters.set(RESOURCE, resource);
3777
3839
  }
3840
+ }
3841
+ /**
3842
+ * Add the `attribute_tokens` parameter to a /token request body.
3843
+ *
3844
+ * When `attributeTokens` is a non-empty array the values are sorted lexicographically and joined
3845
+ * with a single space, then written to the request body. When `attributeTokens` is an empty array
3846
+ * the parameter is deleted from the request body.
3847
+ *
3848
+ * @param parameters - request parameter map that will be serialized into the /token body
3849
+ * @param attributeTokens - caller-provided attribute token strings
3850
+ */
3851
+ function addAttributeTokens(parameters, attributeTokens) {
3852
+ const serialized = serializeAttributeTokens(attributeTokens);
3853
+ if (serialized) {
3854
+ parameters.set(ATTRIBUTE_TOKENS, serialized);
3855
+ }
3856
+ else {
3857
+ parameters.delete(ATTRIBUTE_TOKENS);
3858
+ }
3778
3859
  }
3779
3860
 
3780
- /*! @azure/msal-common v16.11.3 2026-07-29 */
3861
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
3781
3862
 
3782
3863
  /*
3783
3864
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3835,7 +3916,7 @@ function mapToQueryString(parameters) {
3835
3916
  return queryParameterArray.join("&");
3836
3917
  }
3837
3918
 
3838
- /*! @azure/msal-common v16.11.3 2026-07-29 */
3919
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
3839
3920
 
3840
3921
  /*
3841
3922
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3878,7 +3959,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
3878
3959
  },
3879
3960
  };
3880
3961
 
3881
- /*! @azure/msal-common v16.11.3 2026-07-29 */
3962
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
3882
3963
  /*
3883
3964
  * Copyright (c) Microsoft Corporation. All rights reserved.
3884
3965
  * Licensed under the MIT License.
@@ -4153,12 +4234,12 @@ class Logger {
4153
4234
  }
4154
4235
  }
4155
4236
 
4156
- /*! @azure/msal-common v16.11.3 2026-07-29 */
4237
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
4157
4238
  /* eslint-disable header/header */
4158
4239
  const name$1 = "@azure/msal-common";
4159
- const version$1 = "16.11.3";
4240
+ const version$1 = "16.12.0";
4160
4241
 
4161
- /*! @azure/msal-common v16.11.3 2026-07-29 */
4242
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
4162
4243
  /*
4163
4244
  * Copyright (c) Microsoft Corporation. All rights reserved.
4164
4245
  * Licensed under the MIT License.
@@ -4166,7 +4247,7 @@ const version$1 = "16.11.3";
4166
4247
  const cacheQuotaExceeded = "cache_quota_exceeded";
4167
4248
  const cacheErrorUnknown = "cache_error_unknown";
4168
4249
 
4169
- /*! @azure/msal-common v16.11.3 2026-07-29 */
4250
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
4170
4251
 
4171
4252
  /*
4172
4253
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4204,7 +4285,7 @@ function createCacheError(e) {
4204
4285
  }
4205
4286
  }
4206
4287
 
4207
- /*! @azure/msal-common v16.11.3 2026-07-29 */
4288
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
4208
4289
 
4209
4290
  /*
4210
4291
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4431,9 +4512,17 @@ class CacheManager {
4431
4512
  }
4432
4513
  /**
4433
4514
  * saves access token credential
4434
- * @param credential
4515
+ * @param credential - the access token entity to save
4516
+ * @param correlationId - unique identifier for the request
4517
+ * @param kmsi - keep me signed in flag
4435
4518
  */
4436
4519
  async saveAccessToken(credential, correlationId, kmsi) {
4520
+ // Compute hash from components on the entity itself — no need to thread externally.
4521
+ let additionalCacheKeyHash;
4522
+ if (credential.additionalCacheKeyComponents &&
4523
+ Object.keys(credential.additionalCacheKeyComponents).length > 0) {
4524
+ additionalCacheKeyHash = await this.cryptoImpl.hashString(JSON.stringify(credential.additionalCacheKeyComponents));
4525
+ }
4437
4526
  const accessTokenFilter = {
4438
4527
  clientId: credential.clientId,
4439
4528
  credentialType: credential.credentialType,
@@ -4457,7 +4546,7 @@ class CacheManager {
4457
4546
  }
4458
4547
  }
4459
4548
  });
4460
- await this.setAccessTokenCredential(credential, correlationId, kmsi);
4549
+ await this.setAccessTokenCredential(credential, correlationId, kmsi, additionalCacheKeyHash);
4461
4550
  }
4462
4551
  /**
4463
4552
  * Retrieve account entities matching all provided tenant-agnostic filters; if no filter is set, get all account entities in the cache
@@ -4868,6 +4957,12 @@ class CacheManager {
4868
4957
  AuthenticationScheme.BEARER.toLowerCase()
4869
4958
  ? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME
4870
4959
  : CredentialType.ACCESS_TOKEN;
4960
+ const attributeTokenPartition = serializeAttributeTokens(request.attributeTokens);
4961
+ const additionalCacheKeyComponents = attributeTokenPartition
4962
+ ? {
4963
+ attribute_tokens: attributeTokenPartition,
4964
+ }
4965
+ : undefined;
4871
4966
  const accessTokenFilter = {
4872
4967
  homeAccountId: account.homeAccountId,
4873
4968
  environment: account.environment,
@@ -4877,10 +4972,12 @@ class CacheManager {
4877
4972
  target: scopes,
4878
4973
  tokenType: authScheme,
4879
4974
  keyId: request.sshKid,
4975
+ additionalCacheKeyComponents: additionalCacheKeyComponents,
4880
4976
  };
4881
4977
  const accessTokenKeys = (tokenKeys && tokenKeys.accessToken) ||
4882
4978
  this.getTokenKeys().accessToken;
4883
4979
  const accessTokens = [];
4980
+ const matchedKeys = [];
4884
4981
  accessTokenKeys.forEach((key) => {
4885
4982
  // Validate key
4886
4983
  if (this.accessTokenKeyMatchesFilter(key, accessTokenFilter, true)) {
@@ -4889,18 +4986,18 @@ class CacheManager {
4889
4986
  if (accessToken &&
4890
4987
  this.credentialMatchesFilter(accessToken, accessTokenFilter, correlationId)) {
4891
4988
  accessTokens.push(accessToken);
4989
+ matchedKeys.push(key);
4892
4990
  }
4893
4991
  }
4894
4992
  });
4895
- const numAccessTokens = accessTokens.length;
4896
- if (numAccessTokens < 1) {
4993
+ if (accessTokens.length < 1) {
4897
4994
  this.commonLogger.info("CacheManager:getAccessToken - No token found", correlationId);
4898
4995
  return null;
4899
4996
  }
4900
- else if (numAccessTokens > 1) {
4997
+ else if (accessTokens.length > 1) {
4901
4998
  this.commonLogger.info("CacheManager:getAccessToken - Multiple access tokens found, clearing them", correlationId);
4902
- accessTokens.forEach((accessToken) => {
4903
- this.removeAccessToken(this.generateCredentialKey(accessToken), correlationId);
4999
+ matchedKeys.forEach((key) => {
5000
+ this.removeAccessToken(key, correlationId);
4904
5001
  });
4905
5002
  this.performanceClient.addFields({ multiMatchedAT: accessTokens.length }, correlationId);
4906
5003
  return null;
@@ -5343,7 +5440,9 @@ class DefaultStorageClass extends CacheManager {
5343
5440
  getTokenKeys() {
5344
5441
  throw createClientAuthError(methodNotImplemented, "");
5345
5442
  }
5346
- generateCredentialKey() {
5443
+ /* eslint-disable @typescript-eslint/no-unused-vars */
5444
+ generateCredentialKey(_credential, _hash) {
5445
+ /* eslint-enable @typescript-eslint/no-unused-vars */
5347
5446
  throw createClientAuthError(methodNotImplemented, "");
5348
5447
  }
5349
5448
  generateAccountKey() {
@@ -5351,7 +5450,7 @@ class DefaultStorageClass extends CacheManager {
5351
5450
  }
5352
5451
  }
5353
5452
 
5354
- /*! @azure/msal-common v16.11.3 2026-07-29 */
5453
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
5355
5454
  /*
5356
5455
  * Copyright (c) Microsoft Corporation. All rights reserved.
5357
5456
  * Licensed under the MIT License.
@@ -5365,7 +5464,7 @@ class DefaultStorageClass extends CacheManager {
5365
5464
  const PerformanceEventStatus = {
5366
5465
  InProgress: 1};
5367
5466
 
5368
- /*! @azure/msal-common v16.11.3 2026-07-29 */
5467
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
5369
5468
 
5370
5469
  /*
5371
5470
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5423,7 +5522,7 @@ class StubPerformanceClient {
5423
5522
  }
5424
5523
  }
5425
5524
 
5426
- /*! @azure/msal-common v16.11.3 2026-07-29 */
5525
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
5427
5526
 
5428
5527
  /*
5429
5528
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5519,7 +5618,7 @@ function isOidcProtocolMode(config) {
5519
5618
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
5520
5619
  }
5521
5620
 
5522
- /*! @azure/msal-common v16.11.3 2026-07-29 */
5621
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
5523
5622
  /*
5524
5623
  * Copyright (c) Microsoft Corporation. All rights reserved.
5525
5624
  * Licensed under the MIT License.
@@ -5546,7 +5645,7 @@ function isOidcProtocolMode(config) {
5546
5645
  }
5547
5646
  }
5548
5647
 
5549
- /*! @azure/msal-common v16.11.3 2026-07-29 */
5648
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
5550
5649
 
5551
5650
  /*
5552
5651
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5626,7 +5725,7 @@ class PopTokenGenerator {
5626
5725
  }
5627
5726
  }
5628
5727
 
5629
- /*! @azure/msal-common v16.11.3 2026-07-29 */
5728
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
5630
5729
  /*
5631
5730
  * Copyright (c) Microsoft Corporation. All rights reserved.
5632
5731
  * Licensed under the MIT License.
@@ -5690,7 +5789,7 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
5690
5789
  uiNotAllowed: uiNotAllowed
5691
5790
  });
5692
5791
 
5693
- /*! @azure/msal-common v16.11.3 2026-07-29 */
5792
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
5694
5793
 
5695
5794
  /*
5696
5795
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5757,7 +5856,7 @@ function createInteractionRequiredAuthError(errorCode, correlationId, errorMessa
5757
5856
  return new InteractionRequiredAuthError(errorCode, correlationId, errorMessage);
5758
5857
  }
5759
5858
 
5760
- /*! @azure/msal-common v16.11.3 2026-07-29 */
5859
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
5761
5860
 
5762
5861
  /*
5763
5862
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5776,7 +5875,7 @@ class ServerError extends AuthError {
5776
5875
  }
5777
5876
  }
5778
5877
 
5779
- /*! @azure/msal-common v16.11.3 2026-07-29 */
5878
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
5780
5879
  /**
5781
5880
  * Parses the state into the RequestStateObject, which contains the LibraryState info and the state passed by the user.
5782
5881
  * @param base64Decode
@@ -5809,7 +5908,7 @@ function parseRequestState(base64Decode, state, correlationId) {
5809
5908
  }
5810
5909
  }
5811
5910
 
5812
- /*! @azure/msal-common v16.11.3 2026-07-29 */
5911
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
5813
5912
 
5814
5913
  /*
5815
5914
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5898,7 +5997,15 @@ class ResponseHandler {
5898
5997
  // Add keyId from request to serverTokenResponse if defined
5899
5998
  serverTokenResponse.key_id =
5900
5999
  serverTokenResponse.key_id || request.sshKid || undefined;
5901
- const cacheRecord = this.generateCacheRecord(serverTokenResponse, authority, reqTimestamp, request, idTokenClaims, userAssertionHash, authCodePayload, additionalCacheKeyComponents);
6000
+ // Compute components once for entity storage (fallback if hash not provided by client)
6001
+ const attributeTokenPartition = serializeAttributeTokens(request.attributeTokens);
6002
+ const cacheKeyComponents = additionalCacheKeyComponents ??
6003
+ (attributeTokenPartition
6004
+ ? {
6005
+ attribute_tokens: attributeTokenPartition,
6006
+ }
6007
+ : undefined);
6008
+ const cacheRecord = this.generateCacheRecord(serverTokenResponse, authority, reqTimestamp, request, idTokenClaims, userAssertionHash, authCodePayload, cacheKeyComponents);
5902
6009
  let cacheContext;
5903
6010
  try {
5904
6011
  if (this.persistencePlugin && this.serializableCache) {
@@ -6160,7 +6267,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
6160
6267
  return baseAccount;
6161
6268
  }
6162
6269
 
6163
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6270
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
6164
6271
  /*
6165
6272
  * Copyright (c) Microsoft Corporation. All rights reserved.
6166
6273
  * Licensed under the MIT License.
@@ -6170,7 +6277,7 @@ const CcsCredentialType = {
6170
6277
  UPN: "UPN",
6171
6278
  };
6172
6279
 
6173
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6280
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
6174
6281
  /*
6175
6282
  * Copyright (c) Microsoft Corporation. All rights reserved.
6176
6283
  * Licensed under the MIT License.
@@ -6189,7 +6296,8 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint, fmiP
6189
6296
  }
6190
6297
  }
6191
6298
 
6192
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6299
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
6300
+
6193
6301
  /*
6194
6302
  * Copyright (c) Microsoft Corporation. All rights reserved.
6195
6303
  * Licensed under the MIT License.
@@ -6208,10 +6316,11 @@ function getRequestThumbprint(clientId, request, homeAccountId) {
6208
6316
  sshKid: request.sshKid,
6209
6317
  embeddedClientId: request.embeddedClientId || request.extraParameters?.clientId,
6210
6318
  resource: request.resource,
6319
+ attributeTokens: serializeAttributeTokens(request.attributeTokens),
6211
6320
  };
6212
6321
  }
6213
6322
 
6214
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6323
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
6215
6324
 
6216
6325
  /*
6217
6326
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6297,7 +6406,7 @@ class ThrottlingUtils {
6297
6406
  }
6298
6407
  }
6299
6408
 
6300
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6409
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
6301
6410
 
6302
6411
  /*
6303
6412
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6328,7 +6437,7 @@ function createNetworkError(error, httpStatus, responseHeaders, additionalError)
6328
6437
  return new NetworkError(error, httpStatus, responseHeaders);
6329
6438
  }
6330
6439
 
6331
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6440
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
6332
6441
 
6333
6442
  /*
6334
6443
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6444,7 +6553,7 @@ async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId
6444
6553
  return response;
6445
6554
  }
6446
6555
 
6447
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6556
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
6448
6557
 
6449
6558
  /*
6450
6559
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6565,6 +6674,12 @@ class AuthorizationCodeClient {
6565
6674
  // Add scope array, parameter builder will add default scopes and dedupe
6566
6675
  addScopes(parameters, request.scopes, request.correlationId, true, this.oidcDefaultScopes);
6567
6676
  addResource(parameters, request.resource);
6677
+ if (request.attributeTokens) {
6678
+ addAttributeTokens(parameters, request.attributeTokens);
6679
+ }
6680
+ this.performanceClient?.addFields({
6681
+ hasAttributeTokens: !!request.attributeTokens?.length,
6682
+ }, request.correlationId);
6568
6683
  // add code: user set, not validated
6569
6684
  addAuthorizationCode(parameters, request.code);
6570
6685
  // Add library metadata
@@ -6701,7 +6816,7 @@ class AuthorizationCodeClient {
6701
6816
  }
6702
6817
  }
6703
6818
 
6704
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6819
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
6705
6820
 
6706
6821
  /*
6707
6822
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6852,7 +6967,7 @@ function extractLoginHint(account) {
6852
6967
  return account.loginHint || account.idTokenClaims?.login_hint || null;
6853
6968
  }
6854
6969
 
6855
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6970
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
6856
6971
 
6857
6972
  /*
6858
6973
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7013,6 +7128,12 @@ class RefreshTokenClient {
7013
7128
  addServerTelemetry(parameters, this.serverTelemetryManager);
7014
7129
  }
7015
7130
  addRefreshToken(parameters, request.refreshToken);
7131
+ if (request.attributeTokens) {
7132
+ addAttributeTokens(parameters, request.attributeTokens);
7133
+ }
7134
+ this.performanceClient?.addFields({
7135
+ hasAttributeTokens: !!request.attributeTokens?.length,
7136
+ }, request.correlationId);
7016
7137
  if (this.config.clientCredentials.clientSecret) {
7017
7138
  addClientSecret(parameters, this.config.clientCredentials.clientSecret);
7018
7139
  }
@@ -7073,7 +7194,7 @@ class RefreshTokenClient {
7073
7194
  }
7074
7195
  }
7075
7196
 
7076
- /*! @azure/msal-common v16.11.3 2026-07-29 */
7197
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
7077
7198
 
7078
7199
  /*
7079
7200
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7339,7 +7460,7 @@ class ServerTelemetryManager {
7339
7460
  }
7340
7461
  }
7341
7462
 
7342
- /*! @azure/msal-common v16.11.3 2026-07-29 */
7463
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
7343
7464
 
7344
7465
  /*
7345
7466
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7447,7 +7568,7 @@ class SilentFlowClient {
7447
7568
  }
7448
7569
  }
7449
7570
 
7450
- /*! @azure/msal-common v16.11.3 2026-07-29 */
7571
+ /*! @azure/msal-common v16.12.0 2026-08-04 */
7451
7572
 
7452
7573
  /*
7453
7574
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8532,14 +8653,35 @@ class CryptoProvider {
8532
8653
  */
8533
8654
  /**
8534
8655
  * Computes a combined hash from additional cache key components.
8535
- * Matches the cross-SDK algorithm: sort keys → concatenate key+value → SHA-256 → Base64URL (no padding).
8656
+ *
8657
+ * Matches the cross-SDK algorithm: sort keys ascending → for each key append a
8658
+ * length-prefixed (netstring-style) encoding of the key and value → SHA-256 →
8659
+ * Base64URL (no padding).
8660
+ *
8661
+ * Each entry is encoded as `<byteLen(key)>:<key><byteLen(value)>:<value>` where the
8662
+ * lengths are the UTF-8 **byte** lengths (via `Buffer.byteLength`, not `String.length`
8663
+ * which counts UTF-16 code units). The length prefixes make the serialization injective
8664
+ * so that semantically different component sets can never serialize to the same byte
8665
+ * string. A plain delimiter-less concatenation of key+value is ambiguous
8666
+ * (e.g. `{fmi_path:"value"}` and `{fmi_pat:"hvalue"}` would both yield `fmi_pathvalue`),
8667
+ * which would collide into the same credential cache slot.
8668
+ *
8669
+ * The encoding is byte-identical to the other MSAL SDKs (Go/.NET/Java/Python), so the
8670
+ * resulting hash is a stable cross-SDK cache key. The final credential key is lowercased
8671
+ * downstream in `generateCredentialKey`.
8536
8672
  */
8537
8673
  function computeAdditionalCacheKeyHash(components) {
8538
8674
  const sortedKeys = Object.keys(components).sort();
8539
- const input = sortedKeys.map((k) => k + components[k]).join("");
8675
+ let input = "";
8676
+ for (const key of sortedKeys) {
8677
+ const value = components[key];
8678
+ input +=
8679
+ `${Buffer.byteLength(key, "utf8")}:${key}` +
8680
+ `${Buffer.byteLength(value, "utf8")}:${value}`;
8681
+ }
8540
8682
  return crypto.createHash("sha256").update(input, "utf8").digest("base64url");
8541
8683
  }
8542
- function generateCredentialKey(credential) {
8684
+ function generateCredentialKey(credential, hash) {
8543
8685
  const familyId = (credential.credentialType === CredentialType.REFRESH_TOKEN &&
8544
8686
  credential.familyId) ||
8545
8687
  credential.clientId;
@@ -8557,10 +8699,15 @@ function generateCredentialKey(credential) {
8557
8699
  credential.target || "",
8558
8700
  scheme,
8559
8701
  ];
8560
- // Compute and append a combined hash from additional cache key components (e.g., fmi_path)
8702
+ /*
8703
+ * Compute and append a combined hash from additional cache key components (e.g., fmi_path).
8704
+ * Use the explicitly passed hash if available; fall back to synchronous inline compute
8705
+ * for lookup paths where the entity was read from storage without a cached hash.
8706
+ */
8561
8707
  if (credential.additionalCacheKeyComponents &&
8562
8708
  Object.keys(credential.additionalCacheKeyComponents).length > 0) {
8563
- credentialKey.push(computeAdditionalCacheKeyHash(credential.additionalCacheKeyComponents));
8709
+ credentialKey.push(hash ??
8710
+ computeAdditionalCacheKeyHash(credential.additionalCacheKeyComponents));
8564
8711
  }
8565
8712
  return credentialKey.join(CACHE.KEY_SEPARATOR).toLowerCase();
8566
8713
  }
@@ -8718,8 +8865,8 @@ class NodeStorage extends CacheManager {
8718
8865
  // write to cache
8719
8866
  this.setCache(cache);
8720
8867
  }
8721
- generateCredentialKey(credential) {
8722
- return generateCredentialKey(credential);
8868
+ generateCredentialKey(credential, additionalCacheKeyHash) {
8869
+ return generateCredentialKey(credential, additionalCacheKeyHash);
8723
8870
  }
8724
8871
  generateAccountKey(account) {
8725
8872
  return generateAccountKey(account);
@@ -8788,11 +8935,14 @@ class NodeStorage extends CacheManager {
8788
8935
  return null;
8789
8936
  }
8790
8937
  /**
8791
- * set accessToken credential
8792
- * @param accessToken - cache value to be set of type AccessTokenEntity
8938
+ * Set accessToken credential to the cache
8939
+ * @param accessToken - the access token entity to cache
8940
+ * @param _correlationId - unique identifier for the request
8941
+ * @param _kmsi - keep me signed in flag
8942
+ * @param additionalCacheKeyHash - optional precomputed hash of additionalCacheKeyComponents used in key generation
8793
8943
  */
8794
- async setAccessTokenCredential(accessToken) {
8795
- const accessTokenKey = this.generateCredentialKey(accessToken);
8944
+ async setAccessTokenCredential(accessToken, _correlationId, _kmsi, additionalCacheKeyHash) {
8945
+ const accessTokenKey = this.generateCredentialKey(accessToken, additionalCacheKeyHash);
8796
8946
  this.setItem(accessTokenKey, accessToken);
8797
8947
  }
8798
8948
  /**
@@ -9446,7 +9596,7 @@ class ClientAssertion {
9446
9596
 
9447
9597
  /* eslint-disable header/header */
9448
9598
  const name = "@azure/msal-node";
9449
- const version = "5.4.3";
9599
+ const version = "5.5.0";
9450
9600
 
9451
9601
  /*
9452
9602
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10687,14 +10837,29 @@ class ClientCredentialClient extends BaseClient {
10687
10837
  * @param request - CommonClientCredentialRequest provided by the developer
10688
10838
  */
10689
10839
  async acquireToken(request) {
10690
- // Build additional cache key components for FMI cache isolation
10840
+ // Build additional cache key components for cache isolation
10691
10841
  let additionalCacheKeyComponents;
10692
10842
  if (request.fmiPath) {
10693
10843
  additionalCacheKeyComponents = {
10844
+ ...additionalCacheKeyComponents,
10694
10845
  fmi_path: request.fmiPath,
10695
10846
  };
10696
10847
  }
10697
- if (request.skipCache || request.claims) {
10848
+ /*
10849
+ * Client-originated claims participate in the cache key (unlike server-issued `claims`,
10850
+ * which bypasses the cache). Identical claims values are served from cache; different
10851
+ * values produce separate cache entries. Gate on `!isEmptyObj` (not just `trim()`) so an
10852
+ * empty/whitespace or empty-object (`{}`) value - which contributes nothing to the request
10853
+ * body - does not fragment the cache from an omitted `claimsFromClient`.
10854
+ */
10855
+ if (request.claimsFromClient &&
10856
+ !StringUtils.isEmptyObj(request.claimsFromClient)) {
10857
+ additionalCacheKeyComponents = {
10858
+ ...additionalCacheKeyComponents,
10859
+ client_claims: request.claimsFromClient,
10860
+ };
10861
+ }
10862
+ if (request.skipCache || !StringUtils.isEmptyObj(request.claims)) {
10698
10863
  return this.executeTokenRequest(request, this.authority,
10699
10864
  /* refreshAccessToken */ undefined, additionalCacheKeyComponents);
10700
10865
  }
@@ -10875,10 +11040,16 @@ class ClientCredentialClient extends BaseClient {
10875
11040
  if (request.fmiPath) {
10876
11041
  parameters.set(FMI_PATH, request.fmiPath);
10877
11042
  }
11043
+ /*
11044
+ * Deep-merge the server-issued `claims` challenge with client-originated `claimsFromClient`
11045
+ * (via addClaims -> buildMergedClaims) so both are sent on the wire. Client capabilities
11046
+ * are appended by buildMergedClaims.
11047
+ */
10878
11048
  if (!StringUtils.isEmptyObj(request.claims) ||
11049
+ !StringUtils.isEmptyObj(request.claimsFromClient) ||
10879
11050
  (this.config.authOptions.clientCapabilities &&
10880
11051
  this.config.authOptions.clientCapabilities.length > 0)) {
10881
- addClaims(parameters, request.correlationId, request.claims, this.config.authOptions.clientCapabilities);
11052
+ addClaims(parameters, request.correlationId, request.claims, this.config.authOptions.clientCapabilities, undefined, request.claimsFromClient);
10882
11053
  }
10883
11054
  return mapToQueryString(parameters);
10884
11055
  }
@@ -10904,15 +11075,29 @@ class OnBehalfOfClient extends BaseClient {
10904
11075
  this.scopeSet = new ScopeSet(request.scopes || [], request.correlationId);
10905
11076
  // generate the user_assertion_hash for OBOAssertion
10906
11077
  this.userAssertionHash = await this.cryptoUtils.hashString(request.oboAssertion);
10907
- if (request.skipCache || request.claims) {
10908
- return this.executeTokenRequest(request, this.authority, this.userAssertionHash);
11078
+ /*
11079
+ * Client-originated claims participate in the cache key (unlike server-issued `claims`,
11080
+ * which bypasses the cache). Identical claims values are served from cache; different
11081
+ * values produce separate cache entries. Gate on `!isEmptyObj` (not just `trim()`) so an
11082
+ * empty/whitespace or empty-object (`{}`) value - which contributes nothing to the request
11083
+ * body - does not fragment the cache from an omitted `claimsFromClient`.
11084
+ */
11085
+ let additionalCacheKeyComponents;
11086
+ if (request.claimsFromClient &&
11087
+ !StringUtils.isEmptyObj(request.claimsFromClient)) {
11088
+ additionalCacheKeyComponents = {
11089
+ client_claims: request.claimsFromClient,
11090
+ };
11091
+ }
11092
+ if (request.skipCache || !StringUtils.isEmptyObj(request.claims)) {
11093
+ return this.executeTokenRequest(request, this.authority, this.userAssertionHash, additionalCacheKeyComponents);
10909
11094
  }
10910
11095
  try {
10911
- return await this.getCachedAuthenticationResult(request);
11096
+ return await this.getCachedAuthenticationResult(request, additionalCacheKeyComponents);
10912
11097
  }
10913
11098
  catch (e) {
10914
11099
  // Any failure falls back to interactive request, once we implement distributed cache, we plan to handle `createRefreshRequiredError` to refresh using the RT
10915
- return await this.executeTokenRequest(request, this.authority, this.userAssertionHash);
11100
+ return await this.executeTokenRequest(request, this.authority, this.userAssertionHash, additionalCacheKeyComponents);
10916
11101
  }
10917
11102
  }
10918
11103
  /**
@@ -10923,9 +11108,9 @@ class OnBehalfOfClient extends BaseClient {
10923
11108
  * This is to prevent security issues when the assertion changes over time, however, longlived RT helps retaining the session
10924
11109
  * @param request - developer provided CommonOnBehalfOfRequest
10925
11110
  */
10926
- async getCachedAuthenticationResult(request) {
11111
+ async getCachedAuthenticationResult(request, additionalCacheKeyComponents) {
10927
11112
  // look in the cache for the access_token which matches the incoming_assertion
10928
- const cachedAccessToken = this.readAccessTokenFromCacheForOBO(this.config.authOptions.clientId, request);
11113
+ const cachedAccessToken = this.readAccessTokenFromCacheForOBO(this.config.authOptions.clientId, request, additionalCacheKeyComponents);
10929
11114
  if (!cachedAccessToken) {
10930
11115
  // Must refresh due to non-existent access_token.
10931
11116
  this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN);
@@ -10991,7 +11176,7 @@ class OnBehalfOfClient extends BaseClient {
10991
11176
  * @param clientId - client id
10992
11177
  * @param request - developer provided CommonOnBehalfOfRequest
10993
11178
  */
10994
- readAccessTokenFromCacheForOBO(clientId, request) {
11179
+ readAccessTokenFromCacheForOBO(clientId, request, additionalCacheKeyComponents) {
10995
11180
  const authScheme = request.authenticationScheme ||
10996
11181
  AuthenticationScheme.BEARER;
10997
11182
  /*
@@ -11009,6 +11194,7 @@ class OnBehalfOfClient extends BaseClient {
11009
11194
  tokenType: authScheme,
11010
11195
  keyId: request.sshKid,
11011
11196
  userAssertionHash: this.userAssertionHash,
11197
+ additionalCacheKeyComponents: additionalCacheKeyComponents,
11012
11198
  };
11013
11199
  const accessTokens = this.cacheManager.getAccessTokensByFilter(accessTokenFilter, request.correlationId);
11014
11200
  const numAccessTokens = accessTokens.length;
@@ -11025,7 +11211,7 @@ class OnBehalfOfClient extends BaseClient {
11025
11211
  * @param request - developer provided CommonOnBehalfOfRequest
11026
11212
  * @param authority - authority object
11027
11213
  */
11028
- async executeTokenRequest(request, authority, userAssertionHash) {
11214
+ async executeTokenRequest(request, authority, userAssertionHash, additionalCacheKeyComponents) {
11029
11215
  const queryParametersString = this.createTokenQueryParameters(request);
11030
11216
  const endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParametersString);
11031
11217
  const requestBody = await this.createTokenRequestBody(request);
@@ -11045,7 +11231,12 @@ class OnBehalfOfClient extends BaseClient {
11045
11231
  const response = await this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint, request.correlationId);
11046
11232
  const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin);
11047
11233
  responseHandler.validateTokenResponse(response.body, request.correlationId);
11048
- const tokenResponse = await responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, ApiId.acquireTokenByOBO, undefined, userAssertionHash);
11234
+ const tokenResponse = await responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, ApiId.acquireTokenByOBO, undefined, // authCodePayload
11235
+ userAssertionHash, // userAssertionHash
11236
+ undefined, // handlingRefreshTokenResponse
11237
+ undefined, // forceCacheRefreshTokenResponse
11238
+ undefined, // serverRequestId
11239
+ additionalCacheKeyComponents);
11049
11240
  return tokenResponse;
11050
11241
  }
11051
11242
  /**
@@ -11077,10 +11268,16 @@ class OnBehalfOfClient extends BaseClient {
11077
11268
  addClientAssertion(parameters, await getClientAssertion(clientAssertion.assertion, this.config.authOptions.clientId, request.resourceRequestUri));
11078
11269
  addClientAssertionType(parameters, clientAssertion.assertionType);
11079
11270
  }
11080
- if (request.claims ||
11271
+ /*
11272
+ * Deep-merge the server-issued `claims` challenge with client-originated `claimsFromClient`
11273
+ * (via addClaims -> buildMergedClaims) so both are sent on the wire. Client capabilities
11274
+ * are appended by buildMergedClaims.
11275
+ */
11276
+ if (!StringUtils.isEmptyObj(request.claims) ||
11277
+ !StringUtils.isEmptyObj(request.claimsFromClient) ||
11081
11278
  (this.config.authOptions.clientCapabilities &&
11082
11279
  this.config.authOptions.clientCapabilities.length > 0)) {
11083
- addClaims(parameters, request.correlationId, request.claims, this.config.authOptions.clientCapabilities);
11280
+ addClaims(parameters, request.correlationId, request.claims, this.config.authOptions.clientCapabilities, undefined, request.claimsFromClient);
11084
11281
  }
11085
11282
  return mapToQueryString(parameters);
11086
11283
  }
@@ -11176,10 +11373,16 @@ class UserFederatedIdentityCredentialClient extends BaseClient {
11176
11373
  addClientAssertion(parameters, await getClientAssertion(clientAssertion.assertion, this.config.authOptions.clientId, this.authority.tokenEndpoint));
11177
11374
  addClientAssertionType(parameters, clientAssertion.assertionType);
11178
11375
  }
11179
- if (request.claims ||
11376
+ /*
11377
+ * Deep-merge the server-issued `claims` challenge with client-originated `claimsFromClient`
11378
+ * (via addClaims -> buildMergedClaims) so both are sent on the wire. Client capabilities
11379
+ * are appended by buildMergedClaims.
11380
+ */
11381
+ if (!StringUtils.isEmptyObj(request.claims) ||
11382
+ !StringUtils.isEmptyObj(request.claimsFromClient) ||
11180
11383
  (this.config.authOptions.clientCapabilities &&
11181
11384
  this.config.authOptions.clientCapabilities.length > 0)) {
11182
- addClaims(parameters, request.correlationId, request.claims, this.config.authOptions.clientCapabilities);
11385
+ addClaims(parameters, request.correlationId, request.claims, this.config.authOptions.clientCapabilities, undefined, request.claimsFromClient);
11183
11386
  }
11184
11387
  return mapToQueryString(parameters);
11185
11388
  }