@azure/msal-node 3.5.3 → 3.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cache/NodeStorage.d.ts.map +1 -1
- package/dist/cache/NodeStorage.mjs +3 -2
- package/dist/cache/NodeStorage.mjs.map +1 -1
- package/dist/cache/TokenCache.d.ts +1 -1
- package/dist/cache/TokenCache.d.ts.map +1 -1
- package/dist/cache/TokenCache.mjs +4 -3
- package/dist/cache/TokenCache.mjs.map +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/ClientApplication.mjs +1 -1
- package/dist/client/ClientAssertion.d.ts.map +1 -1
- package/dist/client/ClientAssertion.mjs +3 -3
- package/dist/client/ClientAssertion.mjs.map +1 -1
- package/dist/client/ClientCredentialClient.mjs +1 -1
- package/dist/client/ConfidentialClientApplication.mjs +1 -1
- package/dist/client/DeviceCodeClient.mjs +1 -1
- package/dist/client/ManagedIdentityApplication.d.ts +11 -0
- package/dist/client/ManagedIdentityApplication.d.ts.map +1 -1
- package/dist/client/ManagedIdentityApplication.mjs +46 -11
- package/dist/client/ManagedIdentityApplication.mjs.map +1 -1
- package/dist/client/ManagedIdentityClient.mjs +1 -1
- package/dist/client/ManagedIdentitySources/AppService.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/AppService.mjs +6 -5
- package/dist/client/ManagedIdentitySources/AppService.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/AzureArc.mjs +8 -8
- package/dist/client/ManagedIdentitySources/AzureArc.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +11 -2
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/CloudShell.mjs +4 -4
- package/dist/client/ManagedIdentitySources/CloudShell.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/Imds.d.ts +32 -0
- package/dist/client/ManagedIdentitySources/Imds.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/Imds.mjs +39 -8
- package/dist/client/ManagedIdentitySources/Imds.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/MachineLearning.d.ts +1 -0
- package/dist/client/ManagedIdentitySources/MachineLearning.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/MachineLearning.mjs +19 -9
- package/dist/client/ManagedIdentitySources/MachineLearning.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts +30 -0
- package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +36 -10
- package/dist/client/ManagedIdentitySources/ServiceFabric.mjs.map +1 -1
- package/dist/client/OnBehalfOfClient.mjs +1 -1
- package/dist/client/PublicClientApplication.d.ts.map +1 -1
- package/dist/client/PublicClientApplication.mjs +2 -2
- package/dist/client/PublicClientApplication.mjs.map +1 -1
- package/dist/client/UsernamePasswordClient.mjs +1 -1
- package/dist/config/Configuration.d.ts +4 -2
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.mjs +3 -2
- package/dist/config/Configuration.mjs.map +1 -1
- package/dist/config/ManagedIdentityId.mjs +1 -1
- package/dist/config/ManagedIdentityRequestParameters.mjs +1 -1
- package/dist/crypto/CryptoProvider.d.ts +1 -1
- package/dist/crypto/CryptoProvider.d.ts.map +1 -1
- package/dist/crypto/CryptoProvider.mjs +3 -2
- 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.d.ts.map +1 -1
- package/dist/crypto/PkceGenerator.mjs +3 -3
- package/dist/crypto/PkceGenerator.mjs.map +1 -1
- package/dist/error/ManagedIdentityError.mjs +1 -1
- package/dist/error/ManagedIdentityErrorCodes.mjs +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.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/protocol/Authorize.mjs +1 -1
- package/dist/request/ManagedIdentityRequest.d.ts +6 -3
- package/dist/request/ManagedIdentityRequest.d.ts.map +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.d.ts +21 -6
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.mjs +21 -8
- package/dist/utils/Constants.mjs.map +1 -1
- package/dist/utils/EncodingUtils.mjs +4 -4
- package/dist/utils/EncodingUtils.mjs.map +1 -1
- package/dist/utils/NetworkUtils.mjs +1 -1
- package/dist/utils/TimeUtils.mjs +1 -1
- package/lib/msal-node.cjs +1120 -913
- package/lib/msal-node.cjs.map +1 -1
- package/lib/types/cache/NodeStorage.d.ts.map +1 -1
- package/lib/types/cache/TokenCache.d.ts +1 -1
- package/lib/types/cache/TokenCache.d.ts.map +1 -1
- package/lib/types/client/ClientAssertion.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentityApplication.d.ts +11 -0
- package/lib/types/client/ManagedIdentityApplication.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/AppService.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/Imds.d.ts +32 -0
- package/lib/types/client/ManagedIdentitySources/Imds.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/MachineLearning.d.ts +1 -0
- package/lib/types/client/ManagedIdentitySources/MachineLearning.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/ServiceFabric.d.ts +30 -0
- package/lib/types/client/ManagedIdentitySources/ServiceFabric.d.ts.map +1 -1
- package/lib/types/client/PublicClientApplication.d.ts.map +1 -1
- package/lib/types/config/Configuration.d.ts +4 -2
- package/lib/types/config/Configuration.d.ts.map +1 -1
- package/lib/types/crypto/CryptoProvider.d.ts +1 -1
- package/lib/types/crypto/CryptoProvider.d.ts.map +1 -1
- package/lib/types/crypto/PkceGenerator.d.ts.map +1 -1
- package/lib/types/packageMetadata.d.ts +1 -1
- package/lib/types/request/ManagedIdentityRequest.d.ts +6 -3
- package/lib/types/request/ManagedIdentityRequest.d.ts.map +1 -1
- package/lib/types/utils/Constants.d.ts +21 -6
- package/lib/types/utils/Constants.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/cache/NodeStorage.ts +8 -1
- package/src/cache/TokenCache.ts +8 -3
- package/src/client/ClientAssertion.ts +2 -1
- package/src/client/ManagedIdentityApplication.ts +71 -10
- package/src/client/ManagedIdentitySources/AppService.ts +6 -6
- package/src/client/ManagedIdentitySources/AzureArc.ts +10 -9
- package/src/client/ManagedIdentitySources/BaseManagedIdentitySource.ts +28 -1
- package/src/client/ManagedIdentitySources/CloudShell.ts +4 -4
- package/src/client/ManagedIdentitySources/Imds.ts +40 -10
- package/src/client/ManagedIdentitySources/MachineLearning.ts +28 -10
- package/src/client/ManagedIdentitySources/ServiceFabric.ts +36 -11
- package/src/client/PublicClientApplication.ts +4 -1
- package/src/config/Configuration.ts +5 -1
- package/src/crypto/CryptoProvider.ts +4 -4
- package/src/crypto/PkceGenerator.ts +3 -3
- package/src/packageMetadata.ts +1 -1
- package/src/request/ManagedIdentityRequest.ts +6 -3
- package/src/utils/Constants.ts +25 -6
- package/src/utils/EncodingUtils.ts +3 -3
package/lib/msal-node.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-node v3.
|
|
1
|
+
/*! @azure/msal-node v3.6.1 2025-06-18 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -6,8 +6,8 @@ var http = require('http');
|
|
|
6
6
|
var https = require('https');
|
|
7
7
|
var uuid = require('uuid');
|
|
8
8
|
var crypto = require('crypto');
|
|
9
|
-
var jwt = require('jsonwebtoken');
|
|
10
9
|
var msalCommon = require('@azure/msal-common');
|
|
10
|
+
var jwt = require('jsonwebtoken');
|
|
11
11
|
var fs = require('fs');
|
|
12
12
|
var path = require('path');
|
|
13
13
|
|
|
@@ -153,7 +153,7 @@ class Serializer {
|
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
/*! @azure/msal-common v15.
|
|
156
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
157
157
|
/*
|
|
158
158
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
159
159
|
* Licensed under the MIT License.
|
|
@@ -400,13 +400,6 @@ const PasswordGrantConstants = {
|
|
|
400
400
|
username: "username",
|
|
401
401
|
password: "password",
|
|
402
402
|
};
|
|
403
|
-
/**
|
|
404
|
-
* Response codes
|
|
405
|
-
*/
|
|
406
|
-
const ResponseCodes = {
|
|
407
|
-
httpSuccess: 200,
|
|
408
|
-
httpBadRequest: 400,
|
|
409
|
-
};
|
|
410
403
|
/**
|
|
411
404
|
* Region Discovery Sources
|
|
412
405
|
*/
|
|
@@ -442,9 +435,14 @@ const CacheOutcome = {
|
|
|
442
435
|
PROACTIVELY_REFRESHED: "4",
|
|
443
436
|
};
|
|
444
437
|
// Token renewal offset default in seconds
|
|
445
|
-
const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
|
|
438
|
+
const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
|
|
439
|
+
const EncodingTypes = {
|
|
440
|
+
BASE64: "base64",
|
|
441
|
+
HEX: "hex",
|
|
442
|
+
UTF8: "utf-8",
|
|
443
|
+
};
|
|
446
444
|
|
|
447
|
-
/*! @azure/msal-common v15.
|
|
445
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
448
446
|
/*
|
|
449
447
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
450
448
|
* Licensed under the MIT License.
|
|
@@ -461,7 +459,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
461
459
|
unexpectedError: unexpectedError
|
|
462
460
|
});
|
|
463
461
|
|
|
464
|
-
/*! @azure/msal-common v15.
|
|
462
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
465
463
|
|
|
466
464
|
/*
|
|
467
465
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -510,7 +508,7 @@ function createAuthError(code, additionalMessage) {
|
|
|
510
508
|
: AuthErrorMessages[code]);
|
|
511
509
|
}
|
|
512
510
|
|
|
513
|
-
/*! @azure/msal-common v15.
|
|
511
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
514
512
|
/*
|
|
515
513
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
516
514
|
* Licensed under the MIT License.
|
|
@@ -608,7 +606,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
608
606
|
userTimeoutReached: userTimeoutReached
|
|
609
607
|
});
|
|
610
608
|
|
|
611
|
-
/*! @azure/msal-common v15.
|
|
609
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
612
610
|
|
|
613
611
|
/*
|
|
614
612
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -860,7 +858,7 @@ function createClientAuthError(errorCode, additionalMessage) {
|
|
|
860
858
|
return new ClientAuthError(errorCode, additionalMessage);
|
|
861
859
|
}
|
|
862
860
|
|
|
863
|
-
/*! @azure/msal-common v15.
|
|
861
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
864
862
|
|
|
865
863
|
/*
|
|
866
864
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -899,7 +897,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
|
|
|
899
897
|
},
|
|
900
898
|
};
|
|
901
899
|
|
|
902
|
-
/*! @azure/msal-common v15.
|
|
900
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
903
901
|
|
|
904
902
|
/*
|
|
905
903
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1090,12 +1088,12 @@ class Logger {
|
|
|
1090
1088
|
}
|
|
1091
1089
|
}
|
|
1092
1090
|
|
|
1093
|
-
/*! @azure/msal-common v15.
|
|
1091
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
1094
1092
|
/* eslint-disable header/header */
|
|
1095
1093
|
const name$1 = "@azure/msal-common";
|
|
1096
|
-
const version$1 = "15.
|
|
1094
|
+
const version$1 = "15.7.1";
|
|
1097
1095
|
|
|
1098
|
-
/*! @azure/msal-common v15.
|
|
1096
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
1099
1097
|
/*
|
|
1100
1098
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1101
1099
|
* Licensed under the MIT License.
|
|
@@ -1115,7 +1113,7 @@ const AzureCloudInstance = {
|
|
|
1115
1113
|
AzureUsGovernment: "https://login.microsoftonline.us",
|
|
1116
1114
|
};
|
|
1117
1115
|
|
|
1118
|
-
/*! @azure/msal-common v15.
|
|
1116
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
1119
1117
|
|
|
1120
1118
|
/*
|
|
1121
1119
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1176,7 +1174,7 @@ function checkMaxAge(authTime, maxAge) {
|
|
|
1176
1174
|
}
|
|
1177
1175
|
}
|
|
1178
1176
|
|
|
1179
|
-
/*! @azure/msal-common v15.
|
|
1177
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
1180
1178
|
/*
|
|
1181
1179
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1182
1180
|
* Licensed under the MIT License.
|
|
@@ -1231,7 +1229,7 @@ function delay(t, value) {
|
|
|
1231
1229
|
return new Promise((resolve) => setTimeout(() => resolve(value), t));
|
|
1232
1230
|
}
|
|
1233
1231
|
|
|
1234
|
-
/*! @azure/msal-common v15.
|
|
1232
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
1235
1233
|
|
|
1236
1234
|
/*
|
|
1237
1235
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1558,7 +1556,7 @@ function isAuthorityMetadataExpired(metadata) {
|
|
|
1558
1556
|
return metadata.expiresAt <= nowSeconds();
|
|
1559
1557
|
}
|
|
1560
1558
|
|
|
1561
|
-
/*! @azure/msal-common v15.
|
|
1559
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
1562
1560
|
/*
|
|
1563
1561
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1564
1562
|
* Licensed under the MIT License.
|
|
@@ -1612,7 +1610,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
1612
1610
|
urlParseError: urlParseError
|
|
1613
1611
|
});
|
|
1614
1612
|
|
|
1615
|
-
/*! @azure/msal-common v15.
|
|
1613
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
1616
1614
|
|
|
1617
1615
|
/*
|
|
1618
1616
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1750,7 +1748,7 @@ function createClientConfigurationError(errorCode) {
|
|
|
1750
1748
|
return new ClientConfigurationError(errorCode);
|
|
1751
1749
|
}
|
|
1752
1750
|
|
|
1753
|
-
/*! @azure/msal-common v15.
|
|
1751
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
1754
1752
|
/*
|
|
1755
1753
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1756
1754
|
* Licensed under the MIT License.
|
|
@@ -1847,7 +1845,7 @@ class StringUtils {
|
|
|
1847
1845
|
}
|
|
1848
1846
|
}
|
|
1849
1847
|
|
|
1850
|
-
/*! @azure/msal-common v15.
|
|
1848
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
1851
1849
|
|
|
1852
1850
|
/*
|
|
1853
1851
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2038,7 +2036,7 @@ class ScopeSet {
|
|
|
2038
2036
|
}
|
|
2039
2037
|
}
|
|
2040
2038
|
|
|
2041
|
-
/*! @azure/msal-common v15.
|
|
2039
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
2042
2040
|
|
|
2043
2041
|
/*
|
|
2044
2042
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2078,7 +2076,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
|
|
|
2078
2076
|
};
|
|
2079
2077
|
}
|
|
2080
2078
|
|
|
2081
|
-
/*! @azure/msal-common v15.
|
|
2079
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
2082
2080
|
/*
|
|
2083
2081
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2084
2082
|
* Licensed under the MIT License.
|
|
@@ -2157,7 +2155,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
|
|
|
2157
2155
|
return updatedAccountInfo;
|
|
2158
2156
|
}
|
|
2159
2157
|
|
|
2160
|
-
/*! @azure/msal-common v15.
|
|
2158
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
2161
2159
|
/*
|
|
2162
2160
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2163
2161
|
* Licensed under the MIT License.
|
|
@@ -2172,7 +2170,7 @@ const AuthorityType = {
|
|
|
2172
2170
|
Ciam: 3,
|
|
2173
2171
|
};
|
|
2174
2172
|
|
|
2175
|
-
/*! @azure/msal-common v15.
|
|
2173
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
2176
2174
|
/*
|
|
2177
2175
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2178
2176
|
* Licensed under the MIT License.
|
|
@@ -2194,7 +2192,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
|
|
|
2194
2192
|
return null;
|
|
2195
2193
|
}
|
|
2196
2194
|
|
|
2197
|
-
/*! @azure/msal-common v15.
|
|
2195
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
2198
2196
|
/*
|
|
2199
2197
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2200
2198
|
* Licensed under the MIT License.
|
|
@@ -2218,7 +2216,7 @@ const ProtocolMode = {
|
|
|
2218
2216
|
EAR: "EAR",
|
|
2219
2217
|
};
|
|
2220
2218
|
|
|
2221
|
-
/*! @azure/msal-common v15.
|
|
2219
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
2222
2220
|
|
|
2223
2221
|
/*
|
|
2224
2222
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2461,7 +2459,7 @@ class AccountEntity {
|
|
|
2461
2459
|
}
|
|
2462
2460
|
}
|
|
2463
2461
|
|
|
2464
|
-
/*! @azure/msal-common v15.
|
|
2462
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
2465
2463
|
|
|
2466
2464
|
/*
|
|
2467
2465
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2526,7 +2524,7 @@ function mapToQueryString(parameters, encodeExtraParams = true, extraQueryParame
|
|
|
2526
2524
|
return queryParameterArray.join("&");
|
|
2527
2525
|
}
|
|
2528
2526
|
|
|
2529
|
-
/*! @azure/msal-common v15.
|
|
2527
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
2530
2528
|
|
|
2531
2529
|
/*
|
|
2532
2530
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2690,7 +2688,7 @@ class UrlString {
|
|
|
2690
2688
|
}
|
|
2691
2689
|
}
|
|
2692
2690
|
|
|
2693
|
-
/*! @azure/msal-common v15.
|
|
2691
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
2694
2692
|
|
|
2695
2693
|
/*
|
|
2696
2694
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2830,7 +2828,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
|
|
|
2830
2828
|
return null;
|
|
2831
2829
|
}
|
|
2832
2830
|
|
|
2833
|
-
/*! @azure/msal-common v15.
|
|
2831
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
2834
2832
|
/*
|
|
2835
2833
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2836
2834
|
* Licensed under the MIT License.
|
|
@@ -2838,7 +2836,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
|
|
|
2838
2836
|
const cacheQuotaExceededErrorCode = "cache_quota_exceeded";
|
|
2839
2837
|
const cacheUnknownErrorCode = "cache_error_unknown";
|
|
2840
2838
|
|
|
2841
|
-
/*! @azure/msal-common v15.
|
|
2839
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
2842
2840
|
|
|
2843
2841
|
/*
|
|
2844
2842
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2865,7 +2863,7 @@ class CacheError extends Error {
|
|
|
2865
2863
|
}
|
|
2866
2864
|
}
|
|
2867
2865
|
|
|
2868
|
-
/*! @azure/msal-common v15.
|
|
2866
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
2869
2867
|
|
|
2870
2868
|
/*
|
|
2871
2869
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2876,11 +2874,12 @@ class CacheError extends Error {
|
|
|
2876
2874
|
* @internal
|
|
2877
2875
|
*/
|
|
2878
2876
|
class CacheManager {
|
|
2879
|
-
constructor(clientId, cryptoImpl, logger, staticAuthorityOptions) {
|
|
2877
|
+
constructor(clientId, cryptoImpl, logger, performanceClient, staticAuthorityOptions) {
|
|
2880
2878
|
this.clientId = clientId;
|
|
2881
2879
|
this.cryptoImpl = cryptoImpl;
|
|
2882
2880
|
this.commonLogger = logger.clone(name$1, version$1);
|
|
2883
2881
|
this.staticAuthorityOptions = staticAuthorityOptions;
|
|
2882
|
+
this.performanceClient = performanceClient;
|
|
2884
2883
|
}
|
|
2885
2884
|
/**
|
|
2886
2885
|
* Returns all the accounts in the cache that match the optional filter. If no filter is provided, all accounts are returned.
|
|
@@ -3089,7 +3088,6 @@ class CacheManager {
|
|
|
3089
3088
|
};
|
|
3090
3089
|
const tokenKeys = this.getTokenKeys();
|
|
3091
3090
|
const currentScopes = ScopeSet.fromString(credential.target);
|
|
3092
|
-
const removedAccessTokens = [];
|
|
3093
3091
|
tokenKeys.accessToken.forEach((key) => {
|
|
3094
3092
|
if (!this.accessTokenKeyMatchesFilter(key, accessTokenFilter, false)) {
|
|
3095
3093
|
return;
|
|
@@ -3099,11 +3097,10 @@ class CacheManager {
|
|
|
3099
3097
|
this.credentialMatchesFilter(tokenEntity, accessTokenFilter)) {
|
|
3100
3098
|
const tokenScopeSet = ScopeSet.fromString(tokenEntity.target);
|
|
3101
3099
|
if (tokenScopeSet.intersectingScopeSets(currentScopes)) {
|
|
3102
|
-
|
|
3100
|
+
this.removeAccessToken(key, correlationId);
|
|
3103
3101
|
}
|
|
3104
3102
|
}
|
|
3105
3103
|
});
|
|
3106
|
-
await Promise.all(removedAccessTokens);
|
|
3107
3104
|
await this.setAccessTokenCredential(credential, correlationId);
|
|
3108
3105
|
}
|
|
3109
3106
|
/**
|
|
@@ -3345,34 +3342,31 @@ class CacheManager {
|
|
|
3345
3342
|
/**
|
|
3346
3343
|
* Removes all accounts and related tokens from cache.
|
|
3347
3344
|
*/
|
|
3348
|
-
|
|
3345
|
+
removeAllAccounts(correlationId) {
|
|
3349
3346
|
const allAccountKeys = this.getAccountKeys();
|
|
3350
|
-
const removedAccounts = [];
|
|
3351
3347
|
allAccountKeys.forEach((cacheKey) => {
|
|
3352
|
-
|
|
3348
|
+
this.removeAccount(cacheKey, correlationId);
|
|
3353
3349
|
});
|
|
3354
|
-
await Promise.all(removedAccounts);
|
|
3355
3350
|
}
|
|
3356
3351
|
/**
|
|
3357
3352
|
* Removes the account and related tokens for a given account key
|
|
3358
3353
|
* @param account
|
|
3359
3354
|
*/
|
|
3360
|
-
|
|
3355
|
+
removeAccount(accountKey, correlationId) {
|
|
3361
3356
|
const account = this.getAccount(accountKey, this.commonLogger);
|
|
3362
3357
|
if (!account) {
|
|
3363
3358
|
return;
|
|
3364
3359
|
}
|
|
3365
|
-
|
|
3360
|
+
this.removeAccountContext(account, correlationId);
|
|
3366
3361
|
this.removeItem(accountKey);
|
|
3367
3362
|
}
|
|
3368
3363
|
/**
|
|
3369
3364
|
* Removes credentials associated with the provided account
|
|
3370
3365
|
* @param account
|
|
3371
3366
|
*/
|
|
3372
|
-
|
|
3367
|
+
removeAccountContext(account, correlationId) {
|
|
3373
3368
|
const allTokenKeys = this.getTokenKeys();
|
|
3374
3369
|
const accountId = account.generateAccountId();
|
|
3375
|
-
const removedCredentials = [];
|
|
3376
3370
|
allTokenKeys.idToken.forEach((key) => {
|
|
3377
3371
|
if (key.indexOf(accountId) === 0) {
|
|
3378
3372
|
this.removeIdToken(key);
|
|
@@ -3380,7 +3374,7 @@ class CacheManager {
|
|
|
3380
3374
|
});
|
|
3381
3375
|
allTokenKeys.accessToken.forEach((key) => {
|
|
3382
3376
|
if (key.indexOf(accountId) === 0) {
|
|
3383
|
-
|
|
3377
|
+
this.removeAccessToken(key, correlationId);
|
|
3384
3378
|
}
|
|
3385
3379
|
});
|
|
3386
3380
|
allTokenKeys.refreshToken.forEach((key) => {
|
|
@@ -3388,17 +3382,17 @@ class CacheManager {
|
|
|
3388
3382
|
this.removeRefreshToken(key);
|
|
3389
3383
|
}
|
|
3390
3384
|
});
|
|
3391
|
-
await Promise.all(removedCredentials);
|
|
3392
3385
|
}
|
|
3393
3386
|
/**
|
|
3394
3387
|
* returns a boolean if the given credential is removed
|
|
3395
3388
|
* @param credential
|
|
3396
3389
|
*/
|
|
3397
|
-
|
|
3390
|
+
removeAccessToken(key, correlationId) {
|
|
3398
3391
|
const credential = this.getAccessTokenCredential(key);
|
|
3399
3392
|
if (!credential) {
|
|
3400
3393
|
return;
|
|
3401
3394
|
}
|
|
3395
|
+
this.removeItem(key);
|
|
3402
3396
|
// Remove Token Binding Key from key store for PoP Tokens Credentials
|
|
3403
3397
|
if (credential.credentialType.toLowerCase() ===
|
|
3404
3398
|
CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()) {
|
|
@@ -3406,16 +3400,15 @@ class CacheManager {
|
|
|
3406
3400
|
const accessTokenWithAuthSchemeEntity = credential;
|
|
3407
3401
|
const kid = accessTokenWithAuthSchemeEntity.keyId;
|
|
3408
3402
|
if (kid) {
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
}
|
|
3403
|
+
void this.cryptoImpl
|
|
3404
|
+
.removeTokenBindingKey(kid)
|
|
3405
|
+
.catch(() => {
|
|
3406
|
+
this.commonLogger.error(`Failed to remove token binding key ${kid}`, correlationId);
|
|
3407
|
+
this.performanceClient?.incrementFields({ removeTokenBindingKeyFailure: 1 }, correlationId);
|
|
3408
|
+
});
|
|
3415
3409
|
}
|
|
3416
3410
|
}
|
|
3417
3411
|
}
|
|
3418
|
-
return this.removeItem(key);
|
|
3419
3412
|
}
|
|
3420
3413
|
/**
|
|
3421
3414
|
* Removes all app metadata objects from cache.
|
|
@@ -3557,10 +3550,10 @@ class CacheManager {
|
|
|
3557
3550
|
* @param request {BaseAuthRequest}
|
|
3558
3551
|
* @param tokenKeys {?TokenKeys}
|
|
3559
3552
|
* @param performanceClient {?IPerformanceClient}
|
|
3560
|
-
* @param correlationId {?string}
|
|
3561
3553
|
*/
|
|
3562
|
-
getAccessToken(account, request, tokenKeys, targetRealm
|
|
3563
|
-
|
|
3554
|
+
getAccessToken(account, request, tokenKeys, targetRealm) {
|
|
3555
|
+
const correlationId = request.correlationId;
|
|
3556
|
+
this.commonLogger.trace("CacheManager - getAccessToken called", correlationId);
|
|
3564
3557
|
const scopes = ScopeSet.createSearchScopes(request.scopes);
|
|
3565
3558
|
const authScheme = request.authenticationScheme || AuthenticationScheme.BEARER;
|
|
3566
3559
|
/*
|
|
@@ -3598,20 +3591,18 @@ class CacheManager {
|
|
|
3598
3591
|
});
|
|
3599
3592
|
const numAccessTokens = accessTokens.length;
|
|
3600
3593
|
if (numAccessTokens < 1) {
|
|
3601
|
-
this.commonLogger.info("CacheManager:getAccessToken - No token found");
|
|
3594
|
+
this.commonLogger.info("CacheManager:getAccessToken - No token found", correlationId);
|
|
3602
3595
|
return null;
|
|
3603
3596
|
}
|
|
3604
3597
|
else if (numAccessTokens > 1) {
|
|
3605
|
-
this.commonLogger.info("CacheManager:getAccessToken - Multiple access tokens found, clearing them");
|
|
3598
|
+
this.commonLogger.info("CacheManager:getAccessToken - Multiple access tokens found, clearing them", correlationId);
|
|
3606
3599
|
accessTokens.forEach((accessToken) => {
|
|
3607
|
-
|
|
3600
|
+
this.removeAccessToken(generateCredentialKey(accessToken), correlationId);
|
|
3608
3601
|
});
|
|
3609
|
-
|
|
3610
|
-
performanceClient.addFields({ multiMatchedAT: accessTokens.length }, correlationId);
|
|
3611
|
-
}
|
|
3602
|
+
this.performanceClient.addFields({ multiMatchedAT: accessTokens.length }, correlationId);
|
|
3612
3603
|
return null;
|
|
3613
3604
|
}
|
|
3614
|
-
this.commonLogger.info("CacheManager:getAccessToken - Returning access token");
|
|
3605
|
+
this.commonLogger.info("CacheManager:getAccessToken - Returning access token", correlationId);
|
|
3615
3606
|
return accessTokens[0];
|
|
3616
3607
|
}
|
|
3617
3608
|
/**
|
|
@@ -4049,845 +4040,935 @@ class DefaultStorageClass extends CacheManager {
|
|
|
4049
4040
|
}
|
|
4050
4041
|
}
|
|
4051
4042
|
|
|
4052
|
-
/*! @azure/msal-common v15.
|
|
4053
|
-
|
|
4043
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
4054
4044
|
/*
|
|
4055
4045
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4056
4046
|
* Licensed under the MIT License.
|
|
4057
4047
|
*/
|
|
4058
|
-
const DEFAULT_SYSTEM_OPTIONS$1 = {
|
|
4059
|
-
tokenRenewalOffsetSeconds: DEFAULT_TOKEN_RENEWAL_OFFSET_SEC,
|
|
4060
|
-
preventCorsPreflight: false,
|
|
4061
|
-
};
|
|
4062
|
-
const DEFAULT_LOGGER_IMPLEMENTATION = {
|
|
4063
|
-
loggerCallback: () => {
|
|
4064
|
-
// allow users to not set loggerCallback
|
|
4065
|
-
},
|
|
4066
|
-
piiLoggingEnabled: false,
|
|
4067
|
-
logLevel: exports.LogLevel.Info,
|
|
4068
|
-
correlationId: Constants$1.EMPTY_STRING,
|
|
4069
|
-
};
|
|
4070
|
-
const DEFAULT_CACHE_OPTIONS$1 = {
|
|
4071
|
-
claimsBasedCachingEnabled: false,
|
|
4072
|
-
};
|
|
4073
|
-
const DEFAULT_NETWORK_IMPLEMENTATION = {
|
|
4074
|
-
async sendGetRequestAsync() {
|
|
4075
|
-
throw createClientAuthError(methodNotImplemented);
|
|
4076
|
-
},
|
|
4077
|
-
async sendPostRequestAsync() {
|
|
4078
|
-
throw createClientAuthError(methodNotImplemented);
|
|
4079
|
-
},
|
|
4080
|
-
};
|
|
4081
|
-
const DEFAULT_LIBRARY_INFO = {
|
|
4082
|
-
sku: Constants$1.SKU,
|
|
4083
|
-
version: version$1,
|
|
4084
|
-
cpu: Constants$1.EMPTY_STRING,
|
|
4085
|
-
os: Constants$1.EMPTY_STRING,
|
|
4086
|
-
};
|
|
4087
|
-
const DEFAULT_CLIENT_CREDENTIALS = {
|
|
4088
|
-
clientSecret: Constants$1.EMPTY_STRING,
|
|
4089
|
-
clientAssertion: undefined,
|
|
4090
|
-
};
|
|
4091
|
-
const DEFAULT_AZURE_CLOUD_OPTIONS = {
|
|
4092
|
-
azureCloudInstance: AzureCloudInstance.None,
|
|
4093
|
-
tenant: `${Constants$1.DEFAULT_COMMON_TENANT}`,
|
|
4094
|
-
};
|
|
4095
|
-
const DEFAULT_TELEMETRY_OPTIONS$1 = {
|
|
4096
|
-
application: {
|
|
4097
|
-
appName: "",
|
|
4098
|
-
appVersion: "",
|
|
4099
|
-
},
|
|
4100
|
-
};
|
|
4101
4048
|
/**
|
|
4102
|
-
*
|
|
4103
|
-
*
|
|
4104
|
-
* @param Configuration
|
|
4049
|
+
* Enumeration of operations that are instrumented by have their performance measured by the PerformanceClient.
|
|
4105
4050
|
*
|
|
4106
|
-
* @
|
|
4107
|
-
|
|
4108
|
-
function buildClientConfiguration({ authOptions: userAuthOptions, systemOptions: userSystemOptions, loggerOptions: userLoggerOption, cacheOptions: userCacheOptions, storageInterface: storageImplementation, networkInterface: networkImplementation, cryptoInterface: cryptoImplementation, clientCredentials: clientCredentials, libraryInfo: libraryInfo, telemetry: telemetry, serverTelemetryManager: serverTelemetryManager, persistencePlugin: persistencePlugin, serializableCache: serializableCache, }) {
|
|
4109
|
-
const loggerOptions = {
|
|
4110
|
-
...DEFAULT_LOGGER_IMPLEMENTATION,
|
|
4111
|
-
...userLoggerOption,
|
|
4112
|
-
};
|
|
4113
|
-
return {
|
|
4114
|
-
authOptions: buildAuthOptions(userAuthOptions),
|
|
4115
|
-
systemOptions: { ...DEFAULT_SYSTEM_OPTIONS$1, ...userSystemOptions },
|
|
4116
|
-
loggerOptions: loggerOptions,
|
|
4117
|
-
cacheOptions: { ...DEFAULT_CACHE_OPTIONS$1, ...userCacheOptions },
|
|
4118
|
-
storageInterface: storageImplementation ||
|
|
4119
|
-
new DefaultStorageClass(userAuthOptions.clientId, DEFAULT_CRYPTO_IMPLEMENTATION, new Logger(loggerOptions)),
|
|
4120
|
-
networkInterface: networkImplementation || DEFAULT_NETWORK_IMPLEMENTATION,
|
|
4121
|
-
cryptoInterface: cryptoImplementation || DEFAULT_CRYPTO_IMPLEMENTATION,
|
|
4122
|
-
clientCredentials: clientCredentials || DEFAULT_CLIENT_CREDENTIALS,
|
|
4123
|
-
libraryInfo: { ...DEFAULT_LIBRARY_INFO, ...libraryInfo },
|
|
4124
|
-
telemetry: { ...DEFAULT_TELEMETRY_OPTIONS$1, ...telemetry },
|
|
4125
|
-
serverTelemetryManager: serverTelemetryManager || null,
|
|
4126
|
-
persistencePlugin: persistencePlugin || null,
|
|
4127
|
-
serializableCache: serializableCache || null,
|
|
4128
|
-
};
|
|
4129
|
-
}
|
|
4130
|
-
/**
|
|
4131
|
-
* Construct authoptions from the client and platform passed values
|
|
4132
|
-
* @param authOptions
|
|
4133
|
-
*/
|
|
4134
|
-
function buildAuthOptions(authOptions) {
|
|
4135
|
-
return {
|
|
4136
|
-
clientCapabilities: [],
|
|
4137
|
-
azureCloudOptions: DEFAULT_AZURE_CLOUD_OPTIONS,
|
|
4138
|
-
skipAuthorityMetadataCache: false,
|
|
4139
|
-
instanceAware: false,
|
|
4140
|
-
encodeExtraQueryParams: false,
|
|
4141
|
-
...authOptions,
|
|
4142
|
-
};
|
|
4143
|
-
}
|
|
4144
|
-
/**
|
|
4145
|
-
* Returns true if config has protocolMode set to ProtocolMode.OIDC, false otherwise
|
|
4146
|
-
* @param ClientConfiguration
|
|
4147
|
-
*/
|
|
4148
|
-
function isOidcProtocolMode(config) {
|
|
4149
|
-
return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
|
|
4150
|
-
}
|
|
4151
|
-
|
|
4152
|
-
/*! @azure/msal-common v15.6.0 2025-05-06 */
|
|
4153
|
-
/*
|
|
4154
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4155
|
-
* Licensed under the MIT License.
|
|
4156
|
-
*/
|
|
4157
|
-
const CcsCredentialType = {
|
|
4158
|
-
HOME_ACCOUNT_ID: "home_account_id",
|
|
4159
|
-
UPN: "UPN",
|
|
4160
|
-
};
|
|
4161
|
-
|
|
4162
|
-
/*! @azure/msal-common v15.6.0 2025-05-06 */
|
|
4163
|
-
/*
|
|
4164
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4165
|
-
* Licensed under the MIT License.
|
|
4166
|
-
*/
|
|
4167
|
-
const CLIENT_ID = "client_id";
|
|
4168
|
-
const REDIRECT_URI = "redirect_uri";
|
|
4169
|
-
const RESPONSE_TYPE = "response_type";
|
|
4170
|
-
const RESPONSE_MODE = "response_mode";
|
|
4171
|
-
const GRANT_TYPE = "grant_type";
|
|
4172
|
-
const CLAIMS = "claims";
|
|
4173
|
-
const SCOPE = "scope";
|
|
4174
|
-
const REFRESH_TOKEN = "refresh_token";
|
|
4175
|
-
const STATE = "state";
|
|
4176
|
-
const NONCE = "nonce";
|
|
4177
|
-
const PROMPT = "prompt";
|
|
4178
|
-
const CODE = "code";
|
|
4179
|
-
const CODE_CHALLENGE = "code_challenge";
|
|
4180
|
-
const CODE_CHALLENGE_METHOD = "code_challenge_method";
|
|
4181
|
-
const CODE_VERIFIER = "code_verifier";
|
|
4182
|
-
const CLIENT_REQUEST_ID = "client-request-id";
|
|
4183
|
-
const X_CLIENT_SKU = "x-client-SKU";
|
|
4184
|
-
const X_CLIENT_VER = "x-client-VER";
|
|
4185
|
-
const X_CLIENT_OS = "x-client-OS";
|
|
4186
|
-
const X_CLIENT_CPU = "x-client-CPU";
|
|
4187
|
-
const X_CLIENT_CURR_TELEM = "x-client-current-telemetry";
|
|
4188
|
-
const X_CLIENT_LAST_TELEM = "x-client-last-telemetry";
|
|
4189
|
-
const X_MS_LIB_CAPABILITY = "x-ms-lib-capability";
|
|
4190
|
-
const X_APP_NAME = "x-app-name";
|
|
4191
|
-
const X_APP_VER = "x-app-ver";
|
|
4192
|
-
const POST_LOGOUT_URI = "post_logout_redirect_uri";
|
|
4193
|
-
const ID_TOKEN_HINT = "id_token_hint";
|
|
4194
|
-
const DEVICE_CODE = "device_code";
|
|
4195
|
-
const CLIENT_SECRET = "client_secret";
|
|
4196
|
-
const CLIENT_ASSERTION = "client_assertion";
|
|
4197
|
-
const CLIENT_ASSERTION_TYPE = "client_assertion_type";
|
|
4198
|
-
const TOKEN_TYPE = "token_type";
|
|
4199
|
-
const REQ_CNF = "req_cnf";
|
|
4200
|
-
const OBO_ASSERTION = "assertion";
|
|
4201
|
-
const REQUESTED_TOKEN_USE = "requested_token_use";
|
|
4202
|
-
const ON_BEHALF_OF = "on_behalf_of";
|
|
4203
|
-
const RETURN_SPA_CODE = "return_spa_code";
|
|
4204
|
-
const LOGOUT_HINT = "logout_hint";
|
|
4205
|
-
const SID = "sid";
|
|
4206
|
-
const LOGIN_HINT = "login_hint";
|
|
4207
|
-
const DOMAIN_HINT = "domain_hint";
|
|
4208
|
-
const X_CLIENT_EXTRA_SKU = "x-client-xtra-sku";
|
|
4209
|
-
const BROKER_CLIENT_ID = "brk_client_id";
|
|
4210
|
-
const BROKER_REDIRECT_URI = "brk_redirect_uri";
|
|
4211
|
-
const INSTANCE_AWARE = "instance_aware";
|
|
4212
|
-
|
|
4213
|
-
/*! @azure/msal-common v15.6.0 2025-05-06 */
|
|
4214
|
-
|
|
4215
|
-
/*
|
|
4216
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4217
|
-
* Licensed under the MIT License.
|
|
4218
|
-
*/
|
|
4219
|
-
function instrumentBrokerParams(parameters, correlationId, performanceClient) {
|
|
4220
|
-
if (!correlationId) {
|
|
4221
|
-
return;
|
|
4222
|
-
}
|
|
4223
|
-
const clientId = parameters.get(CLIENT_ID);
|
|
4224
|
-
if (clientId && parameters.has(BROKER_CLIENT_ID)) {
|
|
4225
|
-
performanceClient?.addFields({
|
|
4226
|
-
embeddedClientId: clientId,
|
|
4227
|
-
embeddedRedirectUri: parameters.get(REDIRECT_URI),
|
|
4228
|
-
}, correlationId);
|
|
4229
|
-
}
|
|
4230
|
-
}
|
|
4231
|
-
/**
|
|
4232
|
-
* Add the given response_type
|
|
4233
|
-
* @param parameters
|
|
4234
|
-
* @param responseType
|
|
4235
|
-
*/
|
|
4236
|
-
function addResponseType(parameters, responseType) {
|
|
4237
|
-
parameters.set(RESPONSE_TYPE, responseType);
|
|
4238
|
-
}
|
|
4239
|
-
/**
|
|
4240
|
-
* add response_mode. defaults to query.
|
|
4241
|
-
* @param responseMode
|
|
4242
|
-
*/
|
|
4243
|
-
function addResponseMode(parameters, responseMode) {
|
|
4244
|
-
parameters.set(RESPONSE_MODE, responseMode ? responseMode : ResponseMode.QUERY);
|
|
4245
|
-
}
|
|
4246
|
-
/**
|
|
4247
|
-
* add scopes. set addOidcScopes to false to prevent default scopes in non-user scenarios
|
|
4248
|
-
* @param scopeSet
|
|
4249
|
-
* @param addOidcScopes
|
|
4250
|
-
*/
|
|
4251
|
-
function addScopes(parameters, scopes, addOidcScopes = true, defaultScopes = OIDC_DEFAULT_SCOPES) {
|
|
4252
|
-
// Always add openid to the scopes when adding OIDC scopes
|
|
4253
|
-
if (addOidcScopes &&
|
|
4254
|
-
!defaultScopes.includes("openid") &&
|
|
4255
|
-
!scopes.includes("openid")) {
|
|
4256
|
-
defaultScopes.push("openid");
|
|
4257
|
-
}
|
|
4258
|
-
const requestScopes = addOidcScopes
|
|
4259
|
-
? [...(scopes || []), ...defaultScopes]
|
|
4260
|
-
: scopes || [];
|
|
4261
|
-
const scopeSet = new ScopeSet(requestScopes);
|
|
4262
|
-
parameters.set(SCOPE, scopeSet.printScopes());
|
|
4263
|
-
}
|
|
4264
|
-
/**
|
|
4265
|
-
* add clientId
|
|
4266
|
-
* @param clientId
|
|
4267
|
-
*/
|
|
4268
|
-
function addClientId(parameters, clientId) {
|
|
4269
|
-
parameters.set(CLIENT_ID, clientId);
|
|
4270
|
-
}
|
|
4271
|
-
/**
|
|
4272
|
-
* add redirect_uri
|
|
4273
|
-
* @param redirectUri
|
|
4274
|
-
*/
|
|
4275
|
-
function addRedirectUri(parameters, redirectUri) {
|
|
4276
|
-
parameters.set(REDIRECT_URI, redirectUri);
|
|
4277
|
-
}
|
|
4278
|
-
/**
|
|
4279
|
-
* add post logout redirectUri
|
|
4280
|
-
* @param redirectUri
|
|
4281
|
-
*/
|
|
4282
|
-
function addPostLogoutRedirectUri(parameters, redirectUri) {
|
|
4283
|
-
parameters.set(POST_LOGOUT_URI, redirectUri);
|
|
4284
|
-
}
|
|
4285
|
-
/**
|
|
4286
|
-
* add id_token_hint to logout request
|
|
4287
|
-
* @param idTokenHint
|
|
4288
|
-
*/
|
|
4289
|
-
function addIdTokenHint(parameters, idTokenHint) {
|
|
4290
|
-
parameters.set(ID_TOKEN_HINT, idTokenHint);
|
|
4291
|
-
}
|
|
4292
|
-
/**
|
|
4293
|
-
* add domain_hint
|
|
4294
|
-
* @param domainHint
|
|
4295
|
-
*/
|
|
4296
|
-
function addDomainHint(parameters, domainHint) {
|
|
4297
|
-
parameters.set(DOMAIN_HINT, domainHint);
|
|
4298
|
-
}
|
|
4299
|
-
/**
|
|
4300
|
-
* add login_hint
|
|
4301
|
-
* @param loginHint
|
|
4051
|
+
* @export
|
|
4052
|
+
* @enum {number}
|
|
4302
4053
|
*/
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4054
|
+
const PerformanceEvents = {
|
|
4055
|
+
/**
|
|
4056
|
+
* acquireTokenByCode API (msal-browser and msal-node).
|
|
4057
|
+
* Used to acquire tokens by trading an authorization code against the token endpoint.
|
|
4058
|
+
*/
|
|
4059
|
+
AcquireTokenByCode: "acquireTokenByCode",
|
|
4060
|
+
/**
|
|
4061
|
+
* acquireTokenByRefreshToken API (msal-browser and msal-node).
|
|
4062
|
+
* Used to renew an access token using a refresh token against the token endpoint.
|
|
4063
|
+
*/
|
|
4064
|
+
AcquireTokenByRefreshToken: "acquireTokenByRefreshToken",
|
|
4065
|
+
/**
|
|
4066
|
+
* acquireTokenSilent API (msal-browser and msal-node).
|
|
4067
|
+
* Used to silently acquire a new access token (from the cache or the network).
|
|
4068
|
+
*/
|
|
4069
|
+
AcquireTokenSilent: "acquireTokenSilent",
|
|
4070
|
+
/**
|
|
4071
|
+
* acquireTokenSilentAsync (msal-browser).
|
|
4072
|
+
* Internal API for acquireTokenSilent.
|
|
4073
|
+
*/
|
|
4074
|
+
AcquireTokenSilentAsync: "acquireTokenSilentAsync",
|
|
4075
|
+
/**
|
|
4076
|
+
* acquireTokenPopup (msal-browser).
|
|
4077
|
+
* Used to acquire a new access token interactively through pop ups
|
|
4078
|
+
*/
|
|
4079
|
+
AcquireTokenPopup: "acquireTokenPopup",
|
|
4080
|
+
/**
|
|
4081
|
+
* acquireTokenPreRedirect (msal-browser).
|
|
4082
|
+
* First part of the redirect flow.
|
|
4083
|
+
* Used to acquire a new access token interactively through redirects.
|
|
4084
|
+
*/
|
|
4085
|
+
AcquireTokenPreRedirect: "acquireTokenPreRedirect",
|
|
4086
|
+
/**
|
|
4087
|
+
* acquireTokenRedirect (msal-browser).
|
|
4088
|
+
* Second part of the redirect flow.
|
|
4089
|
+
* Used to acquire a new access token interactively through redirects.
|
|
4090
|
+
*/
|
|
4091
|
+
AcquireTokenRedirect: "acquireTokenRedirect",
|
|
4092
|
+
/**
|
|
4093
|
+
* getPublicKeyThumbprint API in CryptoOpts class (msal-browser).
|
|
4094
|
+
* Used to generate a public/private keypair and generate a public key thumbprint for pop requests.
|
|
4095
|
+
*/
|
|
4096
|
+
CryptoOptsGetPublicKeyThumbprint: "cryptoOptsGetPublicKeyThumbprint",
|
|
4097
|
+
/**
|
|
4098
|
+
* signJwt API in CryptoOpts class (msal-browser).
|
|
4099
|
+
* Used to signed a pop token.
|
|
4100
|
+
*/
|
|
4101
|
+
CryptoOptsSignJwt: "cryptoOptsSignJwt",
|
|
4102
|
+
/**
|
|
4103
|
+
* acquireToken API in the SilentCacheClient class (msal-browser).
|
|
4104
|
+
* Used to read access tokens from the cache.
|
|
4105
|
+
*/
|
|
4106
|
+
SilentCacheClientAcquireToken: "silentCacheClientAcquireToken",
|
|
4107
|
+
/**
|
|
4108
|
+
* acquireToken API in the SilentIframeClient class (msal-browser).
|
|
4109
|
+
* Used to acquire a new set of tokens from the authorize endpoint in a hidden iframe.
|
|
4110
|
+
*/
|
|
4111
|
+
SilentIframeClientAcquireToken: "silentIframeClientAcquireToken",
|
|
4112
|
+
AwaitConcurrentIframe: "awaitConcurrentIframe",
|
|
4113
|
+
/**
|
|
4114
|
+
* acquireToken API in SilentRereshClient (msal-browser).
|
|
4115
|
+
* Used to acquire a new set of tokens from the token endpoint using a refresh token.
|
|
4116
|
+
*/
|
|
4117
|
+
SilentRefreshClientAcquireToken: "silentRefreshClientAcquireToken",
|
|
4118
|
+
/**
|
|
4119
|
+
* ssoSilent API (msal-browser).
|
|
4120
|
+
* Used to silently acquire an authorization code and set of tokens using a hidden iframe.
|
|
4121
|
+
*/
|
|
4122
|
+
SsoSilent: "ssoSilent",
|
|
4123
|
+
/**
|
|
4124
|
+
* getDiscoveredAuthority API in StandardInteractionClient class (msal-browser).
|
|
4125
|
+
* Used to load authority metadata for a request.
|
|
4126
|
+
*/
|
|
4127
|
+
StandardInteractionClientGetDiscoveredAuthority: "standardInteractionClientGetDiscoveredAuthority",
|
|
4128
|
+
/**
|
|
4129
|
+
* acquireToken APIs in msal-browser.
|
|
4130
|
+
* Used to make an /authorize endpoint call with native brokering enabled.
|
|
4131
|
+
*/
|
|
4132
|
+
FetchAccountIdWithNativeBroker: "fetchAccountIdWithNativeBroker",
|
|
4133
|
+
/**
|
|
4134
|
+
* acquireToken API in NativeInteractionClient class (msal-browser).
|
|
4135
|
+
* Used to acquire a token from Native component when native brokering is enabled.
|
|
4136
|
+
*/
|
|
4137
|
+
NativeInteractionClientAcquireToken: "nativeInteractionClientAcquireToken",
|
|
4138
|
+
/**
|
|
4139
|
+
* Time spent creating default headers for requests to token endpoint
|
|
4140
|
+
*/
|
|
4141
|
+
BaseClientCreateTokenRequestHeaders: "baseClientCreateTokenRequestHeaders",
|
|
4142
|
+
/**
|
|
4143
|
+
* Time spent sending/waiting for the response of a request to the token endpoint
|
|
4144
|
+
*/
|
|
4145
|
+
NetworkClientSendPostRequestAsync: "networkClientSendPostRequestAsync",
|
|
4146
|
+
RefreshTokenClientExecutePostToTokenEndpoint: "refreshTokenClientExecutePostToTokenEndpoint",
|
|
4147
|
+
AuthorizationCodeClientExecutePostToTokenEndpoint: "authorizationCodeClientExecutePostToTokenEndpoint",
|
|
4148
|
+
/**
|
|
4149
|
+
* Used to measure the time taken for completing embedded-broker handshake (PW-Broker).
|
|
4150
|
+
*/
|
|
4151
|
+
BrokerHandhshake: "brokerHandshake",
|
|
4152
|
+
/**
|
|
4153
|
+
* acquireTokenByRefreshToken API in BrokerClientApplication (PW-Broker) .
|
|
4154
|
+
*/
|
|
4155
|
+
AcquireTokenByRefreshTokenInBroker: "acquireTokenByRefreshTokenInBroker",
|
|
4156
|
+
/**
|
|
4157
|
+
* Time taken for token acquisition by broker
|
|
4158
|
+
*/
|
|
4159
|
+
AcquireTokenByBroker: "acquireTokenByBroker",
|
|
4160
|
+
/**
|
|
4161
|
+
* Time spent on the network for refresh token acquisition
|
|
4162
|
+
*/
|
|
4163
|
+
RefreshTokenClientExecuteTokenRequest: "refreshTokenClientExecuteTokenRequest",
|
|
4164
|
+
/**
|
|
4165
|
+
* Time taken for acquiring refresh token , records RT size
|
|
4166
|
+
*/
|
|
4167
|
+
RefreshTokenClientAcquireToken: "refreshTokenClientAcquireToken",
|
|
4168
|
+
/**
|
|
4169
|
+
* Time taken for acquiring cached refresh token
|
|
4170
|
+
*/
|
|
4171
|
+
RefreshTokenClientAcquireTokenWithCachedRefreshToken: "refreshTokenClientAcquireTokenWithCachedRefreshToken",
|
|
4172
|
+
/**
|
|
4173
|
+
* acquireTokenByRefreshToken API in RefreshTokenClient (msal-common).
|
|
4174
|
+
*/
|
|
4175
|
+
RefreshTokenClientAcquireTokenByRefreshToken: "refreshTokenClientAcquireTokenByRefreshToken",
|
|
4176
|
+
/**
|
|
4177
|
+
* Helper function to create token request body in RefreshTokenClient (msal-common).
|
|
4178
|
+
*/
|
|
4179
|
+
RefreshTokenClientCreateTokenRequestBody: "refreshTokenClientCreateTokenRequestBody",
|
|
4180
|
+
/**
|
|
4181
|
+
* acquireTokenFromCache (msal-browser).
|
|
4182
|
+
* Internal API for acquiring token from cache
|
|
4183
|
+
*/
|
|
4184
|
+
AcquireTokenFromCache: "acquireTokenFromCache",
|
|
4185
|
+
SilentFlowClientAcquireCachedToken: "silentFlowClientAcquireCachedToken",
|
|
4186
|
+
SilentFlowClientGenerateResultFromCacheRecord: "silentFlowClientGenerateResultFromCacheRecord",
|
|
4187
|
+
/**
|
|
4188
|
+
* acquireTokenBySilentIframe (msal-browser).
|
|
4189
|
+
* Internal API for acquiring token by silent Iframe
|
|
4190
|
+
*/
|
|
4191
|
+
AcquireTokenBySilentIframe: "acquireTokenBySilentIframe",
|
|
4192
|
+
/**
|
|
4193
|
+
* Internal API for initializing base request in BaseInteractionClient (msal-browser)
|
|
4194
|
+
*/
|
|
4195
|
+
InitializeBaseRequest: "initializeBaseRequest",
|
|
4196
|
+
/**
|
|
4197
|
+
* Internal API for initializing silent request in SilentCacheClient (msal-browser)
|
|
4198
|
+
*/
|
|
4199
|
+
InitializeSilentRequest: "initializeSilentRequest",
|
|
4200
|
+
InitializeClientApplication: "initializeClientApplication",
|
|
4201
|
+
InitializeCache: "initializeCache",
|
|
4202
|
+
/**
|
|
4203
|
+
* Helper function in SilentIframeClient class (msal-browser).
|
|
4204
|
+
*/
|
|
4205
|
+
SilentIframeClientTokenHelper: "silentIframeClientTokenHelper",
|
|
4206
|
+
/**
|
|
4207
|
+
* SilentHandler
|
|
4208
|
+
*/
|
|
4209
|
+
SilentHandlerInitiateAuthRequest: "silentHandlerInitiateAuthRequest",
|
|
4210
|
+
SilentHandlerMonitorIframeForHash: "silentHandlerMonitorIframeForHash",
|
|
4211
|
+
SilentHandlerLoadFrame: "silentHandlerLoadFrame",
|
|
4212
|
+
SilentHandlerLoadFrameSync: "silentHandlerLoadFrameSync",
|
|
4213
|
+
/**
|
|
4214
|
+
* Helper functions in StandardInteractionClient class (msal-browser)
|
|
4215
|
+
*/
|
|
4216
|
+
StandardInteractionClientCreateAuthCodeClient: "standardInteractionClientCreateAuthCodeClient",
|
|
4217
|
+
StandardInteractionClientGetClientConfiguration: "standardInteractionClientGetClientConfiguration",
|
|
4218
|
+
StandardInteractionClientInitializeAuthorizationRequest: "standardInteractionClientInitializeAuthorizationRequest",
|
|
4219
|
+
/**
|
|
4220
|
+
* getAuthCodeUrl API (msal-browser and msal-node).
|
|
4221
|
+
*/
|
|
4222
|
+
GetAuthCodeUrl: "getAuthCodeUrl",
|
|
4223
|
+
GetStandardParams: "getStandardParams",
|
|
4224
|
+
/**
|
|
4225
|
+
* Functions from InteractionHandler (msal-browser)
|
|
4226
|
+
*/
|
|
4227
|
+
HandleCodeResponseFromServer: "handleCodeResponseFromServer",
|
|
4228
|
+
HandleCodeResponse: "handleCodeResponse",
|
|
4229
|
+
HandleResponseEar: "handleResponseEar",
|
|
4230
|
+
HandleResponsePlatformBroker: "handleResponsePlatformBroker",
|
|
4231
|
+
HandleResponseCode: "handleResponseCode",
|
|
4232
|
+
UpdateTokenEndpointAuthority: "updateTokenEndpointAuthority",
|
|
4233
|
+
/**
|
|
4234
|
+
* APIs in Authorization Code Client (msal-common)
|
|
4235
|
+
*/
|
|
4236
|
+
AuthClientAcquireToken: "authClientAcquireToken",
|
|
4237
|
+
AuthClientExecuteTokenRequest: "authClientExecuteTokenRequest",
|
|
4238
|
+
AuthClientCreateTokenRequestBody: "authClientCreateTokenRequestBody",
|
|
4239
|
+
/**
|
|
4240
|
+
* Generate functions in PopTokenGenerator (msal-common)
|
|
4241
|
+
*/
|
|
4242
|
+
PopTokenGenerateCnf: "popTokenGenerateCnf",
|
|
4243
|
+
PopTokenGenerateKid: "popTokenGenerateKid",
|
|
4244
|
+
/**
|
|
4245
|
+
* handleServerTokenResponse API in ResponseHandler (msal-common)
|
|
4246
|
+
*/
|
|
4247
|
+
HandleServerTokenResponse: "handleServerTokenResponse",
|
|
4248
|
+
DeserializeResponse: "deserializeResponse",
|
|
4249
|
+
/**
|
|
4250
|
+
* Authority functions
|
|
4251
|
+
*/
|
|
4252
|
+
AuthorityFactoryCreateDiscoveredInstance: "authorityFactoryCreateDiscoveredInstance",
|
|
4253
|
+
AuthorityResolveEndpointsAsync: "authorityResolveEndpointsAsync",
|
|
4254
|
+
AuthorityResolveEndpointsFromLocalSources: "authorityResolveEndpointsFromLocalSources",
|
|
4255
|
+
AuthorityGetCloudDiscoveryMetadataFromNetwork: "authorityGetCloudDiscoveryMetadataFromNetwork",
|
|
4256
|
+
AuthorityUpdateCloudDiscoveryMetadata: "authorityUpdateCloudDiscoveryMetadata",
|
|
4257
|
+
AuthorityGetEndpointMetadataFromNetwork: "authorityGetEndpointMetadataFromNetwork",
|
|
4258
|
+
AuthorityUpdateEndpointMetadata: "authorityUpdateEndpointMetadata",
|
|
4259
|
+
AuthorityUpdateMetadataWithRegionalInformation: "authorityUpdateMetadataWithRegionalInformation",
|
|
4260
|
+
/**
|
|
4261
|
+
* Region Discovery functions
|
|
4262
|
+
*/
|
|
4263
|
+
RegionDiscoveryDetectRegion: "regionDiscoveryDetectRegion",
|
|
4264
|
+
RegionDiscoveryGetRegionFromIMDS: "regionDiscoveryGetRegionFromIMDS",
|
|
4265
|
+
RegionDiscoveryGetCurrentVersion: "regionDiscoveryGetCurrentVersion",
|
|
4266
|
+
AcquireTokenByCodeAsync: "acquireTokenByCodeAsync",
|
|
4267
|
+
GetEndpointMetadataFromNetwork: "getEndpointMetadataFromNetwork",
|
|
4268
|
+
GetCloudDiscoveryMetadataFromNetworkMeasurement: "getCloudDiscoveryMetadataFromNetworkMeasurement",
|
|
4269
|
+
HandleRedirectPromiseMeasurement: "handleRedirectPromise",
|
|
4270
|
+
HandleNativeRedirectPromiseMeasurement: "handleNativeRedirectPromise",
|
|
4271
|
+
UpdateCloudDiscoveryMetadataMeasurement: "updateCloudDiscoveryMetadataMeasurement",
|
|
4272
|
+
UsernamePasswordClientAcquireToken: "usernamePasswordClientAcquireToken",
|
|
4273
|
+
NativeMessageHandlerHandshake: "nativeMessageHandlerHandshake",
|
|
4274
|
+
NativeGenerateAuthResult: "nativeGenerateAuthResult",
|
|
4275
|
+
RemoveHiddenIframe: "removeHiddenIframe",
|
|
4276
|
+
/**
|
|
4277
|
+
* Cache operations
|
|
4278
|
+
*/
|
|
4279
|
+
ClearTokensAndKeysWithClaims: "clearTokensAndKeysWithClaims",
|
|
4280
|
+
CacheManagerGetRefreshToken: "cacheManagerGetRefreshToken",
|
|
4281
|
+
ImportExistingCache: "importExistingCache",
|
|
4282
|
+
SetUserData: "setUserData",
|
|
4283
|
+
LocalStorageUpdated: "localStorageUpdated",
|
|
4284
|
+
/**
|
|
4285
|
+
* Crypto Operations
|
|
4286
|
+
*/
|
|
4287
|
+
GeneratePkceCodes: "generatePkceCodes",
|
|
4288
|
+
GenerateCodeVerifier: "generateCodeVerifier",
|
|
4289
|
+
GenerateCodeChallengeFromVerifier: "generateCodeChallengeFromVerifier",
|
|
4290
|
+
Sha256Digest: "sha256Digest",
|
|
4291
|
+
GetRandomValues: "getRandomValues",
|
|
4292
|
+
GenerateHKDF: "generateHKDF",
|
|
4293
|
+
GenerateBaseKey: "generateBaseKey",
|
|
4294
|
+
Base64Decode: "base64Decode",
|
|
4295
|
+
UrlEncodeArr: "urlEncodeArr",
|
|
4296
|
+
Encrypt: "encrypt",
|
|
4297
|
+
Decrypt: "decrypt",
|
|
4298
|
+
GenerateEarKey: "generateEarKey",
|
|
4299
|
+
DecryptEarResponse: "decryptEarResponse",
|
|
4300
|
+
};
|
|
4306
4301
|
/**
|
|
4307
|
-
*
|
|
4308
|
-
*
|
|
4302
|
+
* State of the performance event.
|
|
4303
|
+
*
|
|
4304
|
+
* @export
|
|
4305
|
+
* @enum {number}
|
|
4309
4306
|
*/
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
*/
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
* add sid
|
|
4322
|
-
* @param sid
|
|
4323
|
-
*/
|
|
4324
|
-
function addSid(parameters, sid) {
|
|
4325
|
-
parameters.set(SID, sid);
|
|
4326
|
-
}
|
|
4327
|
-
/**
|
|
4328
|
-
* add claims
|
|
4329
|
-
* @param claims
|
|
4307
|
+
const PerformanceEventStatus = {
|
|
4308
|
+
NotStarted: 0,
|
|
4309
|
+
InProgress: 1,
|
|
4310
|
+
Completed: 2,
|
|
4311
|
+
};
|
|
4312
|
+
|
|
4313
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
4314
|
+
|
|
4315
|
+
/*
|
|
4316
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4317
|
+
* Licensed under the MIT License.
|
|
4330
4318
|
*/
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
JSON.parse(mergedClaims);
|
|
4319
|
+
class StubPerformanceMeasurement {
|
|
4320
|
+
startMeasurement() {
|
|
4321
|
+
return;
|
|
4335
4322
|
}
|
|
4336
|
-
|
|
4337
|
-
|
|
4323
|
+
endMeasurement() {
|
|
4324
|
+
return;
|
|
4325
|
+
}
|
|
4326
|
+
flushMeasurement() {
|
|
4327
|
+
return null;
|
|
4338
4328
|
}
|
|
4339
|
-
parameters.set(CLAIMS, mergedClaims);
|
|
4340
|
-
}
|
|
4341
|
-
/**
|
|
4342
|
-
* add correlationId
|
|
4343
|
-
* @param correlationId
|
|
4344
|
-
*/
|
|
4345
|
-
function addCorrelationId(parameters, correlationId) {
|
|
4346
|
-
parameters.set(CLIENT_REQUEST_ID, correlationId);
|
|
4347
4329
|
}
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
*/
|
|
4352
|
-
function addLibraryInfo(parameters, libraryInfo) {
|
|
4353
|
-
// Telemetry Info
|
|
4354
|
-
parameters.set(X_CLIENT_SKU, libraryInfo.sku);
|
|
4355
|
-
parameters.set(X_CLIENT_VER, libraryInfo.version);
|
|
4356
|
-
if (libraryInfo.os) {
|
|
4357
|
-
parameters.set(X_CLIENT_OS, libraryInfo.os);
|
|
4330
|
+
class StubPerformanceClient {
|
|
4331
|
+
generateId() {
|
|
4332
|
+
return "callback-id";
|
|
4358
4333
|
}
|
|
4359
|
-
|
|
4360
|
-
|
|
4334
|
+
startMeasurement(measureName, correlationId) {
|
|
4335
|
+
return {
|
|
4336
|
+
end: () => null,
|
|
4337
|
+
discard: () => { },
|
|
4338
|
+
add: () => { },
|
|
4339
|
+
increment: () => { },
|
|
4340
|
+
event: {
|
|
4341
|
+
eventId: this.generateId(),
|
|
4342
|
+
status: PerformanceEventStatus.InProgress,
|
|
4343
|
+
authority: "",
|
|
4344
|
+
libraryName: "",
|
|
4345
|
+
libraryVersion: "",
|
|
4346
|
+
clientId: "",
|
|
4347
|
+
name: measureName,
|
|
4348
|
+
startTimeMs: Date.now(),
|
|
4349
|
+
correlationId: correlationId || "",
|
|
4350
|
+
},
|
|
4351
|
+
measurement: new StubPerformanceMeasurement(),
|
|
4352
|
+
};
|
|
4361
4353
|
}
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
* Add client telemetry parameters
|
|
4365
|
-
* @param appTelemetry
|
|
4366
|
-
*/
|
|
4367
|
-
function addApplicationTelemetry(parameters, appTelemetry) {
|
|
4368
|
-
if (appTelemetry?.appName) {
|
|
4369
|
-
parameters.set(X_APP_NAME, appTelemetry.appName);
|
|
4354
|
+
startPerformanceMeasurement() {
|
|
4355
|
+
return new StubPerformanceMeasurement();
|
|
4370
4356
|
}
|
|
4371
|
-
|
|
4372
|
-
|
|
4357
|
+
calculateQueuedTime() {
|
|
4358
|
+
return 0;
|
|
4373
4359
|
}
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
* add prompt
|
|
4377
|
-
* @param prompt
|
|
4378
|
-
*/
|
|
4379
|
-
function addPrompt(parameters, prompt) {
|
|
4380
|
-
parameters.set(PROMPT, prompt);
|
|
4381
|
-
}
|
|
4382
|
-
/**
|
|
4383
|
-
* add state
|
|
4384
|
-
* @param state
|
|
4385
|
-
*/
|
|
4386
|
-
function addState(parameters, state) {
|
|
4387
|
-
if (state) {
|
|
4388
|
-
parameters.set(STATE, state);
|
|
4360
|
+
addQueueMeasurement() {
|
|
4361
|
+
return;
|
|
4389
4362
|
}
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
* add nonce
|
|
4393
|
-
* @param nonce
|
|
4394
|
-
*/
|
|
4395
|
-
function addNonce(parameters, nonce) {
|
|
4396
|
-
parameters.set(NONCE, nonce);
|
|
4397
|
-
}
|
|
4398
|
-
/**
|
|
4399
|
-
* add code_challenge and code_challenge_method
|
|
4400
|
-
* - throw if either of them are not passed
|
|
4401
|
-
* @param codeChallenge
|
|
4402
|
-
* @param codeChallengeMethod
|
|
4403
|
-
*/
|
|
4404
|
-
function addCodeChallengeParams(parameters, codeChallenge, codeChallengeMethod) {
|
|
4405
|
-
if (codeChallenge && codeChallengeMethod) {
|
|
4406
|
-
parameters.set(CODE_CHALLENGE, codeChallenge);
|
|
4407
|
-
parameters.set(CODE_CHALLENGE_METHOD, codeChallengeMethod);
|
|
4363
|
+
setPreQueueTime() {
|
|
4364
|
+
return;
|
|
4408
4365
|
}
|
|
4409
|
-
|
|
4410
|
-
|
|
4366
|
+
endMeasurement() {
|
|
4367
|
+
return null;
|
|
4411
4368
|
}
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4369
|
+
discardMeasurements() {
|
|
4370
|
+
return;
|
|
4371
|
+
}
|
|
4372
|
+
removePerformanceCallback() {
|
|
4373
|
+
return true;
|
|
4374
|
+
}
|
|
4375
|
+
addPerformanceCallback() {
|
|
4376
|
+
return "";
|
|
4377
|
+
}
|
|
4378
|
+
emitEvents() {
|
|
4379
|
+
return;
|
|
4380
|
+
}
|
|
4381
|
+
addFields() {
|
|
4382
|
+
return;
|
|
4383
|
+
}
|
|
4384
|
+
incrementFields() {
|
|
4385
|
+
return;
|
|
4386
|
+
}
|
|
4387
|
+
cacheEventByCorrelationId() {
|
|
4388
|
+
return;
|
|
4389
|
+
}
|
|
4390
|
+
}
|
|
4391
|
+
|
|
4392
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
4393
|
+
|
|
4394
|
+
/*
|
|
4395
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4396
|
+
* Licensed under the MIT License.
|
|
4416
4397
|
*/
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4398
|
+
const DEFAULT_SYSTEM_OPTIONS$1 = {
|
|
4399
|
+
tokenRenewalOffsetSeconds: DEFAULT_TOKEN_RENEWAL_OFFSET_SEC,
|
|
4400
|
+
preventCorsPreflight: false,
|
|
4401
|
+
};
|
|
4402
|
+
const DEFAULT_LOGGER_IMPLEMENTATION = {
|
|
4403
|
+
loggerCallback: () => {
|
|
4404
|
+
// allow users to not set loggerCallback
|
|
4405
|
+
},
|
|
4406
|
+
piiLoggingEnabled: false,
|
|
4407
|
+
logLevel: exports.LogLevel.Info,
|
|
4408
|
+
correlationId: Constants$1.EMPTY_STRING,
|
|
4409
|
+
};
|
|
4410
|
+
const DEFAULT_CACHE_OPTIONS$1 = {
|
|
4411
|
+
claimsBasedCachingEnabled: false,
|
|
4412
|
+
};
|
|
4413
|
+
const DEFAULT_NETWORK_IMPLEMENTATION = {
|
|
4414
|
+
async sendGetRequestAsync() {
|
|
4415
|
+
throw createClientAuthError(methodNotImplemented);
|
|
4416
|
+
},
|
|
4417
|
+
async sendPostRequestAsync() {
|
|
4418
|
+
throw createClientAuthError(methodNotImplemented);
|
|
4419
|
+
},
|
|
4420
|
+
};
|
|
4421
|
+
const DEFAULT_LIBRARY_INFO = {
|
|
4422
|
+
sku: Constants$1.SKU,
|
|
4423
|
+
version: version$1,
|
|
4424
|
+
cpu: Constants$1.EMPTY_STRING,
|
|
4425
|
+
os: Constants$1.EMPTY_STRING,
|
|
4426
|
+
};
|
|
4427
|
+
const DEFAULT_CLIENT_CREDENTIALS = {
|
|
4428
|
+
clientSecret: Constants$1.EMPTY_STRING,
|
|
4429
|
+
clientAssertion: undefined,
|
|
4430
|
+
};
|
|
4431
|
+
const DEFAULT_AZURE_CLOUD_OPTIONS = {
|
|
4432
|
+
azureCloudInstance: AzureCloudInstance.None,
|
|
4433
|
+
tenant: `${Constants$1.DEFAULT_COMMON_TENANT}`,
|
|
4434
|
+
};
|
|
4435
|
+
const DEFAULT_TELEMETRY_OPTIONS$1 = {
|
|
4436
|
+
application: {
|
|
4437
|
+
appName: "",
|
|
4438
|
+
appVersion: "",
|
|
4439
|
+
},
|
|
4440
|
+
};
|
|
4420
4441
|
/**
|
|
4421
|
-
*
|
|
4422
|
-
*
|
|
4442
|
+
* Function that sets the default options when not explicitly configured from app developer
|
|
4443
|
+
*
|
|
4444
|
+
* @param Configuration
|
|
4445
|
+
*
|
|
4446
|
+
* @returns Configuration
|
|
4423
4447
|
*/
|
|
4424
|
-
function
|
|
4425
|
-
|
|
4448
|
+
function buildClientConfiguration({ authOptions: userAuthOptions, systemOptions: userSystemOptions, loggerOptions: userLoggerOption, cacheOptions: userCacheOptions, storageInterface: storageImplementation, networkInterface: networkImplementation, cryptoInterface: cryptoImplementation, clientCredentials: clientCredentials, libraryInfo: libraryInfo, telemetry: telemetry, serverTelemetryManager: serverTelemetryManager, persistencePlugin: persistencePlugin, serializableCache: serializableCache, }) {
|
|
4449
|
+
const loggerOptions = {
|
|
4450
|
+
...DEFAULT_LOGGER_IMPLEMENTATION,
|
|
4451
|
+
...userLoggerOption,
|
|
4452
|
+
};
|
|
4453
|
+
return {
|
|
4454
|
+
authOptions: buildAuthOptions(userAuthOptions),
|
|
4455
|
+
systemOptions: { ...DEFAULT_SYSTEM_OPTIONS$1, ...userSystemOptions },
|
|
4456
|
+
loggerOptions: loggerOptions,
|
|
4457
|
+
cacheOptions: { ...DEFAULT_CACHE_OPTIONS$1, ...userCacheOptions },
|
|
4458
|
+
storageInterface: storageImplementation ||
|
|
4459
|
+
new DefaultStorageClass(userAuthOptions.clientId, DEFAULT_CRYPTO_IMPLEMENTATION, new Logger(loggerOptions), new StubPerformanceClient()),
|
|
4460
|
+
networkInterface: networkImplementation || DEFAULT_NETWORK_IMPLEMENTATION,
|
|
4461
|
+
cryptoInterface: cryptoImplementation || DEFAULT_CRYPTO_IMPLEMENTATION,
|
|
4462
|
+
clientCredentials: clientCredentials || DEFAULT_CLIENT_CREDENTIALS,
|
|
4463
|
+
libraryInfo: { ...DEFAULT_LIBRARY_INFO, ...libraryInfo },
|
|
4464
|
+
telemetry: { ...DEFAULT_TELEMETRY_OPTIONS$1, ...telemetry },
|
|
4465
|
+
serverTelemetryManager: serverTelemetryManager || null,
|
|
4466
|
+
persistencePlugin: persistencePlugin || null,
|
|
4467
|
+
serializableCache: serializableCache || null,
|
|
4468
|
+
};
|
|
4426
4469
|
}
|
|
4427
4470
|
/**
|
|
4428
|
-
*
|
|
4429
|
-
* @param
|
|
4471
|
+
* Construct authoptions from the client and platform passed values
|
|
4472
|
+
* @param authOptions
|
|
4430
4473
|
*/
|
|
4431
|
-
function
|
|
4432
|
-
|
|
4474
|
+
function buildAuthOptions(authOptions) {
|
|
4475
|
+
return {
|
|
4476
|
+
clientCapabilities: [],
|
|
4477
|
+
azureCloudOptions: DEFAULT_AZURE_CLOUD_OPTIONS,
|
|
4478
|
+
skipAuthorityMetadataCache: false,
|
|
4479
|
+
instanceAware: false,
|
|
4480
|
+
encodeExtraQueryParams: false,
|
|
4481
|
+
...authOptions,
|
|
4482
|
+
};
|
|
4433
4483
|
}
|
|
4434
4484
|
/**
|
|
4435
|
-
*
|
|
4436
|
-
* @param
|
|
4485
|
+
* Returns true if config has protocolMode set to ProtocolMode.OIDC, false otherwise
|
|
4486
|
+
* @param ClientConfiguration
|
|
4437
4487
|
*/
|
|
4438
|
-
function
|
|
4439
|
-
|
|
4440
|
-
}
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4488
|
+
function isOidcProtocolMode(config) {
|
|
4489
|
+
return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
|
|
4490
|
+
}
|
|
4491
|
+
|
|
4492
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
4493
|
+
/*
|
|
4494
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4495
|
+
* Licensed under the MIT License.
|
|
4444
4496
|
*/
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4497
|
+
const CcsCredentialType = {
|
|
4498
|
+
HOME_ACCOUNT_ID: "home_account_id",
|
|
4499
|
+
UPN: "UPN",
|
|
4500
|
+
};
|
|
4501
|
+
|
|
4502
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
4503
|
+
/*
|
|
4504
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4505
|
+
* Licensed under the MIT License.
|
|
4451
4506
|
*/
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4507
|
+
const CLIENT_ID = "client_id";
|
|
4508
|
+
const REDIRECT_URI = "redirect_uri";
|
|
4509
|
+
const RESPONSE_TYPE = "response_type";
|
|
4510
|
+
const RESPONSE_MODE = "response_mode";
|
|
4511
|
+
const GRANT_TYPE = "grant_type";
|
|
4512
|
+
const CLAIMS = "claims";
|
|
4513
|
+
const SCOPE = "scope";
|
|
4514
|
+
const REFRESH_TOKEN = "refresh_token";
|
|
4515
|
+
const STATE = "state";
|
|
4516
|
+
const NONCE = "nonce";
|
|
4517
|
+
const PROMPT = "prompt";
|
|
4518
|
+
const CODE = "code";
|
|
4519
|
+
const CODE_CHALLENGE = "code_challenge";
|
|
4520
|
+
const CODE_CHALLENGE_METHOD = "code_challenge_method";
|
|
4521
|
+
const CODE_VERIFIER = "code_verifier";
|
|
4522
|
+
const CLIENT_REQUEST_ID = "client-request-id";
|
|
4523
|
+
const X_CLIENT_SKU = "x-client-SKU";
|
|
4524
|
+
const X_CLIENT_VER = "x-client-VER";
|
|
4525
|
+
const X_CLIENT_OS = "x-client-OS";
|
|
4526
|
+
const X_CLIENT_CPU = "x-client-CPU";
|
|
4527
|
+
const X_CLIENT_CURR_TELEM = "x-client-current-telemetry";
|
|
4528
|
+
const X_CLIENT_LAST_TELEM = "x-client-last-telemetry";
|
|
4529
|
+
const X_MS_LIB_CAPABILITY = "x-ms-lib-capability";
|
|
4530
|
+
const X_APP_NAME = "x-app-name";
|
|
4531
|
+
const X_APP_VER = "x-app-ver";
|
|
4532
|
+
const POST_LOGOUT_URI = "post_logout_redirect_uri";
|
|
4533
|
+
const ID_TOKEN_HINT = "id_token_hint";
|
|
4534
|
+
const DEVICE_CODE = "device_code";
|
|
4535
|
+
const CLIENT_SECRET = "client_secret";
|
|
4536
|
+
const CLIENT_ASSERTION = "client_assertion";
|
|
4537
|
+
const CLIENT_ASSERTION_TYPE = "client_assertion_type";
|
|
4538
|
+
const TOKEN_TYPE = "token_type";
|
|
4539
|
+
const REQ_CNF = "req_cnf";
|
|
4540
|
+
const OBO_ASSERTION = "assertion";
|
|
4541
|
+
const REQUESTED_TOKEN_USE = "requested_token_use";
|
|
4542
|
+
const ON_BEHALF_OF = "on_behalf_of";
|
|
4543
|
+
const RETURN_SPA_CODE = "return_spa_code";
|
|
4544
|
+
const LOGOUT_HINT = "logout_hint";
|
|
4545
|
+
const SID = "sid";
|
|
4546
|
+
const LOGIN_HINT = "login_hint";
|
|
4547
|
+
const DOMAIN_HINT = "domain_hint";
|
|
4548
|
+
const X_CLIENT_EXTRA_SKU = "x-client-xtra-sku";
|
|
4549
|
+
const BROKER_CLIENT_ID = "brk_client_id";
|
|
4550
|
+
const BROKER_REDIRECT_URI = "brk_redirect_uri";
|
|
4551
|
+
const INSTANCE_AWARE = "instance_aware";
|
|
4552
|
+
|
|
4553
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
4554
|
+
|
|
4555
|
+
/*
|
|
4556
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4557
|
+
* Licensed under the MIT License.
|
|
4460
4558
|
*/
|
|
4461
|
-
function
|
|
4462
|
-
if (
|
|
4463
|
-
|
|
4559
|
+
function instrumentBrokerParams(parameters, correlationId, performanceClient) {
|
|
4560
|
+
if (!correlationId) {
|
|
4561
|
+
return;
|
|
4562
|
+
}
|
|
4563
|
+
const clientId = parameters.get(CLIENT_ID);
|
|
4564
|
+
if (clientId && parameters.has(BROKER_CLIENT_ID)) {
|
|
4565
|
+
performanceClient?.addFields({
|
|
4566
|
+
embeddedClientId: clientId,
|
|
4567
|
+
embeddedRedirectUri: parameters.get(REDIRECT_URI),
|
|
4568
|
+
}, correlationId);
|
|
4464
4569
|
}
|
|
4465
4570
|
}
|
|
4466
4571
|
/**
|
|
4467
|
-
*
|
|
4468
|
-
* @param
|
|
4572
|
+
* Add the given response_type
|
|
4573
|
+
* @param parameters
|
|
4574
|
+
* @param responseType
|
|
4469
4575
|
*/
|
|
4470
|
-
function
|
|
4471
|
-
parameters.set(
|
|
4576
|
+
function addResponseType(parameters, responseType) {
|
|
4577
|
+
parameters.set(RESPONSE_TYPE, responseType);
|
|
4472
4578
|
}
|
|
4473
4579
|
/**
|
|
4474
|
-
* add
|
|
4475
|
-
* @param
|
|
4580
|
+
* add response_mode. defaults to query.
|
|
4581
|
+
* @param responseMode
|
|
4476
4582
|
*/
|
|
4477
|
-
function
|
|
4478
|
-
parameters.set(
|
|
4583
|
+
function addResponseMode(parameters, responseMode) {
|
|
4584
|
+
parameters.set(RESPONSE_MODE, responseMode ? responseMode : ResponseMode.QUERY);
|
|
4479
4585
|
}
|
|
4480
4586
|
/**
|
|
4481
|
-
* add
|
|
4482
|
-
* @param
|
|
4587
|
+
* add scopes. set addOidcScopes to false to prevent default scopes in non-user scenarios
|
|
4588
|
+
* @param scopeSet
|
|
4589
|
+
* @param addOidcScopes
|
|
4483
4590
|
*/
|
|
4484
|
-
function
|
|
4485
|
-
|
|
4591
|
+
function addScopes(parameters, scopes, addOidcScopes = true, defaultScopes = OIDC_DEFAULT_SCOPES) {
|
|
4592
|
+
// Always add openid to the scopes when adding OIDC scopes
|
|
4593
|
+
if (addOidcScopes &&
|
|
4594
|
+
!defaultScopes.includes("openid") &&
|
|
4595
|
+
!scopes.includes("openid")) {
|
|
4596
|
+
defaultScopes.push("openid");
|
|
4597
|
+
}
|
|
4598
|
+
const requestScopes = addOidcScopes
|
|
4599
|
+
? [...(scopes || []), ...defaultScopes]
|
|
4600
|
+
: scopes || [];
|
|
4601
|
+
const scopeSet = new ScopeSet(requestScopes);
|
|
4602
|
+
parameters.set(SCOPE, scopeSet.printScopes());
|
|
4486
4603
|
}
|
|
4487
4604
|
/**
|
|
4488
|
-
* add
|
|
4489
|
-
*
|
|
4605
|
+
* add clientId
|
|
4606
|
+
* @param clientId
|
|
4490
4607
|
*/
|
|
4491
|
-
function
|
|
4492
|
-
parameters.set(
|
|
4608
|
+
function addClientId(parameters, clientId) {
|
|
4609
|
+
parameters.set(CLIENT_ID, clientId);
|
|
4493
4610
|
}
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4611
|
+
/**
|
|
4612
|
+
* add redirect_uri
|
|
4613
|
+
* @param redirectUri
|
|
4614
|
+
*/
|
|
4615
|
+
function addRedirectUri(parameters, redirectUri) {
|
|
4616
|
+
parameters.set(REDIRECT_URI, redirectUri);
|
|
4498
4617
|
}
|
|
4499
4618
|
/**
|
|
4500
|
-
* add
|
|
4501
|
-
* @param
|
|
4619
|
+
* add post logout redirectUri
|
|
4620
|
+
* @param redirectUri
|
|
4502
4621
|
*/
|
|
4503
|
-
function
|
|
4504
|
-
|
|
4505
|
-
if (!parameters.has(key) && value) {
|
|
4506
|
-
parameters.set(key, value);
|
|
4507
|
-
}
|
|
4508
|
-
});
|
|
4622
|
+
function addPostLogoutRedirectUri(parameters, redirectUri) {
|
|
4623
|
+
parameters.set(POST_LOGOUT_URI, redirectUri);
|
|
4509
4624
|
}
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
else {
|
|
4517
|
-
try {
|
|
4518
|
-
mergedClaims = JSON.parse(claims);
|
|
4519
|
-
}
|
|
4520
|
-
catch (e) {
|
|
4521
|
-
throw createClientConfigurationError(invalidClaims);
|
|
4522
|
-
}
|
|
4523
|
-
}
|
|
4524
|
-
if (clientCapabilities && clientCapabilities.length > 0) {
|
|
4525
|
-
if (!mergedClaims.hasOwnProperty(ClaimsRequestKeys.ACCESS_TOKEN)) {
|
|
4526
|
-
// Add access_token key to claims object
|
|
4527
|
-
mergedClaims[ClaimsRequestKeys.ACCESS_TOKEN] = {};
|
|
4528
|
-
}
|
|
4529
|
-
// Add xms_cc claim with provided clientCapabilities to access_token key
|
|
4530
|
-
mergedClaims[ClaimsRequestKeys.ACCESS_TOKEN][ClaimsRequestKeys.XMS_CC] =
|
|
4531
|
-
{
|
|
4532
|
-
values: clientCapabilities,
|
|
4533
|
-
};
|
|
4534
|
-
}
|
|
4535
|
-
return JSON.stringify(mergedClaims);
|
|
4625
|
+
/**
|
|
4626
|
+
* add id_token_hint to logout request
|
|
4627
|
+
* @param idTokenHint
|
|
4628
|
+
*/
|
|
4629
|
+
function addIdTokenHint(parameters, idTokenHint) {
|
|
4630
|
+
parameters.set(ID_TOKEN_HINT, idTokenHint);
|
|
4536
4631
|
}
|
|
4537
4632
|
/**
|
|
4538
|
-
*
|
|
4539
|
-
* @param
|
|
4633
|
+
* add domain_hint
|
|
4634
|
+
* @param domainHint
|
|
4540
4635
|
*/
|
|
4541
|
-
function
|
|
4542
|
-
parameters.set(
|
|
4636
|
+
function addDomainHint(parameters, domainHint) {
|
|
4637
|
+
parameters.set(DOMAIN_HINT, domainHint);
|
|
4543
4638
|
}
|
|
4544
4639
|
/**
|
|
4545
|
-
*
|
|
4546
|
-
* @param
|
|
4640
|
+
* add login_hint
|
|
4641
|
+
* @param loginHint
|
|
4547
4642
|
*/
|
|
4548
|
-
function
|
|
4549
|
-
parameters.set(
|
|
4643
|
+
function addLoginHint(parameters, loginHint) {
|
|
4644
|
+
parameters.set(LOGIN_HINT, loginHint);
|
|
4550
4645
|
}
|
|
4551
4646
|
/**
|
|
4552
|
-
*
|
|
4553
|
-
* @param
|
|
4647
|
+
* Adds the CCS (Cache Credential Service) query parameter for login_hint
|
|
4648
|
+
* @param loginHint
|
|
4554
4649
|
*/
|
|
4555
|
-
function
|
|
4556
|
-
|
|
4557
|
-
parameters.set(TOKEN_TYPE, AuthenticationScheme.POP);
|
|
4558
|
-
parameters.set(REQ_CNF, cnfString);
|
|
4559
|
-
}
|
|
4650
|
+
function addCcsUpn(parameters, loginHint) {
|
|
4651
|
+
parameters.set(HeaderNames.CCS_HEADER, `UPN:${loginHint}`);
|
|
4560
4652
|
}
|
|
4561
4653
|
/**
|
|
4562
|
-
*
|
|
4654
|
+
* Adds the CCS (Cache Credential Service) query parameter for account object
|
|
4655
|
+
* @param loginHint
|
|
4563
4656
|
*/
|
|
4564
|
-
function
|
|
4565
|
-
|
|
4566
|
-
parameters.set(TOKEN_TYPE, AuthenticationScheme.SSH);
|
|
4567
|
-
parameters.set(REQ_CNF, sshJwkString);
|
|
4568
|
-
}
|
|
4657
|
+
function addCcsOid(parameters, clientInfo) {
|
|
4658
|
+
parameters.set(HeaderNames.CCS_HEADER, `Oid:${clientInfo.uid}@${clientInfo.utid}`);
|
|
4569
4659
|
}
|
|
4570
4660
|
/**
|
|
4571
|
-
* add
|
|
4572
|
-
* @param
|
|
4661
|
+
* add sid
|
|
4662
|
+
* @param sid
|
|
4573
4663
|
*/
|
|
4574
|
-
function
|
|
4575
|
-
parameters.set(
|
|
4576
|
-
parameters.set(X_CLIENT_LAST_TELEM, serverTelemetryManager.generateLastRequestHeaderValue());
|
|
4664
|
+
function addSid(parameters, sid) {
|
|
4665
|
+
parameters.set(SID, sid);
|
|
4577
4666
|
}
|
|
4578
4667
|
/**
|
|
4579
|
-
*
|
|
4668
|
+
* add claims
|
|
4669
|
+
* @param claims
|
|
4580
4670
|
*/
|
|
4581
|
-
function
|
|
4582
|
-
|
|
4671
|
+
function addClaims(parameters, claims, clientCapabilities) {
|
|
4672
|
+
const mergedClaims = addClientCapabilitiesToClaims(claims, clientCapabilities);
|
|
4673
|
+
try {
|
|
4674
|
+
JSON.parse(mergedClaims);
|
|
4675
|
+
}
|
|
4676
|
+
catch (e) {
|
|
4677
|
+
throw createClientConfigurationError(invalidClaims);
|
|
4678
|
+
}
|
|
4679
|
+
parameters.set(CLAIMS, mergedClaims);
|
|
4583
4680
|
}
|
|
4584
4681
|
/**
|
|
4585
|
-
*
|
|
4682
|
+
* add correlationId
|
|
4683
|
+
* @param correlationId
|
|
4586
4684
|
*/
|
|
4587
|
-
function
|
|
4588
|
-
parameters.set(
|
|
4685
|
+
function addCorrelationId(parameters, correlationId) {
|
|
4686
|
+
parameters.set(CLIENT_REQUEST_ID, correlationId);
|
|
4589
4687
|
}
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4688
|
+
/**
|
|
4689
|
+
* add library info query params
|
|
4690
|
+
* @param libraryInfo
|
|
4691
|
+
*/
|
|
4692
|
+
function addLibraryInfo(parameters, libraryInfo) {
|
|
4693
|
+
// Telemetry Info
|
|
4694
|
+
parameters.set(X_CLIENT_SKU, libraryInfo.sku);
|
|
4695
|
+
parameters.set(X_CLIENT_VER, libraryInfo.version);
|
|
4696
|
+
if (libraryInfo.os) {
|
|
4697
|
+
parameters.set(X_CLIENT_OS, libraryInfo.os);
|
|
4593
4698
|
}
|
|
4594
|
-
if (
|
|
4595
|
-
parameters.set(
|
|
4699
|
+
if (libraryInfo.cpu) {
|
|
4700
|
+
parameters.set(X_CLIENT_CPU, libraryInfo.cpu);
|
|
4596
4701
|
}
|
|
4597
|
-
}
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4602
|
-
* Licensed under the MIT License.
|
|
4702
|
+
}
|
|
4703
|
+
/**
|
|
4704
|
+
* Add client telemetry parameters
|
|
4705
|
+
* @param appTelemetry
|
|
4603
4706
|
*/
|
|
4604
|
-
function
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
*
|
|
4614
|
-
*
|
|
4707
|
+
function addApplicationTelemetry(parameters, appTelemetry) {
|
|
4708
|
+
if (appTelemetry?.appName) {
|
|
4709
|
+
parameters.set(X_APP_NAME, appTelemetry.appName);
|
|
4710
|
+
}
|
|
4711
|
+
if (appTelemetry?.appVersion) {
|
|
4712
|
+
parameters.set(X_APP_VER, appTelemetry.appVersion);
|
|
4713
|
+
}
|
|
4714
|
+
}
|
|
4715
|
+
/**
|
|
4716
|
+
* add prompt
|
|
4717
|
+
* @param prompt
|
|
4615
4718
|
*/
|
|
4616
|
-
function
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
/*
|
|
4623
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4624
|
-
* Licensed under the MIT License.
|
|
4719
|
+
function addPrompt(parameters, prompt) {
|
|
4720
|
+
parameters.set(PROMPT, prompt);
|
|
4721
|
+
}
|
|
4722
|
+
/**
|
|
4723
|
+
* add state
|
|
4724
|
+
* @param state
|
|
4625
4725
|
*/
|
|
4626
|
-
function
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
}
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
*
|
|
4634
|
-
* Licensed under the MIT License.
|
|
4726
|
+
function addState(parameters, state) {
|
|
4727
|
+
if (state) {
|
|
4728
|
+
parameters.set(STATE, state);
|
|
4729
|
+
}
|
|
4730
|
+
}
|
|
4731
|
+
/**
|
|
4732
|
+
* add nonce
|
|
4733
|
+
* @param nonce
|
|
4635
4734
|
*/
|
|
4735
|
+
function addNonce(parameters, nonce) {
|
|
4736
|
+
parameters.set(NONCE, nonce);
|
|
4737
|
+
}
|
|
4636
4738
|
/**
|
|
4637
|
-
*
|
|
4638
|
-
*
|
|
4639
|
-
* @
|
|
4640
|
-
* @
|
|
4739
|
+
* add code_challenge and code_challenge_method
|
|
4740
|
+
* - throw if either of them are not passed
|
|
4741
|
+
* @param codeChallenge
|
|
4742
|
+
* @param codeChallengeMethod
|
|
4641
4743
|
*/
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
CacheManagerGetRefreshToken: "cacheManagerGetRefreshToken",
|
|
4869
|
-
ImportExistingCache: "importExistingCache",
|
|
4870
|
-
SetUserData: "setUserData",
|
|
4871
|
-
LocalStorageUpdated: "localStorageUpdated",
|
|
4872
|
-
/**
|
|
4873
|
-
* Crypto Operations
|
|
4874
|
-
*/
|
|
4875
|
-
GeneratePkceCodes: "generatePkceCodes",
|
|
4876
|
-
GenerateCodeVerifier: "generateCodeVerifier",
|
|
4877
|
-
GenerateCodeChallengeFromVerifier: "generateCodeChallengeFromVerifier",
|
|
4878
|
-
Sha256Digest: "sha256Digest",
|
|
4879
|
-
GetRandomValues: "getRandomValues",
|
|
4880
|
-
GenerateHKDF: "generateHKDF",
|
|
4881
|
-
GenerateBaseKey: "generateBaseKey",
|
|
4882
|
-
Base64Decode: "base64Decode",
|
|
4883
|
-
UrlEncodeArr: "urlEncodeArr",
|
|
4884
|
-
Encrypt: "encrypt",
|
|
4885
|
-
Decrypt: "decrypt",
|
|
4886
|
-
GenerateEarKey: "generateEarKey",
|
|
4887
|
-
DecryptEarResponse: "decryptEarResponse",
|
|
4888
|
-
};
|
|
4744
|
+
function addCodeChallengeParams(parameters, codeChallenge, codeChallengeMethod) {
|
|
4745
|
+
if (codeChallenge && codeChallengeMethod) {
|
|
4746
|
+
parameters.set(CODE_CHALLENGE, codeChallenge);
|
|
4747
|
+
parameters.set(CODE_CHALLENGE_METHOD, codeChallengeMethod);
|
|
4748
|
+
}
|
|
4749
|
+
else {
|
|
4750
|
+
throw createClientConfigurationError(pkceParamsMissing);
|
|
4751
|
+
}
|
|
4752
|
+
}
|
|
4753
|
+
/**
|
|
4754
|
+
* add the `authorization_code` passed by the user to exchange for a token
|
|
4755
|
+
* @param code
|
|
4756
|
+
*/
|
|
4757
|
+
function addAuthorizationCode(parameters, code) {
|
|
4758
|
+
parameters.set(CODE, code);
|
|
4759
|
+
}
|
|
4760
|
+
/**
|
|
4761
|
+
* add the `authorization_code` passed by the user to exchange for a token
|
|
4762
|
+
* @param code
|
|
4763
|
+
*/
|
|
4764
|
+
function addDeviceCode(parameters, code) {
|
|
4765
|
+
parameters.set(DEVICE_CODE, code);
|
|
4766
|
+
}
|
|
4767
|
+
/**
|
|
4768
|
+
* add the `refreshToken` passed by the user
|
|
4769
|
+
* @param refreshToken
|
|
4770
|
+
*/
|
|
4771
|
+
function addRefreshToken(parameters, refreshToken) {
|
|
4772
|
+
parameters.set(REFRESH_TOKEN, refreshToken);
|
|
4773
|
+
}
|
|
4774
|
+
/**
|
|
4775
|
+
* add the `code_verifier` passed by the user to exchange for a token
|
|
4776
|
+
* @param codeVerifier
|
|
4777
|
+
*/
|
|
4778
|
+
function addCodeVerifier(parameters, codeVerifier) {
|
|
4779
|
+
parameters.set(CODE_VERIFIER, codeVerifier);
|
|
4780
|
+
}
|
|
4781
|
+
/**
|
|
4782
|
+
* add client_secret
|
|
4783
|
+
* @param clientSecret
|
|
4784
|
+
*/
|
|
4785
|
+
function addClientSecret(parameters, clientSecret) {
|
|
4786
|
+
parameters.set(CLIENT_SECRET, clientSecret);
|
|
4787
|
+
}
|
|
4788
|
+
/**
|
|
4789
|
+
* add clientAssertion for confidential client flows
|
|
4790
|
+
* @param clientAssertion
|
|
4791
|
+
*/
|
|
4792
|
+
function addClientAssertion(parameters, clientAssertion) {
|
|
4793
|
+
if (clientAssertion) {
|
|
4794
|
+
parameters.set(CLIENT_ASSERTION, clientAssertion);
|
|
4795
|
+
}
|
|
4796
|
+
}
|
|
4797
|
+
/**
|
|
4798
|
+
* add clientAssertionType for confidential client flows
|
|
4799
|
+
* @param clientAssertionType
|
|
4800
|
+
*/
|
|
4801
|
+
function addClientAssertionType(parameters, clientAssertionType) {
|
|
4802
|
+
if (clientAssertionType) {
|
|
4803
|
+
parameters.set(CLIENT_ASSERTION_TYPE, clientAssertionType);
|
|
4804
|
+
}
|
|
4805
|
+
}
|
|
4806
|
+
/**
|
|
4807
|
+
* add OBO assertion for confidential client flows
|
|
4808
|
+
* @param clientAssertion
|
|
4809
|
+
*/
|
|
4810
|
+
function addOboAssertion(parameters, oboAssertion) {
|
|
4811
|
+
parameters.set(OBO_ASSERTION, oboAssertion);
|
|
4812
|
+
}
|
|
4813
|
+
/**
|
|
4814
|
+
* add grant type
|
|
4815
|
+
* @param grantType
|
|
4816
|
+
*/
|
|
4817
|
+
function addRequestTokenUse(parameters, tokenUse) {
|
|
4818
|
+
parameters.set(REQUESTED_TOKEN_USE, tokenUse);
|
|
4819
|
+
}
|
|
4820
|
+
/**
|
|
4821
|
+
* add grant type
|
|
4822
|
+
* @param grantType
|
|
4823
|
+
*/
|
|
4824
|
+
function addGrantType(parameters, grantType) {
|
|
4825
|
+
parameters.set(GRANT_TYPE, grantType);
|
|
4826
|
+
}
|
|
4827
|
+
/**
|
|
4828
|
+
* add client info
|
|
4829
|
+
*
|
|
4830
|
+
*/
|
|
4831
|
+
function addClientInfo(parameters) {
|
|
4832
|
+
parameters.set(CLIENT_INFO, "1");
|
|
4833
|
+
}
|
|
4834
|
+
function addInstanceAware(parameters) {
|
|
4835
|
+
if (!parameters.has(INSTANCE_AWARE)) {
|
|
4836
|
+
parameters.set(INSTANCE_AWARE, "true");
|
|
4837
|
+
}
|
|
4838
|
+
}
|
|
4839
|
+
/**
|
|
4840
|
+
* add extraQueryParams
|
|
4841
|
+
* @param eQParams
|
|
4842
|
+
*/
|
|
4843
|
+
function addExtraQueryParameters(parameters, eQParams) {
|
|
4844
|
+
Object.entries(eQParams).forEach(([key, value]) => {
|
|
4845
|
+
if (!parameters.has(key) && value) {
|
|
4846
|
+
parameters.set(key, value);
|
|
4847
|
+
}
|
|
4848
|
+
});
|
|
4849
|
+
}
|
|
4850
|
+
function addClientCapabilitiesToClaims(claims, clientCapabilities) {
|
|
4851
|
+
let mergedClaims;
|
|
4852
|
+
// Parse provided claims into JSON object or initialize empty object
|
|
4853
|
+
if (!claims) {
|
|
4854
|
+
mergedClaims = {};
|
|
4855
|
+
}
|
|
4856
|
+
else {
|
|
4857
|
+
try {
|
|
4858
|
+
mergedClaims = JSON.parse(claims);
|
|
4859
|
+
}
|
|
4860
|
+
catch (e) {
|
|
4861
|
+
throw createClientConfigurationError(invalidClaims);
|
|
4862
|
+
}
|
|
4863
|
+
}
|
|
4864
|
+
if (clientCapabilities && clientCapabilities.length > 0) {
|
|
4865
|
+
if (!mergedClaims.hasOwnProperty(ClaimsRequestKeys.ACCESS_TOKEN)) {
|
|
4866
|
+
// Add access_token key to claims object
|
|
4867
|
+
mergedClaims[ClaimsRequestKeys.ACCESS_TOKEN] = {};
|
|
4868
|
+
}
|
|
4869
|
+
// Add xms_cc claim with provided clientCapabilities to access_token key
|
|
4870
|
+
mergedClaims[ClaimsRequestKeys.ACCESS_TOKEN][ClaimsRequestKeys.XMS_CC] =
|
|
4871
|
+
{
|
|
4872
|
+
values: clientCapabilities,
|
|
4873
|
+
};
|
|
4874
|
+
}
|
|
4875
|
+
return JSON.stringify(mergedClaims);
|
|
4876
|
+
}
|
|
4877
|
+
/**
|
|
4878
|
+
* adds `username` for Password Grant flow
|
|
4879
|
+
* @param username
|
|
4880
|
+
*/
|
|
4881
|
+
function addUsername(parameters, username) {
|
|
4882
|
+
parameters.set(PasswordGrantConstants.username, username);
|
|
4883
|
+
}
|
|
4884
|
+
/**
|
|
4885
|
+
* adds `password` for Password Grant flow
|
|
4886
|
+
* @param password
|
|
4887
|
+
*/
|
|
4888
|
+
function addPassword(parameters, password) {
|
|
4889
|
+
parameters.set(PasswordGrantConstants.password, password);
|
|
4890
|
+
}
|
|
4891
|
+
/**
|
|
4892
|
+
* add pop_jwk to query params
|
|
4893
|
+
* @param cnfString
|
|
4894
|
+
*/
|
|
4895
|
+
function addPopToken(parameters, cnfString) {
|
|
4896
|
+
if (cnfString) {
|
|
4897
|
+
parameters.set(TOKEN_TYPE, AuthenticationScheme.POP);
|
|
4898
|
+
parameters.set(REQ_CNF, cnfString);
|
|
4899
|
+
}
|
|
4900
|
+
}
|
|
4901
|
+
/**
|
|
4902
|
+
* add SSH JWK and key ID to query params
|
|
4903
|
+
*/
|
|
4904
|
+
function addSshJwk(parameters, sshJwkString) {
|
|
4905
|
+
if (sshJwkString) {
|
|
4906
|
+
parameters.set(TOKEN_TYPE, AuthenticationScheme.SSH);
|
|
4907
|
+
parameters.set(REQ_CNF, sshJwkString);
|
|
4908
|
+
}
|
|
4909
|
+
}
|
|
4910
|
+
/**
|
|
4911
|
+
* add server telemetry fields
|
|
4912
|
+
* @param serverTelemetryManager
|
|
4913
|
+
*/
|
|
4914
|
+
function addServerTelemetry(parameters, serverTelemetryManager) {
|
|
4915
|
+
parameters.set(X_CLIENT_CURR_TELEM, serverTelemetryManager.generateCurrentRequestHeaderValue());
|
|
4916
|
+
parameters.set(X_CLIENT_LAST_TELEM, serverTelemetryManager.generateLastRequestHeaderValue());
|
|
4917
|
+
}
|
|
4918
|
+
/**
|
|
4919
|
+
* Adds parameter that indicates to the server that throttling is supported
|
|
4920
|
+
*/
|
|
4921
|
+
function addThrottling(parameters) {
|
|
4922
|
+
parameters.set(X_MS_LIB_CAPABILITY, ThrottlingConstants.X_MS_LIB_CAPABILITY_VALUE);
|
|
4923
|
+
}
|
|
4924
|
+
/**
|
|
4925
|
+
* Adds logout_hint parameter for "silent" logout which prevent server account picker
|
|
4926
|
+
*/
|
|
4927
|
+
function addLogoutHint(parameters, logoutHint) {
|
|
4928
|
+
parameters.set(LOGOUT_HINT, logoutHint);
|
|
4929
|
+
}
|
|
4930
|
+
function addBrokerParameters(parameters, brokerClientId, brokerRedirectUri) {
|
|
4931
|
+
if (!parameters.has(BROKER_CLIENT_ID)) {
|
|
4932
|
+
parameters.set(BROKER_CLIENT_ID, brokerClientId);
|
|
4933
|
+
}
|
|
4934
|
+
if (!parameters.has(BROKER_REDIRECT_URI)) {
|
|
4935
|
+
parameters.set(BROKER_REDIRECT_URI, brokerRedirectUri);
|
|
4936
|
+
}
|
|
4937
|
+
}
|
|
4938
|
+
|
|
4939
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
4940
|
+
/*
|
|
4941
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4942
|
+
* Licensed under the MIT License.
|
|
4943
|
+
*/
|
|
4944
|
+
function isOpenIdConfigResponse(response) {
|
|
4945
|
+
return (response.hasOwnProperty("authorization_endpoint") &&
|
|
4946
|
+
response.hasOwnProperty("token_endpoint") &&
|
|
4947
|
+
response.hasOwnProperty("issuer") &&
|
|
4948
|
+
response.hasOwnProperty("jwks_uri"));
|
|
4949
|
+
}
|
|
4950
|
+
|
|
4951
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
4952
|
+
/*
|
|
4953
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4954
|
+
* Licensed under the MIT License.
|
|
4955
|
+
*/
|
|
4956
|
+
function isCloudInstanceDiscoveryResponse(response) {
|
|
4957
|
+
return (response.hasOwnProperty("tenant_discovery_endpoint") &&
|
|
4958
|
+
response.hasOwnProperty("metadata"));
|
|
4959
|
+
}
|
|
4960
|
+
|
|
4961
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
4962
|
+
/*
|
|
4963
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4964
|
+
* Licensed under the MIT License.
|
|
4965
|
+
*/
|
|
4966
|
+
function isCloudInstanceDiscoveryErrorResponse(response) {
|
|
4967
|
+
return (response.hasOwnProperty("error") &&
|
|
4968
|
+
response.hasOwnProperty("error_description"));
|
|
4969
|
+
}
|
|
4889
4970
|
|
|
4890
|
-
/*! @azure/msal-common v15.
|
|
4971
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
4891
4972
|
/*
|
|
4892
4973
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4893
4974
|
* Licensed under the MIT License.
|
|
@@ -4983,7 +5064,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
|
|
|
4983
5064
|
};
|
|
4984
5065
|
};
|
|
4985
5066
|
|
|
4986
|
-
/*! @azure/msal-common v15.
|
|
5067
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
4987
5068
|
|
|
4988
5069
|
/*
|
|
4989
5070
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5010,15 +5091,13 @@ class RegionDiscovery {
|
|
|
5010
5091
|
const options = RegionDiscovery.IMDS_OPTIONS;
|
|
5011
5092
|
try {
|
|
5012
5093
|
const localIMDSVersionResponse = await invokeAsync(this.getRegionFromIMDS.bind(this), PerformanceEvents.RegionDiscoveryGetRegionFromIMDS, this.logger, this.performanceClient, this.correlationId)(Constants$1.IMDS_VERSION, options);
|
|
5013
|
-
if (localIMDSVersionResponse.status ===
|
|
5014
|
-
ResponseCodes.httpSuccess) {
|
|
5094
|
+
if (localIMDSVersionResponse.status === HttpStatus.SUCCESS) {
|
|
5015
5095
|
autodetectedRegionName = localIMDSVersionResponse.body;
|
|
5016
5096
|
regionDiscoveryMetadata.region_source =
|
|
5017
5097
|
RegionDiscoverySources.IMDS;
|
|
5018
5098
|
}
|
|
5019
5099
|
// If the response using the local IMDS version failed, try to fetch the current version of IMDS and retry.
|
|
5020
|
-
if (localIMDSVersionResponse.status ===
|
|
5021
|
-
ResponseCodes.httpBadRequest) {
|
|
5100
|
+
if (localIMDSVersionResponse.status === HttpStatus.BAD_REQUEST) {
|
|
5022
5101
|
const currentIMDSVersion = await invokeAsync(this.getCurrentVersion.bind(this), PerformanceEvents.RegionDiscoveryGetCurrentVersion, this.logger, this.performanceClient, this.correlationId)(options);
|
|
5023
5102
|
if (!currentIMDSVersion) {
|
|
5024
5103
|
regionDiscoveryMetadata.region_source =
|
|
@@ -5026,8 +5105,7 @@ class RegionDiscovery {
|
|
|
5026
5105
|
return null;
|
|
5027
5106
|
}
|
|
5028
5107
|
const currentIMDSVersionResponse = await invokeAsync(this.getRegionFromIMDS.bind(this), PerformanceEvents.RegionDiscoveryGetRegionFromIMDS, this.logger, this.performanceClient, this.correlationId)(currentIMDSVersion, options);
|
|
5029
|
-
if (currentIMDSVersionResponse.status ===
|
|
5030
|
-
ResponseCodes.httpSuccess) {
|
|
5108
|
+
if (currentIMDSVersionResponse.status === HttpStatus.SUCCESS) {
|
|
5031
5109
|
autodetectedRegionName =
|
|
5032
5110
|
currentIMDSVersionResponse.body;
|
|
5033
5111
|
regionDiscoveryMetadata.region_source =
|
|
@@ -5072,7 +5150,7 @@ class RegionDiscovery {
|
|
|
5072
5150
|
try {
|
|
5073
5151
|
const response = await this.networkInterface.sendGetRequestAsync(`${Constants$1.IMDS_ENDPOINT}?format=json`, options);
|
|
5074
5152
|
// When IMDS endpoint is called without the api version query param, bad request response comes back with latest version.
|
|
5075
|
-
if (response.status ===
|
|
5153
|
+
if (response.status === HttpStatus.BAD_REQUEST &&
|
|
5076
5154
|
response.body &&
|
|
5077
5155
|
response.body["newest-versions"] &&
|
|
5078
5156
|
response.body["newest-versions"].length > 0) {
|
|
@@ -5092,7 +5170,7 @@ RegionDiscovery.IMDS_OPTIONS = {
|
|
|
5092
5170
|
},
|
|
5093
5171
|
};
|
|
5094
5172
|
|
|
5095
|
-
/*! @azure/msal-common v15.
|
|
5173
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
5096
5174
|
|
|
5097
5175
|
/*
|
|
5098
5176
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5931,7 +6009,7 @@ function buildStaticAuthorityOptions(authOptions) {
|
|
|
5931
6009
|
};
|
|
5932
6010
|
}
|
|
5933
6011
|
|
|
5934
|
-
/*! @azure/msal-common v15.
|
|
6012
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
5935
6013
|
|
|
5936
6014
|
/*
|
|
5937
6015
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5962,7 +6040,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
|
|
|
5962
6040
|
}
|
|
5963
6041
|
}
|
|
5964
6042
|
|
|
5965
|
-
/*! @azure/msal-common v15.
|
|
6043
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
5966
6044
|
|
|
5967
6045
|
/*
|
|
5968
6046
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5981,7 +6059,7 @@ class ServerError extends AuthError {
|
|
|
5981
6059
|
}
|
|
5982
6060
|
}
|
|
5983
6061
|
|
|
5984
|
-
/*! @azure/msal-common v15.
|
|
6062
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
5985
6063
|
/*
|
|
5986
6064
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5987
6065
|
* Licensed under the MIT License.
|
|
@@ -6002,7 +6080,7 @@ function getRequestThumbprint(clientId, request, homeAccountId) {
|
|
|
6002
6080
|
};
|
|
6003
6081
|
}
|
|
6004
6082
|
|
|
6005
|
-
/*! @azure/msal-common v15.
|
|
6083
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
6006
6084
|
|
|
6007
6085
|
/*
|
|
6008
6086
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6089,7 +6167,7 @@ class ThrottlingUtils {
|
|
|
6089
6167
|
}
|
|
6090
6168
|
}
|
|
6091
6169
|
|
|
6092
|
-
/*! @azure/msal-common v15.
|
|
6170
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
6093
6171
|
|
|
6094
6172
|
/*
|
|
6095
6173
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6109,7 +6187,7 @@ class NetworkError extends AuthError {
|
|
|
6109
6187
|
}
|
|
6110
6188
|
}
|
|
6111
6189
|
|
|
6112
|
-
/*! @azure/msal-common v15.
|
|
6190
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
6113
6191
|
|
|
6114
6192
|
/*
|
|
6115
6193
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6257,7 +6335,7 @@ class BaseClient {
|
|
|
6257
6335
|
}
|
|
6258
6336
|
}
|
|
6259
6337
|
|
|
6260
|
-
/*! @azure/msal-common v15.
|
|
6338
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
6261
6339
|
/*
|
|
6262
6340
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6263
6341
|
* Licensed under the MIT License.
|
|
@@ -6266,6 +6344,7 @@ class BaseClient {
|
|
|
6266
6344
|
const noTokensFound = "no_tokens_found";
|
|
6267
6345
|
const nativeAccountUnavailable = "native_account_unavailable";
|
|
6268
6346
|
const refreshTokenExpired = "refresh_token_expired";
|
|
6347
|
+
const uxNotAllowed = "ux_not_allowed";
|
|
6269
6348
|
// Codes potentially returned by server
|
|
6270
6349
|
const interactionRequired = "interaction_required";
|
|
6271
6350
|
const consentRequired = "consent_required";
|
|
@@ -6280,10 +6359,11 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
6280
6359
|
loginRequired: loginRequired,
|
|
6281
6360
|
nativeAccountUnavailable: nativeAccountUnavailable,
|
|
6282
6361
|
noTokensFound: noTokensFound,
|
|
6283
|
-
refreshTokenExpired: refreshTokenExpired
|
|
6362
|
+
refreshTokenExpired: refreshTokenExpired,
|
|
6363
|
+
uxNotAllowed: uxNotAllowed
|
|
6284
6364
|
});
|
|
6285
6365
|
|
|
6286
|
-
/*! @azure/msal-common v15.
|
|
6366
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
6287
6367
|
|
|
6288
6368
|
/*
|
|
6289
6369
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6297,6 +6377,7 @@ const InteractionRequiredServerErrorMessage = [
|
|
|
6297
6377
|
consentRequired,
|
|
6298
6378
|
loginRequired,
|
|
6299
6379
|
badToken,
|
|
6380
|
+
uxNotAllowed,
|
|
6300
6381
|
];
|
|
6301
6382
|
const InteractionRequiredAuthSubErrorMessage = [
|
|
6302
6383
|
"message_only",
|
|
@@ -6311,6 +6392,7 @@ const InteractionRequiredAuthErrorMessages = {
|
|
|
6311
6392
|
[nativeAccountUnavailable]: "The requested account is not available in the native broker. It may have been deleted or logged out. Please sign-in again using an interactive API.",
|
|
6312
6393
|
[refreshTokenExpired]: "Refresh token has expired.",
|
|
6313
6394
|
[badToken]: "Identity provider returned bad_token due to an expired or invalid refresh token. Please invoke an interactive API to resolve.",
|
|
6395
|
+
[uxNotAllowed]: "`canShowUI` flag in Edge was set to false. User interaction required on web page. Please invoke an interactive API to resolve.",
|
|
6314
6396
|
};
|
|
6315
6397
|
/**
|
|
6316
6398
|
* Interaction required errors defined by the SDK
|
|
@@ -6371,7 +6453,7 @@ function createInteractionRequiredAuthError(errorCode) {
|
|
|
6371
6453
|
return new InteractionRequiredAuthError(errorCode, InteractionRequiredAuthErrorMessages[errorCode]);
|
|
6372
6454
|
}
|
|
6373
6455
|
|
|
6374
|
-
/*! @azure/msal-common v15.
|
|
6456
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
6375
6457
|
|
|
6376
6458
|
/*
|
|
6377
6459
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6443,7 +6525,7 @@ class ProtocolUtils {
|
|
|
6443
6525
|
}
|
|
6444
6526
|
}
|
|
6445
6527
|
|
|
6446
|
-
/*! @azure/msal-common v15.
|
|
6528
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
6447
6529
|
|
|
6448
6530
|
/*
|
|
6449
6531
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6527,7 +6609,7 @@ class PopTokenGenerator {
|
|
|
6527
6609
|
}
|
|
6528
6610
|
}
|
|
6529
6611
|
|
|
6530
|
-
/*! @azure/msal-common v15.
|
|
6612
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
6531
6613
|
/*
|
|
6532
6614
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6533
6615
|
* Licensed under the MIT License.
|
|
@@ -6554,7 +6636,7 @@ class PopTokenGenerator {
|
|
|
6554
6636
|
}
|
|
6555
6637
|
}
|
|
6556
6638
|
|
|
6557
|
-
/*! @azure/msal-common v15.
|
|
6639
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
6558
6640
|
|
|
6559
6641
|
/*
|
|
6560
6642
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6885,7 +6967,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
|
|
|
6885
6967
|
return baseAccount;
|
|
6886
6968
|
}
|
|
6887
6969
|
|
|
6888
|
-
/*! @azure/msal-common v15.
|
|
6970
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
6889
6971
|
|
|
6890
6972
|
/*
|
|
6891
6973
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6952,7 +7034,7 @@ class RequestValidator {
|
|
|
6952
7034
|
}
|
|
6953
7035
|
}
|
|
6954
7036
|
|
|
6955
|
-
/*! @azure/msal-common v15.
|
|
7037
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
6956
7038
|
/*
|
|
6957
7039
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6958
7040
|
* Licensed under the MIT License.
|
|
@@ -6970,7 +7052,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint) {
|
|
|
6970
7052
|
}
|
|
6971
7053
|
}
|
|
6972
7054
|
|
|
6973
|
-
/*! @azure/msal-common v15.
|
|
7055
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
6974
7056
|
|
|
6975
7057
|
/*
|
|
6976
7058
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7203,7 +7285,7 @@ class AuthorizationCodeClient extends BaseClient {
|
|
|
7203
7285
|
}
|
|
7204
7286
|
}
|
|
7205
7287
|
|
|
7206
|
-
/*! @azure/msal-common v15.
|
|
7288
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
7207
7289
|
|
|
7208
7290
|
/*
|
|
7209
7291
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7412,7 +7494,7 @@ class RefreshTokenClient extends BaseClient {
|
|
|
7412
7494
|
}
|
|
7413
7495
|
}
|
|
7414
7496
|
|
|
7415
|
-
/*! @azure/msal-common v15.
|
|
7497
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
7416
7498
|
|
|
7417
7499
|
/*
|
|
7418
7500
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7444,7 +7526,7 @@ class SilentFlowClient extends BaseClient {
|
|
|
7444
7526
|
const requestTenantId = request.account.tenantId ||
|
|
7445
7527
|
getTenantFromAuthorityString(request.authority);
|
|
7446
7528
|
const tokenKeys = this.cacheManager.getTokenKeys();
|
|
7447
|
-
const cachedAccessToken = this.cacheManager.getAccessToken(request.account, request, tokenKeys, requestTenantId
|
|
7529
|
+
const cachedAccessToken = this.cacheManager.getAccessToken(request.account, request, tokenKeys, requestTenantId);
|
|
7448
7530
|
if (!cachedAccessToken) {
|
|
7449
7531
|
// must refresh due to non-existent access_token
|
|
7450
7532
|
this.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN, request.correlationId);
|
|
@@ -7510,7 +7592,7 @@ class SilentFlowClient extends BaseClient {
|
|
|
7510
7592
|
}
|
|
7511
7593
|
}
|
|
7512
7594
|
|
|
7513
|
-
/*! @azure/msal-common v15.
|
|
7595
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
7514
7596
|
|
|
7515
7597
|
/*
|
|
7516
7598
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7660,7 +7742,7 @@ function extractLoginHint(account) {
|
|
|
7660
7742
|
return account.idTokenClaims?.login_hint || null;
|
|
7661
7743
|
}
|
|
7662
7744
|
|
|
7663
|
-
/*! @azure/msal-common v15.
|
|
7745
|
+
/*! @azure/msal-common v15.7.1 2025-06-18 */
|
|
7664
7746
|
|
|
7665
7747
|
/*
|
|
7666
7748
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8112,20 +8194,33 @@ var internals = /*#__PURE__*/Object.freeze({
|
|
|
8112
8194
|
* Licensed under the MIT License.
|
|
8113
8195
|
*/
|
|
8114
8196
|
// MSI Constants. Docs for MSI are available here https://docs.microsoft.com/azure/app-service/overview-managed-identity
|
|
8115
|
-
const AUTHORIZATION_HEADER_NAME = "Authorization";
|
|
8116
|
-
const METADATA_HEADER_NAME = "Metadata";
|
|
8117
|
-
const APP_SERVICE_SECRET_HEADER_NAME = "X-IDENTITY-HEADER";
|
|
8118
|
-
const ML_AND_SF_SECRET_HEADER_NAME = "secret";
|
|
8119
|
-
const API_VERSION_QUERY_PARAMETER_NAME = "api-version";
|
|
8120
|
-
const RESOURCE_BODY_OR_QUERY_PARAMETER_NAME = "resource";
|
|
8121
8197
|
const DEFAULT_MANAGED_IDENTITY_ID = "system_assigned_managed_identity";
|
|
8122
8198
|
const MANAGED_IDENTITY_DEFAULT_TENANT = "managed_identity";
|
|
8123
8199
|
const DEFAULT_AUTHORITY_FOR_MANAGED_IDENTITY = `https://login.microsoftonline.com/${MANAGED_IDENTITY_DEFAULT_TENANT}/`;
|
|
8200
|
+
/**
|
|
8201
|
+
* Managed Identity Headers - used in network requests
|
|
8202
|
+
*/
|
|
8203
|
+
const ManagedIdentityHeaders = {
|
|
8204
|
+
AUTHORIZATION_HEADER_NAME: "Authorization",
|
|
8205
|
+
METADATA_HEADER_NAME: "Metadata",
|
|
8206
|
+
APP_SERVICE_SECRET_HEADER_NAME: "X-IDENTITY-HEADER",
|
|
8207
|
+
ML_AND_SF_SECRET_HEADER_NAME: "secret",
|
|
8208
|
+
};
|
|
8209
|
+
/**
|
|
8210
|
+
* Managed Identity Query Parameters - used in network requests
|
|
8211
|
+
*/
|
|
8212
|
+
const ManagedIdentityQueryParameters = {
|
|
8213
|
+
API_VERSION: "api-version",
|
|
8214
|
+
RESOURCE: "resource",
|
|
8215
|
+
SHA256_TOKEN_TO_REFRESH: "token_sha256_to_refresh",
|
|
8216
|
+
XMS_CC: "xms_cc",
|
|
8217
|
+
};
|
|
8124
8218
|
/**
|
|
8125
8219
|
* Managed Identity Environment Variable Names
|
|
8126
8220
|
*/
|
|
8127
8221
|
const ManagedIdentityEnvironmentVariableNames = {
|
|
8128
8222
|
AZURE_POD_IDENTITY_AUTHORITY_HOST: "AZURE_POD_IDENTITY_AUTHORITY_HOST",
|
|
8223
|
+
DEFAULT_IDENTITY_CLIENT_ID: "DEFAULT_IDENTITY_CLIENT_ID",
|
|
8129
8224
|
IDENTITY_ENDPOINT: "IDENTITY_ENDPOINT",
|
|
8130
8225
|
IDENTITY_HEADER: "IDENTITY_HEADER",
|
|
8131
8226
|
IDENTITY_SERVER_THUMBPRINT: "IDENTITY_SERVER_THUMBPRINT",
|
|
@@ -8852,7 +8947,7 @@ function buildAppConfiguration({ auth, broker, cache, system, telemetry, }) {
|
|
|
8852
8947
|
telemetry: { ...DEFAULT_TELEMETRY_OPTIONS, ...telemetry },
|
|
8853
8948
|
};
|
|
8854
8949
|
}
|
|
8855
|
-
function buildManagedIdentityConfiguration({ managedIdentityIdParams, system, }) {
|
|
8950
|
+
function buildManagedIdentityConfiguration({ clientCapabilities, managedIdentityIdParams, system, }) {
|
|
8856
8951
|
const managedIdentityId = new ManagedIdentityId(managedIdentityIdParams);
|
|
8857
8952
|
const loggerOptions = system?.loggerOptions || DEFAULT_LOGGER_OPTIONS;
|
|
8858
8953
|
let networkClient;
|
|
@@ -8865,6 +8960,7 @@ function buildManagedIdentityConfiguration({ managedIdentityIdParams, system, })
|
|
|
8865
8960
|
networkClient = new HttpClient(system?.proxyUrl, system?.customAgentOptions);
|
|
8866
8961
|
}
|
|
8867
8962
|
return {
|
|
8963
|
+
clientCapabilities: clientCapabilities || [],
|
|
8868
8964
|
managedIdentityId: managedIdentityId,
|
|
8869
8965
|
system: {
|
|
8870
8966
|
loggerOptions,
|
|
@@ -8909,7 +9005,7 @@ class EncodingUtils {
|
|
|
8909
9005
|
* @param str text
|
|
8910
9006
|
*/
|
|
8911
9007
|
static base64Encode(str, encoding) {
|
|
8912
|
-
return Buffer.from(str, encoding).toString(
|
|
9008
|
+
return Buffer.from(str, encoding).toString(EncodingTypes.BASE64);
|
|
8913
9009
|
}
|
|
8914
9010
|
/**
|
|
8915
9011
|
* encode a URL
|
|
@@ -8928,7 +9024,7 @@ class EncodingUtils {
|
|
|
8928
9024
|
* @param base64Str Base64 encoded text
|
|
8929
9025
|
*/
|
|
8930
9026
|
static base64Decode(base64Str) {
|
|
8931
|
-
return Buffer.from(base64Str,
|
|
9027
|
+
return Buffer.from(base64Str, EncodingTypes.BASE64).toString("utf8");
|
|
8932
9028
|
}
|
|
8933
9029
|
/**
|
|
8934
9030
|
* @param base64Str Base64 encoded Url
|
|
@@ -9002,7 +9098,7 @@ class PkceGenerator {
|
|
|
9002
9098
|
* @param codeVerifier
|
|
9003
9099
|
*/
|
|
9004
9100
|
generateCodeChallengeFromVerifier(codeVerifier) {
|
|
9005
|
-
return EncodingUtils.base64EncodeUrl(this.hashUtils.sha256(codeVerifier).toString(
|
|
9101
|
+
return EncodingUtils.base64EncodeUrl(this.hashUtils.sha256(codeVerifier).toString(EncodingTypes.BASE64), EncodingTypes.BASE64);
|
|
9006
9102
|
}
|
|
9007
9103
|
}
|
|
9008
9104
|
|
|
@@ -9092,7 +9188,7 @@ class CryptoProvider {
|
|
|
9092
9188
|
* Returns the SHA-256 hash of an input string
|
|
9093
9189
|
*/
|
|
9094
9190
|
async hashString(plainText) {
|
|
9095
|
-
return EncodingUtils.base64EncodeUrl(this.hashUtils.sha256(plainText).toString(
|
|
9191
|
+
return EncodingUtils.base64EncodeUrl(this.hashUtils.sha256(plainText).toString(EncodingTypes.BASE64), EncodingTypes.BASE64);
|
|
9096
9192
|
}
|
|
9097
9193
|
}
|
|
9098
9194
|
|
|
@@ -9106,7 +9202,7 @@ class CryptoProvider {
|
|
|
9106
9202
|
*/
|
|
9107
9203
|
class NodeStorage extends CacheManager {
|
|
9108
9204
|
constructor(logger, clientId, cryptoImpl, staticAuthorityOptions) {
|
|
9109
|
-
super(clientId, cryptoImpl, logger, staticAuthorityOptions);
|
|
9205
|
+
super(clientId, cryptoImpl, logger, new msalCommon.StubPerformanceClient(), staticAuthorityOptions);
|
|
9110
9206
|
this.cache = {};
|
|
9111
9207
|
this.changeEmitters = [];
|
|
9112
9208
|
this.logger = logger;
|
|
@@ -9639,7 +9735,7 @@ class TokenCache {
|
|
|
9639
9735
|
* API to remove a specific account and the relevant data from cache
|
|
9640
9736
|
* @param account - AccountInfo passed by the user
|
|
9641
9737
|
*/
|
|
9642
|
-
async removeAccount(account) {
|
|
9738
|
+
async removeAccount(account, correlationId) {
|
|
9643
9739
|
this.logger.trace("removeAccount called");
|
|
9644
9740
|
let cacheContext;
|
|
9645
9741
|
try {
|
|
@@ -9647,7 +9743,7 @@ class TokenCache {
|
|
|
9647
9743
|
cacheContext = new TokenCacheContext(this, true);
|
|
9648
9744
|
await this.persistence.beforeCacheAccess(cacheContext);
|
|
9649
9745
|
}
|
|
9650
|
-
|
|
9746
|
+
this.storage.removeAccount(AccountEntity.generateAccountCacheKey(account), correlationId || new GuidGenerator().generateGuid());
|
|
9651
9747
|
}
|
|
9652
9748
|
finally {
|
|
9653
9749
|
if (this.persistence && cacheContext) {
|
|
@@ -9895,7 +9991,7 @@ class ClientAssertion {
|
|
|
9895
9991
|
? JwtConstants.X5T_256
|
|
9896
9992
|
: JwtConstants.X5T;
|
|
9897
9993
|
Object.assign(header, {
|
|
9898
|
-
[thumbprintHeader]: EncodingUtils.base64EncodeUrl(this.thumbprint,
|
|
9994
|
+
[thumbprintHeader]: EncodingUtils.base64EncodeUrl(this.thumbprint, EncodingTypes.HEX),
|
|
9899
9995
|
});
|
|
9900
9996
|
if (this.publicCertificate) {
|
|
9901
9997
|
Object.assign(header, {
|
|
@@ -9944,7 +10040,7 @@ class ClientAssertion {
|
|
|
9944
10040
|
|
|
9945
10041
|
/* eslint-disable header/header */
|
|
9946
10042
|
const name = "@azure/msal-node";
|
|
9947
|
-
const version = "3.
|
|
10043
|
+
const version = "3.6.1";
|
|
9948
10044
|
|
|
9949
10045
|
/*
|
|
9950
10046
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -10930,7 +11026,7 @@ class PublicClientApplication extends ClientApplication {
|
|
|
10930
11026
|
};
|
|
10931
11027
|
await this.nativeBrokerPlugin.signOut(signoutRequest);
|
|
10932
11028
|
}
|
|
10933
|
-
await this.getTokenCache().removeAccount(request.account);
|
|
11029
|
+
await this.getTokenCache().removeAccount(request.account, request.correlationId);
|
|
10934
11030
|
}
|
|
10935
11031
|
/**
|
|
10936
11032
|
* Returns all cached accounts for this application. If brokering is enabled this request will be serviced by the broker.
|
|
@@ -11691,6 +11787,15 @@ class BaseManagedIdentitySource {
|
|
|
11691
11787
|
}
|
|
11692
11788
|
async acquireTokenWithManagedIdentity(managedIdentityRequest, managedIdentityId, fakeAuthority, refreshAccessToken) {
|
|
11693
11789
|
const networkRequest = this.createRequest(managedIdentityRequest.resource, managedIdentityId);
|
|
11790
|
+
if (managedIdentityRequest.revokedTokenSha256Hash) {
|
|
11791
|
+
this.logger.info(`[Managed Identity] The following claims are present in the request: ${managedIdentityRequest.claims}`);
|
|
11792
|
+
networkRequest.queryParameters[ManagedIdentityQueryParameters.SHA256_TOKEN_TO_REFRESH] = managedIdentityRequest.revokedTokenSha256Hash;
|
|
11793
|
+
}
|
|
11794
|
+
if (managedIdentityRequest.clientCapabilities?.length) {
|
|
11795
|
+
const clientCapabilities = managedIdentityRequest.clientCapabilities.toString();
|
|
11796
|
+
this.logger.info(`[Managed Identity] The following client capabilities are present in the request: ${clientCapabilities}`);
|
|
11797
|
+
networkRequest.queryParameters[ManagedIdentityQueryParameters.XMS_CC] = clientCapabilities;
|
|
11798
|
+
}
|
|
11694
11799
|
const headers = networkRequest.headers;
|
|
11695
11800
|
headers[HeaderNames.CONTENT_TYPE] = Constants$1.URL_FORM_CONTENT_TYPE;
|
|
11696
11801
|
const networkRequestOptions = { headers };
|
|
@@ -11903,10 +12008,11 @@ class AppService extends BaseManagedIdentitySource {
|
|
|
11903
12008
|
}
|
|
11904
12009
|
createRequest(resource, managedIdentityId) {
|
|
11905
12010
|
const request = new ManagedIdentityRequestParameters(HttpMethod.GET, this.identityEndpoint);
|
|
11906
|
-
request.headers[APP_SERVICE_SECRET_HEADER_NAME] =
|
|
11907
|
-
|
|
12011
|
+
request.headers[ManagedIdentityHeaders.APP_SERVICE_SECRET_HEADER_NAME] =
|
|
12012
|
+
this.identityHeader;
|
|
12013
|
+
request.queryParameters[ManagedIdentityQueryParameters.API_VERSION] =
|
|
11908
12014
|
APP_SERVICE_MSI_API_VERSION;
|
|
11909
|
-
request.queryParameters[
|
|
12015
|
+
request.queryParameters[ManagedIdentityQueryParameters.RESOURCE] =
|
|
11910
12016
|
resource;
|
|
11911
12017
|
if (managedIdentityId.idType !== ManagedIdentityIdType.SYSTEM_ASSIGNED) {
|
|
11912
12018
|
request.queryParameters[this.getManagedIdentityUserAssignedIdQueryParameterKey(managedIdentityId.idType)] = managedIdentityId.id;
|
|
@@ -11992,10 +12098,10 @@ class AzureArc extends BaseManagedIdentitySource {
|
|
|
11992
12098
|
}
|
|
11993
12099
|
createRequest(resource) {
|
|
11994
12100
|
const request = new ManagedIdentityRequestParameters(HttpMethod.GET, this.identityEndpoint.replace("localhost", "127.0.0.1"));
|
|
11995
|
-
request.headers[METADATA_HEADER_NAME] = "true";
|
|
11996
|
-
request.queryParameters[
|
|
12101
|
+
request.headers[ManagedIdentityHeaders.METADATA_HEADER_NAME] = "true";
|
|
12102
|
+
request.queryParameters[ManagedIdentityQueryParameters.API_VERSION] =
|
|
11997
12103
|
ARC_API_VERSION;
|
|
11998
|
-
request.queryParameters[
|
|
12104
|
+
request.queryParameters[ManagedIdentityQueryParameters.RESOURCE] =
|
|
11999
12105
|
resource;
|
|
12000
12106
|
// bodyParameters calculated in BaseManagedIdentity.acquireTokenWithManagedIdentity
|
|
12001
12107
|
return request;
|
|
@@ -12045,14 +12151,14 @@ class AzureArc extends BaseManagedIdentitySource {
|
|
|
12045
12151
|
// attempt to read the contents of the secret file
|
|
12046
12152
|
let secret;
|
|
12047
12153
|
try {
|
|
12048
|
-
secret = fs.readFileSync(secretFilePath,
|
|
12154
|
+
secret = fs.readFileSync(secretFilePath, EncodingTypes.UTF8);
|
|
12049
12155
|
}
|
|
12050
12156
|
catch (e) {
|
|
12051
12157
|
throw createManagedIdentityError(unableToReadSecretFile);
|
|
12052
12158
|
}
|
|
12053
12159
|
const authHeaderValue = `Basic ${secret}`;
|
|
12054
12160
|
this.logger.info(`[Managed Identity] Adding authorization header to the request.`);
|
|
12055
|
-
networkRequest.headers[AUTHORIZATION_HEADER_NAME] = authHeaderValue;
|
|
12161
|
+
networkRequest.headers[ManagedIdentityHeaders.AUTHORIZATION_HEADER_NAME] = authHeaderValue;
|
|
12056
12162
|
try {
|
|
12057
12163
|
retryResponse =
|
|
12058
12164
|
await networkClient.sendGetRequestAsync(networkRequest.computeUri(), networkRequestOptions);
|
|
@@ -12102,8 +12208,8 @@ class CloudShell extends BaseManagedIdentitySource {
|
|
|
12102
12208
|
}
|
|
12103
12209
|
createRequest(resource) {
|
|
12104
12210
|
const request = new ManagedIdentityRequestParameters(HttpMethod.POST, this.msiEndpoint);
|
|
12105
|
-
request.headers[METADATA_HEADER_NAME] = "true";
|
|
12106
|
-
request.bodyParameters[
|
|
12211
|
+
request.headers[ManagedIdentityHeaders.METADATA_HEADER_NAME] = "true";
|
|
12212
|
+
request.bodyParameters[ManagedIdentityQueryParameters.RESOURCE] =
|
|
12107
12213
|
resource;
|
|
12108
12214
|
return request;
|
|
12109
12215
|
}
|
|
@@ -12232,16 +12338,39 @@ class ImdsRetryPolicy {
|
|
|
12232
12338
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12233
12339
|
* Licensed under the MIT License.
|
|
12234
12340
|
*/
|
|
12235
|
-
//
|
|
12341
|
+
// Documentation for IMDS is available at https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/how-to-use-vm-token#get-a-token-using-http
|
|
12236
12342
|
const IMDS_TOKEN_PATH = "/metadata/identity/oauth2/token";
|
|
12237
12343
|
const DEFAULT_IMDS_ENDPOINT = `http://169.254.169.254${IMDS_TOKEN_PATH}`;
|
|
12238
12344
|
const IMDS_API_VERSION = "2018-02-01";
|
|
12239
|
-
|
|
12345
|
+
/**
|
|
12346
|
+
* Original source of code: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/src/ImdsManagedIdentitySource.cs
|
|
12347
|
+
*/
|
|
12240
12348
|
class Imds extends BaseManagedIdentitySource {
|
|
12349
|
+
/**
|
|
12350
|
+
* Constructs an Imds instance.
|
|
12351
|
+
* @param logger - Logger instance for logging.
|
|
12352
|
+
* @param nodeStorage - NodeStorage instance for caching.
|
|
12353
|
+
* @param networkClient - Network client for HTTP requests.
|
|
12354
|
+
* @param cryptoProvider - CryptoProvider for cryptographic operations.
|
|
12355
|
+
* @param disableInternalRetries - Whether to disable internal retry logic.
|
|
12356
|
+
* @param identityEndpoint - The IMDS endpoint to use.
|
|
12357
|
+
*/
|
|
12241
12358
|
constructor(logger, nodeStorage, networkClient, cryptoProvider, disableInternalRetries, identityEndpoint) {
|
|
12242
12359
|
super(logger, nodeStorage, networkClient, cryptoProvider, disableInternalRetries);
|
|
12243
12360
|
this.identityEndpoint = identityEndpoint;
|
|
12244
12361
|
}
|
|
12362
|
+
/**
|
|
12363
|
+
* Attempts to create an Imds instance by determining the correct endpoint.
|
|
12364
|
+
* If the AZURE_POD_IDENTITY_AUTHORITY_HOST environment variable is set, it uses that as the endpoint.
|
|
12365
|
+
* Otherwise, it falls back to the default IMDS endpoint.
|
|
12366
|
+
*
|
|
12367
|
+
* @param logger - Logger instance for logging.
|
|
12368
|
+
* @param nodeStorage - NodeStorage instance for caching.
|
|
12369
|
+
* @param networkClient - Network client for HTTP requests.
|
|
12370
|
+
* @param cryptoProvider - CryptoProvider for cryptographic operations.
|
|
12371
|
+
* @param disableInternalRetries - Whether to disable internal retry logic.
|
|
12372
|
+
* @returns An instance of Imds configured with the appropriate endpoint.
|
|
12373
|
+
*/
|
|
12245
12374
|
static tryCreate(logger, nodeStorage, networkClient, cryptoProvider, disableInternalRetries) {
|
|
12246
12375
|
let validatedIdentityEndpoint;
|
|
12247
12376
|
if (process.env[ManagedIdentityEnvironmentVariableNames
|
|
@@ -12257,18 +12386,26 @@ class Imds extends BaseManagedIdentitySource {
|
|
|
12257
12386
|
}
|
|
12258
12387
|
return new Imds(logger, nodeStorage, networkClient, cryptoProvider, disableInternalRetries, validatedIdentityEndpoint);
|
|
12259
12388
|
}
|
|
12389
|
+
/**
|
|
12390
|
+
* Creates a ManagedIdentityRequestParameters object for acquiring a token from IMDS.
|
|
12391
|
+
* Sets the required headers and query parameters for the IMDS token request.
|
|
12392
|
+
*
|
|
12393
|
+
* @param resource - The resource URI for which the token is requested.
|
|
12394
|
+
* @param managedIdentityId - The managed identity ID (system-assigned or user-assigned).
|
|
12395
|
+
* @returns A ManagedIdentityRequestParameters object configured for IMDS.
|
|
12396
|
+
*/
|
|
12260
12397
|
createRequest(resource, managedIdentityId) {
|
|
12261
12398
|
const request = new ManagedIdentityRequestParameters(HttpMethod.GET, this.identityEndpoint);
|
|
12262
|
-
request.headers[METADATA_HEADER_NAME] = "true";
|
|
12263
|
-
request.queryParameters[
|
|
12399
|
+
request.headers[ManagedIdentityHeaders.METADATA_HEADER_NAME] = "true";
|
|
12400
|
+
request.queryParameters[ManagedIdentityQueryParameters.API_VERSION] =
|
|
12264
12401
|
IMDS_API_VERSION;
|
|
12265
|
-
request.queryParameters[
|
|
12402
|
+
request.queryParameters[ManagedIdentityQueryParameters.RESOURCE] =
|
|
12266
12403
|
resource;
|
|
12267
12404
|
if (managedIdentityId.idType !== ManagedIdentityIdType.SYSTEM_ASSIGNED) {
|
|
12268
12405
|
request.queryParameters[this.getManagedIdentityUserAssignedIdQueryParameterKey(managedIdentityId.idType, true // indicates source is IMDS
|
|
12269
12406
|
)] = managedIdentityId.id;
|
|
12270
12407
|
}
|
|
12271
|
-
// bodyParameters calculated in BaseManagedIdentity.acquireTokenWithManagedIdentity
|
|
12408
|
+
// The bodyParameters are calculated in BaseManagedIdentity.acquireTokenWithManagedIdentity.
|
|
12272
12409
|
request.retryPolicy = new ImdsRetryPolicy();
|
|
12273
12410
|
return request;
|
|
12274
12411
|
}
|
|
@@ -12278,17 +12415,30 @@ class Imds extends BaseManagedIdentitySource {
|
|
|
12278
12415
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12279
12416
|
* Licensed under the MIT License.
|
|
12280
12417
|
*/
|
|
12281
|
-
// MSI Constants. Docs for MSI are available here https://docs.microsoft.com/azure/app-service/overview-managed-identity
|
|
12282
12418
|
const SERVICE_FABRIC_MSI_API_VERSION = "2019-07-01-preview";
|
|
12283
12419
|
/**
|
|
12284
12420
|
* Original source of code: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/src/ServiceFabricManagedIdentitySource.cs
|
|
12285
12421
|
*/
|
|
12286
12422
|
class ServiceFabric extends BaseManagedIdentitySource {
|
|
12423
|
+
/**
|
|
12424
|
+
* Constructs a new ServiceFabric managed identity source.
|
|
12425
|
+
* @param logger Logger instance for logging
|
|
12426
|
+
* @param nodeStorage NodeStorage instance for caching
|
|
12427
|
+
* @param networkClient Network client for HTTP requests
|
|
12428
|
+
* @param cryptoProvider Crypto provider for cryptographic operations
|
|
12429
|
+
* @param disableInternalRetries Whether to disable internal retry logic
|
|
12430
|
+
* @param identityEndpoint The Service Fabric managed identity endpoint
|
|
12431
|
+
* @param identityHeader The Service Fabric managed identity secret header
|
|
12432
|
+
*/
|
|
12287
12433
|
constructor(logger, nodeStorage, networkClient, cryptoProvider, disableInternalRetries, identityEndpoint, identityHeader) {
|
|
12288
12434
|
super(logger, nodeStorage, networkClient, cryptoProvider, disableInternalRetries);
|
|
12289
12435
|
this.identityEndpoint = identityEndpoint;
|
|
12290
12436
|
this.identityHeader = identityHeader;
|
|
12291
12437
|
}
|
|
12438
|
+
/**
|
|
12439
|
+
* Retrieves the environment variables required for Service Fabric managed identity.
|
|
12440
|
+
* @returns An array containing the identity endpoint, identity header, and identity server thumbprint.
|
|
12441
|
+
*/
|
|
12292
12442
|
static getEnvironmentVariables() {
|
|
12293
12443
|
const identityEndpoint = process.env[ManagedIdentityEnvironmentVariableNames.IDENTITY_ENDPOINT];
|
|
12294
12444
|
const identityHeader = process.env[ManagedIdentityEnvironmentVariableNames.IDENTITY_HEADER];
|
|
@@ -12296,12 +12446,18 @@ class ServiceFabric extends BaseManagedIdentitySource {
|
|
|
12296
12446
|
.IDENTITY_SERVER_THUMBPRINT];
|
|
12297
12447
|
return [identityEndpoint, identityHeader, identityServerThumbprint];
|
|
12298
12448
|
}
|
|
12449
|
+
/**
|
|
12450
|
+
* Attempts to create a ServiceFabric managed identity source if all required environment variables are present.
|
|
12451
|
+
* @param logger Logger instance for logging
|
|
12452
|
+
* @param nodeStorage NodeStorage instance for caching
|
|
12453
|
+
* @param networkClient Network client for HTTP requests
|
|
12454
|
+
* @param cryptoProvider Crypto provider for cryptographic operations
|
|
12455
|
+
* @param disableInternalRetries Whether to disable internal retry logic
|
|
12456
|
+
* @param managedIdentityId Managed identity identifier
|
|
12457
|
+
* @returns A ServiceFabric instance if environment variables are set, otherwise null
|
|
12458
|
+
*/
|
|
12299
12459
|
static tryCreate(logger, nodeStorage, networkClient, cryptoProvider, disableInternalRetries, managedIdentityId) {
|
|
12300
12460
|
const [identityEndpoint, identityHeader, identityServerThumbprint] = ServiceFabric.getEnvironmentVariables();
|
|
12301
|
-
/*
|
|
12302
|
-
* if either of the identity endpoint, identity header, or identity server thumbprint
|
|
12303
|
-
* environment variables are undefined, this MSI provider is unavailable.
|
|
12304
|
-
*/
|
|
12305
12461
|
if (!identityEndpoint || !identityHeader || !identityServerThumbprint) {
|
|
12306
12462
|
logger.info(`[Managed Identity] ${ManagedIdentitySourceNames.SERVICE_FABRIC} managed identity is unavailable because one or all of the '${ManagedIdentityEnvironmentVariableNames.IDENTITY_HEADER}', '${ManagedIdentityEnvironmentVariableNames.IDENTITY_ENDPOINT}' or '${ManagedIdentityEnvironmentVariableNames.IDENTITY_SERVER_THUMBPRINT}' environment variables are not defined.`);
|
|
12307
12463
|
return null;
|
|
@@ -12313,12 +12469,19 @@ class ServiceFabric extends BaseManagedIdentitySource {
|
|
|
12313
12469
|
}
|
|
12314
12470
|
return new ServiceFabric(logger, nodeStorage, networkClient, cryptoProvider, disableInternalRetries, identityEndpoint, identityHeader);
|
|
12315
12471
|
}
|
|
12472
|
+
/**
|
|
12473
|
+
* Creates the request parameters for acquiring a token from the Service Fabric cluster.
|
|
12474
|
+
* @param resource - The resource URI for which the token is requested.
|
|
12475
|
+
* @param managedIdentityId - The managed identity ID (system-assigned or user-assigned).
|
|
12476
|
+
* @returns A ManagedIdentityRequestParameters object configured for Service Fabric.
|
|
12477
|
+
*/
|
|
12316
12478
|
createRequest(resource, managedIdentityId) {
|
|
12317
12479
|
const request = new ManagedIdentityRequestParameters(HttpMethod.GET, this.identityEndpoint);
|
|
12318
|
-
request.headers[ML_AND_SF_SECRET_HEADER_NAME] =
|
|
12319
|
-
|
|
12480
|
+
request.headers[ManagedIdentityHeaders.ML_AND_SF_SECRET_HEADER_NAME] =
|
|
12481
|
+
this.identityHeader;
|
|
12482
|
+
request.queryParameters[ManagedIdentityQueryParameters.API_VERSION] =
|
|
12320
12483
|
SERVICE_FABRIC_MSI_API_VERSION;
|
|
12321
|
-
request.queryParameters[
|
|
12484
|
+
request.queryParameters[ManagedIdentityQueryParameters.RESOURCE] =
|
|
12322
12485
|
resource;
|
|
12323
12486
|
if (managedIdentityId.idType !== ManagedIdentityIdType.SYSTEM_ASSIGNED) {
|
|
12324
12487
|
request.queryParameters[this.getManagedIdentityUserAssignedIdQueryParameterKey(managedIdentityId.idType)] = managedIdentityId.id;
|
|
@@ -12333,6 +12496,7 @@ class ServiceFabric extends BaseManagedIdentitySource {
|
|
|
12333
12496
|
* Licensed under the MIT License.
|
|
12334
12497
|
*/
|
|
12335
12498
|
const MACHINE_LEARNING_MSI_API_VERSION = "2017-09-01";
|
|
12499
|
+
const MANAGED_IDENTITY_MACHINE_LEARNING_UNSUPPORTED_ID_TYPE_ERROR = `Only client id is supported for user-assigned managed identity in ${ManagedIdentitySourceNames.MACHINE_LEARNING}.`; // referenced in unit test
|
|
12336
12500
|
class MachineLearning extends BaseManagedIdentitySource {
|
|
12337
12501
|
constructor(logger, nodeStorage, networkClient, cryptoProvider, disableInternalRetries, msiEndpoint, secret) {
|
|
12338
12502
|
super(logger, nodeStorage, networkClient, cryptoProvider, disableInternalRetries);
|
|
@@ -12357,17 +12521,26 @@ class MachineLearning extends BaseManagedIdentitySource {
|
|
|
12357
12521
|
}
|
|
12358
12522
|
createRequest(resource, managedIdentityId) {
|
|
12359
12523
|
const request = new ManagedIdentityRequestParameters(HttpMethod.GET, this.msiEndpoint);
|
|
12360
|
-
request.headers[METADATA_HEADER_NAME] = "true";
|
|
12361
|
-
request.headers[ML_AND_SF_SECRET_HEADER_NAME] =
|
|
12362
|
-
|
|
12524
|
+
request.headers[ManagedIdentityHeaders.METADATA_HEADER_NAME] = "true";
|
|
12525
|
+
request.headers[ManagedIdentityHeaders.ML_AND_SF_SECRET_HEADER_NAME] =
|
|
12526
|
+
this.secret;
|
|
12527
|
+
request.queryParameters[ManagedIdentityQueryParameters.API_VERSION] =
|
|
12363
12528
|
MACHINE_LEARNING_MSI_API_VERSION;
|
|
12364
|
-
request.queryParameters[
|
|
12529
|
+
request.queryParameters[ManagedIdentityQueryParameters.RESOURCE] =
|
|
12365
12530
|
resource;
|
|
12366
|
-
if (managedIdentityId.idType
|
|
12531
|
+
if (managedIdentityId.idType === ManagedIdentityIdType.SYSTEM_ASSIGNED) {
|
|
12532
|
+
request.queryParameters[ManagedIdentityUserAssignedIdQueryParameterNames.MANAGED_IDENTITY_CLIENT_ID_2017] = process.env[ManagedIdentityEnvironmentVariableNames
|
|
12533
|
+
.DEFAULT_IDENTITY_CLIENT_ID]; // this environment variable is always set in an Azure Machine Learning source
|
|
12534
|
+
}
|
|
12535
|
+
else if (managedIdentityId.idType ===
|
|
12536
|
+
ManagedIdentityIdType.USER_ASSIGNED_CLIENT_ID) {
|
|
12367
12537
|
request.queryParameters[this.getManagedIdentityUserAssignedIdQueryParameterKey(managedIdentityId.idType, false, // isIMDS
|
|
12368
12538
|
true // uses2017API
|
|
12369
12539
|
)] = managedIdentityId.id;
|
|
12370
12540
|
}
|
|
12541
|
+
else {
|
|
12542
|
+
throw new Error(MANAGED_IDENTITY_MACHINE_LEARNING_UNSUPPORTED_ID_TYPE_ERROR);
|
|
12543
|
+
}
|
|
12371
12544
|
// bodyParameters calculated in BaseManagedIdentity.acquireTokenWithManagedIdentity
|
|
12372
12545
|
return request;
|
|
12373
12546
|
}
|
|
@@ -12442,6 +12615,7 @@ class ManagedIdentityClient {
|
|
|
12442
12615
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12443
12616
|
* Licensed under the MIT License.
|
|
12444
12617
|
*/
|
|
12618
|
+
const SOURCES_THAT_SUPPORT_TOKEN_REVOCATION = [ManagedIdentitySourceNames.SERVICE_FABRIC];
|
|
12445
12619
|
/**
|
|
12446
12620
|
* Class to initialize a managed identity and identify the service
|
|
12447
12621
|
* @public
|
|
@@ -12474,6 +12648,7 @@ class ManagedIdentityApplication {
|
|
|
12474
12648
|
},
|
|
12475
12649
|
});
|
|
12476
12650
|
this.managedIdentityClient = new ManagedIdentityClient(this.logger, ManagedIdentityApplication.nodeStorage, this.networkClient, this.cryptoProvider, this.config.disableInternalRetries);
|
|
12651
|
+
this.hashUtils = new HashUtils();
|
|
12477
12652
|
}
|
|
12478
12653
|
/**
|
|
12479
12654
|
* Acquire an access token from the cache or the managed identity
|
|
@@ -12492,28 +12667,60 @@ class ManagedIdentityApplication {
|
|
|
12492
12667
|
],
|
|
12493
12668
|
authority: this.fakeAuthority.canonicalAuthority,
|
|
12494
12669
|
correlationId: this.cryptoProvider.createNewGuid(),
|
|
12670
|
+
claims: managedIdentityRequestParams.claims,
|
|
12671
|
+
clientCapabilities: this.config.clientCapabilities,
|
|
12495
12672
|
};
|
|
12496
|
-
if (
|
|
12497
|
-
managedIdentityRequest.
|
|
12498
|
-
// make a network call to the managed identity source
|
|
12499
|
-
return this.managedIdentityClient.sendManagedIdentityTokenRequest(managedIdentityRequest, this.config.managedIdentityId, this.fakeAuthority);
|
|
12673
|
+
if (managedIdentityRequest.forceRefresh) {
|
|
12674
|
+
return this.acquireTokenFromManagedIdentity(managedIdentityRequest, this.config.managedIdentityId, this.fakeAuthority);
|
|
12500
12675
|
}
|
|
12501
12676
|
const [cachedAuthenticationResult, lastCacheOutcome] = await this.fakeClientCredentialClient.getCachedAuthenticationResult(managedIdentityRequest, this.config, this.cryptoProvider, this.fakeAuthority, ManagedIdentityApplication.nodeStorage);
|
|
12677
|
+
/*
|
|
12678
|
+
* Check if claims are present in the managed identity request.
|
|
12679
|
+
* If so, the cached token will not be used.
|
|
12680
|
+
*/
|
|
12681
|
+
if (managedIdentityRequest.claims) {
|
|
12682
|
+
const sourceName = this.managedIdentityClient.getManagedIdentitySource();
|
|
12683
|
+
/*
|
|
12684
|
+
* Check if there is a cached token and if the Managed Identity source supports token revocation.
|
|
12685
|
+
* If so, hash the cached access token and add it to the request.
|
|
12686
|
+
*/
|
|
12687
|
+
if (cachedAuthenticationResult &&
|
|
12688
|
+
SOURCES_THAT_SUPPORT_TOKEN_REVOCATION.includes(sourceName)) {
|
|
12689
|
+
const revokedTokenSha256Hash = this.hashUtils
|
|
12690
|
+
.sha256(cachedAuthenticationResult.accessToken)
|
|
12691
|
+
.toString(EncodingTypes.HEX);
|
|
12692
|
+
managedIdentityRequest.revokedTokenSha256Hash =
|
|
12693
|
+
revokedTokenSha256Hash;
|
|
12694
|
+
}
|
|
12695
|
+
return this.acquireTokenFromManagedIdentity(managedIdentityRequest, this.config.managedIdentityId, this.fakeAuthority);
|
|
12696
|
+
}
|
|
12502
12697
|
if (cachedAuthenticationResult) {
|
|
12503
12698
|
// if the token is not expired but must be refreshed; get a new one in the background
|
|
12504
12699
|
if (lastCacheOutcome === CacheOutcome.PROACTIVELY_REFRESHED) {
|
|
12505
12700
|
this.logger.info("ClientCredentialClient:getCachedAuthenticationResult - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed.");
|
|
12506
|
-
//
|
|
12701
|
+
// force refresh; will run in the background
|
|
12507
12702
|
const refreshAccessToken = true;
|
|
12508
|
-
await this.
|
|
12703
|
+
await this.acquireTokenFromManagedIdentity(managedIdentityRequest, this.config.managedIdentityId, this.fakeAuthority, refreshAccessToken);
|
|
12509
12704
|
}
|
|
12510
12705
|
return cachedAuthenticationResult;
|
|
12511
12706
|
}
|
|
12512
12707
|
else {
|
|
12513
|
-
|
|
12514
|
-
return this.managedIdentityClient.sendManagedIdentityTokenRequest(managedIdentityRequest, this.config.managedIdentityId, this.fakeAuthority);
|
|
12708
|
+
return this.acquireTokenFromManagedIdentity(managedIdentityRequest, this.config.managedIdentityId, this.fakeAuthority);
|
|
12515
12709
|
}
|
|
12516
12710
|
}
|
|
12711
|
+
/**
|
|
12712
|
+
* Acquires a token from a managed identity endpoint.
|
|
12713
|
+
*
|
|
12714
|
+
* @param managedIdentityRequest - The request object containing parameters for the managed identity token request.
|
|
12715
|
+
* @param managedIdentityId - The identifier for the managed identity (e.g., client ID or resource ID).
|
|
12716
|
+
* @param fakeAuthority - A placeholder authority used for the token request.
|
|
12717
|
+
* @param refreshAccessToken - Optional flag indicating whether to force a refresh of the access token.
|
|
12718
|
+
* @returns A promise that resolves to an AuthenticationResult containing the acquired token and related information.
|
|
12719
|
+
*/
|
|
12720
|
+
async acquireTokenFromManagedIdentity(managedIdentityRequest, managedIdentityId, fakeAuthority, refreshAccessToken) {
|
|
12721
|
+
// make a network call to the managed identity
|
|
12722
|
+
return this.managedIdentityClient.sendManagedIdentityTokenRequest(managedIdentityRequest, managedIdentityId, fakeAuthority, refreshAccessToken);
|
|
12723
|
+
}
|
|
12517
12724
|
/**
|
|
12518
12725
|
* Determine the Managed Identity Source based on available environment variables. This API is consumed by Azure Identity SDK.
|
|
12519
12726
|
* @returns ManagedIdentitySourceNames - The Managed Identity source's name
|