@azure/msal-node 5.4.3 → 5.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/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 +16 -6
  11. package/dist/client/ClientApplication.mjs.map +1 -1
  12. package/dist/client/ClientAssertion.mjs +1 -1
  13. package/dist/client/ClientCredentialClient.mjs +30 -7
  14. package/dist/client/ClientCredentialClient.mjs.map +1 -1
  15. package/dist/client/ConfidentialClientApplication.mjs +1 -1
  16. package/dist/client/DeviceCodeClient.mjs +2 -2
  17. package/dist/client/DeviceCodeClient.mjs.map +1 -1
  18. package/dist/client/ManagedIdentityApplication.mjs +1 -1
  19. package/dist/client/ManagedIdentityClient.mjs +1 -1
  20. package/dist/client/ManagedIdentitySources/AppService.mjs +1 -1
  21. package/dist/client/ManagedIdentitySources/AzureArc.mjs +93 -16
  22. package/dist/client/ManagedIdentitySources/AzureArc.mjs.map +1 -1
  23. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +1 -1
  24. package/dist/client/ManagedIdentitySources/CloudShell.mjs +1 -1
  25. package/dist/client/ManagedIdentitySources/Imds.mjs +1 -1
  26. package/dist/client/ManagedIdentitySources/MachineLearning.mjs +1 -1
  27. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +1 -1
  28. package/dist/client/OnBehalfOfClient.mjs +44 -15
  29. package/dist/client/OnBehalfOfClient.mjs.map +1 -1
  30. package/dist/client/PublicClientApplication.mjs +1 -1
  31. package/dist/client/UserFederatedIdentityCredentialClient.mjs +11 -5
  32. package/dist/client/UserFederatedIdentityCredentialClient.mjs.map +1 -1
  33. package/dist/client/UsernamePasswordClient.mjs +2 -2
  34. package/dist/client/UsernamePasswordClient.mjs.map +1 -1
  35. package/dist/config/Configuration.mjs +1 -1
  36. package/dist/config/ManagedIdentityId.mjs +1 -1
  37. package/dist/config/ManagedIdentityRequestParameters.mjs +1 -1
  38. package/dist/crypto/CryptoProvider.mjs +13 -13
  39. package/dist/crypto/CryptoProvider.mjs.map +1 -1
  40. package/dist/crypto/GuidGenerator.mjs +1 -1
  41. package/dist/crypto/HashUtils.mjs +1 -1
  42. package/dist/crypto/PkceGenerator.mjs +1 -1
  43. package/dist/error/ClientAuthErrorCodes.mjs +1 -1
  44. package/dist/error/ManagedIdentityError.mjs +5 -4
  45. package/dist/error/ManagedIdentityError.mjs.map +1 -1
  46. package/dist/error/ManagedIdentityErrorCodes.mjs +3 -2
  47. package/dist/error/ManagedIdentityErrorCodes.mjs.map +1 -1
  48. package/dist/error/NodeAuthError.mjs +1 -1
  49. package/dist/index.mjs +1 -1
  50. package/dist/internals.mjs +1 -1
  51. package/dist/network/HttpClient.mjs +1 -1
  52. package/dist/network/HttpClientWithRetries.mjs +1 -1
  53. package/dist/network/LoopbackClient.mjs +1 -1
  54. package/dist/packageMetadata.mjs +2 -2
  55. package/dist/protocol/Authorize.mjs +1 -1
  56. package/dist/retry/DefaultManagedIdentityRetryPolicy.mjs +1 -1
  57. package/dist/retry/ExponentialRetryStrategy.mjs +1 -1
  58. package/dist/retry/ImdsRetryPolicy.mjs +1 -1
  59. package/dist/retry/LinearRetryStrategy.mjs +1 -1
  60. package/dist/utils/Constants.mjs +1 -1
  61. package/dist/utils/EncodingUtils.mjs +1 -1
  62. package/dist/utils/TimeUtils.mjs +1 -1
  63. package/lib/msal-node.cjs +709 -198
  64. package/lib/msal-node.cjs.map +1 -1
  65. package/package.json +2 -2
  66. package/src/cache/CacheHelpers.ts +36 -7
  67. package/src/cache/NodeStorage.ts +18 -6
  68. package/src/client/ClientApplication.ts +15 -5
  69. package/src/client/ClientCredentialClient.ts +34 -5
  70. package/src/client/DeviceCodeClient.ts +2 -1
  71. package/src/client/ManagedIdentitySources/AzureArc.ts +139 -19
  72. package/src/client/OnBehalfOfClient.ts +58 -14
  73. package/src/client/UserFederatedIdentityCredentialClient.ts +13 -3
  74. package/src/client/UsernamePasswordClient.ts +2 -1
  75. package/src/crypto/CryptoProvider.ts +31 -13
  76. package/src/error/ManagedIdentityError.ts +4 -2
  77. package/src/error/ManagedIdentityErrorCodes.ts +2 -0
  78. package/src/packageMetadata.ts +1 -1
  79. package/src/request/AuthorizationCodeRequest.ts +4 -0
  80. package/src/request/CommonClientCredentialRequest.ts +7 -0
  81. package/src/request/CommonOnBehalfOfRequest.ts +7 -0
  82. package/src/request/CommonUserFederatedIdentityCredentialRequest.ts +7 -0
  83. package/src/response/ManagedIdentityTokenResponse.ts +3 -0
  84. package/types/cache/CacheHelpers.d.ts +1 -1
  85. package/types/cache/CacheHelpers.d.ts.map +1 -1
  86. package/types/cache/NodeStorage.d.ts +7 -4
  87. package/types/cache/NodeStorage.d.ts.map +1 -1
  88. package/types/client/ClientApplication.d.ts.map +1 -1
  89. package/types/client/ClientCredentialClient.d.ts.map +1 -1
  90. package/types/client/DeviceCodeClient.d.ts.map +1 -1
  91. package/types/client/ManagedIdentitySources/AzureArc.d.ts +22 -8
  92. package/types/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
  93. package/types/client/OnBehalfOfClient.d.ts.map +1 -1
  94. package/types/client/UserFederatedIdentityCredentialClient.d.ts.map +1 -1
  95. package/types/client/UsernamePasswordClient.d.ts.map +1 -1
  96. package/types/crypto/CryptoProvider.d.ts +11 -9
  97. package/types/crypto/CryptoProvider.d.ts.map +1 -1
  98. package/types/error/ManagedIdentityError.d.ts +1 -0
  99. package/types/error/ManagedIdentityError.d.ts.map +1 -1
  100. package/types/error/ManagedIdentityErrorCodes.d.ts +1 -0
  101. package/types/error/ManagedIdentityErrorCodes.d.ts.map +1 -1
  102. package/types/packageMetadata.d.ts +1 -1
  103. package/types/request/AuthorizationCodeRequest.d.ts +4 -0
  104. package/types/request/AuthorizationCodeRequest.d.ts.map +1 -1
  105. package/types/request/CommonClientCredentialRequest.d.ts +7 -0
  106. package/types/request/CommonClientCredentialRequest.d.ts.map +1 -1
  107. package/types/request/CommonOnBehalfOfRequest.d.ts +7 -0
  108. package/types/request/CommonOnBehalfOfRequest.d.ts.map +1 -1
  109. package/types/request/CommonUserFederatedIdentityCredentialRequest.d.ts +7 -0
  110. package/types/request/CommonUserFederatedIdentityCredentialRequest.d.ts.map +1 -1
  111. package/types/response/ManagedIdentityTokenResponse.d.ts +3 -0
  112. package/types/response/ManagedIdentityTokenResponse.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.6.0 2026-08-18 */
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.13.0 2026-08-18 */
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.13.0 2026-08-18 */
212
213
  /*
213
214
  * Copyright (c) Microsoft Corporation. All rights reserved.
214
215
  * Licensed under the MIT License.
@@ -453,6 +454,10 @@ const CacheOutcome = {
453
454
  // When the token request goes to the identity provider because refresh_in was used and the existing token needs to be refreshed
454
455
  PROACTIVELY_REFRESHED: "4",
455
456
  };
457
+ const JsonWebTokenTypes = {
458
+ Pop: "pop",
459
+ Dpop: "dpop+jwt",
460
+ };
456
461
  // Token renewal offset default in seconds
457
462
  const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
458
463
  const EncodingTypes = {
@@ -461,7 +466,7 @@ const EncodingTypes = {
461
466
  UTF8: "utf-8",
462
467
  };
463
468
 
464
- /*! @azure/msal-common v16.11.3 2026-07-29 */
469
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
465
470
  /*
466
471
  * Copyright (c) Microsoft Corporation. All rights reserved.
467
472
  * Licensed under the MIT License.
@@ -490,7 +495,7 @@ function createAuthError(code, correlationId, additionalMessage) {
490
495
  return new AuthError(code, correlationId, additionalMessage || getDefaultErrorMessage(code));
491
496
  }
492
497
 
493
- /*! @azure/msal-common v16.11.3 2026-07-29 */
498
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
494
499
 
495
500
  /*
496
501
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -513,7 +518,7 @@ function createClientAuthError(errorCode, correlationId, additionalMessage) {
513
518
  return new ClientAuthError(errorCode, correlationId, additionalMessage);
514
519
  }
515
520
 
516
- /*! @azure/msal-common v16.11.3 2026-07-29 */
521
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
517
522
  /*
518
523
  * Copyright (c) Microsoft Corporation. All rights reserved.
519
524
  * Licensed under the MIT License.
@@ -597,7 +602,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
597
602
  userCanceled: userCanceled
598
603
  });
599
604
 
600
- /*! @azure/msal-common v16.11.3 2026-07-29 */
605
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
601
606
 
602
607
  /*
603
608
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -635,7 +640,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
635
640
  };
636
641
  }
637
642
 
638
- /*! @azure/msal-common v16.11.3 2026-07-29 */
643
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
639
644
 
640
645
  /*
641
646
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -701,7 +706,7 @@ function getJWSPayload(authToken, correlationId) {
701
706
  return matches[2];
702
707
  }
703
708
 
704
- /*! @azure/msal-common v16.11.3 2026-07-29 */
709
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
705
710
 
706
711
  /*
707
712
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -789,7 +794,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
789
794
  return updatedAccountInfo;
790
795
  }
791
796
 
792
- /*! @azure/msal-common v16.11.3 2026-07-29 */
797
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
793
798
  /*
794
799
  * Copyright (c) Microsoft Corporation. All rights reserved.
795
800
  * Licensed under the MIT License.
@@ -804,7 +809,7 @@ const AuthorityType = {
804
809
  Ciam: 3,
805
810
  };
806
811
 
807
- /*! @azure/msal-common v16.11.3 2026-07-29 */
812
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
808
813
  /*
809
814
  * Copyright (c) Microsoft Corporation. All rights reserved.
810
815
  * Licensed under the MIT License.
@@ -826,7 +831,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
826
831
  return null;
827
832
  }
828
833
 
829
- /*! @azure/msal-common v16.11.3 2026-07-29 */
834
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
830
835
  /*
831
836
  * Copyright (c) Microsoft Corporation. All rights reserved.
832
837
  * Licensed under the MIT License.
@@ -850,7 +855,7 @@ const ProtocolMode = {
850
855
  EAR: "EAR",
851
856
  };
852
857
 
853
- /*! @azure/msal-common v16.11.3 2026-07-29 */
858
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
854
859
  /**
855
860
  * Returns the AccountInfo interface for this account.
856
861
  * @internal
@@ -999,7 +1004,7 @@ function isAccountEntity(entity) {
999
1004
  entity.hasOwnProperty("authorityType"));
1000
1005
  }
1001
1006
 
1002
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1007
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
1003
1008
  /*
1004
1009
  * Copyright (c) Microsoft Corporation. All rights reserved.
1005
1010
  * Licensed under the MIT License.
@@ -1016,7 +1021,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
1016
1021
  unexpectedError: unexpectedError
1017
1022
  });
1018
1023
 
1019
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1024
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
1020
1025
 
1021
1026
  /*
1022
1027
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1036,7 +1041,7 @@ function createClientConfigurationError(errorCode, correlationId) {
1036
1041
  return new ClientConfigurationError(errorCode, correlationId);
1037
1042
  }
1038
1043
 
1039
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1044
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
1040
1045
  /*
1041
1046
  * Copyright (c) Microsoft Corporation. All rights reserved.
1042
1047
  * Licensed under the MIT License.
@@ -1057,6 +1062,7 @@ const invalidAuthorityMetadata = "invalid_authority_metadata";
1057
1062
  const untrustedAuthority = "untrusted_authority";
1058
1063
  const missingSshJwk = "missing_ssh_jwk";
1059
1064
  const missingSshKid = "missing_ssh_kid";
1065
+ const unsupportedAuthenticationScheme = "unsupported_authentication_scheme";
1060
1066
  const missingNonceAuthenticationHeader = "missing_nonce_authentication_header";
1061
1067
  const invalidAuthenticationHeader = "invalid_authentication_header";
1062
1068
  const cannotSetOIDCOptions = "cannot_set_OIDCOptions";
@@ -1095,12 +1101,13 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
1095
1101
  pkceParamsMissing: pkceParamsMissing,
1096
1102
  redirectUriEmpty: redirectUriEmpty,
1097
1103
  tokenRequestEmpty: tokenRequestEmpty,
1104
+ unsupportedAuthenticationScheme: unsupportedAuthenticationScheme,
1098
1105
  untrustedAuthority: untrustedAuthority,
1099
1106
  urlEmptyError: urlEmptyError,
1100
1107
  urlParseError: urlParseError
1101
1108
  });
1102
1109
 
1103
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1110
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
1104
1111
  /*
1105
1112
  * Copyright (c) Microsoft Corporation. All rights reserved.
1106
1113
  * Licensed under the MIT License.
@@ -1112,7 +1119,7 @@ function isOpenIdConfigResponse(response) {
1112
1119
  response.hasOwnProperty("jwks_uri"));
1113
1120
  }
1114
1121
 
1115
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1122
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
1116
1123
  /*
1117
1124
  * Copyright (c) Microsoft Corporation. All rights reserved.
1118
1125
  * Licensed under the MIT License.
@@ -1192,7 +1199,7 @@ class StringUtils {
1192
1199
  }
1193
1200
  }
1194
1201
 
1195
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1202
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
1196
1203
 
1197
1204
  /*
1198
1205
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1350,7 +1357,7 @@ class UrlString {
1350
1357
  }
1351
1358
  }
1352
1359
 
1353
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1360
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
1354
1361
 
1355
1362
  /*
1356
1363
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1359,10 +1366,7 @@ class UrlString {
1359
1366
  // Build endpoint metadata dynamically to avoid string duplication
1360
1367
  const endpointHosts = [
1361
1368
  { host: "login.microsoftonline.com" },
1362
- {
1363
- host: "login.chinacloudapi.cn",
1364
- issuerHost: "login.partner.microsoftonline.cn", // Issuer differs
1365
- },
1369
+ { host: "login.partner.microsoftonline.cn" },
1366
1370
  { host: "login.microsoftonline.us" },
1367
1371
  { host: "login.sovcloud-identity.fr" },
1368
1372
  { host: "login.sovcloud-identity.de" },
@@ -1516,7 +1520,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
1516
1520
  return null;
1517
1521
  }
1518
1522
 
1519
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1523
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
1520
1524
  /*
1521
1525
  * Copyright (c) Microsoft Corporation. All rights reserved.
1522
1526
  * Licensed under the MIT License.
@@ -1536,7 +1540,7 @@ const AzureCloudInstance = {
1536
1540
  AzureUsGovernment: "https://login.microsoftonline.us",
1537
1541
  };
1538
1542
 
1539
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1543
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
1540
1544
  /*
1541
1545
  * Copyright (c) Microsoft Corporation. All rights reserved.
1542
1546
  * Licensed under the MIT License.
@@ -1546,7 +1550,7 @@ function isCloudInstanceDiscoveryResponse(response) {
1546
1550
  response.hasOwnProperty("metadata"));
1547
1551
  }
1548
1552
 
1549
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1553
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
1550
1554
  /*
1551
1555
  * Copyright (c) Microsoft Corporation. All rights reserved.
1552
1556
  * Licensed under the MIT License.
@@ -1556,7 +1560,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
1556
1560
  response.hasOwnProperty("error_description"));
1557
1561
  }
1558
1562
 
1559
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1563
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
1560
1564
  /*
1561
1565
  * Copyright (c) Microsoft Corporation. All rights reserved.
1562
1566
  * Licensed under the MIT License.
@@ -1618,7 +1622,7 @@ const RegionDiscoveryGetCurrentVersion = "regionDiscoveryGetCurrentVersion";
1618
1622
  */
1619
1623
  const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
1620
1624
 
1621
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1625
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
1622
1626
  /*
1623
1627
  * Copyright (c) Microsoft Corporation. All rights reserved.
1624
1628
  * Licensed under the MIT License.
@@ -1711,7 +1715,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
1711
1715
  };
1712
1716
  };
1713
1717
 
1714
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1718
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
1715
1719
 
1716
1720
  /*
1717
1721
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1822,7 +1826,7 @@ RegionDiscovery.IMDS_OPTIONS = {
1822
1826
  },
1823
1827
  };
1824
1828
 
1825
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1829
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
1826
1830
  /*
1827
1831
  * Copyright (c) Microsoft Corporation. All rights reserved.
1828
1832
  * Licensed under the MIT License.
@@ -1877,7 +1881,7 @@ function delay(t, value) {
1877
1881
  return new Promise((resolve) => setTimeout(() => resolve(value), t));
1878
1882
  }
1879
1883
 
1880
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1884
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
1881
1885
 
1882
1886
  /*
1883
1887
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1934,6 +1938,7 @@ function createAccessTokenEntity(homeAccountId, environment, accessToken, client
1934
1938
  if (refreshOn) {
1935
1939
  atEntity.refreshOn = refreshOn.toString();
1936
1940
  }
1941
+ const normalizedTokenType = atEntity.tokenType?.toLowerCase();
1937
1942
  /*
1938
1943
  * Create Access Token With Auth Scheme instead of regular access token
1939
1944
  * Cast to lower to handle "bearer" from ADFS
@@ -1942,7 +1947,7 @@ function createAccessTokenEntity(homeAccountId, environment, accessToken, client
1942
1947
  AuthenticationScheme.BEARER.toLowerCase()) {
1943
1948
  atEntity.credentialType =
1944
1949
  CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;
1945
- switch (atEntity.tokenType) {
1950
+ switch (normalizedTokenType) {
1946
1951
  case AuthenticationScheme.POP:
1947
1952
  // Make sure keyId is present and add it to credential
1948
1953
  const tokenClaims = extractTokenClaims(accessToken, base64Decode, correlationId);
@@ -1951,6 +1956,12 @@ function createAccessTokenEntity(homeAccountId, environment, accessToken, client
1951
1956
  }
1952
1957
  atEntity.keyId = tokenClaims.cnf.kid;
1953
1958
  break;
1959
+ case "dpop":
1960
+ if (!keyId) {
1961
+ throw createClientAuthError(keyIdMissing, correlationId);
1962
+ }
1963
+ atEntity.keyId = keyId;
1964
+ break;
1954
1965
  case AuthenticationScheme.SSH:
1955
1966
  atEntity.keyId = keyId;
1956
1967
  }
@@ -2142,9 +2153,22 @@ function updateCloudDiscoveryMetadata(authorityMetadata, updatedValues, fromNetw
2142
2153
  */
2143
2154
  function isAuthorityMetadataExpired(metadata) {
2144
2155
  return metadata.expiresAt <= nowSeconds();
2156
+ }
2157
+ /**
2158
+ * Serialize attribute tokens synchronously (sort and join).
2159
+ * This is a sync-only operation for use at request construction time.
2160
+ * @param attributeTokens - array of tokens
2161
+ * @returns serialized partition string or undefined if no tokens
2162
+ */
2163
+ function serializeAttributeTokens(attributeTokens) {
2164
+ if (!attributeTokens || attributeTokens.length === 0) {
2165
+ return undefined;
2166
+ }
2167
+ // Serialize: sort and join tokens
2168
+ return [...attributeTokens].sort().join(" ");
2145
2169
  }
2146
2170
 
2147
- /*! @azure/msal-common v16.11.3 2026-07-29 */
2171
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
2148
2172
 
2149
2173
  /*
2150
2174
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3114,7 +3138,7 @@ function buildStaticAuthorityOptions(authOptions) {
3114
3138
  };
3115
3139
  }
3116
3140
 
3117
- /*! @azure/msal-common v16.11.3 2026-07-29 */
3141
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
3118
3142
 
3119
3143
  /*
3120
3144
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3148,7 +3172,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
3148
3172
  }
3149
3173
  }
3150
3174
 
3151
- /*! @azure/msal-common v16.11.3 2026-07-29 */
3175
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
3152
3176
 
3153
3177
  /*
3154
3178
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3344,7 +3368,7 @@ class ScopeSet {
3344
3368
  }
3345
3369
  }
3346
3370
 
3347
- /*! @azure/msal-common v16.11.3 2026-07-29 */
3371
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
3348
3372
 
3349
3373
  /*
3350
3374
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3466,13 +3490,14 @@ function addSid(parameters, sid) {
3466
3490
  * @param claims - The claims string from the request
3467
3491
  * @param clientCapabilities - The client capabilities from configuration
3468
3492
  * @param skipBrokerClaims - When true and BROKER_CLIENT_ID is present, excludes clientCapabilities from claims
3493
+ * @param claimsToMerge - Optional client-originated claims JSON string (e.g. `claimsFromClient`) deep-merged into `claims` with precedence on conflicts
3469
3494
  */
3470
- function addClaims(parameters, correlationId, claims, clientCapabilities, skipBrokerClaims) {
3495
+ function addClaims(parameters, correlationId, claims, clientCapabilities, skipBrokerClaims, claimsToMerge) {
3471
3496
  // Skip clientCapabilities if skipBrokerClaims is set to true and this is a brokered authentication flow
3472
3497
  const configClaims = skipBrokerClaims && parameters.has(BROKER_CLIENT_ID)
3473
3498
  ? undefined
3474
3499
  : clientCapabilities;
3475
- const mergedClaims = buildMergedClaims(claims, configClaims, correlationId);
3500
+ const mergedClaims = buildMergedClaims(claims, configClaims, correlationId, claimsToMerge);
3476
3501
  parameters.set(CLAIMS, mergedClaims);
3477
3502
  }
3478
3503
  /**
@@ -3659,32 +3684,79 @@ const DEFAULT_ID_TOKEN_CLAIMS = {
3659
3684
  [ClaimsRequestKeys.LOGIN_HINT]: { essential: false },
3660
3685
  };
3661
3686
  /**
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.
3687
+ * Parses a claims JSON string into an object, throwing a ClientConfigurationError
3688
+ * (error code `invalid_claims`) if the value is not a valid JSON object. The raw
3689
+ * claims value is never included in the error - it may contain sensitive data.
3690
+ * @param claims - Claims JSON string. Must be valid JSON representing an object.
3691
+ * @param correlationId - The request correlation id
3692
+ * @returns The parsed claims object
3693
+ */
3694
+ function parseClaims(claims, correlationId = "") {
3695
+ let parsed;
3696
+ try {
3697
+ parsed = JSON.parse(claims);
3698
+ }
3699
+ catch (e) {
3700
+ // Malformed JSON
3701
+ throw createClientConfigurationError(invalidClaims, correlationId);
3702
+ }
3703
+ if (!isPlainObject$1(parsed)) {
3704
+ // Valid JSON, but not an object (e.g. an array, a scalar, or the literal `null`).
3705
+ throw createClientConfigurationError(invalidClaims, correlationId);
3706
+ }
3707
+ return parsed;
3708
+ }
3709
+ /**
3710
+ * Type guard for a non-null, non-array object (a JSON "object" value).
3711
+ * @param value - The value to test
3712
+ * @returns True when value is a plain object that can be deep-merged
3713
+ */
3714
+ function isPlainObject$1(value) {
3715
+ return typeof value === "object" && value !== null && !Array.isArray(value);
3716
+ }
3717
+ /**
3718
+ * Recursively deep-merges two parsed claims objects. Nested objects are merged key-by-key;
3719
+ * for any other value type (arrays, scalars, null) the value from `claimsToMerge` replaces
3720
+ * the base. This mirrors the deep merge used by msal-dotnet so that, for example, a server
3721
+ * `access_token` challenge and a client-originated `access_token` claim are combined rather
3722
+ * than one clobbering the other.
3723
+ * @param baseClaims - The parsed base claims object
3724
+ * @param claimsToMerge - The parsed claims object merged in with precedence
3725
+ * @returns The deep-merged claims object
3726
+ */
3727
+ function deepMergeClaims(baseClaims, claimsToMerge) {
3728
+ const merged = { ...baseClaims };
3729
+ for (const [key, mergeInValue] of Object.entries(claimsToMerge)) {
3730
+ const baseValue = merged[key];
3731
+ if (isPlainObject$1(baseValue) && isPlainObject$1(mergeInValue)) {
3732
+ merged[key] = deepMergeClaims(baseValue, mergeInValue);
3733
+ }
3734
+ else {
3735
+ merged[key] = mergeInValue;
3736
+ }
3737
+ }
3738
+ return merged;
3739
+ }
3740
+ /**
3741
+ * Parses claims JSON, optionally deep-merges a second client-originated claims string
3742
+ * (`claimsToMerge`, e.g. `claimsFromClient`) with precedence on conflicting keys, merges
3743
+ * default optional idToken claims (signin_state, login_hint), and appends client
3744
+ * capabilities (xms_cc) to the access_token section.
3664
3745
  * Does not overwrite idToken claims already specified by the caller.
3665
3746
  * @param claims - Existing claims JSON string from the request (may be undefined)
3666
3747
  * @param clientCapabilities - Client capabilities array from configuration
3748
+ * @param correlationId - The request correlation id
3749
+ * @param claimsToMerge - Optional second claims JSON string (e.g. client-originated `claimsFromClient`)
3750
+ * deep-merged into `claims` with precedence on conflicts; parsed and validated when present. Nested
3751
+ * objects are merged recursively; arrays and scalar values are replaced.
3667
3752
  * @returns Merged claims JSON string
3668
3753
  */
3669
- function buildMergedClaims(claims, clientCapabilities, correlationId = "") {
3670
- let mergedClaims;
3754
+ function buildMergedClaims(claims, clientCapabilities, correlationId = "", claimsToMerge) {
3671
3755
  // 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
- }
3756
+ let mergedClaims = claims ? parseClaims(claims, correlationId) : {};
3757
+ // Deep-merge client-originated claims (e.g. `claimsFromClient`) with precedence on conflicts
3758
+ if (claimsToMerge?.trim()) {
3759
+ mergedClaims = deepMergeClaims(mergedClaims, parseClaims(claimsToMerge, correlationId));
3688
3760
  }
3689
3761
  // Add default optional idToken claims
3690
3762
  if (!Object.prototype.hasOwnProperty.call(mergedClaims, ClaimsRequestKeys.ID_TOKEN)) {
@@ -3775,9 +3847,28 @@ function addResource(parameters, resource) {
3775
3847
  if (resource) {
3776
3848
  parameters.set(RESOURCE, resource);
3777
3849
  }
3850
+ }
3851
+ /**
3852
+ * Add the `attribute_tokens` parameter to a /token request body.
3853
+ *
3854
+ * When `attributeTokens` is a non-empty array the values are sorted lexicographically and joined
3855
+ * with a single space, then written to the request body. When `attributeTokens` is an empty array
3856
+ * the parameter is deleted from the request body.
3857
+ *
3858
+ * @param parameters - request parameter map that will be serialized into the /token body
3859
+ * @param attributeTokens - caller-provided attribute token strings
3860
+ */
3861
+ function addAttributeTokens(parameters, attributeTokens) {
3862
+ const serialized = serializeAttributeTokens(attributeTokens);
3863
+ if (serialized) {
3864
+ parameters.set(ATTRIBUTE_TOKENS, serialized);
3865
+ }
3866
+ else {
3867
+ parameters.delete(ATTRIBUTE_TOKENS);
3868
+ }
3778
3869
  }
3779
3870
 
3780
- /*! @azure/msal-common v16.11.3 2026-07-29 */
3871
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
3781
3872
 
3782
3873
  /*
3783
3874
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3835,12 +3926,19 @@ function mapToQueryString(parameters) {
3835
3926
  return queryParameterArray.join("&");
3836
3927
  }
3837
3928
 
3838
- /*! @azure/msal-common v16.11.3 2026-07-29 */
3929
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
3839
3930
 
3840
3931
  /*
3841
3932
  * Copyright (c) Microsoft Corporation. All rights reserved.
3842
3933
  * Licensed under the MIT License.
3843
3934
  */
3935
+ /**
3936
+ * Shared JOSE algorithm literals used by MSAL package internals.
3937
+ * @internal
3938
+ */
3939
+ const JsonWebTokenAlgorithms = {
3940
+ RS256: "RS256",
3941
+ };
3844
3942
  /**
3845
3943
  * Default crypto implementation used when a platform-specific implementation has
3846
3944
  * not been provided.
@@ -3861,24 +3959,44 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
3861
3959
  encodeKid: () => {
3862
3960
  throw createClientAuthError(methodNotImplemented, "");
3863
3961
  },
3864
- async getPublicKeyThumbprint() {
3865
- throw createClientAuthError(methodNotImplemented, "");
3866
- },
3867
- async removeTokenBindingKey() {
3868
- throw createClientAuthError(methodNotImplemented, "");
3962
+ async removeTokenBindingKey(kid, correlationId) {
3963
+ throw createClientAuthError(methodNotImplemented, correlationId);
3869
3964
  },
3870
- async clearKeystore() {
3871
- throw createClientAuthError(methodNotImplemented, "");
3965
+ async clearKeystore(correlationId) {
3966
+ throw createClientAuthError(methodNotImplemented, correlationId);
3872
3967
  },
3873
- async signJwt() {
3874
- throw createClientAuthError(methodNotImplemented, "");
3968
+ async signTokenBindingJwt(header, payload, kid, correlationId) {
3969
+ throw createClientAuthError(methodNotImplemented, correlationId);
3875
3970
  },
3876
3971
  async hashString() {
3877
3972
  throw createClientAuthError(methodNotImplemented, "");
3878
3973
  },
3879
3974
  };
3880
3975
 
3881
- /*! @azure/msal-common v16.11.3 2026-07-29 */
3976
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
3977
+
3978
+ /*
3979
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3980
+ * Licensed under the MIT License.
3981
+ */
3982
+ /**
3983
+ * Default token-binding key manager used when a platform-specific implementation
3984
+ * has not been provided.
3985
+ * @internal
3986
+ */
3987
+ const DEFAULT_TOKEN_BINDING_KEY_MANAGER = {
3988
+ async provisionTokenBindingKey(request) {
3989
+ throw createClientAuthError(methodNotImplemented, request.correlationId);
3990
+ },
3991
+ async removeTokenBindingKey(_kid, correlationId) {
3992
+ throw createClientAuthError(methodNotImplemented, correlationId);
3993
+ },
3994
+ async getTokenBindingPublicKeyJwk(_kid, correlationId) {
3995
+ throw createClientAuthError(methodNotImplemented, correlationId);
3996
+ },
3997
+ };
3998
+
3999
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
3882
4000
  /*
3883
4001
  * Copyright (c) Microsoft Corporation. All rights reserved.
3884
4002
  * Licensed under the MIT License.
@@ -4153,12 +4271,12 @@ class Logger {
4153
4271
  }
4154
4272
  }
4155
4273
 
4156
- /*! @azure/msal-common v16.11.3 2026-07-29 */
4274
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
4157
4275
  /* eslint-disable header/header */
4158
4276
  const name$1 = "@azure/msal-common";
4159
- const version$1 = "16.11.3";
4277
+ const version$1 = "16.13.0";
4160
4278
 
4161
- /*! @azure/msal-common v16.11.3 2026-07-29 */
4279
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
4162
4280
  /*
4163
4281
  * Copyright (c) Microsoft Corporation. All rights reserved.
4164
4282
  * Licensed under the MIT License.
@@ -4166,7 +4284,7 @@ const version$1 = "16.11.3";
4166
4284
  const cacheQuotaExceeded = "cache_quota_exceeded";
4167
4285
  const cacheErrorUnknown = "cache_error_unknown";
4168
4286
 
4169
- /*! @azure/msal-common v16.11.3 2026-07-29 */
4287
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
4170
4288
 
4171
4289
  /*
4172
4290
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4204,7 +4322,7 @@ function createCacheError(e) {
4204
4322
  }
4205
4323
  }
4206
4324
 
4207
- /*! @azure/msal-common v16.11.3 2026-07-29 */
4325
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
4208
4326
 
4209
4327
  /*
4210
4328
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4431,9 +4549,17 @@ class CacheManager {
4431
4549
  }
4432
4550
  /**
4433
4551
  * saves access token credential
4434
- * @param credential
4552
+ * @param credential - the access token entity to save
4553
+ * @param correlationId - unique identifier for the request
4554
+ * @param kmsi - keep me signed in flag
4435
4555
  */
4436
4556
  async saveAccessToken(credential, correlationId, kmsi) {
4557
+ // Compute hash from components on the entity itself — no need to thread externally.
4558
+ let additionalCacheKeyHash;
4559
+ if (credential.additionalCacheKeyComponents &&
4560
+ Object.keys(credential.additionalCacheKeyComponents).length > 0) {
4561
+ additionalCacheKeyHash = await this.cryptoImpl.hashString(JSON.stringify(credential.additionalCacheKeyComponents));
4562
+ }
4437
4563
  const accessTokenFilter = {
4438
4564
  clientId: credential.clientId,
4439
4565
  credentialType: credential.credentialType,
@@ -4457,7 +4583,7 @@ class CacheManager {
4457
4583
  }
4458
4584
  }
4459
4585
  });
4460
- await this.setAccessTokenCredential(credential, correlationId, kmsi);
4586
+ await this.setAccessTokenCredential(credential, correlationId, kmsi, additionalCacheKeyHash);
4461
4587
  }
4462
4588
  /**
4463
4589
  * Retrieve account entities matching all provided tenant-agnostic filters; if no filter is set, get all account entities in the cache
@@ -4557,16 +4683,9 @@ class CacheManager {
4557
4683
  // Access Token with Auth Scheme specific matching
4558
4684
  if (entity.credentialType ===
4559
4685
  CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME) {
4560
- if (!!filter.tokenType &&
4561
- !this.matchTokenType(entity, filter.tokenType)) {
4686
+ if (!this.matchAccessTokenWithAuthScheme(entity, filter)) {
4562
4687
  return false;
4563
4688
  }
4564
- // KeyId (sshKid) in request must match cached SSH certificate keyId because SSH cert is bound to a specific key
4565
- if (filter.tokenType === AuthenticationScheme.SSH) {
4566
- if (filter.keyId && !this.matchKeyId(entity, filter.keyId)) {
4567
- return false;
4568
- }
4569
- }
4570
4689
  }
4571
4690
  // Additional cache key components matching (bidirectional isolation)
4572
4691
  const entityComponents = entity.additionalCacheKeyComponents;
@@ -4868,6 +4987,12 @@ class CacheManager {
4868
4987
  AuthenticationScheme.BEARER.toLowerCase()
4869
4988
  ? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME
4870
4989
  : CredentialType.ACCESS_TOKEN;
4990
+ const attributeTokenPartition = serializeAttributeTokens(request.attributeTokens);
4991
+ const additionalCacheKeyComponents = attributeTokenPartition
4992
+ ? {
4993
+ attribute_tokens: attributeTokenPartition,
4994
+ }
4995
+ : undefined;
4871
4996
  const accessTokenFilter = {
4872
4997
  homeAccountId: account.homeAccountId,
4873
4998
  environment: account.environment,
@@ -4876,11 +5001,15 @@ class CacheManager {
4876
5001
  realm: targetRealm || account.tenantId,
4877
5002
  target: scopes,
4878
5003
  tokenType: authScheme,
4879
- keyId: request.sshKid,
5004
+ keyId: authScheme === AuthenticationScheme.SSH
5005
+ ? request.sshKid
5006
+ : undefined,
5007
+ additionalCacheKeyComponents: additionalCacheKeyComponents,
4880
5008
  };
4881
5009
  const accessTokenKeys = (tokenKeys && tokenKeys.accessToken) ||
4882
5010
  this.getTokenKeys().accessToken;
4883
5011
  const accessTokens = [];
5012
+ const matchedKeys = [];
4884
5013
  accessTokenKeys.forEach((key) => {
4885
5014
  // Validate key
4886
5015
  if (this.accessTokenKeyMatchesFilter(key, accessTokenFilter, true)) {
@@ -4889,18 +5018,18 @@ class CacheManager {
4889
5018
  if (accessToken &&
4890
5019
  this.credentialMatchesFilter(accessToken, accessTokenFilter, correlationId)) {
4891
5020
  accessTokens.push(accessToken);
5021
+ matchedKeys.push(key);
4892
5022
  }
4893
5023
  }
4894
5024
  });
4895
- const numAccessTokens = accessTokens.length;
4896
- if (numAccessTokens < 1) {
5025
+ if (accessTokens.length < 1) {
4897
5026
  this.commonLogger.info("CacheManager:getAccessToken - No token found", correlationId);
4898
5027
  return null;
4899
5028
  }
4900
- else if (numAccessTokens > 1) {
5029
+ else if (accessTokens.length > 1) {
4901
5030
  this.commonLogger.info("CacheManager:getAccessToken - Multiple access tokens found, clearing them", correlationId);
4902
- accessTokens.forEach((accessToken) => {
4903
- this.removeAccessToken(this.generateCredentialKey(accessToken), correlationId);
5031
+ matchedKeys.forEach((key) => {
5032
+ this.removeAccessToken(key, correlationId);
4904
5033
  });
4905
5034
  this.performanceClient.addFields({ multiMatchedAT: accessTokens.length }, correlationId);
4906
5035
  return null;
@@ -5236,7 +5365,29 @@ class CacheManager {
5236
5365
  * @param tokenType
5237
5366
  */
5238
5367
  matchTokenType(entity, tokenType) {
5239
- return !!(entity.tokenType && entity.tokenType === tokenType);
5368
+ return !!(entity.tokenType &&
5369
+ entity.tokenType.toLowerCase() === tokenType.toLowerCase());
5370
+ }
5371
+ matchAccessTokenWithAuthScheme(entity, filter) {
5372
+ const normalizedFilterTokenType = filter.tokenType?.toLowerCase();
5373
+ if (!!filter.tokenType &&
5374
+ !this.matchTokenType(entity, filter.tokenType)) {
5375
+ return false;
5376
+ }
5377
+ switch (normalizedFilterTokenType) {
5378
+ case "dpop":
5379
+ return this.matchKeyBoundAccessToken(entity, filter, true);
5380
+ case AuthenticationScheme.SSH:
5381
+ return this.matchKeyBoundAccessToken(entity, filter, false);
5382
+ default:
5383
+ return true;
5384
+ }
5385
+ }
5386
+ matchKeyBoundAccessToken(entity, filter, requireKeyId) {
5387
+ if (!filter.keyId) {
5388
+ return !requireKeyId;
5389
+ }
5390
+ return this.matchKeyId(entity, filter.keyId);
5240
5391
  }
5241
5392
  /**
5242
5393
  * Returns true if the credential's keyId matches the one in the request, false otherwise
@@ -5343,7 +5494,9 @@ class DefaultStorageClass extends CacheManager {
5343
5494
  getTokenKeys() {
5344
5495
  throw createClientAuthError(methodNotImplemented, "");
5345
5496
  }
5346
- generateCredentialKey() {
5497
+ /* eslint-disable @typescript-eslint/no-unused-vars */
5498
+ generateCredentialKey(_credential, _hash) {
5499
+ /* eslint-enable @typescript-eslint/no-unused-vars */
5347
5500
  throw createClientAuthError(methodNotImplemented, "");
5348
5501
  }
5349
5502
  generateAccountKey() {
@@ -5351,7 +5504,7 @@ class DefaultStorageClass extends CacheManager {
5351
5504
  }
5352
5505
  }
5353
5506
 
5354
- /*! @azure/msal-common v16.11.3 2026-07-29 */
5507
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
5355
5508
  /*
5356
5509
  * Copyright (c) Microsoft Corporation. All rights reserved.
5357
5510
  * Licensed under the MIT License.
@@ -5365,7 +5518,7 @@ class DefaultStorageClass extends CacheManager {
5365
5518
  const PerformanceEventStatus = {
5366
5519
  InProgress: 1};
5367
5520
 
5368
- /*! @azure/msal-common v16.11.3 2026-07-29 */
5521
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
5369
5522
 
5370
5523
  /*
5371
5524
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5423,7 +5576,7 @@ class StubPerformanceClient {
5423
5576
  }
5424
5577
  }
5425
5578
 
5426
- /*! @azure/msal-common v16.11.3 2026-07-29 */
5579
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
5427
5580
 
5428
5581
  /*
5429
5582
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5477,7 +5630,7 @@ const DEFAULT_TELEMETRY_OPTIONS$1 = {
5477
5630
  * @returns Configuration
5478
5631
  * @internal
5479
5632
  */
5480
- function buildClientConfiguration({ authOptions: userAuthOptions, systemOptions: userSystemOptions, loggerOptions: userLoggerOption, storageInterface: storageImplementation, networkInterface: networkImplementation, cryptoInterface: cryptoImplementation, clientCredentials: clientCredentials, libraryInfo: libraryInfo, telemetry: telemetry, serverTelemetryManager: serverTelemetryManager, persistencePlugin: persistencePlugin, serializableCache: serializableCache, }) {
5633
+ function buildClientConfiguration({ authOptions: userAuthOptions, systemOptions: userSystemOptions, loggerOptions: userLoggerOption, storageInterface: storageImplementation, networkInterface: networkImplementation, cryptoInterface: cryptoImplementation, tokenBindingKeyManager: tokenBindingKeyManager, clientCredentials: clientCredentials, libraryInfo: libraryInfo, telemetry: telemetry, serverTelemetryManager: serverTelemetryManager, persistencePlugin: persistencePlugin, serializableCache: serializableCache, }) {
5481
5634
  const loggerOptions = {
5482
5635
  ...DEFAULT_LOGGER_IMPLEMENTATION,
5483
5636
  ...userLoggerOption,
@@ -5490,6 +5643,7 @@ function buildClientConfiguration({ authOptions: userAuthOptions, systemOptions:
5490
5643
  new DefaultStorageClass(userAuthOptions.clientId, DEFAULT_CRYPTO_IMPLEMENTATION, new Logger(loggerOptions, name$1, version$1), new StubPerformanceClient()),
5491
5644
  networkInterface: networkImplementation || DEFAULT_NETWORK_IMPLEMENTATION,
5492
5645
  cryptoInterface: cryptoImplementation || DEFAULT_CRYPTO_IMPLEMENTATION,
5646
+ tokenBindingKeyManager: tokenBindingKeyManager || DEFAULT_TOKEN_BINDING_KEY_MANAGER,
5493
5647
  clientCredentials: clientCredentials || DEFAULT_CLIENT_CREDENTIALS,
5494
5648
  libraryInfo: { ...DEFAULT_LIBRARY_INFO, ...libraryInfo },
5495
5649
  telemetry: { ...DEFAULT_TELEMETRY_OPTIONS$1, ...telemetry },
@@ -5519,7 +5673,7 @@ function isOidcProtocolMode(config) {
5519
5673
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
5520
5674
  }
5521
5675
 
5522
- /*! @azure/msal-common v16.11.3 2026-07-29 */
5676
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
5523
5677
  /*
5524
5678
  * Copyright (c) Microsoft Corporation. All rights reserved.
5525
5679
  * Licensed under the MIT License.
@@ -5546,7 +5700,129 @@ function isOidcProtocolMode(config) {
5546
5700
  }
5547
5701
  }
5548
5702
 
5549
- /*! @azure/msal-common v16.11.3 2026-07-29 */
5703
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
5704
+
5705
+ /*
5706
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5707
+ * Licensed under the MIT License.
5708
+ */
5709
+ /**
5710
+ * Error thrown when there is an error in the client code running on the browser.
5711
+ */
5712
+ class JoseHeaderError extends AuthError {
5713
+ constructor(errorCode, correlationId, errorMessage) {
5714
+ super(errorCode, correlationId, errorMessage);
5715
+ this.name = "JoseHeaderError";
5716
+ Object.setPrototypeOf(this, JoseHeaderError.prototype);
5717
+ }
5718
+ }
5719
+ /** Returns JoseHeaderError object */
5720
+ function createJoseHeaderError(code, correlationId) {
5721
+ return new JoseHeaderError(code, correlationId);
5722
+ }
5723
+
5724
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
5725
+ /*
5726
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5727
+ * Licensed under the MIT License.
5728
+ */
5729
+ /**
5730
+ * Checks whether a value is a plain JSON-like object.
5731
+ * Allows objects with null prototypes, but rejects arrays and object subclasses.
5732
+ */
5733
+ function isPlainObject(value) {
5734
+ if (typeof value !== "object" ||
5735
+ value === null ||
5736
+ Object.prototype.toString.call(value) !== "[object Object]") {
5737
+ return false;
5738
+ }
5739
+ if (Object.getPrototypeOf(value) === null) {
5740
+ return true;
5741
+ }
5742
+ let proto = value;
5743
+ while (Object.getPrototypeOf(proto) !== null) {
5744
+ proto = Object.getPrototypeOf(proto);
5745
+ }
5746
+ return Object.getPrototypeOf(value) === proto;
5747
+ }
5748
+
5749
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
5750
+ /*
5751
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5752
+ * Licensed under the MIT License.
5753
+ */
5754
+ const missingKidError = "missing_kid_error";
5755
+ const missingAlgError = "missing_alg_error";
5756
+ const missingJwkError = "missing_jwk_error";
5757
+ const invalidJwkError = "invalid_jwk_error";
5758
+
5759
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
5760
+
5761
+ /*
5762
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5763
+ * Licensed under the MIT License.
5764
+ */
5765
+ /** @internal */
5766
+ class JoseHeader {
5767
+ constructor(options, correlationId) {
5768
+ if (typeof options.alg !== "string" || !options.alg) {
5769
+ throw createJoseHeaderError(missingAlgError, correlationId);
5770
+ }
5771
+ this.typ = options.typ;
5772
+ this.alg = options.alg;
5773
+ this.kid = options.kid;
5774
+ this.jwk = options.jwk;
5775
+ }
5776
+ /**
5777
+ * Builds SignedHttpRequest formatted JOSE Header from the
5778
+ * JOSE Header options provided or previously set on the object.
5779
+ * Throws if keyId or algorithm aren't provided since they are required for Access Token Binding.
5780
+ * @param shrHeaderOptions
5781
+ * @param correlationId
5782
+ * @returns
5783
+ */
5784
+ static getShrHeader(shrHeaderOptions, correlationId) {
5785
+ // KeyID is required on the SHR header
5786
+ if (!shrHeaderOptions.kid) {
5787
+ throw createJoseHeaderError(missingKidError, correlationId);
5788
+ }
5789
+ // Alg is required on the SHR header
5790
+ if (!shrHeaderOptions.alg) {
5791
+ throw createJoseHeaderError(missingAlgError, correlationId);
5792
+ }
5793
+ return new JoseHeader({
5794
+ // Access Token PoP headers must have type pop, but the type header can be overriden for special cases
5795
+ typ: shrHeaderOptions.typ || JsonWebTokenTypes.Pop,
5796
+ kid: shrHeaderOptions.kid,
5797
+ alg: shrHeaderOptions.alg,
5798
+ }, correlationId);
5799
+ }
5800
+ /**
5801
+ * Builds a DPoP formatted JOSE Header from the JOSE Header options provided.
5802
+ * Throws if public JWK or algorithm aren't provided since they are required for DPoP.
5803
+ * @param dpopHeaderOptions
5804
+ * @param correlationId
5805
+ * @returns
5806
+ */
5807
+ static getDpopHeader(dpopHeaderOptions, correlationId) {
5808
+ if (!isPlainObject(dpopHeaderOptions.jwk)) {
5809
+ throw createJoseHeaderError(missingJwkError, correlationId);
5810
+ }
5811
+ if (!dpopHeaderOptions.alg) {
5812
+ throw createJoseHeaderError(missingAlgError, correlationId);
5813
+ }
5814
+ if (Object.keys(dpopHeaderOptions.jwk).length === 0) {
5815
+ throw createJoseHeaderError(invalidJwkError, correlationId);
5816
+ }
5817
+ return new JoseHeader({
5818
+ typ: JsonWebTokenTypes.Dpop,
5819
+ alg: dpopHeaderOptions.alg,
5820
+ jwk: dpopHeaderOptions.jwk,
5821
+ }, correlationId);
5822
+ }
5823
+ }
5824
+
5825
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
5550
5826
 
5551
5827
  /*
5552
5828
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5554,10 +5830,13 @@ function isOidcProtocolMode(config) {
5554
5830
  */
5555
5831
  const KeyLocation = {
5556
5832
  SW: "sw"};
5833
+ const SHR_TOKEN_BINDING_KEY_TYPE = "shr";
5834
+ const SHR_TOKEN_BINDING_KEY_ALGORITHM = JsonWebTokenAlgorithms.RS256;
5557
5835
  /** @internal */
5558
5836
  class PopTokenGenerator {
5559
- constructor(cryptoUtils, performanceClient) {
5837
+ constructor(cryptoUtils, tokenBindingKeyManager, performanceClient) {
5560
5838
  this.cryptoUtils = cryptoUtils;
5839
+ this.tokenBindingKeyManager = tokenBindingKeyManager;
5561
5840
  this.performanceClient = performanceClient;
5562
5841
  }
5563
5842
  /**
@@ -5580,7 +5859,11 @@ class PopTokenGenerator {
5580
5859
  * @returns
5581
5860
  */
5582
5861
  async generateKid(request) {
5583
- const kidThumbprint = await this.cryptoUtils.getPublicKeyThumbprint(request);
5862
+ const kidThumbprint = await this.tokenBindingKeyManager.provisionTokenBindingKey({
5863
+ correlationId: request.correlationId,
5864
+ tokenBindingKeyType: SHR_TOKEN_BINDING_KEY_TYPE,
5865
+ tokenBindingKeyAlgorithm: SHR_TOKEN_BINDING_KEY_ALGORITHM,
5866
+ });
5584
5867
  return {
5585
5868
  kid: kidThumbprint,
5586
5869
  xms_ksl: KeyLocation.SW,
@@ -5610,7 +5893,17 @@ class PopTokenGenerator {
5610
5893
  ? new UrlString(resourceRequestUri, request.correlationId)
5611
5894
  : undefined;
5612
5895
  const resourceUrlComponents = resourceUrlString?.getUrlComponents();
5613
- return this.cryptoUtils.signJwt({
5896
+ const publicKeyJwk = await this.tokenBindingKeyManager.getTokenBindingPublicKeyJwk(keyId, request.correlationId);
5897
+ const encodedKeyIdThumbprint = this.cryptoUtils.base64UrlEncode(JSON.stringify({ kid: keyId }));
5898
+ const shrAlgorithm = shrOptions?.header?.alg ||
5899
+ publicKeyJwk.alg ||
5900
+ SHR_TOKEN_BINDING_KEY_ALGORITHM;
5901
+ const shrHeader = JoseHeader.getShrHeader({
5902
+ ...shrOptions?.header,
5903
+ alg: shrAlgorithm,
5904
+ kid: encodedKeyIdThumbprint,
5905
+ }, request.correlationId);
5906
+ const shrPayload = {
5614
5907
  at: payload,
5615
5908
  ts: nowSeconds(),
5616
5909
  m: resourceRequestMethod?.toUpperCase(),
@@ -5622,11 +5915,15 @@ class PopTokenGenerator {
5622
5915
  : undefined,
5623
5916
  client_claims: shrClaims || undefined,
5624
5917
  ...claims,
5625
- }, keyId, shrOptions, request.correlationId);
5918
+ cnf: {
5919
+ jwk: publicKeyJwk,
5920
+ },
5921
+ };
5922
+ return this.cryptoUtils.signTokenBindingJwt(shrHeader, shrPayload, keyId, request.correlationId);
5626
5923
  }
5627
5924
  }
5628
5925
 
5629
- /*! @azure/msal-common v16.11.3 2026-07-29 */
5926
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
5630
5927
  /*
5631
5928
  * Copyright (c) Microsoft Corporation. All rights reserved.
5632
5929
  * Licensed under the MIT License.
@@ -5690,7 +5987,7 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
5690
5987
  uiNotAllowed: uiNotAllowed
5691
5988
  });
5692
5989
 
5693
- /*! @azure/msal-common v16.11.3 2026-07-29 */
5990
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
5694
5991
 
5695
5992
  /*
5696
5993
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5757,7 +6054,7 @@ function createInteractionRequiredAuthError(errorCode, correlationId, errorMessa
5757
6054
  return new InteractionRequiredAuthError(errorCode, correlationId, errorMessage);
5758
6055
  }
5759
6056
 
5760
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6057
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
5761
6058
 
5762
6059
  /*
5763
6060
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5776,7 +6073,7 @@ class ServerError extends AuthError {
5776
6073
  }
5777
6074
  }
5778
6075
 
5779
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6076
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
5780
6077
  /**
5781
6078
  * Parses the state into the RequestStateObject, which contains the LibraryState info and the state passed by the user.
5782
6079
  * @param base64Decode
@@ -5809,7 +6106,7 @@ function parseRequestState(base64Decode, state, correlationId) {
5809
6106
  }
5810
6107
  }
5811
6108
 
5812
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6109
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
5813
6110
 
5814
6111
  /*
5815
6112
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5820,10 +6117,11 @@ function parseRequestState(base64Decode, state, correlationId) {
5820
6117
  * @internal
5821
6118
  */
5822
6119
  class ResponseHandler {
5823
- constructor(clientId, cacheStorage, cryptoObj, logger, performanceClient, serializableCache, persistencePlugin) {
6120
+ constructor(clientId, cacheStorage, cryptoObj, logger, performanceClient, serializableCache, persistencePlugin, tokenBindingKeyManager = DEFAULT_TOKEN_BINDING_KEY_MANAGER) {
5824
6121
  this.clientId = clientId;
5825
6122
  this.cacheStorage = cacheStorage;
5826
6123
  this.cryptoObj = cryptoObj;
6124
+ this.tokenBindingKeyManager = tokenBindingKeyManager;
5827
6125
  this.logger = logger;
5828
6126
  this.performanceClient = performanceClient;
5829
6127
  this.serializableCache = serializableCache;
@@ -5898,7 +6196,15 @@ class ResponseHandler {
5898
6196
  // Add keyId from request to serverTokenResponse if defined
5899
6197
  serverTokenResponse.key_id =
5900
6198
  serverTokenResponse.key_id || request.sshKid || undefined;
5901
- const cacheRecord = this.generateCacheRecord(serverTokenResponse, authority, reqTimestamp, request, idTokenClaims, userAssertionHash, authCodePayload, additionalCacheKeyComponents);
6199
+ // Compute components once for entity storage (fallback if hash not provided by client)
6200
+ const attributeTokenPartition = serializeAttributeTokens(request.attributeTokens);
6201
+ const cacheKeyComponents = additionalCacheKeyComponents ??
6202
+ (attributeTokenPartition
6203
+ ? {
6204
+ attribute_tokens: attributeTokenPartition,
6205
+ }
6206
+ : undefined);
6207
+ const cacheRecord = this.generateCacheRecord(serverTokenResponse, authority, reqTimestamp, request, idTokenClaims, userAssertionHash, authCodePayload, cacheKeyComponents);
5902
6208
  let cacheContext;
5903
6209
  try {
5904
6210
  if (this.persistencePlugin && this.serializableCache) {
@@ -5924,7 +6230,12 @@ class ResponseHandler {
5924
6230
  this.performanceClient?.addFields({
5925
6231
  acntLoggedOut: true,
5926
6232
  }, request.correlationId);
5927
- return await ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, this.performanceClient, idTokenClaims, requestStateObj, undefined, serverRequestId);
6233
+ return await ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, this.performanceClient, {
6234
+ idTokenClaims,
6235
+ requestState: requestStateObj,
6236
+ requestId: serverRequestId,
6237
+ tokenBindingKeyManager: this.tokenBindingKeyManager,
6238
+ });
5928
6239
  }
5929
6240
  }
5930
6241
  await this.cacheStorage.saveCacheRecord(cacheRecord, request.correlationId, isKmsi(idTokenClaims || {}), apiId, request.storeInCache);
@@ -5937,7 +6248,13 @@ class ResponseHandler {
5937
6248
  await this.persistencePlugin.afterCacheAccess(cacheContext);
5938
6249
  }
5939
6250
  }
5940
- return ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, this.performanceClient, idTokenClaims, requestStateObj, serverTokenResponse, serverRequestId);
6251
+ return ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, this.performanceClient, {
6252
+ idTokenClaims,
6253
+ requestState: requestStateObj,
6254
+ serverTokenResponse,
6255
+ requestId: serverRequestId,
6256
+ tokenBindingKeyManager: this.tokenBindingKeyManager,
6257
+ });
5941
6258
  }
5942
6259
  /**
5943
6260
  * Generates CacheRecord
@@ -6033,7 +6350,8 @@ class ResponseHandler {
6033
6350
  * @param fromTokenCache
6034
6351
  * @param stateString
6035
6352
  */
6036
- static async generateAuthenticationResult(cryptoObj, authority, cacheRecord, fromTokenCache, request, performanceClient, idTokenClaims, requestState, serverTokenResponse, requestId) {
6353
+ static async generateAuthenticationResult(cryptoObj, authority, cacheRecord, fromTokenCache, request, performanceClient, options = {}) {
6354
+ const { idTokenClaims, requestState, serverTokenResponse, requestId, tokenBindingKeyManager = DEFAULT_TOKEN_BINDING_KEY_MANAGER, } = options;
6037
6355
  let accessToken = "";
6038
6356
  let responseScopes = [];
6039
6357
  let expiresOn = null;
@@ -6048,7 +6366,7 @@ class ResponseHandler {
6048
6366
  if (cacheRecord.accessToken.tokenType ===
6049
6367
  AuthenticationScheme.POP &&
6050
6368
  !request.popKid) {
6051
- const popTokenGenerator = new PopTokenGenerator(cryptoObj, performanceClient);
6369
+ const popTokenGenerator = new PopTokenGenerator(cryptoObj, tokenBindingKeyManager, performanceClient);
6052
6370
  const { secret, keyId } = cacheRecord.accessToken;
6053
6371
  if (!keyId) {
6054
6372
  throw createClientAuthError(keyIdMissing, request.correlationId);
@@ -6160,7 +6478,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
6160
6478
  return baseAccount;
6161
6479
  }
6162
6480
 
6163
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6481
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
6164
6482
  /*
6165
6483
  * Copyright (c) Microsoft Corporation. All rights reserved.
6166
6484
  * Licensed under the MIT License.
@@ -6170,7 +6488,7 @@ const CcsCredentialType = {
6170
6488
  UPN: "UPN",
6171
6489
  };
6172
6490
 
6173
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6491
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
6174
6492
  /*
6175
6493
  * Copyright (c) Microsoft Corporation. All rights reserved.
6176
6494
  * Licensed under the MIT License.
@@ -6189,7 +6507,8 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint, fmiP
6189
6507
  }
6190
6508
  }
6191
6509
 
6192
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6510
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
6511
+
6193
6512
  /*
6194
6513
  * Copyright (c) Microsoft Corporation. All rights reserved.
6195
6514
  * Licensed under the MIT License.
@@ -6208,10 +6527,11 @@ function getRequestThumbprint(clientId, request, homeAccountId) {
6208
6527
  sshKid: request.sshKid,
6209
6528
  embeddedClientId: request.embeddedClientId || request.extraParameters?.clientId,
6210
6529
  resource: request.resource,
6530
+ attributeTokens: serializeAttributeTokens(request.attributeTokens),
6211
6531
  };
6212
6532
  }
6213
6533
 
6214
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6534
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
6215
6535
 
6216
6536
  /*
6217
6537
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6297,7 +6617,7 @@ class ThrottlingUtils {
6297
6617
  }
6298
6618
  }
6299
6619
 
6300
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6620
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
6301
6621
 
6302
6622
  /*
6303
6623
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6328,7 +6648,7 @@ function createNetworkError(error, httpStatus, responseHeaders, additionalError)
6328
6648
  return new NetworkError(error, httpStatus, responseHeaders);
6329
6649
  }
6330
6650
 
6331
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6651
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
6332
6652
 
6333
6653
  /*
6334
6654
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6444,7 +6764,7 @@ async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId
6444
6764
  return response;
6445
6765
  }
6446
6766
 
6447
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6767
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
6448
6768
 
6449
6769
  /*
6450
6770
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6494,7 +6814,7 @@ class AuthorizationCodeClient {
6494
6814
  const response = await invokeAsync(this.executeTokenRequest.bind(this), AuthClientExecuteTokenRequest, this.logger, this.performanceClient, request.correlationId)(this.authority, request, this.serverTelemetryManager);
6495
6815
  // Retrieve requestId from response headers
6496
6816
  const requestId = response.headers?.[HeaderNames.X_MS_REQUEST_ID];
6497
- const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin);
6817
+ const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin, this.config.tokenBindingKeyManager);
6498
6818
  // Validate response. This function throws a server error if an error is returned by the server.
6499
6819
  responseHandler.validateTokenResponse(response.body, request.correlationId);
6500
6820
  return invokeAsync(responseHandler.handleServerTokenResponse.bind(responseHandler), HandleServerTokenResponse, this.logger, this.performanceClient, request.correlationId)(response.body, this.authority, reqTimestamp, request, apiId, authCodePayload, undefined, undefined, undefined, requestId);
@@ -6565,6 +6885,12 @@ class AuthorizationCodeClient {
6565
6885
  // Add scope array, parameter builder will add default scopes and dedupe
6566
6886
  addScopes(parameters, request.scopes, request.correlationId, true, this.oidcDefaultScopes);
6567
6887
  addResource(parameters, request.resource);
6888
+ if (request.attributeTokens) {
6889
+ addAttributeTokens(parameters, request.attributeTokens);
6890
+ }
6891
+ this.performanceClient?.addFields({
6892
+ hasAttributeTokens: !!request.attributeTokens?.length,
6893
+ }, request.correlationId);
6568
6894
  // add code: user set, not validated
6569
6895
  addAuthorizationCode(parameters, request.code);
6570
6896
  // Add library metadata
@@ -6589,7 +6915,7 @@ class AuthorizationCodeClient {
6589
6915
  addGrantType(parameters, GrantType.AUTHORIZATION_CODE_GRANT);
6590
6916
  addClientInfo(parameters);
6591
6917
  if (request.authenticationScheme === AuthenticationScheme.POP) {
6592
- const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
6918
+ const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.config.tokenBindingKeyManager, this.performanceClient);
6593
6919
  let reqCnfData;
6594
6920
  if (!request.popKid) {
6595
6921
  const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
@@ -6701,7 +7027,7 @@ class AuthorizationCodeClient {
6701
7027
  }
6702
7028
  }
6703
7029
 
6704
- /*! @azure/msal-common v16.11.3 2026-07-29 */
7030
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
6705
7031
 
6706
7032
  /*
6707
7033
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6852,7 +7178,7 @@ function extractLoginHint(account) {
6852
7178
  return account.loginHint || account.idTokenClaims?.login_hint || null;
6853
7179
  }
6854
7180
 
6855
- /*! @azure/msal-common v16.11.3 2026-07-29 */
7181
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
6856
7182
 
6857
7183
  /*
6858
7184
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6887,7 +7213,7 @@ class RefreshTokenClient {
6887
7213
  const response = await invokeAsync(this.executeTokenRequest.bind(this), RefreshTokenClientExecuteTokenRequest, this.logger, this.performanceClient, request.correlationId)(request, this.authority);
6888
7214
  // Retrieve requestId from response headers
6889
7215
  const requestId = response.headers?.[HeaderNames.X_MS_REQUEST_ID];
6890
- const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin);
7216
+ const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin, this.config.tokenBindingKeyManager);
6891
7217
  responseHandler.validateTokenResponse(response.body, request.correlationId);
6892
7218
  return invokeAsync(responseHandler.handleServerTokenResponse.bind(responseHandler), HandleServerTokenResponse, this.logger, this.performanceClient, request.correlationId)(response.body, this.authority, reqTimestamp, request, apiId, undefined, undefined, true, request.forceCache, requestId);
6893
7219
  }
@@ -7013,6 +7339,12 @@ class RefreshTokenClient {
7013
7339
  addServerTelemetry(parameters, this.serverTelemetryManager);
7014
7340
  }
7015
7341
  addRefreshToken(parameters, request.refreshToken);
7342
+ if (request.attributeTokens) {
7343
+ addAttributeTokens(parameters, request.attributeTokens);
7344
+ }
7345
+ this.performanceClient?.addFields({
7346
+ hasAttributeTokens: !!request.attributeTokens?.length,
7347
+ }, request.correlationId);
7016
7348
  if (this.config.clientCredentials.clientSecret) {
7017
7349
  addClientSecret(parameters, this.config.clientCredentials.clientSecret);
7018
7350
  }
@@ -7022,7 +7354,7 @@ class RefreshTokenClient {
7022
7354
  addClientAssertionType(parameters, clientAssertion.assertionType);
7023
7355
  }
7024
7356
  if (request.authenticationScheme === AuthenticationScheme.POP) {
7025
- const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
7357
+ const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.config.tokenBindingKeyManager, this.performanceClient);
7026
7358
  let reqCnfData;
7027
7359
  if (!request.popKid) {
7028
7360
  const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
@@ -7073,7 +7405,7 @@ class RefreshTokenClient {
7073
7405
  }
7074
7406
  }
7075
7407
 
7076
- /*! @azure/msal-common v16.11.3 2026-07-29 */
7408
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
7077
7409
 
7078
7410
  /*
7079
7411
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7339,7 +7671,7 @@ class ServerTelemetryManager {
7339
7671
  }
7340
7672
  }
7341
7673
 
7342
- /*! @azure/msal-common v16.11.3 2026-07-29 */
7674
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
7343
7675
 
7344
7676
  /*
7345
7677
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7443,11 +7775,14 @@ class SilentFlowClient {
7443
7775
  if (cacheRecord.idToken) {
7444
7776
  idTokenClaims = extractTokenClaims(cacheRecord.idToken.secret, this.config.cryptoInterface.base64Decode, request.correlationId);
7445
7777
  }
7446
- return ResponseHandler.generateAuthenticationResult(this.cryptoUtils, this.authority, cacheRecord, true, request, this.performanceClient, idTokenClaims);
7778
+ return ResponseHandler.generateAuthenticationResult(this.cryptoUtils, this.authority, cacheRecord, true, request, this.performanceClient, {
7779
+ idTokenClaims,
7780
+ tokenBindingKeyManager: this.config.tokenBindingKeyManager,
7781
+ });
7447
7782
  }
7448
7783
  }
7449
7784
 
7450
- /*! @azure/msal-common v16.11.3 2026-07-29 */
7785
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
7451
7786
 
7452
7787
  /*
7453
7788
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7996,6 +8331,7 @@ const unableToCreateCloudShell = "unable_to_create_cloud_shell";
7996
8331
  const unableToCreateSource = "unable_to_create_source";
7997
8332
  const unableToReadSecretFile = "unable_to_read_secret_file";
7998
8333
  const userAssignedNotAvailableAtRuntime = "user_assigned_not_available_at_runtime";
8334
+ const userAssignedManagedIdentityNotConfirmed = "user_assigned_managed_identity_not_confirmed";
7999
8335
  const wwwAuthenticateHeaderMissing = "www_authenticate_header_missing";
8000
8336
  const wwwAuthenticateHeaderUnsupportedFormat = "www_authenticate_header_unsupported_format";
8001
8337
  const MsiEnvironmentVariableUrlMalformedErrorCodes = {
@@ -8033,8 +8369,9 @@ const ManagedIdentityErrorMessages = {
8033
8369
  [unableToCreateSource]: "Unable to create a Managed Identity source based on environment variables.",
8034
8370
  [unableToReadSecretFile]: "Unable to read the secret file.",
8035
8371
  [userAssignedNotAvailableAtRuntime]: "Service Fabric user assigned managed identity ClientId or ResourceId is not configurable at runtime.",
8036
- [wwwAuthenticateHeaderMissing]: "A 401 response was received form the Azure Arc Managed Identity, but the www-authenticate header is missing.",
8037
- [wwwAuthenticateHeaderUnsupportedFormat]: "A 401 response was received form the Azure Arc Managed Identity, but the www-authenticate header is in an unsupported format.",
8372
+ [userAssignedManagedIdentityNotConfirmed]: "Azure Arc did not confirm the requested user-assigned managed identity in the token response. The agent likely does not support user-assigned managed identity and returned the system-assigned identity.",
8373
+ [wwwAuthenticateHeaderMissing]: "A 401 response was received from the Azure Arc Managed Identity, but the www-authenticate header is missing.",
8374
+ [wwwAuthenticateHeaderUnsupportedFormat]: "A 401 response was received from the Azure Arc Managed Identity, but the www-authenticate header is in an unsupported format.",
8038
8375
  };
8039
8376
  class ManagedIdentityError extends AuthError {
8040
8377
  constructor(errorCode, correlationId) {
@@ -8491,30 +8828,30 @@ class CryptoProvider {
8491
8828
  generatePkceCodes() {
8492
8829
  return this.pkceGenerator.generatePkceCodes();
8493
8830
  }
8494
- /**
8495
- * Generates a keypair, stores it and returns a thumbprint - not yet implemented for node
8496
- */
8497
- getPublicKeyThumbprint() {
8498
- throw new Error("Method not implemented.");
8499
- }
8500
8831
  /**
8501
8832
  * Removes cryptographic keypair from key store matching the keyId passed in
8502
8833
  * @param kid - public key id
8834
+ * @param correlationId - correlation id
8503
8835
  */
8504
- removeTokenBindingKey() {
8836
+ removeTokenBindingKey(kid, correlationId) {
8505
8837
  throw new Error("Method not implemented.");
8506
8838
  }
8507
8839
  /**
8508
8840
  * Removes all cryptographic keys from Keystore
8841
+ * @param correlationId - correlation id
8509
8842
  */
8510
- clearKeystore() {
8843
+ clearKeystore(correlationId) {
8511
8844
  throw new Error("Method not implemented.");
8512
8845
  }
8513
8846
  /**
8514
- * Signs the given object as a jwt payload with private key retrieved by given kid - currently not implemented for node
8847
+ * Signs a compact JWT with a token-binding key - not yet implemented for node
8848
+ * @param header - JOSE header
8849
+ * @param payload - JWT payload
8850
+ * @param kid - public key id
8851
+ * @param correlationId - correlation id
8515
8852
  */
8516
- signJwt() {
8517
- throw new Error("Method not implemented.");
8853
+ signTokenBindingJwt(header, payload, kid, correlationId) {
8854
+ throw createClientAuthError(methodNotImplemented, correlationId);
8518
8855
  }
8519
8856
  /**
8520
8857
  * Returns the SHA-256 hash of an input string
@@ -8532,14 +8869,35 @@ class CryptoProvider {
8532
8869
  */
8533
8870
  /**
8534
8871
  * 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).
8872
+ *
8873
+ * Matches the cross-SDK algorithm: sort keys ascending → for each key append a
8874
+ * length-prefixed (netstring-style) encoding of the key and value → SHA-256 →
8875
+ * Base64URL (no padding).
8876
+ *
8877
+ * Each entry is encoded as `<byteLen(key)>:<key><byteLen(value)>:<value>` where the
8878
+ * lengths are the UTF-8 **byte** lengths (via `Buffer.byteLength`, not `String.length`
8879
+ * which counts UTF-16 code units). The length prefixes make the serialization injective
8880
+ * so that semantically different component sets can never serialize to the same byte
8881
+ * string. A plain delimiter-less concatenation of key+value is ambiguous
8882
+ * (e.g. `{fmi_path:"value"}` and `{fmi_pat:"hvalue"}` would both yield `fmi_pathvalue`),
8883
+ * which would collide into the same credential cache slot.
8884
+ *
8885
+ * The encoding is byte-identical to the other MSAL SDKs (Go/.NET/Java/Python), so the
8886
+ * resulting hash is a stable cross-SDK cache key. The final credential key is lowercased
8887
+ * downstream in `generateCredentialKey`.
8536
8888
  */
8537
8889
  function computeAdditionalCacheKeyHash(components) {
8538
8890
  const sortedKeys = Object.keys(components).sort();
8539
- const input = sortedKeys.map((k) => k + components[k]).join("");
8891
+ let input = "";
8892
+ for (const key of sortedKeys) {
8893
+ const value = components[key];
8894
+ input +=
8895
+ `${Buffer.byteLength(key, "utf8")}:${key}` +
8896
+ `${Buffer.byteLength(value, "utf8")}:${value}`;
8897
+ }
8540
8898
  return crypto.createHash("sha256").update(input, "utf8").digest("base64url");
8541
8899
  }
8542
- function generateCredentialKey(credential) {
8900
+ function generateCredentialKey(credential, hash) {
8543
8901
  const familyId = (credential.credentialType === CredentialType.REFRESH_TOKEN &&
8544
8902
  credential.familyId) ||
8545
8903
  credential.clientId;
@@ -8557,10 +8915,15 @@ function generateCredentialKey(credential) {
8557
8915
  credential.target || "",
8558
8916
  scheme,
8559
8917
  ];
8560
- // Compute and append a combined hash from additional cache key components (e.g., fmi_path)
8918
+ /*
8919
+ * Compute and append a combined hash from additional cache key components (e.g., fmi_path).
8920
+ * Use the explicitly passed hash if available; fall back to synchronous inline compute
8921
+ * for lookup paths where the entity was read from storage without a cached hash.
8922
+ */
8561
8923
  if (credential.additionalCacheKeyComponents &&
8562
8924
  Object.keys(credential.additionalCacheKeyComponents).length > 0) {
8563
- credentialKey.push(computeAdditionalCacheKeyHash(credential.additionalCacheKeyComponents));
8925
+ credentialKey.push(hash ??
8926
+ computeAdditionalCacheKeyHash(credential.additionalCacheKeyComponents));
8564
8927
  }
8565
8928
  return credentialKey.join(CACHE.KEY_SEPARATOR).toLowerCase();
8566
8929
  }
@@ -8718,8 +9081,8 @@ class NodeStorage extends CacheManager {
8718
9081
  // write to cache
8719
9082
  this.setCache(cache);
8720
9083
  }
8721
- generateCredentialKey(credential) {
8722
- return generateCredentialKey(credential);
9084
+ generateCredentialKey(credential, additionalCacheKeyHash) {
9085
+ return generateCredentialKey(credential, additionalCacheKeyHash);
8723
9086
  }
8724
9087
  generateAccountKey(account) {
8725
9088
  return generateAccountKey(account);
@@ -8788,11 +9151,14 @@ class NodeStorage extends CacheManager {
8788
9151
  return null;
8789
9152
  }
8790
9153
  /**
8791
- * set accessToken credential
8792
- * @param accessToken - cache value to be set of type AccessTokenEntity
9154
+ * Set accessToken credential to the cache
9155
+ * @param accessToken - the access token entity to cache
9156
+ * @param _correlationId - unique identifier for the request
9157
+ * @param _kmsi - keep me signed in flag
9158
+ * @param additionalCacheKeyHash - optional precomputed hash of additionalCacheKeyComponents used in key generation
8793
9159
  */
8794
- async setAccessTokenCredential(accessToken) {
8795
- const accessTokenKey = this.generateCredentialKey(accessToken);
9160
+ async setAccessTokenCredential(accessToken, _correlationId, _kmsi, additionalCacheKeyHash) {
9161
+ const accessTokenKey = this.generateCredentialKey(accessToken, additionalCacheKeyHash);
8796
9162
  this.setItem(accessTokenKey, accessToken);
8797
9163
  }
8798
9164
  /**
@@ -9446,7 +9812,7 @@ class ClientAssertion {
9446
9812
 
9447
9813
  /* eslint-disable header/header */
9448
9814
  const name = "@azure/msal-node";
9449
- const version = "5.4.3";
9815
+ const version = "5.6.0";
9450
9816
 
9451
9817
  /*
9452
9818
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -9532,7 +9898,7 @@ class UsernamePasswordClient extends BaseClient {
9532
9898
  this.logger.info("in acquireToken call in username-password client", request.correlationId);
9533
9899
  const reqTimestamp = nowSeconds();
9534
9900
  const response = await this.executeTokenRequest(this.authority, request);
9535
- const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin);
9901
+ const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin, this.config.tokenBindingKeyManager);
9536
9902
  // Validate response. This function throws a server error if an error is returned by the server.
9537
9903
  responseHandler.validateTokenResponse(response.body, request.correlationId);
9538
9904
  const tokenResponse = responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, ApiId.acquireTokenByUsernamePassword);
@@ -9693,11 +10059,21 @@ class ClientApplication {
9693
10059
  */
9694
10060
  async acquireTokenByCode(request, authCodePayLoad) {
9695
10061
  this.logger.info("acquireTokenByCode called", request.correlationId || "");
9696
- if (request.state && authCodePayLoad) {
10062
+ let validatedAuthCodePayload = authCodePayLoad;
10063
+ if (request.state && validatedAuthCodePayload) {
9697
10064
  this.logger.info("acquireTokenByCode - validating state", request.correlationId || "");
9698
- this.validateState(request.state, authCodePayLoad.state || "", request.correlationId || "");
9699
- // eslint-disable-next-line no-param-reassign
9700
- authCodePayLoad = { ...authCodePayLoad, state: "" };
10065
+ this.validateState(request.state, validatedAuthCodePayload.state || "", request.correlationId || "");
10066
+ validatedAuthCodePayload = {
10067
+ ...validatedAuthCodePayload,
10068
+ state: "",
10069
+ };
10070
+ }
10071
+ if (request.nonce) {
10072
+ validatedAuthCodePayload = {
10073
+ ...validatedAuthCodePayload,
10074
+ code: request.code,
10075
+ nonce: request.nonce,
10076
+ };
9701
10077
  }
9702
10078
  const validRequest = {
9703
10079
  ...request,
@@ -9710,7 +10086,7 @@ class ClientApplication {
9710
10086
  const authClientConfig = await this.buildOauthClientConfiguration(discoveredAuthority, validRequest.correlationId, validRequest.redirectUri, serverTelemetryManager);
9711
10087
  const authorizationCodeClient = new AuthorizationCodeClient(authClientConfig, new StubPerformanceClient());
9712
10088
  this.logger.verbose("Auth code client created", validRequest.correlationId);
9713
- return await authorizationCodeClient.acquireToken(validRequest, ApiId.acquireTokenByCode, authCodePayLoad);
10089
+ return await authorizationCodeClient.acquireToken(validRequest, ApiId.acquireTokenByCode, validatedAuthCodePayload);
9714
10090
  }
9715
10091
  catch (e) {
9716
10092
  if (e instanceof AuthError) {
@@ -10193,7 +10569,7 @@ class DeviceCodeClient extends BaseClient {
10193
10569
  request.deviceCodeCallback(deviceCodeResponse);
10194
10570
  const reqTimestamp = nowSeconds();
10195
10571
  const response = await this.acquireTokenWithDeviceCode(request, deviceCodeResponse);
10196
- const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin);
10572
+ const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin, this.config.tokenBindingKeyManager);
10197
10573
  // Validate response. This function throws a server error if an error is returned by the server.
10198
10574
  responseHandler.validateTokenResponse(response, request.correlationId);
10199
10575
  return responseHandler.handleServerTokenResponse(response, this.authority, reqTimestamp, request, ApiId.acquireTokenByDeviceCode);
@@ -10687,14 +11063,29 @@ class ClientCredentialClient extends BaseClient {
10687
11063
  * @param request - CommonClientCredentialRequest provided by the developer
10688
11064
  */
10689
11065
  async acquireToken(request) {
10690
- // Build additional cache key components for FMI cache isolation
11066
+ // Build additional cache key components for cache isolation
10691
11067
  let additionalCacheKeyComponents;
10692
11068
  if (request.fmiPath) {
10693
11069
  additionalCacheKeyComponents = {
11070
+ ...additionalCacheKeyComponents,
10694
11071
  fmi_path: request.fmiPath,
10695
11072
  };
10696
11073
  }
10697
- if (request.skipCache || request.claims) {
11074
+ /*
11075
+ * Client-originated claims participate in the cache key (unlike server-issued `claims`,
11076
+ * which bypasses the cache). Identical claims values are served from cache; different
11077
+ * values produce separate cache entries. Gate on `!isEmptyObj` (not just `trim()`) so an
11078
+ * empty/whitespace or empty-object (`{}`) value - which contributes nothing to the request
11079
+ * body - does not fragment the cache from an omitted `claimsFromClient`.
11080
+ */
11081
+ if (request.claimsFromClient &&
11082
+ !StringUtils.isEmptyObj(request.claimsFromClient)) {
11083
+ additionalCacheKeyComponents = {
11084
+ ...additionalCacheKeyComponents,
11085
+ client_claims: request.claimsFromClient,
11086
+ };
11087
+ }
11088
+ if (request.skipCache || !StringUtils.isEmptyObj(request.claims)) {
10698
11089
  return this.executeTokenRequest(request, this.authority,
10699
11090
  /* refreshAccessToken */ undefined, additionalCacheKeyComponents);
10700
11091
  }
@@ -10761,7 +11152,9 @@ class ClientCredentialClient extends BaseClient {
10761
11152
  accessToken: cachedAccessToken,
10762
11153
  refreshToken: null,
10763
11154
  appMetadata: null,
10764
- }, true, request, this.performanceClient),
11155
+ }, true, request, this.performanceClient, {
11156
+ tokenBindingKeyManager: this.config.tokenBindingKeyManager,
11157
+ }),
10765
11158
  lastCacheOutcome,
10766
11159
  ];
10767
11160
  }
@@ -10834,7 +11227,7 @@ class ClientCredentialClient extends BaseClient {
10834
11227
  serverTokenResponse = response.body;
10835
11228
  serverTokenResponse.status = response.status;
10836
11229
  }
10837
- const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin);
11230
+ const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin, this.config.tokenBindingKeyManager);
10838
11231
  responseHandler.validateTokenResponse(serverTokenResponse, request.correlationId, refreshAccessToken);
10839
11232
  const tokenResponse = await responseHandler.handleServerTokenResponse(serverTokenResponse, this.authority, reqTimestamp, request, ApiId.acquireTokenByClientCredential, undefined, // authCodePayload
10840
11233
  undefined, // userAssertionHash
@@ -10875,10 +11268,16 @@ class ClientCredentialClient extends BaseClient {
10875
11268
  if (request.fmiPath) {
10876
11269
  parameters.set(FMI_PATH, request.fmiPath);
10877
11270
  }
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
+ */
10878
11276
  if (!StringUtils.isEmptyObj(request.claims) ||
11277
+ !StringUtils.isEmptyObj(request.claimsFromClient) ||
10879
11278
  (this.config.authOptions.clientCapabilities &&
10880
11279
  this.config.authOptions.clientCapabilities.length > 0)) {
10881
- addClaims(parameters, request.correlationId, request.claims, this.config.authOptions.clientCapabilities);
11280
+ addClaims(parameters, request.correlationId, request.claims, this.config.authOptions.clientCapabilities, undefined, request.claimsFromClient);
10882
11281
  }
10883
11282
  return mapToQueryString(parameters);
10884
11283
  }
@@ -10904,15 +11303,29 @@ class OnBehalfOfClient extends BaseClient {
10904
11303
  this.scopeSet = new ScopeSet(request.scopes || [], request.correlationId);
10905
11304
  // generate the user_assertion_hash for OBOAssertion
10906
11305
  this.userAssertionHash = await this.cryptoUtils.hashString(request.oboAssertion);
10907
- if (request.skipCache || request.claims) {
10908
- return this.executeTokenRequest(request, this.authority, this.userAssertionHash);
11306
+ /*
11307
+ * Client-originated claims participate in the cache key (unlike server-issued `claims`,
11308
+ * which bypasses the cache). Identical claims values are served from cache; different
11309
+ * values produce separate cache entries. Gate on `!isEmptyObj` (not just `trim()`) so an
11310
+ * empty/whitespace or empty-object (`{}`) value - which contributes nothing to the request
11311
+ * body - does not fragment the cache from an omitted `claimsFromClient`.
11312
+ */
11313
+ let additionalCacheKeyComponents;
11314
+ if (request.claimsFromClient &&
11315
+ !StringUtils.isEmptyObj(request.claimsFromClient)) {
11316
+ additionalCacheKeyComponents = {
11317
+ client_claims: request.claimsFromClient,
11318
+ };
11319
+ }
11320
+ if (request.skipCache || !StringUtils.isEmptyObj(request.claims)) {
11321
+ return this.executeTokenRequest(request, this.authority, this.userAssertionHash, additionalCacheKeyComponents);
10909
11322
  }
10910
11323
  try {
10911
- return await this.getCachedAuthenticationResult(request);
11324
+ return await this.getCachedAuthenticationResult(request, additionalCacheKeyComponents);
10912
11325
  }
10913
11326
  catch (e) {
10914
11327
  // 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);
11328
+ return await this.executeTokenRequest(request, this.authority, this.userAssertionHash, additionalCacheKeyComponents);
10916
11329
  }
10917
11330
  }
10918
11331
  /**
@@ -10923,9 +11336,9 @@ class OnBehalfOfClient extends BaseClient {
10923
11336
  * This is to prevent security issues when the assertion changes over time, however, longlived RT helps retaining the session
10924
11337
  * @param request - developer provided CommonOnBehalfOfRequest
10925
11338
  */
10926
- async getCachedAuthenticationResult(request) {
11339
+ async getCachedAuthenticationResult(request, additionalCacheKeyComponents) {
10927
11340
  // look in the cache for the access_token which matches the incoming_assertion
10928
- const cachedAccessToken = this.readAccessTokenFromCacheForOBO(this.config.authOptions.clientId, request);
11341
+ const cachedAccessToken = this.readAccessTokenFromCacheForOBO(this.config.authOptions.clientId, request, additionalCacheKeyComponents);
10929
11342
  if (!cachedAccessToken) {
10930
11343
  // Must refresh due to non-existent access_token.
10931
11344
  this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN);
@@ -10964,7 +11377,10 @@ class OnBehalfOfClient extends BaseClient {
10964
11377
  idToken: cachedIdToken,
10965
11378
  refreshToken: null,
10966
11379
  appMetadata: null,
10967
- }, true, request, this.performanceClient, idTokenClaims);
11380
+ }, true, request, this.performanceClient, {
11381
+ idTokenClaims,
11382
+ tokenBindingKeyManager: this.config.tokenBindingKeyManager,
11383
+ });
10968
11384
  }
10969
11385
  /**
10970
11386
  * read idtoken from cache, this is a specific implementation for OBO as the requirements differ from a generic lookup in the cacheManager
@@ -10991,7 +11407,7 @@ class OnBehalfOfClient extends BaseClient {
10991
11407
  * @param clientId - client id
10992
11408
  * @param request - developer provided CommonOnBehalfOfRequest
10993
11409
  */
10994
- readAccessTokenFromCacheForOBO(clientId, request) {
11410
+ readAccessTokenFromCacheForOBO(clientId, request, additionalCacheKeyComponents) {
10995
11411
  const authScheme = request.authenticationScheme ||
10996
11412
  AuthenticationScheme.BEARER;
10997
11413
  /*
@@ -11009,6 +11425,7 @@ class OnBehalfOfClient extends BaseClient {
11009
11425
  tokenType: authScheme,
11010
11426
  keyId: request.sshKid,
11011
11427
  userAssertionHash: this.userAssertionHash,
11428
+ additionalCacheKeyComponents: additionalCacheKeyComponents,
11012
11429
  };
11013
11430
  const accessTokens = this.cacheManager.getAccessTokensByFilter(accessTokenFilter, request.correlationId);
11014
11431
  const numAccessTokens = accessTokens.length;
@@ -11025,7 +11442,7 @@ class OnBehalfOfClient extends BaseClient {
11025
11442
  * @param request - developer provided CommonOnBehalfOfRequest
11026
11443
  * @param authority - authority object
11027
11444
  */
11028
- async executeTokenRequest(request, authority, userAssertionHash) {
11445
+ async executeTokenRequest(request, authority, userAssertionHash, additionalCacheKeyComponents) {
11029
11446
  const queryParametersString = this.createTokenQueryParameters(request);
11030
11447
  const endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParametersString);
11031
11448
  const requestBody = await this.createTokenRequestBody(request);
@@ -11043,9 +11460,14 @@ class OnBehalfOfClient extends BaseClient {
11043
11460
  };
11044
11461
  const reqTimestamp = nowSeconds();
11045
11462
  const response = await this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint, request.correlationId);
11046
- const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin);
11463
+ const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin, this.config.tokenBindingKeyManager);
11047
11464
  responseHandler.validateTokenResponse(response.body, request.correlationId);
11048
- const tokenResponse = await responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, ApiId.acquireTokenByOBO, undefined, userAssertionHash);
11465
+ const tokenResponse = await responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, ApiId.acquireTokenByOBO, undefined, // authCodePayload
11466
+ userAssertionHash, // userAssertionHash
11467
+ undefined, // handlingRefreshTokenResponse
11468
+ undefined, // forceCacheRefreshTokenResponse
11469
+ undefined, // serverRequestId
11470
+ additionalCacheKeyComponents);
11049
11471
  return tokenResponse;
11050
11472
  }
11051
11473
  /**
@@ -11077,10 +11499,16 @@ class OnBehalfOfClient extends BaseClient {
11077
11499
  addClientAssertion(parameters, await getClientAssertion(clientAssertion.assertion, this.config.authOptions.clientId, request.resourceRequestUri));
11078
11500
  addClientAssertionType(parameters, clientAssertion.assertionType);
11079
11501
  }
11080
- if (request.claims ||
11502
+ /*
11503
+ * Deep-merge the server-issued `claims` challenge with client-originated `claimsFromClient`
11504
+ * (via addClaims -> buildMergedClaims) so both are sent on the wire. Client capabilities
11505
+ * are appended by buildMergedClaims.
11506
+ */
11507
+ if (!StringUtils.isEmptyObj(request.claims) ||
11508
+ !StringUtils.isEmptyObj(request.claimsFromClient) ||
11081
11509
  (this.config.authOptions.clientCapabilities &&
11082
11510
  this.config.authOptions.clientCapabilities.length > 0)) {
11083
- addClaims(parameters, request.correlationId, request.claims, this.config.authOptions.clientCapabilities);
11511
+ addClaims(parameters, request.correlationId, request.claims, this.config.authOptions.clientCapabilities, undefined, request.claimsFromClient);
11084
11512
  }
11085
11513
  return mapToQueryString(parameters);
11086
11514
  }
@@ -11132,7 +11560,7 @@ class UserFederatedIdentityCredentialClient extends BaseClient {
11132
11560
  };
11133
11561
  const reqTimestamp = nowSeconds();
11134
11562
  const response = await this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint, request.correlationId);
11135
- const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin);
11563
+ const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin, this.config.tokenBindingKeyManager);
11136
11564
  responseHandler.validateTokenResponse(response.body, request.correlationId);
11137
11565
  const tokenResponse = await responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, ApiId.acquireTokenByUserFederatedIdentityCredential);
11138
11566
  return tokenResponse;
@@ -11176,10 +11604,16 @@ class UserFederatedIdentityCredentialClient extends BaseClient {
11176
11604
  addClientAssertion(parameters, await getClientAssertion(clientAssertion.assertion, this.config.authOptions.clientId, this.authority.tokenEndpoint));
11177
11605
  addClientAssertionType(parameters, clientAssertion.assertionType);
11178
11606
  }
11179
- if (request.claims ||
11607
+ /*
11608
+ * Deep-merge the server-issued `claims` challenge with client-originated `claimsFromClient`
11609
+ * (via addClaims -> buildMergedClaims) so both are sent on the wire. Client capabilities
11610
+ * are appended by buildMergedClaims.
11611
+ */
11612
+ if (!StringUtils.isEmptyObj(request.claims) ||
11613
+ !StringUtils.isEmptyObj(request.claimsFromClient) ||
11180
11614
  (this.config.authOptions.clientCapabilities &&
11181
11615
  this.config.authOptions.clientCapabilities.length > 0)) {
11182
- addClaims(parameters, request.correlationId, request.claims, this.config.authOptions.clientCapabilities);
11616
+ addClaims(parameters, request.correlationId, request.claims, this.config.authOptions.clientCapabilities, undefined, request.claimsFromClient);
11183
11617
  }
11184
11618
  return mapToQueryString(parameters);
11185
11619
  }
@@ -12006,22 +12440,24 @@ class AzureArc extends BaseManagedIdentitySource {
12006
12440
  * Attempts to create an AzureArc managed identity source instance.
12007
12441
  *
12008
12442
  * Validates the Azure Arc environment by checking environment variables
12009
- * and performing file-based detection. It ensures that only system-assigned managed identities
12010
- * are supported for Azure Arc scenarios. The method performs comprehensive validation of
12011
- * endpoint URLs and logs detailed information about the detection process.
12443
+ * and performing file-based detection. Azure Arc supports both system-assigned and user-assigned
12444
+ * managed identities; when a user-assigned identity is requested, its selector is forwarded on the
12445
+ * request and validated against the token response echo (fail closed). The method performs
12446
+ * comprehensive validation of endpoint URLs and logs detailed information about the detection process.
12012
12447
  *
12013
12448
  * @param logger - Logger instance for capturing creation and validation steps
12014
12449
  * @param nodeStorage - Storage implementation for the managed identity source
12015
12450
  * @param networkClient - Network client for HTTP communication
12016
12451
  * @param cryptoProvider - Cryptographic operations provider
12017
12452
  * @param disableInternalRetries - Whether to disable automatic retry mechanisms
12018
- * @param managedIdentityId - The managed identity configuration, must be system-assigned
12453
+ * @param _managedIdentityId - Unused; Azure Arc now supports user-assigned identities, which are
12454
+ * forwarded on the request and validated against the token response echo (fail closed).
12019
12455
  *
12020
12456
  * @returns AzureArc instance if the environment supports Azure Arc managed identity, null otherwise
12021
- *
12022
- * @throws {ManagedIdentityError} When a user-assigned managed identity is specified (not supported for Azure Arc)
12023
12457
  */
12024
- static tryCreate(logger, nodeStorage, networkClient, cryptoProvider, disableInternalRetries, managedIdentityId) {
12458
+ static tryCreate(logger, nodeStorage, networkClient, cryptoProvider, disableInternalRetries,
12459
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
12460
+ _managedIdentityId) {
12025
12461
  const [identityEndpoint, imdsEndpoint] = AzureArc.getEnvironmentVariables();
12026
12462
  // if either of the identity or imds endpoints are undefined (even after himds file detection)
12027
12463
  if (!identityEndpoint || !imdsEndpoint) {
@@ -12042,9 +12478,6 @@ class AzureArc extends BaseManagedIdentitySource {
12042
12478
  AzureArc.getValidatedEnvVariableUrlString(ManagedIdentityEnvironmentVariableNames.IMDS_ENDPOINT, imdsEndpoint, ManagedIdentitySourceNames.AZURE_ARC, logger);
12043
12479
  logger.info(`[Managed Identity] Environment variables validation passed for ${ManagedIdentitySourceNames.AZURE_ARC} managed identity. Endpoint URI: ${validatedIdentityEndpoint}. Creating ${ManagedIdentitySourceNames.AZURE_ARC} managed identity.`, "");
12044
12480
  }
12045
- if (managedIdentityId.idType !== ManagedIdentityIdType.SYSTEM_ASSIGNED) {
12046
- throw createManagedIdentityError(unableToCreateAzureArc, "");
12047
- }
12048
12481
  return new AzureArc(logger, nodeStorage, networkClient, cryptoProvider, disableInternalRetries, identityEndpoint);
12049
12482
  }
12050
12483
  /**
@@ -12058,16 +12491,85 @@ class AzureArc extends BaseManagedIdentitySource {
12058
12491
  *
12059
12492
  * @returns A configured ManagedIdentityRequestParameters object ready for network execution
12060
12493
  */
12061
- createRequest(resource) {
12494
+ createRequest(resource, managedIdentityId) {
12062
12495
  const request = new ManagedIdentityRequestParameters(HttpMethod.GET, this.identityEndpoint.replace("localhost", "127.0.0.1"));
12063
12496
  request.headers[ManagedIdentityHeaders.METADATA_HEADER_NAME] = "true";
12064
12497
  request.queryParameters[ManagedIdentityQueryParameters.API_VERSION] =
12065
12498
  ARC_API_VERSION;
12066
12499
  request.queryParameters[ManagedIdentityQueryParameters.RESOURCE] =
12067
12500
  resource;
12501
+ if (managedIdentityId.idType !== ManagedIdentityIdType.SYSTEM_ASSIGNED) {
12502
+ /*
12503
+ * Forward the user-assigned selector. Azure Arc honors the IMDS "msi_res_id" spelling for
12504
+ * the resource-id selector (isImds = true); "mi_res_id" is silently ignored and returns
12505
+ * the system-assigned identity.
12506
+ */
12507
+ request.queryParameters[this.getManagedIdentityUserAssignedIdQueryParameterKey(managedIdentityId.idType, true // isImds -> msi_res_id for the resource-id selector
12508
+ )] = managedIdentityId.id;
12509
+ }
12068
12510
  // bodyParameters calculated in BaseManagedIdentity.acquireTokenWithManagedIdentity
12069
12511
  return request;
12070
12512
  }
12513
+ /**
12514
+ * Fails closed when a user-assigned identity was requested but the Azure Arc token response does
12515
+ * not confirm it. A legacy Azure Arc agent ignores the client_id / object_id / msi_res_id selector
12516
+ * and silently returns the machine's system-assigned identity; an agent that supports user-assigned
12517
+ * managed identity echoes the identity it used. When the echoed identity is missing or does not
12518
+ * match the requested selector, MSAL must not return a token for a different identity than requested.
12519
+ *
12520
+ * @param networkRequest - The request that produced this response; its query parameters carry the
12521
+ * requested user-assigned selector (client_id / object_id / msi_res_id)
12522
+ * @param responseBody - The deserialized Azure Arc token response
12523
+ *
12524
+ * @throws {ManagedIdentityError} When a user-assigned identity was requested but not confirmed
12525
+ */
12526
+ validateUserAssignedIdentityWasHonored(networkRequest, responseBody) {
12527
+ /*
12528
+ * Derive the requested selector from the request that produced this response rather than from
12529
+ * instance state. The managed identity source instance is cached and reused across acquireToken
12530
+ * calls, so relying on a stored field could compare against a different identity than the one
12531
+ * this request actually asked for. The network request is scoped to this call and carries exactly
12532
+ * one user-assigned selector (client_id, object_id, or msi_res_id) when a UAMI was requested.
12533
+ */
12534
+ const queryParameters = networkRequest.queryParameters;
12535
+ let requestedIdentity;
12536
+ let echoedIdentity;
12537
+ if (queryParameters[ManagedIdentityUserAssignedIdQueryParameterNames
12538
+ .MANAGED_IDENTITY_CLIENT_ID]) {
12539
+ requestedIdentity =
12540
+ queryParameters[ManagedIdentityUserAssignedIdQueryParameterNames
12541
+ .MANAGED_IDENTITY_CLIENT_ID];
12542
+ echoedIdentity = responseBody.client_id;
12543
+ }
12544
+ else if (queryParameters[ManagedIdentityUserAssignedIdQueryParameterNames
12545
+ .MANAGED_IDENTITY_OBJECT_ID]) {
12546
+ requestedIdentity =
12547
+ queryParameters[ManagedIdentityUserAssignedIdQueryParameterNames
12548
+ .MANAGED_IDENTITY_OBJECT_ID];
12549
+ echoedIdentity = responseBody.object_id;
12550
+ }
12551
+ else if (queryParameters[ManagedIdentityUserAssignedIdQueryParameterNames
12552
+ .MANAGED_IDENTITY_RESOURCE_ID_IMDS]) {
12553
+ requestedIdentity =
12554
+ queryParameters[ManagedIdentityUserAssignedIdQueryParameterNames
12555
+ .MANAGED_IDENTITY_RESOURCE_ID_IMDS];
12556
+ // Accept either spelling on the echo as a safety net; Azure Arc returns msi_res_id.
12557
+ echoedIdentity = responseBody.msi_res_id || responseBody.mi_res_id;
12558
+ }
12559
+ else {
12560
+ // System-assigned (no user-assigned selector forwarded): nothing to confirm.
12561
+ return;
12562
+ }
12563
+ /*
12564
+ * Compare case-insensitively: client_id / object_id are GUIDs, and an ARM resource id can
12565
+ * legitimately differ in segment casing.
12566
+ */
12567
+ if (!echoedIdentity ||
12568
+ echoedIdentity.toLowerCase() !== requestedIdentity.toLowerCase()) {
12569
+ this.logger.error("[Managed Identity] Azure Arc did not confirm the requested user-assigned identity in the token response. The agent likely does not support user-assigned managed identity and returned the system-assigned identity.", "");
12570
+ throw createManagedIdentityError(userAssignedManagedIdentityNotConfirmed, "");
12571
+ }
12572
+ }
12071
12573
  /**
12072
12574
  * Processes the server response and handles Azure Arc-specific authentication challenges.
12073
12575
  *
@@ -12158,7 +12660,16 @@ class AzureArc extends BaseManagedIdentitySource {
12158
12660
  }
12159
12661
  }
12160
12662
  }
12161
- return this.getServerTokenResponse(retryResponse || originalResponse);
12663
+ const finalResponse = retryResponse || originalResponse;
12664
+ /*
12665
+ * Fail closed: when a user-assigned identity was requested and the agent returned a token,
12666
+ * ensure the echoed identity matches. A genuine service error (no access_token, e.g. a 404
12667
+ * for a non-existent identity) is surfaced normally by the response handler.
12668
+ */
12669
+ if (finalResponse.body.access_token) {
12670
+ this.validateUserAssignedIdentityWasHonored(networkRequest, finalResponse.body);
12671
+ }
12672
+ return this.getServerTokenResponse(finalResponse);
12162
12673
  }
12163
12674
  }
12164
12675