@azure/msal-node 5.5.0 → 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.
- package/dist/cache/CacheHelpers.mjs +1 -1
- package/dist/cache/NodeStorage.mjs +1 -1
- package/dist/cache/TokenCache.mjs +1 -1
- package/dist/cache/distributed/DistributedCachePlugin.mjs +1 -1
- package/dist/cache/serializer/Deserializer.mjs +1 -1
- package/dist/cache/serializer/Serializer.mjs +1 -1
- package/dist/client/BaseClient.mjs +1 -1
- package/dist/client/ClientApplication.mjs +16 -6
- package/dist/client/ClientApplication.mjs.map +1 -1
- package/dist/client/ClientAssertion.mjs +1 -1
- package/dist/client/ClientCredentialClient.mjs +5 -3
- package/dist/client/ClientCredentialClient.mjs.map +1 -1
- package/dist/client/ConfidentialClientApplication.mjs +1 -1
- package/dist/client/DeviceCodeClient.mjs +2 -2
- package/dist/client/DeviceCodeClient.mjs.map +1 -1
- package/dist/client/ManagedIdentityApplication.mjs +1 -1
- package/dist/client/ManagedIdentityClient.mjs +1 -1
- package/dist/client/ManagedIdentitySources/AppService.mjs +1 -1
- package/dist/client/ManagedIdentitySources/AzureArc.mjs +93 -16
- package/dist/client/ManagedIdentitySources/AzureArc.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +1 -1
- package/dist/client/ManagedIdentitySources/CloudShell.mjs +1 -1
- package/dist/client/ManagedIdentitySources/Imds.mjs +1 -1
- package/dist/client/ManagedIdentitySources/MachineLearning.mjs +1 -1
- package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +1 -1
- package/dist/client/OnBehalfOfClient.mjs +6 -3
- package/dist/client/OnBehalfOfClient.mjs.map +1 -1
- package/dist/client/PublicClientApplication.mjs +1 -1
- package/dist/client/UserFederatedIdentityCredentialClient.mjs +2 -2
- package/dist/client/UserFederatedIdentityCredentialClient.mjs.map +1 -1
- package/dist/client/UsernamePasswordClient.mjs +2 -2
- package/dist/client/UsernamePasswordClient.mjs.map +1 -1
- package/dist/config/Configuration.mjs +1 -1
- package/dist/config/ManagedIdentityId.mjs +1 -1
- package/dist/config/ManagedIdentityRequestParameters.mjs +1 -1
- package/dist/crypto/CryptoProvider.mjs +13 -13
- package/dist/crypto/CryptoProvider.mjs.map +1 -1
- package/dist/crypto/GuidGenerator.mjs +1 -1
- package/dist/crypto/HashUtils.mjs +1 -1
- package/dist/crypto/PkceGenerator.mjs +1 -1
- package/dist/error/ClientAuthErrorCodes.mjs +1 -1
- package/dist/error/ManagedIdentityError.mjs +5 -4
- package/dist/error/ManagedIdentityError.mjs.map +1 -1
- package/dist/error/ManagedIdentityErrorCodes.mjs +3 -2
- package/dist/error/ManagedIdentityErrorCodes.mjs.map +1 -1
- package/dist/error/NodeAuthError.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/internals.mjs +1 -1
- package/dist/network/HttpClient.mjs +1 -1
- package/dist/network/HttpClientWithRetries.mjs +1 -1
- package/dist/network/LoopbackClient.mjs +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/protocol/Authorize.mjs +1 -1
- package/dist/retry/DefaultManagedIdentityRetryPolicy.mjs +1 -1
- package/dist/retry/ExponentialRetryStrategy.mjs +1 -1
- package/dist/retry/ImdsRetryPolicy.mjs +1 -1
- package/dist/retry/LinearRetryStrategy.mjs +1 -1
- package/dist/utils/Constants.mjs +1 -1
- package/dist/utils/EncodingUtils.mjs +1 -1
- package/dist/utils/TimeUtils.mjs +1 -1
- package/lib/msal-node.cjs +450 -142
- package/lib/msal-node.cjs.map +1 -1
- package/package.json +2 -2
- package/src/client/ClientApplication.ts +15 -5
- package/src/client/ClientCredentialClient.ts +6 -2
- package/src/client/DeviceCodeClient.ts +2 -1
- package/src/client/ManagedIdentitySources/AzureArc.ts +139 -19
- package/src/client/OnBehalfOfClient.ts +6 -2
- package/src/client/UserFederatedIdentityCredentialClient.ts +2 -1
- package/src/client/UsernamePasswordClient.ts +2 -1
- package/src/crypto/CryptoProvider.ts +31 -13
- package/src/error/ManagedIdentityError.ts +4 -2
- package/src/error/ManagedIdentityErrorCodes.ts +2 -0
- package/src/packageMetadata.ts +1 -1
- package/src/request/AuthorizationCodeRequest.ts +4 -0
- package/src/response/ManagedIdentityTokenResponse.ts +3 -0
- package/types/client/ClientApplication.d.ts.map +1 -1
- package/types/client/ClientCredentialClient.d.ts.map +1 -1
- package/types/client/DeviceCodeClient.d.ts.map +1 -1
- package/types/client/ManagedIdentitySources/AzureArc.d.ts +22 -8
- package/types/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
- package/types/client/OnBehalfOfClient.d.ts.map +1 -1
- package/types/client/UserFederatedIdentityCredentialClient.d.ts.map +1 -1
- package/types/client/UsernamePasswordClient.d.ts.map +1 -1
- package/types/crypto/CryptoProvider.d.ts +11 -9
- package/types/crypto/CryptoProvider.d.ts.map +1 -1
- package/types/error/ManagedIdentityError.d.ts +1 -0
- package/types/error/ManagedIdentityError.d.ts.map +1 -1
- package/types/error/ManagedIdentityErrorCodes.d.ts +1 -0
- package/types/error/ManagedIdentityErrorCodes.d.ts.map +1 -1
- package/types/packageMetadata.d.ts +1 -1
- package/types/request/AuthorizationCodeRequest.d.ts +4 -0
- package/types/request/AuthorizationCodeRequest.d.ts.map +1 -1
- package/types/response/ManagedIdentityTokenResponse.d.ts +3 -0
- package/types/response/ManagedIdentityTokenResponse.d.ts.map +1 -1
package/lib/msal-node.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-node v5.
|
|
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.
|
|
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.
|
|
@@ -209,7 +209,7 @@ const USER_ID = "user_id";
|
|
|
209
209
|
const FMI_PATH = "fmi_path";
|
|
210
210
|
const ATTRIBUTE_TOKENS = "attribute_tokens";
|
|
211
211
|
|
|
212
|
-
/*! @azure/msal-common v16.
|
|
212
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
213
213
|
/*
|
|
214
214
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
215
215
|
* Licensed under the MIT License.
|
|
@@ -454,6 +454,10 @@ const CacheOutcome = {
|
|
|
454
454
|
// When the token request goes to the identity provider because refresh_in was used and the existing token needs to be refreshed
|
|
455
455
|
PROACTIVELY_REFRESHED: "4",
|
|
456
456
|
};
|
|
457
|
+
const JsonWebTokenTypes = {
|
|
458
|
+
Pop: "pop",
|
|
459
|
+
Dpop: "dpop+jwt",
|
|
460
|
+
};
|
|
457
461
|
// Token renewal offset default in seconds
|
|
458
462
|
const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
|
|
459
463
|
const EncodingTypes = {
|
|
@@ -462,7 +466,7 @@ const EncodingTypes = {
|
|
|
462
466
|
UTF8: "utf-8",
|
|
463
467
|
};
|
|
464
468
|
|
|
465
|
-
/*! @azure/msal-common v16.
|
|
469
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
466
470
|
/*
|
|
467
471
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
468
472
|
* Licensed under the MIT License.
|
|
@@ -491,7 +495,7 @@ function createAuthError(code, correlationId, additionalMessage) {
|
|
|
491
495
|
return new AuthError(code, correlationId, additionalMessage || getDefaultErrorMessage(code));
|
|
492
496
|
}
|
|
493
497
|
|
|
494
|
-
/*! @azure/msal-common v16.
|
|
498
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
495
499
|
|
|
496
500
|
/*
|
|
497
501
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -514,7 +518,7 @@ function createClientAuthError(errorCode, correlationId, additionalMessage) {
|
|
|
514
518
|
return new ClientAuthError(errorCode, correlationId, additionalMessage);
|
|
515
519
|
}
|
|
516
520
|
|
|
517
|
-
/*! @azure/msal-common v16.
|
|
521
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
518
522
|
/*
|
|
519
523
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
520
524
|
* Licensed under the MIT License.
|
|
@@ -598,7 +602,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
598
602
|
userCanceled: userCanceled
|
|
599
603
|
});
|
|
600
604
|
|
|
601
|
-
/*! @azure/msal-common v16.
|
|
605
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
602
606
|
|
|
603
607
|
/*
|
|
604
608
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -636,7 +640,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
|
|
|
636
640
|
};
|
|
637
641
|
}
|
|
638
642
|
|
|
639
|
-
/*! @azure/msal-common v16.
|
|
643
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
640
644
|
|
|
641
645
|
/*
|
|
642
646
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -702,7 +706,7 @@ function getJWSPayload(authToken, correlationId) {
|
|
|
702
706
|
return matches[2];
|
|
703
707
|
}
|
|
704
708
|
|
|
705
|
-
/*! @azure/msal-common v16.
|
|
709
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
706
710
|
|
|
707
711
|
/*
|
|
708
712
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -790,7 +794,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
|
|
|
790
794
|
return updatedAccountInfo;
|
|
791
795
|
}
|
|
792
796
|
|
|
793
|
-
/*! @azure/msal-common v16.
|
|
797
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
794
798
|
/*
|
|
795
799
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
796
800
|
* Licensed under the MIT License.
|
|
@@ -805,7 +809,7 @@ const AuthorityType = {
|
|
|
805
809
|
Ciam: 3,
|
|
806
810
|
};
|
|
807
811
|
|
|
808
|
-
/*! @azure/msal-common v16.
|
|
812
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
809
813
|
/*
|
|
810
814
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
811
815
|
* Licensed under the MIT License.
|
|
@@ -827,7 +831,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
|
|
|
827
831
|
return null;
|
|
828
832
|
}
|
|
829
833
|
|
|
830
|
-
/*! @azure/msal-common v16.
|
|
834
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
831
835
|
/*
|
|
832
836
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
833
837
|
* Licensed under the MIT License.
|
|
@@ -851,7 +855,7 @@ const ProtocolMode = {
|
|
|
851
855
|
EAR: "EAR",
|
|
852
856
|
};
|
|
853
857
|
|
|
854
|
-
/*! @azure/msal-common v16.
|
|
858
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
855
859
|
/**
|
|
856
860
|
* Returns the AccountInfo interface for this account.
|
|
857
861
|
* @internal
|
|
@@ -1000,7 +1004,7 @@ function isAccountEntity(entity) {
|
|
|
1000
1004
|
entity.hasOwnProperty("authorityType"));
|
|
1001
1005
|
}
|
|
1002
1006
|
|
|
1003
|
-
/*! @azure/msal-common v16.
|
|
1007
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
1004
1008
|
/*
|
|
1005
1009
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1006
1010
|
* Licensed under the MIT License.
|
|
@@ -1017,7 +1021,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
1017
1021
|
unexpectedError: unexpectedError
|
|
1018
1022
|
});
|
|
1019
1023
|
|
|
1020
|
-
/*! @azure/msal-common v16.
|
|
1024
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
1021
1025
|
|
|
1022
1026
|
/*
|
|
1023
1027
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1037,7 +1041,7 @@ function createClientConfigurationError(errorCode, correlationId) {
|
|
|
1037
1041
|
return new ClientConfigurationError(errorCode, correlationId);
|
|
1038
1042
|
}
|
|
1039
1043
|
|
|
1040
|
-
/*! @azure/msal-common v16.
|
|
1044
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
1041
1045
|
/*
|
|
1042
1046
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1043
1047
|
* Licensed under the MIT License.
|
|
@@ -1058,6 +1062,7 @@ const invalidAuthorityMetadata = "invalid_authority_metadata";
|
|
|
1058
1062
|
const untrustedAuthority = "untrusted_authority";
|
|
1059
1063
|
const missingSshJwk = "missing_ssh_jwk";
|
|
1060
1064
|
const missingSshKid = "missing_ssh_kid";
|
|
1065
|
+
const unsupportedAuthenticationScheme = "unsupported_authentication_scheme";
|
|
1061
1066
|
const missingNonceAuthenticationHeader = "missing_nonce_authentication_header";
|
|
1062
1067
|
const invalidAuthenticationHeader = "invalid_authentication_header";
|
|
1063
1068
|
const cannotSetOIDCOptions = "cannot_set_OIDCOptions";
|
|
@@ -1096,12 +1101,13 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
1096
1101
|
pkceParamsMissing: pkceParamsMissing,
|
|
1097
1102
|
redirectUriEmpty: redirectUriEmpty,
|
|
1098
1103
|
tokenRequestEmpty: tokenRequestEmpty,
|
|
1104
|
+
unsupportedAuthenticationScheme: unsupportedAuthenticationScheme,
|
|
1099
1105
|
untrustedAuthority: untrustedAuthority,
|
|
1100
1106
|
urlEmptyError: urlEmptyError,
|
|
1101
1107
|
urlParseError: urlParseError
|
|
1102
1108
|
});
|
|
1103
1109
|
|
|
1104
|
-
/*! @azure/msal-common v16.
|
|
1110
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
1105
1111
|
/*
|
|
1106
1112
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1107
1113
|
* Licensed under the MIT License.
|
|
@@ -1113,7 +1119,7 @@ function isOpenIdConfigResponse(response) {
|
|
|
1113
1119
|
response.hasOwnProperty("jwks_uri"));
|
|
1114
1120
|
}
|
|
1115
1121
|
|
|
1116
|
-
/*! @azure/msal-common v16.
|
|
1122
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
1117
1123
|
/*
|
|
1118
1124
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1119
1125
|
* Licensed under the MIT License.
|
|
@@ -1193,7 +1199,7 @@ class StringUtils {
|
|
|
1193
1199
|
}
|
|
1194
1200
|
}
|
|
1195
1201
|
|
|
1196
|
-
/*! @azure/msal-common v16.
|
|
1202
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
1197
1203
|
|
|
1198
1204
|
/*
|
|
1199
1205
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1351,7 +1357,7 @@ class UrlString {
|
|
|
1351
1357
|
}
|
|
1352
1358
|
}
|
|
1353
1359
|
|
|
1354
|
-
/*! @azure/msal-common v16.
|
|
1360
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
1355
1361
|
|
|
1356
1362
|
/*
|
|
1357
1363
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1360,10 +1366,7 @@ class UrlString {
|
|
|
1360
1366
|
// Build endpoint metadata dynamically to avoid string duplication
|
|
1361
1367
|
const endpointHosts = [
|
|
1362
1368
|
{ host: "login.microsoftonline.com" },
|
|
1363
|
-
{
|
|
1364
|
-
host: "login.chinacloudapi.cn",
|
|
1365
|
-
issuerHost: "login.partner.microsoftonline.cn", // Issuer differs
|
|
1366
|
-
},
|
|
1369
|
+
{ host: "login.partner.microsoftonline.cn" },
|
|
1367
1370
|
{ host: "login.microsoftonline.us" },
|
|
1368
1371
|
{ host: "login.sovcloud-identity.fr" },
|
|
1369
1372
|
{ host: "login.sovcloud-identity.de" },
|
|
@@ -1517,7 +1520,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
|
|
|
1517
1520
|
return null;
|
|
1518
1521
|
}
|
|
1519
1522
|
|
|
1520
|
-
/*! @azure/msal-common v16.
|
|
1523
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
1521
1524
|
/*
|
|
1522
1525
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1523
1526
|
* Licensed under the MIT License.
|
|
@@ -1537,7 +1540,7 @@ const AzureCloudInstance = {
|
|
|
1537
1540
|
AzureUsGovernment: "https://login.microsoftonline.us",
|
|
1538
1541
|
};
|
|
1539
1542
|
|
|
1540
|
-
/*! @azure/msal-common v16.
|
|
1543
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
1541
1544
|
/*
|
|
1542
1545
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1543
1546
|
* Licensed under the MIT License.
|
|
@@ -1547,7 +1550,7 @@ function isCloudInstanceDiscoveryResponse(response) {
|
|
|
1547
1550
|
response.hasOwnProperty("metadata"));
|
|
1548
1551
|
}
|
|
1549
1552
|
|
|
1550
|
-
/*! @azure/msal-common v16.
|
|
1553
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
1551
1554
|
/*
|
|
1552
1555
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1553
1556
|
* Licensed under the MIT License.
|
|
@@ -1557,7 +1560,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
|
|
|
1557
1560
|
response.hasOwnProperty("error_description"));
|
|
1558
1561
|
}
|
|
1559
1562
|
|
|
1560
|
-
/*! @azure/msal-common v16.
|
|
1563
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
1561
1564
|
/*
|
|
1562
1565
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1563
1566
|
* Licensed under the MIT License.
|
|
@@ -1619,7 +1622,7 @@ const RegionDiscoveryGetCurrentVersion = "regionDiscoveryGetCurrentVersion";
|
|
|
1619
1622
|
*/
|
|
1620
1623
|
const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
|
|
1621
1624
|
|
|
1622
|
-
/*! @azure/msal-common v16.
|
|
1625
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
1623
1626
|
/*
|
|
1624
1627
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1625
1628
|
* Licensed under the MIT License.
|
|
@@ -1712,7 +1715,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
|
|
|
1712
1715
|
};
|
|
1713
1716
|
};
|
|
1714
1717
|
|
|
1715
|
-
/*! @azure/msal-common v16.
|
|
1718
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
1716
1719
|
|
|
1717
1720
|
/*
|
|
1718
1721
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1823,7 +1826,7 @@ RegionDiscovery.IMDS_OPTIONS = {
|
|
|
1823
1826
|
},
|
|
1824
1827
|
};
|
|
1825
1828
|
|
|
1826
|
-
/*! @azure/msal-common v16.
|
|
1829
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
1827
1830
|
/*
|
|
1828
1831
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1829
1832
|
* Licensed under the MIT License.
|
|
@@ -1878,7 +1881,7 @@ function delay(t, value) {
|
|
|
1878
1881
|
return new Promise((resolve) => setTimeout(() => resolve(value), t));
|
|
1879
1882
|
}
|
|
1880
1883
|
|
|
1881
|
-
/*! @azure/msal-common v16.
|
|
1884
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
1882
1885
|
|
|
1883
1886
|
/*
|
|
1884
1887
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1935,6 +1938,7 @@ function createAccessTokenEntity(homeAccountId, environment, accessToken, client
|
|
|
1935
1938
|
if (refreshOn) {
|
|
1936
1939
|
atEntity.refreshOn = refreshOn.toString();
|
|
1937
1940
|
}
|
|
1941
|
+
const normalizedTokenType = atEntity.tokenType?.toLowerCase();
|
|
1938
1942
|
/*
|
|
1939
1943
|
* Create Access Token With Auth Scheme instead of regular access token
|
|
1940
1944
|
* Cast to lower to handle "bearer" from ADFS
|
|
@@ -1943,7 +1947,7 @@ function createAccessTokenEntity(homeAccountId, environment, accessToken, client
|
|
|
1943
1947
|
AuthenticationScheme.BEARER.toLowerCase()) {
|
|
1944
1948
|
atEntity.credentialType =
|
|
1945
1949
|
CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;
|
|
1946
|
-
switch (
|
|
1950
|
+
switch (normalizedTokenType) {
|
|
1947
1951
|
case AuthenticationScheme.POP:
|
|
1948
1952
|
// Make sure keyId is present and add it to credential
|
|
1949
1953
|
const tokenClaims = extractTokenClaims(accessToken, base64Decode, correlationId);
|
|
@@ -1952,6 +1956,12 @@ function createAccessTokenEntity(homeAccountId, environment, accessToken, client
|
|
|
1952
1956
|
}
|
|
1953
1957
|
atEntity.keyId = tokenClaims.cnf.kid;
|
|
1954
1958
|
break;
|
|
1959
|
+
case "dpop":
|
|
1960
|
+
if (!keyId) {
|
|
1961
|
+
throw createClientAuthError(keyIdMissing, correlationId);
|
|
1962
|
+
}
|
|
1963
|
+
atEntity.keyId = keyId;
|
|
1964
|
+
break;
|
|
1955
1965
|
case AuthenticationScheme.SSH:
|
|
1956
1966
|
atEntity.keyId = keyId;
|
|
1957
1967
|
}
|
|
@@ -2158,7 +2168,7 @@ function serializeAttributeTokens(attributeTokens) {
|
|
|
2158
2168
|
return [...attributeTokens].sort().join(" ");
|
|
2159
2169
|
}
|
|
2160
2170
|
|
|
2161
|
-
/*! @azure/msal-common v16.
|
|
2171
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
2162
2172
|
|
|
2163
2173
|
/*
|
|
2164
2174
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3128,7 +3138,7 @@ function buildStaticAuthorityOptions(authOptions) {
|
|
|
3128
3138
|
};
|
|
3129
3139
|
}
|
|
3130
3140
|
|
|
3131
|
-
/*! @azure/msal-common v16.
|
|
3141
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
3132
3142
|
|
|
3133
3143
|
/*
|
|
3134
3144
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3162,7 +3172,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
|
|
|
3162
3172
|
}
|
|
3163
3173
|
}
|
|
3164
3174
|
|
|
3165
|
-
/*! @azure/msal-common v16.
|
|
3175
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
3166
3176
|
|
|
3167
3177
|
/*
|
|
3168
3178
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3358,7 +3368,7 @@ class ScopeSet {
|
|
|
3358
3368
|
}
|
|
3359
3369
|
}
|
|
3360
3370
|
|
|
3361
|
-
/*! @azure/msal-common v16.
|
|
3371
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
3362
3372
|
|
|
3363
3373
|
/*
|
|
3364
3374
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3690,7 +3700,7 @@ function parseClaims(claims, correlationId = "") {
|
|
|
3690
3700
|
// Malformed JSON
|
|
3691
3701
|
throw createClientConfigurationError(invalidClaims, correlationId);
|
|
3692
3702
|
}
|
|
3693
|
-
if (!isPlainObject(parsed)) {
|
|
3703
|
+
if (!isPlainObject$1(parsed)) {
|
|
3694
3704
|
// Valid JSON, but not an object (e.g. an array, a scalar, or the literal `null`).
|
|
3695
3705
|
throw createClientConfigurationError(invalidClaims, correlationId);
|
|
3696
3706
|
}
|
|
@@ -3701,7 +3711,7 @@ function parseClaims(claims, correlationId = "") {
|
|
|
3701
3711
|
* @param value - The value to test
|
|
3702
3712
|
* @returns True when value is a plain object that can be deep-merged
|
|
3703
3713
|
*/
|
|
3704
|
-
function isPlainObject(value) {
|
|
3714
|
+
function isPlainObject$1(value) {
|
|
3705
3715
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3706
3716
|
}
|
|
3707
3717
|
/**
|
|
@@ -3718,7 +3728,7 @@ function deepMergeClaims(baseClaims, claimsToMerge) {
|
|
|
3718
3728
|
const merged = { ...baseClaims };
|
|
3719
3729
|
for (const [key, mergeInValue] of Object.entries(claimsToMerge)) {
|
|
3720
3730
|
const baseValue = merged[key];
|
|
3721
|
-
if (isPlainObject(baseValue) && isPlainObject(mergeInValue)) {
|
|
3731
|
+
if (isPlainObject$1(baseValue) && isPlainObject$1(mergeInValue)) {
|
|
3722
3732
|
merged[key] = deepMergeClaims(baseValue, mergeInValue);
|
|
3723
3733
|
}
|
|
3724
3734
|
else {
|
|
@@ -3858,7 +3868,7 @@ function addAttributeTokens(parameters, attributeTokens) {
|
|
|
3858
3868
|
}
|
|
3859
3869
|
}
|
|
3860
3870
|
|
|
3861
|
-
/*! @azure/msal-common v16.
|
|
3871
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
3862
3872
|
|
|
3863
3873
|
/*
|
|
3864
3874
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3916,12 +3926,19 @@ function mapToQueryString(parameters) {
|
|
|
3916
3926
|
return queryParameterArray.join("&");
|
|
3917
3927
|
}
|
|
3918
3928
|
|
|
3919
|
-
/*! @azure/msal-common v16.
|
|
3929
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
3920
3930
|
|
|
3921
3931
|
/*
|
|
3922
3932
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3923
3933
|
* Licensed under the MIT License.
|
|
3924
3934
|
*/
|
|
3935
|
+
/**
|
|
3936
|
+
* Shared JOSE algorithm literals used by MSAL package internals.
|
|
3937
|
+
* @internal
|
|
3938
|
+
*/
|
|
3939
|
+
const JsonWebTokenAlgorithms = {
|
|
3940
|
+
RS256: "RS256",
|
|
3941
|
+
};
|
|
3925
3942
|
/**
|
|
3926
3943
|
* Default crypto implementation used when a platform-specific implementation has
|
|
3927
3944
|
* not been provided.
|
|
@@ -3942,24 +3959,44 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
|
|
|
3942
3959
|
encodeKid: () => {
|
|
3943
3960
|
throw createClientAuthError(methodNotImplemented, "");
|
|
3944
3961
|
},
|
|
3945
|
-
async
|
|
3946
|
-
throw createClientAuthError(methodNotImplemented,
|
|
3962
|
+
async removeTokenBindingKey(kid, correlationId) {
|
|
3963
|
+
throw createClientAuthError(methodNotImplemented, correlationId);
|
|
3947
3964
|
},
|
|
3948
|
-
async
|
|
3949
|
-
throw createClientAuthError(methodNotImplemented,
|
|
3950
|
-
},
|
|
3951
|
-
async clearKeystore() {
|
|
3952
|
-
throw createClientAuthError(methodNotImplemented, "");
|
|
3965
|
+
async clearKeystore(correlationId) {
|
|
3966
|
+
throw createClientAuthError(methodNotImplemented, correlationId);
|
|
3953
3967
|
},
|
|
3954
|
-
async
|
|
3955
|
-
throw createClientAuthError(methodNotImplemented,
|
|
3968
|
+
async signTokenBindingJwt(header, payload, kid, correlationId) {
|
|
3969
|
+
throw createClientAuthError(methodNotImplemented, correlationId);
|
|
3956
3970
|
},
|
|
3957
3971
|
async hashString() {
|
|
3958
3972
|
throw createClientAuthError(methodNotImplemented, "");
|
|
3959
3973
|
},
|
|
3960
3974
|
};
|
|
3961
3975
|
|
|
3962
|
-
/*! @azure/msal-common v16.
|
|
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 */
|
|
3963
4000
|
/*
|
|
3964
4001
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3965
4002
|
* Licensed under the MIT License.
|
|
@@ -4234,12 +4271,12 @@ class Logger {
|
|
|
4234
4271
|
}
|
|
4235
4272
|
}
|
|
4236
4273
|
|
|
4237
|
-
/*! @azure/msal-common v16.
|
|
4274
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
4238
4275
|
/* eslint-disable header/header */
|
|
4239
4276
|
const name$1 = "@azure/msal-common";
|
|
4240
|
-
const version$1 = "16.
|
|
4277
|
+
const version$1 = "16.13.0";
|
|
4241
4278
|
|
|
4242
|
-
/*! @azure/msal-common v16.
|
|
4279
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
4243
4280
|
/*
|
|
4244
4281
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4245
4282
|
* Licensed under the MIT License.
|
|
@@ -4247,7 +4284,7 @@ const version$1 = "16.12.0";
|
|
|
4247
4284
|
const cacheQuotaExceeded = "cache_quota_exceeded";
|
|
4248
4285
|
const cacheErrorUnknown = "cache_error_unknown";
|
|
4249
4286
|
|
|
4250
|
-
/*! @azure/msal-common v16.
|
|
4287
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
4251
4288
|
|
|
4252
4289
|
/*
|
|
4253
4290
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4285,7 +4322,7 @@ function createCacheError(e) {
|
|
|
4285
4322
|
}
|
|
4286
4323
|
}
|
|
4287
4324
|
|
|
4288
|
-
/*! @azure/msal-common v16.
|
|
4325
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
4289
4326
|
|
|
4290
4327
|
/*
|
|
4291
4328
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4646,16 +4683,9 @@ class CacheManager {
|
|
|
4646
4683
|
// Access Token with Auth Scheme specific matching
|
|
4647
4684
|
if (entity.credentialType ===
|
|
4648
4685
|
CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME) {
|
|
4649
|
-
if (
|
|
4650
|
-
!this.matchTokenType(entity, filter.tokenType)) {
|
|
4686
|
+
if (!this.matchAccessTokenWithAuthScheme(entity, filter)) {
|
|
4651
4687
|
return false;
|
|
4652
4688
|
}
|
|
4653
|
-
// KeyId (sshKid) in request must match cached SSH certificate keyId because SSH cert is bound to a specific key
|
|
4654
|
-
if (filter.tokenType === AuthenticationScheme.SSH) {
|
|
4655
|
-
if (filter.keyId && !this.matchKeyId(entity, filter.keyId)) {
|
|
4656
|
-
return false;
|
|
4657
|
-
}
|
|
4658
|
-
}
|
|
4659
4689
|
}
|
|
4660
4690
|
// Additional cache key components matching (bidirectional isolation)
|
|
4661
4691
|
const entityComponents = entity.additionalCacheKeyComponents;
|
|
@@ -4971,7 +5001,9 @@ class CacheManager {
|
|
|
4971
5001
|
realm: targetRealm || account.tenantId,
|
|
4972
5002
|
target: scopes,
|
|
4973
5003
|
tokenType: authScheme,
|
|
4974
|
-
keyId:
|
|
5004
|
+
keyId: authScheme === AuthenticationScheme.SSH
|
|
5005
|
+
? request.sshKid
|
|
5006
|
+
: undefined,
|
|
4975
5007
|
additionalCacheKeyComponents: additionalCacheKeyComponents,
|
|
4976
5008
|
};
|
|
4977
5009
|
const accessTokenKeys = (tokenKeys && tokenKeys.accessToken) ||
|
|
@@ -5333,7 +5365,29 @@ class CacheManager {
|
|
|
5333
5365
|
* @param tokenType
|
|
5334
5366
|
*/
|
|
5335
5367
|
matchTokenType(entity, tokenType) {
|
|
5336
|
-
return !!(entity.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);
|
|
5337
5391
|
}
|
|
5338
5392
|
/**
|
|
5339
5393
|
* Returns true if the credential's keyId matches the one in the request, false otherwise
|
|
@@ -5450,7 +5504,7 @@ class DefaultStorageClass extends CacheManager {
|
|
|
5450
5504
|
}
|
|
5451
5505
|
}
|
|
5452
5506
|
|
|
5453
|
-
/*! @azure/msal-common v16.
|
|
5507
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
5454
5508
|
/*
|
|
5455
5509
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5456
5510
|
* Licensed under the MIT License.
|
|
@@ -5464,7 +5518,7 @@ class DefaultStorageClass extends CacheManager {
|
|
|
5464
5518
|
const PerformanceEventStatus = {
|
|
5465
5519
|
InProgress: 1};
|
|
5466
5520
|
|
|
5467
|
-
/*! @azure/msal-common v16.
|
|
5521
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
5468
5522
|
|
|
5469
5523
|
/*
|
|
5470
5524
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5522,7 +5576,7 @@ class StubPerformanceClient {
|
|
|
5522
5576
|
}
|
|
5523
5577
|
}
|
|
5524
5578
|
|
|
5525
|
-
/*! @azure/msal-common v16.
|
|
5579
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
5526
5580
|
|
|
5527
5581
|
/*
|
|
5528
5582
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5576,7 +5630,7 @@ const DEFAULT_TELEMETRY_OPTIONS$1 = {
|
|
|
5576
5630
|
* @returns Configuration
|
|
5577
5631
|
* @internal
|
|
5578
5632
|
*/
|
|
5579
|
-
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, }) {
|
|
5580
5634
|
const loggerOptions = {
|
|
5581
5635
|
...DEFAULT_LOGGER_IMPLEMENTATION,
|
|
5582
5636
|
...userLoggerOption,
|
|
@@ -5589,6 +5643,7 @@ function buildClientConfiguration({ authOptions: userAuthOptions, systemOptions:
|
|
|
5589
5643
|
new DefaultStorageClass(userAuthOptions.clientId, DEFAULT_CRYPTO_IMPLEMENTATION, new Logger(loggerOptions, name$1, version$1), new StubPerformanceClient()),
|
|
5590
5644
|
networkInterface: networkImplementation || DEFAULT_NETWORK_IMPLEMENTATION,
|
|
5591
5645
|
cryptoInterface: cryptoImplementation || DEFAULT_CRYPTO_IMPLEMENTATION,
|
|
5646
|
+
tokenBindingKeyManager: tokenBindingKeyManager || DEFAULT_TOKEN_BINDING_KEY_MANAGER,
|
|
5592
5647
|
clientCredentials: clientCredentials || DEFAULT_CLIENT_CREDENTIALS,
|
|
5593
5648
|
libraryInfo: { ...DEFAULT_LIBRARY_INFO, ...libraryInfo },
|
|
5594
5649
|
telemetry: { ...DEFAULT_TELEMETRY_OPTIONS$1, ...telemetry },
|
|
@@ -5618,7 +5673,7 @@ function isOidcProtocolMode(config) {
|
|
|
5618
5673
|
return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
|
|
5619
5674
|
}
|
|
5620
5675
|
|
|
5621
|
-
/*! @azure/msal-common v16.
|
|
5676
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
5622
5677
|
/*
|
|
5623
5678
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5624
5679
|
* Licensed under the MIT License.
|
|
@@ -5645,7 +5700,129 @@ function isOidcProtocolMode(config) {
|
|
|
5645
5700
|
}
|
|
5646
5701
|
}
|
|
5647
5702
|
|
|
5648
|
-
/*! @azure/msal-common v16.
|
|
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 */
|
|
5649
5826
|
|
|
5650
5827
|
/*
|
|
5651
5828
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5653,10 +5830,13 @@ function isOidcProtocolMode(config) {
|
|
|
5653
5830
|
*/
|
|
5654
5831
|
const KeyLocation = {
|
|
5655
5832
|
SW: "sw"};
|
|
5833
|
+
const SHR_TOKEN_BINDING_KEY_TYPE = "shr";
|
|
5834
|
+
const SHR_TOKEN_BINDING_KEY_ALGORITHM = JsonWebTokenAlgorithms.RS256;
|
|
5656
5835
|
/** @internal */
|
|
5657
5836
|
class PopTokenGenerator {
|
|
5658
|
-
constructor(cryptoUtils, performanceClient) {
|
|
5837
|
+
constructor(cryptoUtils, tokenBindingKeyManager, performanceClient) {
|
|
5659
5838
|
this.cryptoUtils = cryptoUtils;
|
|
5839
|
+
this.tokenBindingKeyManager = tokenBindingKeyManager;
|
|
5660
5840
|
this.performanceClient = performanceClient;
|
|
5661
5841
|
}
|
|
5662
5842
|
/**
|
|
@@ -5679,7 +5859,11 @@ class PopTokenGenerator {
|
|
|
5679
5859
|
* @returns
|
|
5680
5860
|
*/
|
|
5681
5861
|
async generateKid(request) {
|
|
5682
|
-
const kidThumbprint = await this.
|
|
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
|
+
});
|
|
5683
5867
|
return {
|
|
5684
5868
|
kid: kidThumbprint,
|
|
5685
5869
|
xms_ksl: KeyLocation.SW,
|
|
@@ -5709,7 +5893,17 @@ class PopTokenGenerator {
|
|
|
5709
5893
|
? new UrlString(resourceRequestUri, request.correlationId)
|
|
5710
5894
|
: undefined;
|
|
5711
5895
|
const resourceUrlComponents = resourceUrlString?.getUrlComponents();
|
|
5712
|
-
|
|
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 = {
|
|
5713
5907
|
at: payload,
|
|
5714
5908
|
ts: nowSeconds(),
|
|
5715
5909
|
m: resourceRequestMethod?.toUpperCase(),
|
|
@@ -5721,11 +5915,15 @@ class PopTokenGenerator {
|
|
|
5721
5915
|
: undefined,
|
|
5722
5916
|
client_claims: shrClaims || undefined,
|
|
5723
5917
|
...claims,
|
|
5724
|
-
|
|
5918
|
+
cnf: {
|
|
5919
|
+
jwk: publicKeyJwk,
|
|
5920
|
+
},
|
|
5921
|
+
};
|
|
5922
|
+
return this.cryptoUtils.signTokenBindingJwt(shrHeader, shrPayload, keyId, request.correlationId);
|
|
5725
5923
|
}
|
|
5726
5924
|
}
|
|
5727
5925
|
|
|
5728
|
-
/*! @azure/msal-common v16.
|
|
5926
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
5729
5927
|
/*
|
|
5730
5928
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5731
5929
|
* Licensed under the MIT License.
|
|
@@ -5789,7 +5987,7 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
5789
5987
|
uiNotAllowed: uiNotAllowed
|
|
5790
5988
|
});
|
|
5791
5989
|
|
|
5792
|
-
/*! @azure/msal-common v16.
|
|
5990
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
5793
5991
|
|
|
5794
5992
|
/*
|
|
5795
5993
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5856,7 +6054,7 @@ function createInteractionRequiredAuthError(errorCode, correlationId, errorMessa
|
|
|
5856
6054
|
return new InteractionRequiredAuthError(errorCode, correlationId, errorMessage);
|
|
5857
6055
|
}
|
|
5858
6056
|
|
|
5859
|
-
/*! @azure/msal-common v16.
|
|
6057
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
5860
6058
|
|
|
5861
6059
|
/*
|
|
5862
6060
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5875,7 +6073,7 @@ class ServerError extends AuthError {
|
|
|
5875
6073
|
}
|
|
5876
6074
|
}
|
|
5877
6075
|
|
|
5878
|
-
/*! @azure/msal-common v16.
|
|
6076
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
5879
6077
|
/**
|
|
5880
6078
|
* Parses the state into the RequestStateObject, which contains the LibraryState info and the state passed by the user.
|
|
5881
6079
|
* @param base64Decode
|
|
@@ -5908,7 +6106,7 @@ function parseRequestState(base64Decode, state, correlationId) {
|
|
|
5908
6106
|
}
|
|
5909
6107
|
}
|
|
5910
6108
|
|
|
5911
|
-
/*! @azure/msal-common v16.
|
|
6109
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
5912
6110
|
|
|
5913
6111
|
/*
|
|
5914
6112
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5919,10 +6117,11 @@ function parseRequestState(base64Decode, state, correlationId) {
|
|
|
5919
6117
|
* @internal
|
|
5920
6118
|
*/
|
|
5921
6119
|
class ResponseHandler {
|
|
5922
|
-
constructor(clientId, cacheStorage, cryptoObj, logger, performanceClient, serializableCache, persistencePlugin) {
|
|
6120
|
+
constructor(clientId, cacheStorage, cryptoObj, logger, performanceClient, serializableCache, persistencePlugin, tokenBindingKeyManager = DEFAULT_TOKEN_BINDING_KEY_MANAGER) {
|
|
5923
6121
|
this.clientId = clientId;
|
|
5924
6122
|
this.cacheStorage = cacheStorage;
|
|
5925
6123
|
this.cryptoObj = cryptoObj;
|
|
6124
|
+
this.tokenBindingKeyManager = tokenBindingKeyManager;
|
|
5926
6125
|
this.logger = logger;
|
|
5927
6126
|
this.performanceClient = performanceClient;
|
|
5928
6127
|
this.serializableCache = serializableCache;
|
|
@@ -6031,7 +6230,12 @@ class ResponseHandler {
|
|
|
6031
6230
|
this.performanceClient?.addFields({
|
|
6032
6231
|
acntLoggedOut: true,
|
|
6033
6232
|
}, request.correlationId);
|
|
6034
|
-
return await ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, this.performanceClient,
|
|
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
|
+
});
|
|
6035
6239
|
}
|
|
6036
6240
|
}
|
|
6037
6241
|
await this.cacheStorage.saveCacheRecord(cacheRecord, request.correlationId, isKmsi(idTokenClaims || {}), apiId, request.storeInCache);
|
|
@@ -6044,7 +6248,13 @@ class ResponseHandler {
|
|
|
6044
6248
|
await this.persistencePlugin.afterCacheAccess(cacheContext);
|
|
6045
6249
|
}
|
|
6046
6250
|
}
|
|
6047
|
-
return ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, this.performanceClient,
|
|
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
|
+
});
|
|
6048
6258
|
}
|
|
6049
6259
|
/**
|
|
6050
6260
|
* Generates CacheRecord
|
|
@@ -6140,7 +6350,8 @@ class ResponseHandler {
|
|
|
6140
6350
|
* @param fromTokenCache
|
|
6141
6351
|
* @param stateString
|
|
6142
6352
|
*/
|
|
6143
|
-
static async generateAuthenticationResult(cryptoObj, authority, cacheRecord, fromTokenCache, request, performanceClient,
|
|
6353
|
+
static async generateAuthenticationResult(cryptoObj, authority, cacheRecord, fromTokenCache, request, performanceClient, options = {}) {
|
|
6354
|
+
const { idTokenClaims, requestState, serverTokenResponse, requestId, tokenBindingKeyManager = DEFAULT_TOKEN_BINDING_KEY_MANAGER, } = options;
|
|
6144
6355
|
let accessToken = "";
|
|
6145
6356
|
let responseScopes = [];
|
|
6146
6357
|
let expiresOn = null;
|
|
@@ -6155,7 +6366,7 @@ class ResponseHandler {
|
|
|
6155
6366
|
if (cacheRecord.accessToken.tokenType ===
|
|
6156
6367
|
AuthenticationScheme.POP &&
|
|
6157
6368
|
!request.popKid) {
|
|
6158
|
-
const popTokenGenerator = new PopTokenGenerator(cryptoObj, performanceClient);
|
|
6369
|
+
const popTokenGenerator = new PopTokenGenerator(cryptoObj, tokenBindingKeyManager, performanceClient);
|
|
6159
6370
|
const { secret, keyId } = cacheRecord.accessToken;
|
|
6160
6371
|
if (!keyId) {
|
|
6161
6372
|
throw createClientAuthError(keyIdMissing, request.correlationId);
|
|
@@ -6267,7 +6478,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
|
|
|
6267
6478
|
return baseAccount;
|
|
6268
6479
|
}
|
|
6269
6480
|
|
|
6270
|
-
/*! @azure/msal-common v16.
|
|
6481
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
6271
6482
|
/*
|
|
6272
6483
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6273
6484
|
* Licensed under the MIT License.
|
|
@@ -6277,7 +6488,7 @@ const CcsCredentialType = {
|
|
|
6277
6488
|
UPN: "UPN",
|
|
6278
6489
|
};
|
|
6279
6490
|
|
|
6280
|
-
/*! @azure/msal-common v16.
|
|
6491
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
6281
6492
|
/*
|
|
6282
6493
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6283
6494
|
* Licensed under the MIT License.
|
|
@@ -6296,7 +6507,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint, fmiP
|
|
|
6296
6507
|
}
|
|
6297
6508
|
}
|
|
6298
6509
|
|
|
6299
|
-
/*! @azure/msal-common v16.
|
|
6510
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
6300
6511
|
|
|
6301
6512
|
/*
|
|
6302
6513
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6320,7 +6531,7 @@ function getRequestThumbprint(clientId, request, homeAccountId) {
|
|
|
6320
6531
|
};
|
|
6321
6532
|
}
|
|
6322
6533
|
|
|
6323
|
-
/*! @azure/msal-common v16.
|
|
6534
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
6324
6535
|
|
|
6325
6536
|
/*
|
|
6326
6537
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6406,7 +6617,7 @@ class ThrottlingUtils {
|
|
|
6406
6617
|
}
|
|
6407
6618
|
}
|
|
6408
6619
|
|
|
6409
|
-
/*! @azure/msal-common v16.
|
|
6620
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
6410
6621
|
|
|
6411
6622
|
/*
|
|
6412
6623
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6437,7 +6648,7 @@ function createNetworkError(error, httpStatus, responseHeaders, additionalError)
|
|
|
6437
6648
|
return new NetworkError(error, httpStatus, responseHeaders);
|
|
6438
6649
|
}
|
|
6439
6650
|
|
|
6440
|
-
/*! @azure/msal-common v16.
|
|
6651
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
6441
6652
|
|
|
6442
6653
|
/*
|
|
6443
6654
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6553,7 +6764,7 @@ async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId
|
|
|
6553
6764
|
return response;
|
|
6554
6765
|
}
|
|
6555
6766
|
|
|
6556
|
-
/*! @azure/msal-common v16.
|
|
6767
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
6557
6768
|
|
|
6558
6769
|
/*
|
|
6559
6770
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6603,7 +6814,7 @@ class AuthorizationCodeClient {
|
|
|
6603
6814
|
const response = await invokeAsync(this.executeTokenRequest.bind(this), AuthClientExecuteTokenRequest, this.logger, this.performanceClient, request.correlationId)(this.authority, request, this.serverTelemetryManager);
|
|
6604
6815
|
// Retrieve requestId from response headers
|
|
6605
6816
|
const requestId = response.headers?.[HeaderNames.X_MS_REQUEST_ID];
|
|
6606
|
-
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);
|
|
6607
6818
|
// Validate response. This function throws a server error if an error is returned by the server.
|
|
6608
6819
|
responseHandler.validateTokenResponse(response.body, request.correlationId);
|
|
6609
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);
|
|
@@ -6704,7 +6915,7 @@ class AuthorizationCodeClient {
|
|
|
6704
6915
|
addGrantType(parameters, GrantType.AUTHORIZATION_CODE_GRANT);
|
|
6705
6916
|
addClientInfo(parameters);
|
|
6706
6917
|
if (request.authenticationScheme === AuthenticationScheme.POP) {
|
|
6707
|
-
const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
|
|
6918
|
+
const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.config.tokenBindingKeyManager, this.performanceClient);
|
|
6708
6919
|
let reqCnfData;
|
|
6709
6920
|
if (!request.popKid) {
|
|
6710
6921
|
const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
|
|
@@ -6816,7 +7027,7 @@ class AuthorizationCodeClient {
|
|
|
6816
7027
|
}
|
|
6817
7028
|
}
|
|
6818
7029
|
|
|
6819
|
-
/*! @azure/msal-common v16.
|
|
7030
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
6820
7031
|
|
|
6821
7032
|
/*
|
|
6822
7033
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6967,7 +7178,7 @@ function extractLoginHint(account) {
|
|
|
6967
7178
|
return account.loginHint || account.idTokenClaims?.login_hint || null;
|
|
6968
7179
|
}
|
|
6969
7180
|
|
|
6970
|
-
/*! @azure/msal-common v16.
|
|
7181
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
6971
7182
|
|
|
6972
7183
|
/*
|
|
6973
7184
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7002,7 +7213,7 @@ class RefreshTokenClient {
|
|
|
7002
7213
|
const response = await invokeAsync(this.executeTokenRequest.bind(this), RefreshTokenClientExecuteTokenRequest, this.logger, this.performanceClient, request.correlationId)(request, this.authority);
|
|
7003
7214
|
// Retrieve requestId from response headers
|
|
7004
7215
|
const requestId = response.headers?.[HeaderNames.X_MS_REQUEST_ID];
|
|
7005
|
-
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);
|
|
7006
7217
|
responseHandler.validateTokenResponse(response.body, request.correlationId);
|
|
7007
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);
|
|
7008
7219
|
}
|
|
@@ -7143,7 +7354,7 @@ class RefreshTokenClient {
|
|
|
7143
7354
|
addClientAssertionType(parameters, clientAssertion.assertionType);
|
|
7144
7355
|
}
|
|
7145
7356
|
if (request.authenticationScheme === AuthenticationScheme.POP) {
|
|
7146
|
-
const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
|
|
7357
|
+
const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.config.tokenBindingKeyManager, this.performanceClient);
|
|
7147
7358
|
let reqCnfData;
|
|
7148
7359
|
if (!request.popKid) {
|
|
7149
7360
|
const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
|
|
@@ -7194,7 +7405,7 @@ class RefreshTokenClient {
|
|
|
7194
7405
|
}
|
|
7195
7406
|
}
|
|
7196
7407
|
|
|
7197
|
-
/*! @azure/msal-common v16.
|
|
7408
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
7198
7409
|
|
|
7199
7410
|
/*
|
|
7200
7411
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7460,7 +7671,7 @@ class ServerTelemetryManager {
|
|
|
7460
7671
|
}
|
|
7461
7672
|
}
|
|
7462
7673
|
|
|
7463
|
-
/*! @azure/msal-common v16.
|
|
7674
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
7464
7675
|
|
|
7465
7676
|
/*
|
|
7466
7677
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7564,11 +7775,14 @@ class SilentFlowClient {
|
|
|
7564
7775
|
if (cacheRecord.idToken) {
|
|
7565
7776
|
idTokenClaims = extractTokenClaims(cacheRecord.idToken.secret, this.config.cryptoInterface.base64Decode, request.correlationId);
|
|
7566
7777
|
}
|
|
7567
|
-
return ResponseHandler.generateAuthenticationResult(this.cryptoUtils, this.authority, cacheRecord, true, request, this.performanceClient,
|
|
7778
|
+
return ResponseHandler.generateAuthenticationResult(this.cryptoUtils, this.authority, cacheRecord, true, request, this.performanceClient, {
|
|
7779
|
+
idTokenClaims,
|
|
7780
|
+
tokenBindingKeyManager: this.config.tokenBindingKeyManager,
|
|
7781
|
+
});
|
|
7568
7782
|
}
|
|
7569
7783
|
}
|
|
7570
7784
|
|
|
7571
|
-
/*! @azure/msal-common v16.
|
|
7785
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
7572
7786
|
|
|
7573
7787
|
/*
|
|
7574
7788
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8117,6 +8331,7 @@ const unableToCreateCloudShell = "unable_to_create_cloud_shell";
|
|
|
8117
8331
|
const unableToCreateSource = "unable_to_create_source";
|
|
8118
8332
|
const unableToReadSecretFile = "unable_to_read_secret_file";
|
|
8119
8333
|
const userAssignedNotAvailableAtRuntime = "user_assigned_not_available_at_runtime";
|
|
8334
|
+
const userAssignedManagedIdentityNotConfirmed = "user_assigned_managed_identity_not_confirmed";
|
|
8120
8335
|
const wwwAuthenticateHeaderMissing = "www_authenticate_header_missing";
|
|
8121
8336
|
const wwwAuthenticateHeaderUnsupportedFormat = "www_authenticate_header_unsupported_format";
|
|
8122
8337
|
const MsiEnvironmentVariableUrlMalformedErrorCodes = {
|
|
@@ -8154,8 +8369,9 @@ const ManagedIdentityErrorMessages = {
|
|
|
8154
8369
|
[unableToCreateSource]: "Unable to create a Managed Identity source based on environment variables.",
|
|
8155
8370
|
[unableToReadSecretFile]: "Unable to read the secret file.",
|
|
8156
8371
|
[userAssignedNotAvailableAtRuntime]: "Service Fabric user assigned managed identity ClientId or ResourceId is not configurable at runtime.",
|
|
8157
|
-
[
|
|
8158
|
-
[
|
|
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.",
|
|
8159
8375
|
};
|
|
8160
8376
|
class ManagedIdentityError extends AuthError {
|
|
8161
8377
|
constructor(errorCode, correlationId) {
|
|
@@ -8612,30 +8828,30 @@ class CryptoProvider {
|
|
|
8612
8828
|
generatePkceCodes() {
|
|
8613
8829
|
return this.pkceGenerator.generatePkceCodes();
|
|
8614
8830
|
}
|
|
8615
|
-
/**
|
|
8616
|
-
* Generates a keypair, stores it and returns a thumbprint - not yet implemented for node
|
|
8617
|
-
*/
|
|
8618
|
-
getPublicKeyThumbprint() {
|
|
8619
|
-
throw new Error("Method not implemented.");
|
|
8620
|
-
}
|
|
8621
8831
|
/**
|
|
8622
8832
|
* Removes cryptographic keypair from key store matching the keyId passed in
|
|
8623
8833
|
* @param kid - public key id
|
|
8834
|
+
* @param correlationId - correlation id
|
|
8624
8835
|
*/
|
|
8625
|
-
removeTokenBindingKey() {
|
|
8836
|
+
removeTokenBindingKey(kid, correlationId) {
|
|
8626
8837
|
throw new Error("Method not implemented.");
|
|
8627
8838
|
}
|
|
8628
8839
|
/**
|
|
8629
8840
|
* Removes all cryptographic keys from Keystore
|
|
8841
|
+
* @param correlationId - correlation id
|
|
8630
8842
|
*/
|
|
8631
|
-
clearKeystore() {
|
|
8843
|
+
clearKeystore(correlationId) {
|
|
8632
8844
|
throw new Error("Method not implemented.");
|
|
8633
8845
|
}
|
|
8634
8846
|
/**
|
|
8635
|
-
* Signs
|
|
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
|
|
8636
8852
|
*/
|
|
8637
|
-
|
|
8638
|
-
throw
|
|
8853
|
+
signTokenBindingJwt(header, payload, kid, correlationId) {
|
|
8854
|
+
throw createClientAuthError(methodNotImplemented, correlationId);
|
|
8639
8855
|
}
|
|
8640
8856
|
/**
|
|
8641
8857
|
* Returns the SHA-256 hash of an input string
|
|
@@ -9596,7 +9812,7 @@ class ClientAssertion {
|
|
|
9596
9812
|
|
|
9597
9813
|
/* eslint-disable header/header */
|
|
9598
9814
|
const name = "@azure/msal-node";
|
|
9599
|
-
const version = "5.
|
|
9815
|
+
const version = "5.6.0";
|
|
9600
9816
|
|
|
9601
9817
|
/*
|
|
9602
9818
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -9682,7 +9898,7 @@ class UsernamePasswordClient extends BaseClient {
|
|
|
9682
9898
|
this.logger.info("in acquireToken call in username-password client", request.correlationId);
|
|
9683
9899
|
const reqTimestamp = nowSeconds();
|
|
9684
9900
|
const response = await this.executeTokenRequest(this.authority, request);
|
|
9685
|
-
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);
|
|
9686
9902
|
// Validate response. This function throws a server error if an error is returned by the server.
|
|
9687
9903
|
responseHandler.validateTokenResponse(response.body, request.correlationId);
|
|
9688
9904
|
const tokenResponse = responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, ApiId.acquireTokenByUsernamePassword);
|
|
@@ -9843,11 +10059,21 @@ class ClientApplication {
|
|
|
9843
10059
|
*/
|
|
9844
10060
|
async acquireTokenByCode(request, authCodePayLoad) {
|
|
9845
10061
|
this.logger.info("acquireTokenByCode called", request.correlationId || "");
|
|
9846
|
-
|
|
10062
|
+
let validatedAuthCodePayload = authCodePayLoad;
|
|
10063
|
+
if (request.state && validatedAuthCodePayload) {
|
|
9847
10064
|
this.logger.info("acquireTokenByCode - validating state", request.correlationId || "");
|
|
9848
|
-
this.validateState(request.state,
|
|
9849
|
-
|
|
9850
|
-
|
|
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
|
+
};
|
|
9851
10077
|
}
|
|
9852
10078
|
const validRequest = {
|
|
9853
10079
|
...request,
|
|
@@ -9860,7 +10086,7 @@ class ClientApplication {
|
|
|
9860
10086
|
const authClientConfig = await this.buildOauthClientConfiguration(discoveredAuthority, validRequest.correlationId, validRequest.redirectUri, serverTelemetryManager);
|
|
9861
10087
|
const authorizationCodeClient = new AuthorizationCodeClient(authClientConfig, new StubPerformanceClient());
|
|
9862
10088
|
this.logger.verbose("Auth code client created", validRequest.correlationId);
|
|
9863
|
-
return await authorizationCodeClient.acquireToken(validRequest, ApiId.acquireTokenByCode,
|
|
10089
|
+
return await authorizationCodeClient.acquireToken(validRequest, ApiId.acquireTokenByCode, validatedAuthCodePayload);
|
|
9864
10090
|
}
|
|
9865
10091
|
catch (e) {
|
|
9866
10092
|
if (e instanceof AuthError) {
|
|
@@ -10343,7 +10569,7 @@ class DeviceCodeClient extends BaseClient {
|
|
|
10343
10569
|
request.deviceCodeCallback(deviceCodeResponse);
|
|
10344
10570
|
const reqTimestamp = nowSeconds();
|
|
10345
10571
|
const response = await this.acquireTokenWithDeviceCode(request, deviceCodeResponse);
|
|
10346
|
-
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);
|
|
10347
10573
|
// Validate response. This function throws a server error if an error is returned by the server.
|
|
10348
10574
|
responseHandler.validateTokenResponse(response, request.correlationId);
|
|
10349
10575
|
return responseHandler.handleServerTokenResponse(response, this.authority, reqTimestamp, request, ApiId.acquireTokenByDeviceCode);
|
|
@@ -10926,7 +11152,9 @@ class ClientCredentialClient extends BaseClient {
|
|
|
10926
11152
|
accessToken: cachedAccessToken,
|
|
10927
11153
|
refreshToken: null,
|
|
10928
11154
|
appMetadata: null,
|
|
10929
|
-
}, true, request, this.performanceClient
|
|
11155
|
+
}, true, request, this.performanceClient, {
|
|
11156
|
+
tokenBindingKeyManager: this.config.tokenBindingKeyManager,
|
|
11157
|
+
}),
|
|
10930
11158
|
lastCacheOutcome,
|
|
10931
11159
|
];
|
|
10932
11160
|
}
|
|
@@ -10999,7 +11227,7 @@ class ClientCredentialClient extends BaseClient {
|
|
|
10999
11227
|
serverTokenResponse = response.body;
|
|
11000
11228
|
serverTokenResponse.status = response.status;
|
|
11001
11229
|
}
|
|
11002
|
-
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);
|
|
11003
11231
|
responseHandler.validateTokenResponse(serverTokenResponse, request.correlationId, refreshAccessToken);
|
|
11004
11232
|
const tokenResponse = await responseHandler.handleServerTokenResponse(serverTokenResponse, this.authority, reqTimestamp, request, ApiId.acquireTokenByClientCredential, undefined, // authCodePayload
|
|
11005
11233
|
undefined, // userAssertionHash
|
|
@@ -11149,7 +11377,10 @@ class OnBehalfOfClient extends BaseClient {
|
|
|
11149
11377
|
idToken: cachedIdToken,
|
|
11150
11378
|
refreshToken: null,
|
|
11151
11379
|
appMetadata: null,
|
|
11152
|
-
}, true, request, this.performanceClient,
|
|
11380
|
+
}, true, request, this.performanceClient, {
|
|
11381
|
+
idTokenClaims,
|
|
11382
|
+
tokenBindingKeyManager: this.config.tokenBindingKeyManager,
|
|
11383
|
+
});
|
|
11153
11384
|
}
|
|
11154
11385
|
/**
|
|
11155
11386
|
* read idtoken from cache, this is a specific implementation for OBO as the requirements differ from a generic lookup in the cacheManager
|
|
@@ -11229,7 +11460,7 @@ class OnBehalfOfClient extends BaseClient {
|
|
|
11229
11460
|
};
|
|
11230
11461
|
const reqTimestamp = nowSeconds();
|
|
11231
11462
|
const response = await this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint, request.correlationId);
|
|
11232
|
-
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);
|
|
11233
11464
|
responseHandler.validateTokenResponse(response.body, request.correlationId);
|
|
11234
11465
|
const tokenResponse = await responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, ApiId.acquireTokenByOBO, undefined, // authCodePayload
|
|
11235
11466
|
userAssertionHash, // userAssertionHash
|
|
@@ -11329,7 +11560,7 @@ class UserFederatedIdentityCredentialClient extends BaseClient {
|
|
|
11329
11560
|
};
|
|
11330
11561
|
const reqTimestamp = nowSeconds();
|
|
11331
11562
|
const response = await this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint, request.correlationId);
|
|
11332
|
-
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);
|
|
11333
11564
|
responseHandler.validateTokenResponse(response.body, request.correlationId);
|
|
11334
11565
|
const tokenResponse = await responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, ApiId.acquireTokenByUserFederatedIdentityCredential);
|
|
11335
11566
|
return tokenResponse;
|
|
@@ -12209,22 +12440,24 @@ class AzureArc extends BaseManagedIdentitySource {
|
|
|
12209
12440
|
* Attempts to create an AzureArc managed identity source instance.
|
|
12210
12441
|
*
|
|
12211
12442
|
* Validates the Azure Arc environment by checking environment variables
|
|
12212
|
-
* and performing file-based detection.
|
|
12213
|
-
*
|
|
12214
|
-
*
|
|
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.
|
|
12215
12447
|
*
|
|
12216
12448
|
* @param logger - Logger instance for capturing creation and validation steps
|
|
12217
12449
|
* @param nodeStorage - Storage implementation for the managed identity source
|
|
12218
12450
|
* @param networkClient - Network client for HTTP communication
|
|
12219
12451
|
* @param cryptoProvider - Cryptographic operations provider
|
|
12220
12452
|
* @param disableInternalRetries - Whether to disable automatic retry mechanisms
|
|
12221
|
-
* @param
|
|
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).
|
|
12222
12455
|
*
|
|
12223
12456
|
* @returns AzureArc instance if the environment supports Azure Arc managed identity, null otherwise
|
|
12224
|
-
*
|
|
12225
|
-
* @throws {ManagedIdentityError} When a user-assigned managed identity is specified (not supported for Azure Arc)
|
|
12226
12457
|
*/
|
|
12227
|
-
static tryCreate(logger, nodeStorage, networkClient, cryptoProvider, disableInternalRetries,
|
|
12458
|
+
static tryCreate(logger, nodeStorage, networkClient, cryptoProvider, disableInternalRetries,
|
|
12459
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12460
|
+
_managedIdentityId) {
|
|
12228
12461
|
const [identityEndpoint, imdsEndpoint] = AzureArc.getEnvironmentVariables();
|
|
12229
12462
|
// if either of the identity or imds endpoints are undefined (even after himds file detection)
|
|
12230
12463
|
if (!identityEndpoint || !imdsEndpoint) {
|
|
@@ -12245,9 +12478,6 @@ class AzureArc extends BaseManagedIdentitySource {
|
|
|
12245
12478
|
AzureArc.getValidatedEnvVariableUrlString(ManagedIdentityEnvironmentVariableNames.IMDS_ENDPOINT, imdsEndpoint, ManagedIdentitySourceNames.AZURE_ARC, logger);
|
|
12246
12479
|
logger.info(`[Managed Identity] Environment variables validation passed for ${ManagedIdentitySourceNames.AZURE_ARC} managed identity. Endpoint URI: ${validatedIdentityEndpoint}. Creating ${ManagedIdentitySourceNames.AZURE_ARC} managed identity.`, "");
|
|
12247
12480
|
}
|
|
12248
|
-
if (managedIdentityId.idType !== ManagedIdentityIdType.SYSTEM_ASSIGNED) {
|
|
12249
|
-
throw createManagedIdentityError(unableToCreateAzureArc, "");
|
|
12250
|
-
}
|
|
12251
12481
|
return new AzureArc(logger, nodeStorage, networkClient, cryptoProvider, disableInternalRetries, identityEndpoint);
|
|
12252
12482
|
}
|
|
12253
12483
|
/**
|
|
@@ -12261,16 +12491,85 @@ class AzureArc extends BaseManagedIdentitySource {
|
|
|
12261
12491
|
*
|
|
12262
12492
|
* @returns A configured ManagedIdentityRequestParameters object ready for network execution
|
|
12263
12493
|
*/
|
|
12264
|
-
createRequest(resource) {
|
|
12494
|
+
createRequest(resource, managedIdentityId) {
|
|
12265
12495
|
const request = new ManagedIdentityRequestParameters(HttpMethod.GET, this.identityEndpoint.replace("localhost", "127.0.0.1"));
|
|
12266
12496
|
request.headers[ManagedIdentityHeaders.METADATA_HEADER_NAME] = "true";
|
|
12267
12497
|
request.queryParameters[ManagedIdentityQueryParameters.API_VERSION] =
|
|
12268
12498
|
ARC_API_VERSION;
|
|
12269
12499
|
request.queryParameters[ManagedIdentityQueryParameters.RESOURCE] =
|
|
12270
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
|
+
}
|
|
12271
12510
|
// bodyParameters calculated in BaseManagedIdentity.acquireTokenWithManagedIdentity
|
|
12272
12511
|
return request;
|
|
12273
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
|
+
}
|
|
12274
12573
|
/**
|
|
12275
12574
|
* Processes the server response and handles Azure Arc-specific authentication challenges.
|
|
12276
12575
|
*
|
|
@@ -12361,7 +12660,16 @@ class AzureArc extends BaseManagedIdentitySource {
|
|
|
12361
12660
|
}
|
|
12362
12661
|
}
|
|
12363
12662
|
}
|
|
12364
|
-
|
|
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);
|
|
12365
12673
|
}
|
|
12366
12674
|
}
|
|
12367
12675
|
|