@azure/msal-node 3.3.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cache/NodeStorage.mjs +1 -1
- package/dist/cache/TokenCache.mjs +1 -1
- package/dist/cache/distributed/DistributedCachePlugin.mjs +1 -1
- package/dist/cache/serializer/Deserializer.mjs +1 -1
- package/dist/cache/serializer/Serializer.mjs +1 -1
- package/dist/client/ClientApplication.d.ts +3 -3
- package/dist/client/ClientApplication.d.ts.map +1 -1
- package/dist/client/ClientApplication.mjs +14 -17
- package/dist/client/ClientApplication.mjs.map +1 -1
- package/dist/client/ClientAssertion.mjs +1 -1
- package/dist/client/ClientCredentialClient.d.ts.map +1 -1
- package/dist/client/ClientCredentialClient.mjs +16 -16
- package/dist/client/ClientCredentialClient.mjs.map +1 -1
- package/dist/client/ConfidentialClientApplication.d.ts.map +1 -1
- package/dist/client/ConfidentialClientApplication.mjs +5 -3
- package/dist/client/ConfidentialClientApplication.mjs.map +1 -1
- package/dist/client/DeviceCodeClient.d.ts.map +1 -1
- package/dist/client/DeviceCodeClient.mjs +24 -24
- package/dist/client/DeviceCodeClient.mjs.map +1 -1
- package/dist/client/ManagedIdentityApplication.mjs +1 -1
- package/dist/client/ManagedIdentityClient.mjs +1 -1
- package/dist/client/ManagedIdentitySources/AppService.mjs +1 -1
- package/dist/client/ManagedIdentitySources/AzureArc.mjs +1 -1
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +1 -1
- package/dist/client/ManagedIdentitySources/CloudShell.mjs +1 -1
- package/dist/client/ManagedIdentitySources/Imds.mjs +1 -1
- package/dist/client/ManagedIdentitySources/MachineLearning.mjs +1 -1
- package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +1 -1
- package/dist/client/OnBehalfOfClient.d.ts.map +1 -1
- package/dist/client/OnBehalfOfClient.mjs +19 -19
- package/dist/client/OnBehalfOfClient.mjs.map +1 -1
- package/dist/client/PublicClientApplication.d.ts.map +1 -1
- package/dist/client/PublicClientApplication.mjs +3 -2
- package/dist/client/PublicClientApplication.mjs.map +1 -1
- package/dist/client/UsernamePasswordClient.d.ts.map +1 -1
- package/dist/client/UsernamePasswordClient.mjs +21 -21
- package/dist/client/UsernamePasswordClient.mjs.map +1 -1
- package/dist/config/Configuration.mjs +1 -1
- package/dist/config/ManagedIdentityId.mjs +1 -1
- package/dist/config/ManagedIdentityRequestParameters.d.ts.map +1 -1
- package/dist/config/ManagedIdentityRequestParameters.mjs +8 -8
- package/dist/config/ManagedIdentityRequestParameters.mjs.map +1 -1
- package/dist/crypto/CryptoProvider.mjs +1 -1
- package/dist/crypto/GuidGenerator.mjs +1 -1
- package/dist/crypto/HashUtils.mjs +1 -1
- package/dist/crypto/PkceGenerator.mjs +1 -1
- package/dist/error/ManagedIdentityError.mjs +1 -1
- package/dist/error/ManagedIdentityErrorCodes.mjs +1 -1
- package/dist/error/NodeAuthError.mjs +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +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/ILoopbackClient.d.ts +2 -2
- package/dist/network/ILoopbackClient.d.ts.map +1 -1
- package/dist/network/LoopbackClient.d.ts +2 -2
- package/dist/network/LoopbackClient.d.ts.map +1 -1
- package/dist/network/LoopbackClient.mjs +3 -2
- package/dist/network/LoopbackClient.mjs.map +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/protocol/Authorize.d.ts +12 -0
- package/dist/protocol/Authorize.d.ts.map +1 -0
- package/dist/protocol/Authorize.mjs +42 -0
- package/dist/protocol/Authorize.mjs.map +1 -0
- package/dist/retry/LinearRetryPolicy.mjs +1 -1
- package/dist/utils/Constants.mjs +1 -1
- package/dist/utils/EncodingUtils.mjs +1 -1
- package/dist/utils/NetworkUtils.mjs +1 -1
- package/dist/utils/TimeUtils.mjs +1 -1
- package/lib/msal-node.cjs +834 -917
- package/lib/msal-node.cjs.map +1 -1
- package/lib/types/client/ClientApplication.d.ts +3 -3
- package/lib/types/client/ClientApplication.d.ts.map +1 -1
- package/lib/types/client/ClientCredentialClient.d.ts.map +1 -1
- package/lib/types/client/ConfidentialClientApplication.d.ts.map +1 -1
- package/lib/types/client/DeviceCodeClient.d.ts.map +1 -1
- package/lib/types/client/OnBehalfOfClient.d.ts.map +1 -1
- package/lib/types/client/PublicClientApplication.d.ts.map +1 -1
- package/lib/types/client/UsernamePasswordClient.d.ts.map +1 -1
- package/lib/types/config/ManagedIdentityRequestParameters.d.ts.map +1 -1
- package/lib/types/index.d.ts +5 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/network/ILoopbackClient.d.ts +2 -2
- package/lib/types/network/ILoopbackClient.d.ts.map +1 -1
- package/lib/types/network/LoopbackClient.d.ts +2 -2
- package/lib/types/network/LoopbackClient.d.ts.map +1 -1
- package/lib/types/packageMetadata.d.ts +1 -1
- package/lib/types/protocol/Authorize.d.ts +12 -0
- package/lib/types/protocol/Authorize.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/client/ClientApplication.ts +42 -44
- package/src/client/ClientCredentialClient.ts +32 -14
- package/src/client/ConfidentialClientApplication.ts +15 -7
- package/src/client/DeviceCodeClient.ts +46 -24
- package/src/client/OnBehalfOfClient.ts +38 -17
- package/src/client/PublicClientApplication.ts +9 -5
- package/src/client/UsernamePasswordClient.ts +37 -19
- package/src/config/ManagedIdentityRequestParameters.ts +17 -7
- package/src/index.ts +5 -2
- package/src/network/ILoopbackClient.ts +2 -2
- package/src/network/LoopbackClient.ts +43 -46
- package/src/packageMetadata.ts +1 -1
- package/src/protocol/Authorize.ts +63 -0
package/lib/msal-node.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-node v3.
|
|
1
|
+
/*! @azure/msal-node v3.4.0 2025-03-20 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -152,7 +152,7 @@ class Serializer {
|
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
/*! @azure/msal-common v15.
|
|
155
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
156
156
|
/*
|
|
157
157
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
158
158
|
* Licensed under the MIT License.
|
|
@@ -445,7 +445,7 @@ const CacheOutcome = {
|
|
|
445
445
|
// Token renewal offset default in seconds
|
|
446
446
|
const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
|
|
447
447
|
|
|
448
|
-
/*! @azure/msal-common v15.
|
|
448
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
449
449
|
/*
|
|
450
450
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
451
451
|
* Licensed under the MIT License.
|
|
@@ -462,7 +462,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
462
462
|
unexpectedError: unexpectedError
|
|
463
463
|
});
|
|
464
464
|
|
|
465
|
-
/*! @azure/msal-common v15.
|
|
465
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
466
466
|
|
|
467
467
|
/*
|
|
468
468
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -511,7 +511,7 @@ function createAuthError(code, additionalMessage) {
|
|
|
511
511
|
: AuthErrorMessages[code]);
|
|
512
512
|
}
|
|
513
513
|
|
|
514
|
-
/*! @azure/msal-common v15.
|
|
514
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
515
515
|
/*
|
|
516
516
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
517
517
|
* Licensed under the MIT License.
|
|
@@ -609,7 +609,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
609
609
|
userTimeoutReached: userTimeoutReached
|
|
610
610
|
});
|
|
611
611
|
|
|
612
|
-
/*! @azure/msal-common v15.
|
|
612
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
613
613
|
|
|
614
614
|
/*
|
|
615
615
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -861,7 +861,7 @@ function createClientAuthError(errorCode, additionalMessage) {
|
|
|
861
861
|
return new ClientAuthError(errorCode, additionalMessage);
|
|
862
862
|
}
|
|
863
863
|
|
|
864
|
-
/*! @azure/msal-common v15.
|
|
864
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
865
865
|
|
|
866
866
|
/*
|
|
867
867
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -900,7 +900,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
|
|
|
900
900
|
},
|
|
901
901
|
};
|
|
902
902
|
|
|
903
|
-
/*! @azure/msal-common v15.
|
|
903
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
904
904
|
|
|
905
905
|
/*
|
|
906
906
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1091,12 +1091,12 @@ class Logger {
|
|
|
1091
1091
|
}
|
|
1092
1092
|
}
|
|
1093
1093
|
|
|
1094
|
-
/*! @azure/msal-common v15.
|
|
1094
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
1095
1095
|
/* eslint-disable header/header */
|
|
1096
1096
|
const name$1 = "@azure/msal-common";
|
|
1097
|
-
const version$1 = "15.
|
|
1097
|
+
const version$1 = "15.3.0";
|
|
1098
1098
|
|
|
1099
|
-
/*! @azure/msal-common v15.
|
|
1099
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
1100
1100
|
/*
|
|
1101
1101
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1102
1102
|
* Licensed under the MIT License.
|
|
@@ -1116,7 +1116,7 @@ const AzureCloudInstance = {
|
|
|
1116
1116
|
AzureUsGovernment: "https://login.microsoftonline.us",
|
|
1117
1117
|
};
|
|
1118
1118
|
|
|
1119
|
-
/*! @azure/msal-common v15.
|
|
1119
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
1120
1120
|
|
|
1121
1121
|
/*
|
|
1122
1122
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1177,7 +1177,7 @@ function checkMaxAge(authTime, maxAge) {
|
|
|
1177
1177
|
}
|
|
1178
1178
|
}
|
|
1179
1179
|
|
|
1180
|
-
/*! @azure/msal-common v15.
|
|
1180
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
1181
1181
|
/*
|
|
1182
1182
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1183
1183
|
* Licensed under the MIT License.
|
|
@@ -1232,7 +1232,7 @@ function delay(t, value) {
|
|
|
1232
1232
|
return new Promise((resolve) => setTimeout(() => resolve(value), t));
|
|
1233
1233
|
}
|
|
1234
1234
|
|
|
1235
|
-
/*! @azure/msal-common v15.
|
|
1235
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
1236
1236
|
|
|
1237
1237
|
/*
|
|
1238
1238
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1559,7 +1559,7 @@ function isAuthorityMetadataExpired(metadata) {
|
|
|
1559
1559
|
return metadata.expiresAt <= nowSeconds();
|
|
1560
1560
|
}
|
|
1561
1561
|
|
|
1562
|
-
/*! @azure/msal-common v15.
|
|
1562
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
1563
1563
|
/*
|
|
1564
1564
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1565
1565
|
* Licensed under the MIT License.
|
|
@@ -1613,7 +1613,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
1613
1613
|
urlParseError: urlParseError
|
|
1614
1614
|
});
|
|
1615
1615
|
|
|
1616
|
-
/*! @azure/msal-common v15.
|
|
1616
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
1617
1617
|
|
|
1618
1618
|
/*
|
|
1619
1619
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1751,7 +1751,7 @@ function createClientConfigurationError(errorCode) {
|
|
|
1751
1751
|
return new ClientConfigurationError(errorCode);
|
|
1752
1752
|
}
|
|
1753
1753
|
|
|
1754
|
-
/*! @azure/msal-common v15.
|
|
1754
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
1755
1755
|
/*
|
|
1756
1756
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1757
1757
|
* Licensed under the MIT License.
|
|
@@ -1848,7 +1848,7 @@ class StringUtils {
|
|
|
1848
1848
|
}
|
|
1849
1849
|
}
|
|
1850
1850
|
|
|
1851
|
-
/*! @azure/msal-common v15.
|
|
1851
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
1852
1852
|
|
|
1853
1853
|
/*
|
|
1854
1854
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2039,7 +2039,7 @@ class ScopeSet {
|
|
|
2039
2039
|
}
|
|
2040
2040
|
}
|
|
2041
2041
|
|
|
2042
|
-
/*! @azure/msal-common v15.
|
|
2042
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
2043
2043
|
|
|
2044
2044
|
/*
|
|
2045
2045
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2079,7 +2079,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
|
|
|
2079
2079
|
};
|
|
2080
2080
|
}
|
|
2081
2081
|
|
|
2082
|
-
/*! @azure/msal-common v15.
|
|
2082
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
2083
2083
|
/*
|
|
2084
2084
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2085
2085
|
* Licensed under the MIT License.
|
|
@@ -2158,7 +2158,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
|
|
|
2158
2158
|
return updatedAccountInfo;
|
|
2159
2159
|
}
|
|
2160
2160
|
|
|
2161
|
-
/*! @azure/msal-common v15.
|
|
2161
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
2162
2162
|
/*
|
|
2163
2163
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2164
2164
|
* Licensed under the MIT License.
|
|
@@ -2173,7 +2173,7 @@ const AuthorityType = {
|
|
|
2173
2173
|
Ciam: 3,
|
|
2174
2174
|
};
|
|
2175
2175
|
|
|
2176
|
-
/*! @azure/msal-common v15.
|
|
2176
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
2177
2177
|
/*
|
|
2178
2178
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2179
2179
|
* Licensed under the MIT License.
|
|
@@ -2195,7 +2195,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
|
|
|
2195
2195
|
return null;
|
|
2196
2196
|
}
|
|
2197
2197
|
|
|
2198
|
-
/*! @azure/msal-common v15.
|
|
2198
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
2199
2199
|
/*
|
|
2200
2200
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2201
2201
|
* Licensed under the MIT License.
|
|
@@ -2208,7 +2208,7 @@ const ProtocolMode = {
|
|
|
2208
2208
|
OIDC: "OIDC",
|
|
2209
2209
|
};
|
|
2210
2210
|
|
|
2211
|
-
/*! @azure/msal-common v15.
|
|
2211
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
2212
2212
|
|
|
2213
2213
|
/*
|
|
2214
2214
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2451,7 +2451,7 @@ class AccountEntity {
|
|
|
2451
2451
|
}
|
|
2452
2452
|
}
|
|
2453
2453
|
|
|
2454
|
-
/*! @azure/msal-common v15.
|
|
2454
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
2455
2455
|
|
|
2456
2456
|
/*
|
|
2457
2457
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2496,9 +2496,19 @@ function getDeserializedResponse(responseString) {
|
|
|
2496
2496
|
throw createClientAuthError(hashNotDeserialized);
|
|
2497
2497
|
}
|
|
2498
2498
|
return null;
|
|
2499
|
+
}
|
|
2500
|
+
/**
|
|
2501
|
+
* Utility to create a URL from the params map
|
|
2502
|
+
*/
|
|
2503
|
+
function mapToQueryString(parameters) {
|
|
2504
|
+
const queryParameterArray = new Array();
|
|
2505
|
+
parameters.forEach((value, key) => {
|
|
2506
|
+
queryParameterArray.push(`${key}=${encodeURIComponent(value)}`);
|
|
2507
|
+
});
|
|
2508
|
+
return queryParameterArray.join("&");
|
|
2499
2509
|
}
|
|
2500
2510
|
|
|
2501
|
-
/*! @azure/msal-common v15.
|
|
2511
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
2502
2512
|
|
|
2503
2513
|
/*
|
|
2504
2514
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2662,7 +2672,7 @@ class UrlString {
|
|
|
2662
2672
|
}
|
|
2663
2673
|
}
|
|
2664
2674
|
|
|
2665
|
-
/*! @azure/msal-common v15.
|
|
2675
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
2666
2676
|
|
|
2667
2677
|
/*
|
|
2668
2678
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2802,7 +2812,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
|
|
|
2802
2812
|
return null;
|
|
2803
2813
|
}
|
|
2804
2814
|
|
|
2805
|
-
/*! @azure/msal-common v15.
|
|
2815
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
2806
2816
|
/*
|
|
2807
2817
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2808
2818
|
* Licensed under the MIT License.
|
|
@@ -2810,7 +2820,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
|
|
|
2810
2820
|
const cacheQuotaExceededErrorCode = "cache_quota_exceeded";
|
|
2811
2821
|
const cacheUnknownErrorCode = "cache_error_unknown";
|
|
2812
2822
|
|
|
2813
|
-
/*! @azure/msal-common v15.
|
|
2823
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
2814
2824
|
|
|
2815
2825
|
/*
|
|
2816
2826
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2837,7 +2847,7 @@ class CacheError extends Error {
|
|
|
2837
2847
|
}
|
|
2838
2848
|
}
|
|
2839
2849
|
|
|
2840
|
-
/*! @azure/msal-common v15.
|
|
2850
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
2841
2851
|
|
|
2842
2852
|
/*
|
|
2843
2853
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4021,7 +4031,7 @@ class DefaultStorageClass extends CacheManager {
|
|
|
4021
4031
|
}
|
|
4022
4032
|
}
|
|
4023
4033
|
|
|
4024
|
-
/*! @azure/msal-common v15.
|
|
4034
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
4025
4035
|
|
|
4026
4036
|
/*
|
|
4027
4037
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4120,7 +4130,7 @@ function isOidcProtocolMode(config) {
|
|
|
4120
4130
|
return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
|
|
4121
4131
|
}
|
|
4122
4132
|
|
|
4123
|
-
/*! @azure/msal-common v15.
|
|
4133
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
4124
4134
|
/*
|
|
4125
4135
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4126
4136
|
* Licensed under the MIT License.
|
|
@@ -4130,7 +4140,7 @@ const CcsCredentialType = {
|
|
|
4130
4140
|
UPN: "UPN",
|
|
4131
4141
|
};
|
|
4132
4142
|
|
|
4133
|
-
/*! @azure/msal-common v15.
|
|
4143
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
4134
4144
|
/*
|
|
4135
4145
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4136
4146
|
* Licensed under the MIT License.
|
|
@@ -4172,83 +4182,16 @@ const OBO_ASSERTION = "assertion";
|
|
|
4172
4182
|
const REQUESTED_TOKEN_USE = "requested_token_use";
|
|
4173
4183
|
const ON_BEHALF_OF = "on_behalf_of";
|
|
4174
4184
|
const RETURN_SPA_CODE = "return_spa_code";
|
|
4175
|
-
const NATIVE_BROKER = "nativebroker";
|
|
4176
4185
|
const LOGOUT_HINT = "logout_hint";
|
|
4177
4186
|
const SID = "sid";
|
|
4178
4187
|
const LOGIN_HINT = "login_hint";
|
|
4179
4188
|
const DOMAIN_HINT = "domain_hint";
|
|
4180
4189
|
const X_CLIENT_EXTRA_SKU = "x-client-xtra-sku";
|
|
4181
4190
|
const BROKER_CLIENT_ID = "brk_client_id";
|
|
4182
|
-
const BROKER_REDIRECT_URI = "brk_redirect_uri";
|
|
4183
|
-
|
|
4184
|
-
/*! @azure/msal-common v15.2.1 2025-03-11 */
|
|
4185
|
-
|
|
4186
|
-
/*
|
|
4187
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4188
|
-
* Licensed under the MIT License.
|
|
4189
|
-
*/
|
|
4190
|
-
/**
|
|
4191
|
-
* Validates server consumable params from the "request" objects
|
|
4192
|
-
*/
|
|
4193
|
-
class RequestValidator {
|
|
4194
|
-
/**
|
|
4195
|
-
* Utility to check if the `redirectUri` in the request is a non-null value
|
|
4196
|
-
* @param redirectUri
|
|
4197
|
-
*/
|
|
4198
|
-
static validateRedirectUri(redirectUri) {
|
|
4199
|
-
if (!redirectUri) {
|
|
4200
|
-
throw createClientConfigurationError(redirectUriEmpty);
|
|
4201
|
-
}
|
|
4202
|
-
}
|
|
4203
|
-
/**
|
|
4204
|
-
* Utility to validate prompt sent by the user in the request
|
|
4205
|
-
* @param prompt
|
|
4206
|
-
*/
|
|
4207
|
-
static validatePrompt(prompt) {
|
|
4208
|
-
const promptValues = [];
|
|
4209
|
-
for (const value in PromptValue) {
|
|
4210
|
-
promptValues.push(PromptValue[value]);
|
|
4211
|
-
}
|
|
4212
|
-
if (promptValues.indexOf(prompt) < 0) {
|
|
4213
|
-
throw createClientConfigurationError(invalidPromptValue);
|
|
4214
|
-
}
|
|
4215
|
-
}
|
|
4216
|
-
static validateClaims(claims) {
|
|
4217
|
-
try {
|
|
4218
|
-
JSON.parse(claims);
|
|
4219
|
-
}
|
|
4220
|
-
catch (e) {
|
|
4221
|
-
throw createClientConfigurationError(invalidClaims);
|
|
4222
|
-
}
|
|
4223
|
-
}
|
|
4224
|
-
/**
|
|
4225
|
-
* Utility to validate code_challenge and code_challenge_method
|
|
4226
|
-
* @param codeChallenge
|
|
4227
|
-
* @param codeChallengeMethod
|
|
4228
|
-
*/
|
|
4229
|
-
static validateCodeChallengeParams(codeChallenge, codeChallengeMethod) {
|
|
4230
|
-
if (!codeChallenge || !codeChallengeMethod) {
|
|
4231
|
-
throw createClientConfigurationError(pkceParamsMissing);
|
|
4232
|
-
}
|
|
4233
|
-
else {
|
|
4234
|
-
this.validateCodeChallengeMethod(codeChallengeMethod);
|
|
4235
|
-
}
|
|
4236
|
-
}
|
|
4237
|
-
/**
|
|
4238
|
-
* Utility to validate code_challenge_method
|
|
4239
|
-
* @param codeChallengeMethod
|
|
4240
|
-
*/
|
|
4241
|
-
static validateCodeChallengeMethod(codeChallengeMethod) {
|
|
4242
|
-
if ([
|
|
4243
|
-
CodeChallengeMethodValues.PLAIN,
|
|
4244
|
-
CodeChallengeMethodValues.S256,
|
|
4245
|
-
].indexOf(codeChallengeMethod) < 0) {
|
|
4246
|
-
throw createClientConfigurationError(invalidCodeChallengeMethod);
|
|
4247
|
-
}
|
|
4248
|
-
}
|
|
4249
|
-
}
|
|
4191
|
+
const BROKER_REDIRECT_URI = "brk_redirect_uri";
|
|
4192
|
+
const INSTANCE_AWARE = "instance_aware";
|
|
4250
4193
|
|
|
4251
|
-
/*! @azure/msal-common v15.
|
|
4194
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
4252
4195
|
|
|
4253
4196
|
/*
|
|
4254
4197
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4266,397 +4209,379 @@ function instrumentBrokerParams(parameters, correlationId, performanceClient) {
|
|
|
4266
4209
|
}, correlationId);
|
|
4267
4210
|
}
|
|
4268
4211
|
}
|
|
4269
|
-
/**
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
/**
|
|
4378
|
-
* add sid
|
|
4379
|
-
* @param sid
|
|
4380
|
-
*/
|
|
4381
|
-
addSid(sid) {
|
|
4382
|
-
this.parameters.set(SID, encodeURIComponent(sid));
|
|
4383
|
-
}
|
|
4384
|
-
/**
|
|
4385
|
-
* add claims
|
|
4386
|
-
* @param claims
|
|
4387
|
-
*/
|
|
4388
|
-
addClaims(claims, clientCapabilities) {
|
|
4389
|
-
const mergedClaims = this.addClientCapabilitiesToClaims(claims, clientCapabilities);
|
|
4390
|
-
RequestValidator.validateClaims(mergedClaims);
|
|
4391
|
-
this.parameters.set(CLAIMS, encodeURIComponent(mergedClaims));
|
|
4392
|
-
}
|
|
4393
|
-
/**
|
|
4394
|
-
* add correlationId
|
|
4395
|
-
* @param correlationId
|
|
4396
|
-
*/
|
|
4397
|
-
addCorrelationId(correlationId) {
|
|
4398
|
-
this.parameters.set(CLIENT_REQUEST_ID, encodeURIComponent(correlationId));
|
|
4399
|
-
}
|
|
4400
|
-
/**
|
|
4401
|
-
* add library info query params
|
|
4402
|
-
* @param libraryInfo
|
|
4403
|
-
*/
|
|
4404
|
-
addLibraryInfo(libraryInfo) {
|
|
4405
|
-
// Telemetry Info
|
|
4406
|
-
this.parameters.set(X_CLIENT_SKU, libraryInfo.sku);
|
|
4407
|
-
this.parameters.set(X_CLIENT_VER, libraryInfo.version);
|
|
4408
|
-
if (libraryInfo.os) {
|
|
4409
|
-
this.parameters.set(X_CLIENT_OS, libraryInfo.os);
|
|
4410
|
-
}
|
|
4411
|
-
if (libraryInfo.cpu) {
|
|
4412
|
-
this.parameters.set(X_CLIENT_CPU, libraryInfo.cpu);
|
|
4413
|
-
}
|
|
4212
|
+
/**
|
|
4213
|
+
* add response_type = code
|
|
4214
|
+
*/
|
|
4215
|
+
function addResponseTypeCode(parameters) {
|
|
4216
|
+
parameters.set(RESPONSE_TYPE, Constants$1.CODE_RESPONSE_TYPE);
|
|
4217
|
+
}
|
|
4218
|
+
/**
|
|
4219
|
+
* add response_type = token id_token
|
|
4220
|
+
*/
|
|
4221
|
+
function addResponseTypeForTokenAndIdToken(parameters) {
|
|
4222
|
+
parameters.set(RESPONSE_TYPE, `${Constants$1.TOKEN_RESPONSE_TYPE} ${Constants$1.ID_TOKEN_RESPONSE_TYPE}`);
|
|
4223
|
+
}
|
|
4224
|
+
/**
|
|
4225
|
+
* add response_mode. defaults to query.
|
|
4226
|
+
* @param responseMode
|
|
4227
|
+
*/
|
|
4228
|
+
function addResponseMode(parameters, responseMode) {
|
|
4229
|
+
parameters.set(RESPONSE_MODE, responseMode ? responseMode : ResponseMode.QUERY);
|
|
4230
|
+
}
|
|
4231
|
+
/**
|
|
4232
|
+
* add scopes. set addOidcScopes to false to prevent default scopes in non-user scenarios
|
|
4233
|
+
* @param scopeSet
|
|
4234
|
+
* @param addOidcScopes
|
|
4235
|
+
*/
|
|
4236
|
+
function addScopes(parameters, scopes, addOidcScopes = true, defaultScopes = OIDC_DEFAULT_SCOPES) {
|
|
4237
|
+
// Always add openid to the scopes when adding OIDC scopes
|
|
4238
|
+
if (addOidcScopes &&
|
|
4239
|
+
!defaultScopes.includes("openid") &&
|
|
4240
|
+
!scopes.includes("openid")) {
|
|
4241
|
+
defaultScopes.push("openid");
|
|
4242
|
+
}
|
|
4243
|
+
const requestScopes = addOidcScopes
|
|
4244
|
+
? [...(scopes || []), ...defaultScopes]
|
|
4245
|
+
: scopes || [];
|
|
4246
|
+
const scopeSet = new ScopeSet(requestScopes);
|
|
4247
|
+
parameters.set(SCOPE, scopeSet.printScopes());
|
|
4248
|
+
}
|
|
4249
|
+
/**
|
|
4250
|
+
* add clientId
|
|
4251
|
+
* @param clientId
|
|
4252
|
+
*/
|
|
4253
|
+
function addClientId(parameters, clientId) {
|
|
4254
|
+
parameters.set(CLIENT_ID, clientId);
|
|
4255
|
+
}
|
|
4256
|
+
/**
|
|
4257
|
+
* add redirect_uri
|
|
4258
|
+
* @param redirectUri
|
|
4259
|
+
*/
|
|
4260
|
+
function addRedirectUri(parameters, redirectUri) {
|
|
4261
|
+
parameters.set(REDIRECT_URI, redirectUri);
|
|
4262
|
+
}
|
|
4263
|
+
/**
|
|
4264
|
+
* add post logout redirectUri
|
|
4265
|
+
* @param redirectUri
|
|
4266
|
+
*/
|
|
4267
|
+
function addPostLogoutRedirectUri(parameters, redirectUri) {
|
|
4268
|
+
parameters.set(POST_LOGOUT_URI, redirectUri);
|
|
4269
|
+
}
|
|
4270
|
+
/**
|
|
4271
|
+
* add id_token_hint to logout request
|
|
4272
|
+
* @param idTokenHint
|
|
4273
|
+
*/
|
|
4274
|
+
function addIdTokenHint(parameters, idTokenHint) {
|
|
4275
|
+
parameters.set(ID_TOKEN_HINT, idTokenHint);
|
|
4276
|
+
}
|
|
4277
|
+
/**
|
|
4278
|
+
* add domain_hint
|
|
4279
|
+
* @param domainHint
|
|
4280
|
+
*/
|
|
4281
|
+
function addDomainHint(parameters, domainHint) {
|
|
4282
|
+
parameters.set(DOMAIN_HINT, domainHint);
|
|
4283
|
+
}
|
|
4284
|
+
/**
|
|
4285
|
+
* add login_hint
|
|
4286
|
+
* @param loginHint
|
|
4287
|
+
*/
|
|
4288
|
+
function addLoginHint(parameters, loginHint) {
|
|
4289
|
+
parameters.set(LOGIN_HINT, loginHint);
|
|
4290
|
+
}
|
|
4291
|
+
/**
|
|
4292
|
+
* Adds the CCS (Cache Credential Service) query parameter for login_hint
|
|
4293
|
+
* @param loginHint
|
|
4294
|
+
*/
|
|
4295
|
+
function addCcsUpn(parameters, loginHint) {
|
|
4296
|
+
parameters.set(HeaderNames.CCS_HEADER, `UPN:${loginHint}`);
|
|
4297
|
+
}
|
|
4298
|
+
/**
|
|
4299
|
+
* Adds the CCS (Cache Credential Service) query parameter for account object
|
|
4300
|
+
* @param loginHint
|
|
4301
|
+
*/
|
|
4302
|
+
function addCcsOid(parameters, clientInfo) {
|
|
4303
|
+
parameters.set(HeaderNames.CCS_HEADER, `Oid:${clientInfo.uid}@${clientInfo.utid}`);
|
|
4304
|
+
}
|
|
4305
|
+
/**
|
|
4306
|
+
* add sid
|
|
4307
|
+
* @param sid
|
|
4308
|
+
*/
|
|
4309
|
+
function addSid(parameters, sid) {
|
|
4310
|
+
parameters.set(SID, sid);
|
|
4311
|
+
}
|
|
4312
|
+
/**
|
|
4313
|
+
* add claims
|
|
4314
|
+
* @param claims
|
|
4315
|
+
*/
|
|
4316
|
+
function addClaims(parameters, claims, clientCapabilities) {
|
|
4317
|
+
const mergedClaims = addClientCapabilitiesToClaims(claims, clientCapabilities);
|
|
4318
|
+
try {
|
|
4319
|
+
JSON.parse(mergedClaims);
|
|
4414
4320
|
}
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
* @param appTelemetry
|
|
4418
|
-
*/
|
|
4419
|
-
addApplicationTelemetry(appTelemetry) {
|
|
4420
|
-
if (appTelemetry?.appName) {
|
|
4421
|
-
this.parameters.set(X_APP_NAME, appTelemetry.appName);
|
|
4422
|
-
}
|
|
4423
|
-
if (appTelemetry?.appVersion) {
|
|
4424
|
-
this.parameters.set(X_APP_VER, appTelemetry.appVersion);
|
|
4425
|
-
}
|
|
4321
|
+
catch (e) {
|
|
4322
|
+
throw createClientConfigurationError(invalidClaims);
|
|
4426
4323
|
}
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4324
|
+
parameters.set(CLAIMS, mergedClaims);
|
|
4325
|
+
}
|
|
4326
|
+
/**
|
|
4327
|
+
* add correlationId
|
|
4328
|
+
* @param correlationId
|
|
4329
|
+
*/
|
|
4330
|
+
function addCorrelationId(parameters, correlationId) {
|
|
4331
|
+
parameters.set(CLIENT_REQUEST_ID, correlationId);
|
|
4332
|
+
}
|
|
4333
|
+
/**
|
|
4334
|
+
* add library info query params
|
|
4335
|
+
* @param libraryInfo
|
|
4336
|
+
*/
|
|
4337
|
+
function addLibraryInfo(parameters, libraryInfo) {
|
|
4338
|
+
// Telemetry Info
|
|
4339
|
+
parameters.set(X_CLIENT_SKU, libraryInfo.sku);
|
|
4340
|
+
parameters.set(X_CLIENT_VER, libraryInfo.version);
|
|
4341
|
+
if (libraryInfo.os) {
|
|
4342
|
+
parameters.set(X_CLIENT_OS, libraryInfo.os);
|
|
4434
4343
|
}
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
* @param state
|
|
4438
|
-
*/
|
|
4439
|
-
addState(state) {
|
|
4440
|
-
if (state) {
|
|
4441
|
-
this.parameters.set(STATE, encodeURIComponent(state));
|
|
4442
|
-
}
|
|
4344
|
+
if (libraryInfo.cpu) {
|
|
4345
|
+
parameters.set(X_CLIENT_CPU, libraryInfo.cpu);
|
|
4443
4346
|
}
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4347
|
+
}
|
|
4348
|
+
/**
|
|
4349
|
+
* Add client telemetry parameters
|
|
4350
|
+
* @param appTelemetry
|
|
4351
|
+
*/
|
|
4352
|
+
function addApplicationTelemetry(parameters, appTelemetry) {
|
|
4353
|
+
if (appTelemetry?.appName) {
|
|
4354
|
+
parameters.set(X_APP_NAME, appTelemetry.appName);
|
|
4450
4355
|
}
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
* - throw if either of them are not passed
|
|
4454
|
-
* @param codeChallenge
|
|
4455
|
-
* @param codeChallengeMethod
|
|
4456
|
-
*/
|
|
4457
|
-
addCodeChallengeParams(codeChallenge, codeChallengeMethod) {
|
|
4458
|
-
RequestValidator.validateCodeChallengeParams(codeChallenge, codeChallengeMethod);
|
|
4459
|
-
if (codeChallenge && codeChallengeMethod) {
|
|
4460
|
-
this.parameters.set(CODE_CHALLENGE, encodeURIComponent(codeChallenge));
|
|
4461
|
-
this.parameters.set(CODE_CHALLENGE_METHOD, encodeURIComponent(codeChallengeMethod));
|
|
4462
|
-
}
|
|
4463
|
-
else {
|
|
4464
|
-
throw createClientConfigurationError(pkceParamsMissing);
|
|
4465
|
-
}
|
|
4356
|
+
if (appTelemetry?.appVersion) {
|
|
4357
|
+
parameters.set(X_APP_VER, appTelemetry.appVersion);
|
|
4466
4358
|
}
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4359
|
+
}
|
|
4360
|
+
/**
|
|
4361
|
+
* add prompt
|
|
4362
|
+
* @param prompt
|
|
4363
|
+
*/
|
|
4364
|
+
function addPrompt(parameters, prompt) {
|
|
4365
|
+
parameters.set(PROMPT, prompt);
|
|
4366
|
+
}
|
|
4367
|
+
/**
|
|
4368
|
+
* add state
|
|
4369
|
+
* @param state
|
|
4370
|
+
*/
|
|
4371
|
+
function addState(parameters, state) {
|
|
4372
|
+
if (state) {
|
|
4373
|
+
parameters.set(STATE, state);
|
|
4473
4374
|
}
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4375
|
+
}
|
|
4376
|
+
/**
|
|
4377
|
+
* add nonce
|
|
4378
|
+
* @param nonce
|
|
4379
|
+
*/
|
|
4380
|
+
function addNonce(parameters, nonce) {
|
|
4381
|
+
parameters.set(NONCE, nonce);
|
|
4382
|
+
}
|
|
4383
|
+
/**
|
|
4384
|
+
* add code_challenge and code_challenge_method
|
|
4385
|
+
* - throw if either of them are not passed
|
|
4386
|
+
* @param codeChallenge
|
|
4387
|
+
* @param codeChallengeMethod
|
|
4388
|
+
*/
|
|
4389
|
+
function addCodeChallengeParams(parameters, codeChallenge, codeChallengeMethod) {
|
|
4390
|
+
if (codeChallenge && codeChallengeMethod) {
|
|
4391
|
+
parameters.set(CODE_CHALLENGE, codeChallenge);
|
|
4392
|
+
parameters.set(CODE_CHALLENGE_METHOD, codeChallengeMethod);
|
|
4480
4393
|
}
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
* @param refreshToken
|
|
4484
|
-
*/
|
|
4485
|
-
addRefreshToken(refreshToken) {
|
|
4486
|
-
this.parameters.set(REFRESH_TOKEN, encodeURIComponent(refreshToken));
|
|
4394
|
+
else {
|
|
4395
|
+
throw createClientConfigurationError(pkceParamsMissing);
|
|
4487
4396
|
}
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4397
|
+
}
|
|
4398
|
+
/**
|
|
4399
|
+
* add the `authorization_code` passed by the user to exchange for a token
|
|
4400
|
+
* @param code
|
|
4401
|
+
*/
|
|
4402
|
+
function addAuthorizationCode(parameters, code) {
|
|
4403
|
+
parameters.set(CODE, code);
|
|
4404
|
+
}
|
|
4405
|
+
/**
|
|
4406
|
+
* add the `authorization_code` passed by the user to exchange for a token
|
|
4407
|
+
* @param code
|
|
4408
|
+
*/
|
|
4409
|
+
function addDeviceCode(parameters, code) {
|
|
4410
|
+
parameters.set(DEVICE_CODE, code);
|
|
4411
|
+
}
|
|
4412
|
+
/**
|
|
4413
|
+
* add the `refreshToken` passed by the user
|
|
4414
|
+
* @param refreshToken
|
|
4415
|
+
*/
|
|
4416
|
+
function addRefreshToken(parameters, refreshToken) {
|
|
4417
|
+
parameters.set(REFRESH_TOKEN, refreshToken);
|
|
4418
|
+
}
|
|
4419
|
+
/**
|
|
4420
|
+
* add the `code_verifier` passed by the user to exchange for a token
|
|
4421
|
+
* @param codeVerifier
|
|
4422
|
+
*/
|
|
4423
|
+
function addCodeVerifier(parameters, codeVerifier) {
|
|
4424
|
+
parameters.set(CODE_VERIFIER, codeVerifier);
|
|
4425
|
+
}
|
|
4426
|
+
/**
|
|
4427
|
+
* add client_secret
|
|
4428
|
+
* @param clientSecret
|
|
4429
|
+
*/
|
|
4430
|
+
function addClientSecret(parameters, clientSecret) {
|
|
4431
|
+
parameters.set(CLIENT_SECRET, clientSecret);
|
|
4432
|
+
}
|
|
4433
|
+
/**
|
|
4434
|
+
* add clientAssertion for confidential client flows
|
|
4435
|
+
* @param clientAssertion
|
|
4436
|
+
*/
|
|
4437
|
+
function addClientAssertion(parameters, clientAssertion) {
|
|
4438
|
+
if (clientAssertion) {
|
|
4439
|
+
parameters.set(CLIENT_ASSERTION, clientAssertion);
|
|
4494
4440
|
}
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4441
|
+
}
|
|
4442
|
+
/**
|
|
4443
|
+
* add clientAssertionType for confidential client flows
|
|
4444
|
+
* @param clientAssertionType
|
|
4445
|
+
*/
|
|
4446
|
+
function addClientAssertionType(parameters, clientAssertionType) {
|
|
4447
|
+
if (clientAssertionType) {
|
|
4448
|
+
parameters.set(CLIENT_ASSERTION_TYPE, clientAssertionType);
|
|
4501
4449
|
}
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4450
|
+
}
|
|
4451
|
+
/**
|
|
4452
|
+
* add OBO assertion for confidential client flows
|
|
4453
|
+
* @param clientAssertion
|
|
4454
|
+
*/
|
|
4455
|
+
function addOboAssertion(parameters, oboAssertion) {
|
|
4456
|
+
parameters.set(OBO_ASSERTION, oboAssertion);
|
|
4457
|
+
}
|
|
4458
|
+
/**
|
|
4459
|
+
* add grant type
|
|
4460
|
+
* @param grantType
|
|
4461
|
+
*/
|
|
4462
|
+
function addRequestTokenUse(parameters, tokenUse) {
|
|
4463
|
+
parameters.set(REQUESTED_TOKEN_USE, tokenUse);
|
|
4464
|
+
}
|
|
4465
|
+
/**
|
|
4466
|
+
* add grant type
|
|
4467
|
+
* @param grantType
|
|
4468
|
+
*/
|
|
4469
|
+
function addGrantType(parameters, grantType) {
|
|
4470
|
+
parameters.set(GRANT_TYPE, grantType);
|
|
4471
|
+
}
|
|
4472
|
+
/**
|
|
4473
|
+
* add client info
|
|
4474
|
+
*
|
|
4475
|
+
*/
|
|
4476
|
+
function addClientInfo(parameters) {
|
|
4477
|
+
parameters.set(CLIENT_INFO, "1");
|
|
4478
|
+
}
|
|
4479
|
+
function addInstanceAware(parameters) {
|
|
4480
|
+
if (!parameters.has(INSTANCE_AWARE)) {
|
|
4481
|
+
parameters.set(INSTANCE_AWARE, "true");
|
|
4510
4482
|
}
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4483
|
+
}
|
|
4484
|
+
/**
|
|
4485
|
+
* add extraQueryParams
|
|
4486
|
+
* @param eQParams
|
|
4487
|
+
*/
|
|
4488
|
+
function addExtraQueryParameters(parameters, eQParams) {
|
|
4489
|
+
Object.entries(eQParams).forEach(([key, value]) => {
|
|
4490
|
+
if (!parameters.has(key) && value) {
|
|
4491
|
+
parameters.set(key, value);
|
|
4518
4492
|
}
|
|
4493
|
+
});
|
|
4494
|
+
}
|
|
4495
|
+
function addClientCapabilitiesToClaims(claims, clientCapabilities) {
|
|
4496
|
+
let mergedClaims;
|
|
4497
|
+
// Parse provided claims into JSON object or initialize empty object
|
|
4498
|
+
if (!claims) {
|
|
4499
|
+
mergedClaims = {};
|
|
4519
4500
|
}
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
*/
|
|
4524
|
-
addOboAssertion(oboAssertion) {
|
|
4525
|
-
this.parameters.set(OBO_ASSERTION, encodeURIComponent(oboAssertion));
|
|
4526
|
-
}
|
|
4527
|
-
/**
|
|
4528
|
-
* add grant type
|
|
4529
|
-
* @param grantType
|
|
4530
|
-
*/
|
|
4531
|
-
addRequestTokenUse(tokenUse) {
|
|
4532
|
-
this.parameters.set(REQUESTED_TOKEN_USE, encodeURIComponent(tokenUse));
|
|
4533
|
-
}
|
|
4534
|
-
/**
|
|
4535
|
-
* add grant type
|
|
4536
|
-
* @param grantType
|
|
4537
|
-
*/
|
|
4538
|
-
addGrantType(grantType) {
|
|
4539
|
-
this.parameters.set(GRANT_TYPE, encodeURIComponent(grantType));
|
|
4540
|
-
}
|
|
4541
|
-
/**
|
|
4542
|
-
* add client info
|
|
4543
|
-
*
|
|
4544
|
-
*/
|
|
4545
|
-
addClientInfo() {
|
|
4546
|
-
this.parameters.set(CLIENT_INFO, "1");
|
|
4547
|
-
}
|
|
4548
|
-
/**
|
|
4549
|
-
* add extraQueryParams
|
|
4550
|
-
* @param eQParams
|
|
4551
|
-
*/
|
|
4552
|
-
addExtraQueryParameters(eQParams) {
|
|
4553
|
-
Object.entries(eQParams).forEach(([key, value]) => {
|
|
4554
|
-
if (!this.parameters.has(key) && value) {
|
|
4555
|
-
this.parameters.set(key, value);
|
|
4556
|
-
}
|
|
4557
|
-
});
|
|
4558
|
-
}
|
|
4559
|
-
addClientCapabilitiesToClaims(claims, clientCapabilities) {
|
|
4560
|
-
let mergedClaims;
|
|
4561
|
-
// Parse provided claims into JSON object or initialize empty object
|
|
4562
|
-
if (!claims) {
|
|
4563
|
-
mergedClaims = {};
|
|
4564
|
-
}
|
|
4565
|
-
else {
|
|
4566
|
-
try {
|
|
4567
|
-
mergedClaims = JSON.parse(claims);
|
|
4568
|
-
}
|
|
4569
|
-
catch (e) {
|
|
4570
|
-
throw createClientConfigurationError(invalidClaims);
|
|
4571
|
-
}
|
|
4572
|
-
}
|
|
4573
|
-
if (clientCapabilities && clientCapabilities.length > 0) {
|
|
4574
|
-
if (!mergedClaims.hasOwnProperty(ClaimsRequestKeys.ACCESS_TOKEN)) {
|
|
4575
|
-
// Add access_token key to claims object
|
|
4576
|
-
mergedClaims[ClaimsRequestKeys.ACCESS_TOKEN] = {};
|
|
4577
|
-
}
|
|
4578
|
-
// Add xms_cc claim with provided clientCapabilities to access_token key
|
|
4579
|
-
mergedClaims[ClaimsRequestKeys.ACCESS_TOKEN][ClaimsRequestKeys.XMS_CC] = {
|
|
4580
|
-
values: clientCapabilities,
|
|
4581
|
-
};
|
|
4501
|
+
else {
|
|
4502
|
+
try {
|
|
4503
|
+
mergedClaims = JSON.parse(claims);
|
|
4582
4504
|
}
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
/**
|
|
4586
|
-
* adds `username` for Password Grant flow
|
|
4587
|
-
* @param username
|
|
4588
|
-
*/
|
|
4589
|
-
addUsername(username) {
|
|
4590
|
-
this.parameters.set(PasswordGrantConstants.username, encodeURIComponent(username));
|
|
4591
|
-
}
|
|
4592
|
-
/**
|
|
4593
|
-
* adds `password` for Password Grant flow
|
|
4594
|
-
* @param password
|
|
4595
|
-
*/
|
|
4596
|
-
addPassword(password) {
|
|
4597
|
-
this.parameters.set(PasswordGrantConstants.password, encodeURIComponent(password));
|
|
4598
|
-
}
|
|
4599
|
-
/**
|
|
4600
|
-
* add pop_jwk to query params
|
|
4601
|
-
* @param cnfString
|
|
4602
|
-
*/
|
|
4603
|
-
addPopToken(cnfString) {
|
|
4604
|
-
if (cnfString) {
|
|
4605
|
-
this.parameters.set(TOKEN_TYPE, AuthenticationScheme.POP);
|
|
4606
|
-
this.parameters.set(REQ_CNF, encodeURIComponent(cnfString));
|
|
4505
|
+
catch (e) {
|
|
4506
|
+
throw createClientConfigurationError(invalidClaims);
|
|
4607
4507
|
}
|
|
4608
4508
|
}
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
if (sshJwkString) {
|
|
4614
|
-
this.parameters.set(TOKEN_TYPE, AuthenticationScheme.SSH);
|
|
4615
|
-
this.parameters.set(REQ_CNF, encodeURIComponent(sshJwkString));
|
|
4509
|
+
if (clientCapabilities && clientCapabilities.length > 0) {
|
|
4510
|
+
if (!mergedClaims.hasOwnProperty(ClaimsRequestKeys.ACCESS_TOKEN)) {
|
|
4511
|
+
// Add access_token key to claims object
|
|
4512
|
+
mergedClaims[ClaimsRequestKeys.ACCESS_TOKEN] = {};
|
|
4616
4513
|
}
|
|
4514
|
+
// Add xms_cc claim with provided clientCapabilities to access_token key
|
|
4515
|
+
mergedClaims[ClaimsRequestKeys.ACCESS_TOKEN][ClaimsRequestKeys.XMS_CC] =
|
|
4516
|
+
{
|
|
4517
|
+
values: clientCapabilities,
|
|
4518
|
+
};
|
|
4617
4519
|
}
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4520
|
+
return JSON.stringify(mergedClaims);
|
|
4521
|
+
}
|
|
4522
|
+
/**
|
|
4523
|
+
* adds `username` for Password Grant flow
|
|
4524
|
+
* @param username
|
|
4525
|
+
*/
|
|
4526
|
+
function addUsername(parameters, username) {
|
|
4527
|
+
parameters.set(PasswordGrantConstants.username, username);
|
|
4528
|
+
}
|
|
4529
|
+
/**
|
|
4530
|
+
* adds `password` for Password Grant flow
|
|
4531
|
+
* @param password
|
|
4532
|
+
*/
|
|
4533
|
+
function addPassword(parameters, password) {
|
|
4534
|
+
parameters.set(PasswordGrantConstants.password, password);
|
|
4535
|
+
}
|
|
4536
|
+
/**
|
|
4537
|
+
* add pop_jwk to query params
|
|
4538
|
+
* @param cnfString
|
|
4539
|
+
*/
|
|
4540
|
+
function addPopToken(parameters, cnfString) {
|
|
4541
|
+
if (cnfString) {
|
|
4542
|
+
parameters.set(TOKEN_TYPE, AuthenticationScheme.POP);
|
|
4543
|
+
parameters.set(REQ_CNF, cnfString);
|
|
4631
4544
|
}
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4545
|
+
}
|
|
4546
|
+
/**
|
|
4547
|
+
* add SSH JWK and key ID to query params
|
|
4548
|
+
*/
|
|
4549
|
+
function addSshJwk(parameters, sshJwkString) {
|
|
4550
|
+
if (sshJwkString) {
|
|
4551
|
+
parameters.set(TOKEN_TYPE, AuthenticationScheme.SSH);
|
|
4552
|
+
parameters.set(REQ_CNF, sshJwkString);
|
|
4637
4553
|
}
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4554
|
+
}
|
|
4555
|
+
/**
|
|
4556
|
+
* add server telemetry fields
|
|
4557
|
+
* @param serverTelemetryManager
|
|
4558
|
+
*/
|
|
4559
|
+
function addServerTelemetry(parameters, serverTelemetryManager) {
|
|
4560
|
+
parameters.set(X_CLIENT_CURR_TELEM, serverTelemetryManager.generateCurrentRequestHeaderValue());
|
|
4561
|
+
parameters.set(X_CLIENT_LAST_TELEM, serverTelemetryManager.generateLastRequestHeaderValue());
|
|
4562
|
+
}
|
|
4563
|
+
/**
|
|
4564
|
+
* Adds parameter that indicates to the server that throttling is supported
|
|
4565
|
+
*/
|
|
4566
|
+
function addThrottling(parameters) {
|
|
4567
|
+
parameters.set(X_MS_LIB_CAPABILITY, ThrottlingConstants.X_MS_LIB_CAPABILITY_VALUE);
|
|
4568
|
+
}
|
|
4569
|
+
/**
|
|
4570
|
+
* Adds logout_hint parameter for "silent" logout which prevent server account picker
|
|
4571
|
+
*/
|
|
4572
|
+
function addLogoutHint(parameters, logoutHint) {
|
|
4573
|
+
parameters.set(LOGOUT_HINT, logoutHint);
|
|
4574
|
+
}
|
|
4575
|
+
function addBrokerParameters(parameters, brokerClientId, brokerRedirectUri) {
|
|
4576
|
+
if (!parameters.has(BROKER_CLIENT_ID)) {
|
|
4577
|
+
parameters.set(BROKER_CLIENT_ID, brokerClientId);
|
|
4645
4578
|
}
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
*/
|
|
4649
|
-
createQueryString() {
|
|
4650
|
-
const queryParameterArray = new Array();
|
|
4651
|
-
this.parameters.forEach((value, key) => {
|
|
4652
|
-
queryParameterArray.push(`${key}=${value}`);
|
|
4653
|
-
});
|
|
4654
|
-
instrumentBrokerParams(this.parameters, this.correlationId, this.performanceClient);
|
|
4655
|
-
return queryParameterArray.join("&");
|
|
4579
|
+
if (!parameters.has(BROKER_REDIRECT_URI)) {
|
|
4580
|
+
parameters.set(BROKER_REDIRECT_URI, brokerRedirectUri);
|
|
4656
4581
|
}
|
|
4657
4582
|
}
|
|
4658
4583
|
|
|
4659
|
-
/*! @azure/msal-common v15.
|
|
4584
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
4660
4585
|
/*
|
|
4661
4586
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4662
4587
|
* Licensed under the MIT License.
|
|
@@ -4668,7 +4593,7 @@ function isOpenIdConfigResponse(response) {
|
|
|
4668
4593
|
response.hasOwnProperty("jwks_uri"));
|
|
4669
4594
|
}
|
|
4670
4595
|
|
|
4671
|
-
/*! @azure/msal-common v15.
|
|
4596
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
4672
4597
|
/*
|
|
4673
4598
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4674
4599
|
* Licensed under the MIT License.
|
|
@@ -4678,7 +4603,7 @@ function isCloudInstanceDiscoveryResponse(response) {
|
|
|
4678
4603
|
response.hasOwnProperty("metadata"));
|
|
4679
4604
|
}
|
|
4680
4605
|
|
|
4681
|
-
/*! @azure/msal-common v15.
|
|
4606
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
4682
4607
|
/*
|
|
4683
4608
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4684
4609
|
* Licensed under the MIT License.
|
|
@@ -4688,7 +4613,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
|
|
|
4688
4613
|
response.hasOwnProperty("error_description"));
|
|
4689
4614
|
}
|
|
4690
4615
|
|
|
4691
|
-
/*! @azure/msal-common v15.
|
|
4616
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
4692
4617
|
/*
|
|
4693
4618
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4694
4619
|
* Licensed under the MIT License.
|
|
@@ -4864,11 +4789,11 @@ const PerformanceEvents = {
|
|
|
4864
4789
|
StandardInteractionClientCreateAuthCodeClient: "standardInteractionClientCreateAuthCodeClient",
|
|
4865
4790
|
StandardInteractionClientGetClientConfiguration: "standardInteractionClientGetClientConfiguration",
|
|
4866
4791
|
StandardInteractionClientInitializeAuthorizationRequest: "standardInteractionClientInitializeAuthorizationRequest",
|
|
4867
|
-
StandardInteractionClientInitializeAuthorizationCodeRequest: "standardInteractionClientInitializeAuthorizationCodeRequest",
|
|
4868
4792
|
/**
|
|
4869
4793
|
* getAuthCodeUrl API (msal-browser and msal-node).
|
|
4870
4794
|
*/
|
|
4871
4795
|
GetAuthCodeUrl: "getAuthCodeUrl",
|
|
4796
|
+
GetStandardParams: "getStandardParams",
|
|
4872
4797
|
/**
|
|
4873
4798
|
* Functions from InteractionHandler (msal-browser)
|
|
4874
4799
|
*/
|
|
@@ -4881,7 +4806,6 @@ const PerformanceEvents = {
|
|
|
4881
4806
|
AuthClientAcquireToken: "authClientAcquireToken",
|
|
4882
4807
|
AuthClientExecuteTokenRequest: "authClientExecuteTokenRequest",
|
|
4883
4808
|
AuthClientCreateTokenRequestBody: "authClientCreateTokenRequestBody",
|
|
4884
|
-
AuthClientCreateQueryString: "authClientCreateQueryString",
|
|
4885
4809
|
/**
|
|
4886
4810
|
* Generate functions in PopTokenGenerator (msal-common)
|
|
4887
4811
|
*/
|
|
@@ -4943,7 +4867,7 @@ const PerformanceEvents = {
|
|
|
4943
4867
|
Decrypt: "decrypt",
|
|
4944
4868
|
};
|
|
4945
4869
|
|
|
4946
|
-
/*! @azure/msal-common v15.
|
|
4870
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
4947
4871
|
/*
|
|
4948
4872
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4949
4873
|
* Licensed under the MIT License.
|
|
@@ -5039,7 +4963,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
|
|
|
5039
4963
|
};
|
|
5040
4964
|
};
|
|
5041
4965
|
|
|
5042
|
-
/*! @azure/msal-common v15.
|
|
4966
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
5043
4967
|
|
|
5044
4968
|
/*
|
|
5045
4969
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5148,7 +5072,7 @@ RegionDiscovery.IMDS_OPTIONS = {
|
|
|
5148
5072
|
},
|
|
5149
5073
|
};
|
|
5150
5074
|
|
|
5151
|
-
/*! @azure/msal-common v15.
|
|
5075
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
5152
5076
|
|
|
5153
5077
|
/*
|
|
5154
5078
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5987,7 +5911,7 @@ function buildStaticAuthorityOptions(authOptions) {
|
|
|
5987
5911
|
};
|
|
5988
5912
|
}
|
|
5989
5913
|
|
|
5990
|
-
/*! @azure/msal-common v15.
|
|
5914
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
5991
5915
|
|
|
5992
5916
|
/*
|
|
5993
5917
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6018,7 +5942,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
|
|
|
6018
5942
|
}
|
|
6019
5943
|
}
|
|
6020
5944
|
|
|
6021
|
-
/*! @azure/msal-common v15.
|
|
5945
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
6022
5946
|
|
|
6023
5947
|
/*
|
|
6024
5948
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6037,7 +5961,7 @@ class ServerError extends AuthError {
|
|
|
6037
5961
|
}
|
|
6038
5962
|
}
|
|
6039
5963
|
|
|
6040
|
-
/*! @azure/msal-common v15.
|
|
5964
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
6041
5965
|
/*
|
|
6042
5966
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6043
5967
|
* Licensed under the MIT License.
|
|
@@ -6058,7 +5982,7 @@ function getRequestThumbprint(clientId, request, homeAccountId) {
|
|
|
6058
5982
|
};
|
|
6059
5983
|
}
|
|
6060
5984
|
|
|
6061
|
-
/*! @azure/msal-common v15.
|
|
5985
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
6062
5986
|
|
|
6063
5987
|
/*
|
|
6064
5988
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6145,7 +6069,7 @@ class ThrottlingUtils {
|
|
|
6145
6069
|
}
|
|
6146
6070
|
}
|
|
6147
6071
|
|
|
6148
|
-
/*! @azure/msal-common v15.
|
|
6072
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
6149
6073
|
|
|
6150
6074
|
/*
|
|
6151
6075
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6165,7 +6089,7 @@ class NetworkError extends AuthError {
|
|
|
6165
6089
|
}
|
|
6166
6090
|
}
|
|
6167
6091
|
|
|
6168
|
-
/*! @azure/msal-common v15.
|
|
6092
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
6169
6093
|
|
|
6170
6094
|
/*
|
|
6171
6095
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6300,22 +6224,20 @@ class BaseClient {
|
|
|
6300
6224
|
* @param request
|
|
6301
6225
|
*/
|
|
6302
6226
|
createTokenQueryParameters(request) {
|
|
6303
|
-
const
|
|
6227
|
+
const parameters = new Map();
|
|
6304
6228
|
if (request.embeddedClientId) {
|
|
6305
|
-
|
|
6306
|
-
brokerClientId: this.config.authOptions.clientId,
|
|
6307
|
-
brokerRedirectUri: this.config.authOptions.redirectUri,
|
|
6308
|
-
});
|
|
6229
|
+
addBrokerParameters(parameters, this.config.authOptions.clientId, this.config.authOptions.redirectUri);
|
|
6309
6230
|
}
|
|
6310
6231
|
if (request.tokenQueryParameters) {
|
|
6311
|
-
|
|
6232
|
+
addExtraQueryParameters(parameters, request.tokenQueryParameters);
|
|
6312
6233
|
}
|
|
6313
|
-
|
|
6314
|
-
|
|
6234
|
+
addCorrelationId(parameters, request.correlationId);
|
|
6235
|
+
instrumentBrokerParams(parameters, request.correlationId, this.performanceClient);
|
|
6236
|
+
return mapToQueryString(parameters);
|
|
6315
6237
|
}
|
|
6316
6238
|
}
|
|
6317
6239
|
|
|
6318
|
-
/*! @azure/msal-common v15.
|
|
6240
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
6319
6241
|
/*
|
|
6320
6242
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6321
6243
|
* Licensed under the MIT License.
|
|
@@ -6341,7 +6263,7 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
6341
6263
|
refreshTokenExpired: refreshTokenExpired
|
|
6342
6264
|
});
|
|
6343
6265
|
|
|
6344
|
-
/*! @azure/msal-common v15.
|
|
6266
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
6345
6267
|
|
|
6346
6268
|
/*
|
|
6347
6269
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6429,7 +6351,7 @@ function createInteractionRequiredAuthError(errorCode) {
|
|
|
6429
6351
|
return new InteractionRequiredAuthError(errorCode, InteractionRequiredAuthErrorMessages[errorCode]);
|
|
6430
6352
|
}
|
|
6431
6353
|
|
|
6432
|
-
/*! @azure/msal-common v15.
|
|
6354
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
6433
6355
|
|
|
6434
6356
|
/*
|
|
6435
6357
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6501,7 +6423,7 @@ class ProtocolUtils {
|
|
|
6501
6423
|
}
|
|
6502
6424
|
}
|
|
6503
6425
|
|
|
6504
|
-
/*! @azure/msal-common v15.
|
|
6426
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
6505
6427
|
|
|
6506
6428
|
/*
|
|
6507
6429
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6585,7 +6507,7 @@ class PopTokenGenerator {
|
|
|
6585
6507
|
}
|
|
6586
6508
|
}
|
|
6587
6509
|
|
|
6588
|
-
/*! @azure/msal-common v15.
|
|
6510
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
6589
6511
|
/*
|
|
6590
6512
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6591
6513
|
* Licensed under the MIT License.
|
|
@@ -6612,19 +6534,12 @@ class PopTokenGenerator {
|
|
|
6612
6534
|
}
|
|
6613
6535
|
}
|
|
6614
6536
|
|
|
6615
|
-
/*! @azure/msal-common v15.
|
|
6537
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
6616
6538
|
|
|
6617
6539
|
/*
|
|
6618
6540
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6619
6541
|
* Licensed under the MIT License.
|
|
6620
6542
|
*/
|
|
6621
|
-
function parseServerErrorNo(serverResponse) {
|
|
6622
|
-
const errorCodePrefix = "code=";
|
|
6623
|
-
const errorCodePrefixIndex = serverResponse.error_uri?.lastIndexOf(errorCodePrefix);
|
|
6624
|
-
return errorCodePrefixIndex && errorCodePrefixIndex >= 0
|
|
6625
|
-
? serverResponse.error_uri?.substring(errorCodePrefixIndex + errorCodePrefix.length)
|
|
6626
|
-
: undefined;
|
|
6627
|
-
}
|
|
6628
6543
|
/**
|
|
6629
6544
|
* Class that handles response parsing.
|
|
6630
6545
|
* @internal
|
|
@@ -6639,46 +6554,6 @@ class ResponseHandler {
|
|
|
6639
6554
|
this.persistencePlugin = persistencePlugin;
|
|
6640
6555
|
this.performanceClient = performanceClient;
|
|
6641
6556
|
}
|
|
6642
|
-
/**
|
|
6643
|
-
* Function which validates server authorization code response.
|
|
6644
|
-
* @param serverResponseHash
|
|
6645
|
-
* @param requestState
|
|
6646
|
-
* @param cryptoObj
|
|
6647
|
-
*/
|
|
6648
|
-
validateServerAuthorizationCodeResponse(serverResponse, requestState) {
|
|
6649
|
-
if (!serverResponse.state || !requestState) {
|
|
6650
|
-
throw serverResponse.state
|
|
6651
|
-
? createClientAuthError(stateNotFound, "Cached State")
|
|
6652
|
-
: createClientAuthError(stateNotFound, "Server State");
|
|
6653
|
-
}
|
|
6654
|
-
let decodedServerResponseState;
|
|
6655
|
-
let decodedRequestState;
|
|
6656
|
-
try {
|
|
6657
|
-
decodedServerResponseState = decodeURIComponent(serverResponse.state);
|
|
6658
|
-
}
|
|
6659
|
-
catch (e) {
|
|
6660
|
-
throw createClientAuthError(invalidState, serverResponse.state);
|
|
6661
|
-
}
|
|
6662
|
-
try {
|
|
6663
|
-
decodedRequestState = decodeURIComponent(requestState);
|
|
6664
|
-
}
|
|
6665
|
-
catch (e) {
|
|
6666
|
-
throw createClientAuthError(invalidState, serverResponse.state);
|
|
6667
|
-
}
|
|
6668
|
-
if (decodedServerResponseState !== decodedRequestState) {
|
|
6669
|
-
throw createClientAuthError(stateMismatch);
|
|
6670
|
-
}
|
|
6671
|
-
// Check for error
|
|
6672
|
-
if (serverResponse.error ||
|
|
6673
|
-
serverResponse.error_description ||
|
|
6674
|
-
serverResponse.suberror) {
|
|
6675
|
-
const serverErrorNo = parseServerErrorNo(serverResponse);
|
|
6676
|
-
if (isInteractionRequiredError(serverResponse.error, serverResponse.error_description, serverResponse.suberror)) {
|
|
6677
|
-
throw new InteractionRequiredAuthError(serverResponse.error || "", serverResponse.error_description, serverResponse.suberror, serverResponse.timestamp || "", serverResponse.trace_id || "", serverResponse.correlation_id || "", serverResponse.claims || "", serverErrorNo);
|
|
6678
|
-
}
|
|
6679
|
-
throw new ServerError(serverResponse.error || "", serverResponse.error_description, serverResponse.suberror, serverErrorNo);
|
|
6680
|
-
}
|
|
6681
|
-
}
|
|
6682
6557
|
/**
|
|
6683
6558
|
* Function which validates server authorization token response.
|
|
6684
6559
|
* @param serverResponse
|
|
@@ -6990,7 +6865,74 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
|
|
|
6990
6865
|
return baseAccount;
|
|
6991
6866
|
}
|
|
6992
6867
|
|
|
6993
|
-
/*! @azure/msal-common v15.
|
|
6868
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
6869
|
+
|
|
6870
|
+
/*
|
|
6871
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6872
|
+
* Licensed under the MIT License.
|
|
6873
|
+
*/
|
|
6874
|
+
/**
|
|
6875
|
+
* Validates server consumable params from the "request" objects
|
|
6876
|
+
*/
|
|
6877
|
+
class RequestValidator {
|
|
6878
|
+
/**
|
|
6879
|
+
* Utility to check if the `redirectUri` in the request is a non-null value
|
|
6880
|
+
* @param redirectUri
|
|
6881
|
+
*/
|
|
6882
|
+
static validateRedirectUri(redirectUri) {
|
|
6883
|
+
if (!redirectUri) {
|
|
6884
|
+
throw createClientConfigurationError(redirectUriEmpty);
|
|
6885
|
+
}
|
|
6886
|
+
}
|
|
6887
|
+
/**
|
|
6888
|
+
* Utility to validate prompt sent by the user in the request
|
|
6889
|
+
* @param prompt
|
|
6890
|
+
*/
|
|
6891
|
+
static validatePrompt(prompt) {
|
|
6892
|
+
const promptValues = [];
|
|
6893
|
+
for (const value in PromptValue) {
|
|
6894
|
+
promptValues.push(PromptValue[value]);
|
|
6895
|
+
}
|
|
6896
|
+
if (promptValues.indexOf(prompt) < 0) {
|
|
6897
|
+
throw createClientConfigurationError(invalidPromptValue);
|
|
6898
|
+
}
|
|
6899
|
+
}
|
|
6900
|
+
static validateClaims(claims) {
|
|
6901
|
+
try {
|
|
6902
|
+
JSON.parse(claims);
|
|
6903
|
+
}
|
|
6904
|
+
catch (e) {
|
|
6905
|
+
throw createClientConfigurationError(invalidClaims);
|
|
6906
|
+
}
|
|
6907
|
+
}
|
|
6908
|
+
/**
|
|
6909
|
+
* Utility to validate code_challenge and code_challenge_method
|
|
6910
|
+
* @param codeChallenge
|
|
6911
|
+
* @param codeChallengeMethod
|
|
6912
|
+
*/
|
|
6913
|
+
static validateCodeChallengeParams(codeChallenge, codeChallengeMethod) {
|
|
6914
|
+
if (!codeChallenge || !codeChallengeMethod) {
|
|
6915
|
+
throw createClientConfigurationError(pkceParamsMissing);
|
|
6916
|
+
}
|
|
6917
|
+
else {
|
|
6918
|
+
this.validateCodeChallengeMethod(codeChallengeMethod);
|
|
6919
|
+
}
|
|
6920
|
+
}
|
|
6921
|
+
/**
|
|
6922
|
+
* Utility to validate code_challenge_method
|
|
6923
|
+
* @param codeChallengeMethod
|
|
6924
|
+
*/
|
|
6925
|
+
static validateCodeChallengeMethod(codeChallengeMethod) {
|
|
6926
|
+
if ([
|
|
6927
|
+
CodeChallengeMethodValues.PLAIN,
|
|
6928
|
+
CodeChallengeMethodValues.S256,
|
|
6929
|
+
].indexOf(codeChallengeMethod) < 0) {
|
|
6930
|
+
throw createClientConfigurationError(invalidCodeChallengeMethod);
|
|
6931
|
+
}
|
|
6932
|
+
}
|
|
6933
|
+
}
|
|
6934
|
+
|
|
6935
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
6994
6936
|
/*
|
|
6995
6937
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6996
6938
|
* Licensed under the MIT License.
|
|
@@ -7008,7 +6950,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint) {
|
|
|
7008
6950
|
}
|
|
7009
6951
|
}
|
|
7010
6952
|
|
|
7011
|
-
/*! @azure/msal-common v15.
|
|
6953
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
7012
6954
|
|
|
7013
6955
|
/*
|
|
7014
6956
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7026,21 +6968,6 @@ class AuthorizationCodeClient extends BaseClient {
|
|
|
7026
6968
|
this.oidcDefaultScopes =
|
|
7027
6969
|
this.config.authOptions.authority.options.OIDCOptions?.defaultScopes;
|
|
7028
6970
|
}
|
|
7029
|
-
/**
|
|
7030
|
-
* Creates the URL of the authorization request letting the user input credentials and consent to the
|
|
7031
|
-
* application. The URL target the /authorize endpoint of the authority configured in the
|
|
7032
|
-
* application object.
|
|
7033
|
-
*
|
|
7034
|
-
* Once the user inputs their credentials and consents, the authority will send a response to the redirect URI
|
|
7035
|
-
* sent in the request and should contain an authorization code, which can then be used to acquire tokens via
|
|
7036
|
-
* acquireToken(AuthorizationCodeRequest)
|
|
7037
|
-
* @param request
|
|
7038
|
-
*/
|
|
7039
|
-
async getAuthCodeUrl(request) {
|
|
7040
|
-
this.performanceClient?.addQueueMeasurement(PerformanceEvents.GetAuthCodeUrl, request.correlationId);
|
|
7041
|
-
const queryString = await invokeAsync(this.createAuthCodeUrlQueryString.bind(this), PerformanceEvents.AuthClientCreateQueryString, this.logger, this.performanceClient, request.correlationId)(request);
|
|
7042
|
-
return UrlString.appendQueryString(this.authority.authorizationEndpoint, queryString);
|
|
7043
|
-
}
|
|
7044
6971
|
/**
|
|
7045
6972
|
* API to acquire a token in exchange of 'authorization_code` acquired by the user in the first leg of the
|
|
7046
6973
|
* authorization_code_grant
|
|
@@ -7060,22 +6987,6 @@ class AuthorizationCodeClient extends BaseClient {
|
|
|
7060
6987
|
responseHandler.validateTokenResponse(response.body);
|
|
7061
6988
|
return invokeAsync(responseHandler.handleServerTokenResponse.bind(responseHandler), PerformanceEvents.HandleServerTokenResponse, this.logger, this.performanceClient, request.correlationId)(response.body, this.authority, reqTimestamp, request, authCodePayload, undefined, undefined, undefined, requestId);
|
|
7062
6989
|
}
|
|
7063
|
-
/**
|
|
7064
|
-
* Handles the hash fragment response from public client code request. Returns a code response used by
|
|
7065
|
-
* the client to exchange for a token in acquireToken.
|
|
7066
|
-
* @param hashFragment
|
|
7067
|
-
*/
|
|
7068
|
-
handleFragmentResponse(serverParams, cachedState) {
|
|
7069
|
-
// Handle responses.
|
|
7070
|
-
const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, null, null);
|
|
7071
|
-
// Get code response
|
|
7072
|
-
responseHandler.validateServerAuthorizationCodeResponse(serverParams, cachedState);
|
|
7073
|
-
// throw when there is no auth code in the response
|
|
7074
|
-
if (!serverParams.code) {
|
|
7075
|
-
throw createClientAuthError(authorizationCodeMissingFromServerResponse);
|
|
7076
|
-
}
|
|
7077
|
-
return serverParams;
|
|
7078
|
-
}
|
|
7079
6990
|
/**
|
|
7080
6991
|
* Used to log out the current user, and redirect the user to the postLogoutRedirectUri.
|
|
7081
6992
|
* Default behaviour is to redirect the user to `window.location.href`.
|
|
@@ -7123,8 +7034,8 @@ class AuthorizationCodeClient extends BaseClient {
|
|
|
7123
7034
|
*/
|
|
7124
7035
|
async createTokenRequestBody(request) {
|
|
7125
7036
|
this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthClientCreateTokenRequestBody, request.correlationId);
|
|
7126
|
-
const
|
|
7127
|
-
|
|
7037
|
+
const parameters = new Map();
|
|
7038
|
+
addClientId(parameters, request.embeddedClientId ||
|
|
7128
7039
|
request.tokenBodyParameters?.[CLIENT_ID] ||
|
|
7129
7040
|
this.config.authOptions.clientId);
|
|
7130
7041
|
/*
|
|
@@ -7137,33 +7048,33 @@ class AuthorizationCodeClient extends BaseClient {
|
|
|
7137
7048
|
}
|
|
7138
7049
|
else {
|
|
7139
7050
|
// Validate and include redirect uri
|
|
7140
|
-
|
|
7051
|
+
addRedirectUri(parameters, request.redirectUri);
|
|
7141
7052
|
}
|
|
7142
7053
|
// Add scope array, parameter builder will add default scopes and dedupe
|
|
7143
|
-
|
|
7054
|
+
addScopes(parameters, request.scopes, true, this.oidcDefaultScopes);
|
|
7144
7055
|
// add code: user set, not validated
|
|
7145
|
-
|
|
7056
|
+
addAuthorizationCode(parameters, request.code);
|
|
7146
7057
|
// Add library metadata
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
|
|
7058
|
+
addLibraryInfo(parameters, this.config.libraryInfo);
|
|
7059
|
+
addApplicationTelemetry(parameters, this.config.telemetry.application);
|
|
7060
|
+
addThrottling(parameters);
|
|
7150
7061
|
if (this.serverTelemetryManager && !isOidcProtocolMode(this.config)) {
|
|
7151
|
-
|
|
7062
|
+
addServerTelemetry(parameters, this.serverTelemetryManager);
|
|
7152
7063
|
}
|
|
7153
7064
|
// add code_verifier if passed
|
|
7154
7065
|
if (request.codeVerifier) {
|
|
7155
|
-
|
|
7066
|
+
addCodeVerifier(parameters, request.codeVerifier);
|
|
7156
7067
|
}
|
|
7157
7068
|
if (this.config.clientCredentials.clientSecret) {
|
|
7158
|
-
|
|
7069
|
+
addClientSecret(parameters, this.config.clientCredentials.clientSecret);
|
|
7159
7070
|
}
|
|
7160
7071
|
if (this.config.clientCredentials.clientAssertion) {
|
|
7161
7072
|
const clientAssertion = this.config.clientCredentials.clientAssertion;
|
|
7162
|
-
|
|
7163
|
-
|
|
7073
|
+
addClientAssertion(parameters, await getClientAssertion(clientAssertion.assertion, this.config.authOptions.clientId, request.resourceRequestUri));
|
|
7074
|
+
addClientAssertionType(parameters, clientAssertion.assertionType);
|
|
7164
7075
|
}
|
|
7165
|
-
|
|
7166
|
-
|
|
7076
|
+
addGrantType(parameters, GrantType.AUTHORIZATION_CODE_GRANT);
|
|
7077
|
+
addClientInfo(parameters);
|
|
7167
7078
|
if (request.authenticationScheme === AuthenticationScheme.POP) {
|
|
7168
7079
|
const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
|
|
7169
7080
|
let reqCnfData;
|
|
@@ -7175,11 +7086,11 @@ class AuthorizationCodeClient extends BaseClient {
|
|
|
7175
7086
|
reqCnfData = this.cryptoUtils.encodeKid(request.popKid);
|
|
7176
7087
|
}
|
|
7177
7088
|
// SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
|
|
7178
|
-
|
|
7089
|
+
addPopToken(parameters, reqCnfData);
|
|
7179
7090
|
}
|
|
7180
7091
|
else if (request.authenticationScheme === AuthenticationScheme.SSH) {
|
|
7181
7092
|
if (request.sshJwk) {
|
|
7182
|
-
|
|
7093
|
+
addSshJwk(parameters, request.sshJwk);
|
|
7183
7094
|
}
|
|
7184
7095
|
else {
|
|
7185
7096
|
throw createClientConfigurationError(missingSshJwk);
|
|
@@ -7188,7 +7099,7 @@ class AuthorizationCodeClient extends BaseClient {
|
|
|
7188
7099
|
if (!StringUtils.isEmptyObj(request.claims) ||
|
|
7189
7100
|
(this.config.authOptions.clientCapabilities &&
|
|
7190
7101
|
this.config.authOptions.clientCapabilities.length > 0)) {
|
|
7191
|
-
|
|
7102
|
+
addClaims(parameters, request.claims, this.config.authOptions.clientCapabilities);
|
|
7192
7103
|
}
|
|
7193
7104
|
let ccsCred = undefined;
|
|
7194
7105
|
if (request.clientInfo) {
|
|
@@ -7212,7 +7123,7 @@ class AuthorizationCodeClient extends BaseClient {
|
|
|
7212
7123
|
case CcsCredentialType.HOME_ACCOUNT_ID:
|
|
7213
7124
|
try {
|
|
7214
7125
|
const clientInfo = buildClientInfoFromHomeAccountId(ccsCred.credential);
|
|
7215
|
-
|
|
7126
|
+
addCcsOid(parameters, clientInfo);
|
|
7216
7127
|
}
|
|
7217
7128
|
catch (e) {
|
|
7218
7129
|
this.logger.verbose("Could not parse home account ID for CCS Header: " +
|
|
@@ -7220,234 +7131,59 @@ class AuthorizationCodeClient extends BaseClient {
|
|
|
7220
7131
|
}
|
|
7221
7132
|
break;
|
|
7222
7133
|
case CcsCredentialType.UPN:
|
|
7223
|
-
|
|
7134
|
+
addCcsUpn(parameters, ccsCred.credential);
|
|
7224
7135
|
break;
|
|
7225
7136
|
}
|
|
7226
7137
|
}
|
|
7227
7138
|
if (request.embeddedClientId) {
|
|
7228
|
-
|
|
7229
|
-
brokerClientId: this.config.authOptions.clientId,
|
|
7230
|
-
brokerRedirectUri: this.config.authOptions.redirectUri,
|
|
7231
|
-
});
|
|
7139
|
+
addBrokerParameters(parameters, this.config.authOptions.clientId, this.config.authOptions.redirectUri);
|
|
7232
7140
|
}
|
|
7233
7141
|
if (request.tokenBodyParameters) {
|
|
7234
|
-
|
|
7142
|
+
addExtraQueryParameters(parameters, request.tokenBodyParameters);
|
|
7235
7143
|
}
|
|
7236
7144
|
// Add hybrid spa parameters if not already provided
|
|
7237
7145
|
if (request.enableSpaAuthorizationCode &&
|
|
7238
7146
|
(!request.tokenBodyParameters ||
|
|
7239
7147
|
!request.tokenBodyParameters[RETURN_SPA_CODE])) {
|
|
7240
|
-
|
|
7148
|
+
addExtraQueryParameters(parameters, {
|
|
7241
7149
|
[RETURN_SPA_CODE]: "1",
|
|
7242
7150
|
});
|
|
7243
7151
|
}
|
|
7244
|
-
|
|
7245
|
-
|
|
7246
|
-
/**
|
|
7247
|
-
* This API validates the `AuthorizationCodeUrlRequest` and creates a URL
|
|
7248
|
-
* @param request
|
|
7249
|
-
*/
|
|
7250
|
-
async createAuthCodeUrlQueryString(request) {
|
|
7251
|
-
// generate the correlationId if not set by the user and add
|
|
7252
|
-
const correlationId = request.correlationId ||
|
|
7253
|
-
this.config.cryptoInterface.createNewGuid();
|
|
7254
|
-
this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthClientCreateQueryString, correlationId);
|
|
7255
|
-
const parameterBuilder = new RequestParameterBuilder(correlationId, this.performanceClient);
|
|
7256
|
-
parameterBuilder.addClientId(request.embeddedClientId ||
|
|
7257
|
-
request.extraQueryParameters?.[CLIENT_ID] ||
|
|
7258
|
-
this.config.authOptions.clientId);
|
|
7259
|
-
const requestScopes = [
|
|
7260
|
-
...(request.scopes || []),
|
|
7261
|
-
...(request.extraScopesToConsent || []),
|
|
7262
|
-
];
|
|
7263
|
-
parameterBuilder.addScopes(requestScopes, true, this.oidcDefaultScopes);
|
|
7264
|
-
// validate the redirectUri (to be a non null value)
|
|
7265
|
-
parameterBuilder.addRedirectUri(request.redirectUri);
|
|
7266
|
-
parameterBuilder.addCorrelationId(correlationId);
|
|
7267
|
-
// add response_mode. If not passed in it defaults to query.
|
|
7268
|
-
parameterBuilder.addResponseMode(request.responseMode);
|
|
7269
|
-
// add response_type = code
|
|
7270
|
-
parameterBuilder.addResponseTypeCode();
|
|
7271
|
-
// add library info parameters
|
|
7272
|
-
parameterBuilder.addLibraryInfo(this.config.libraryInfo);
|
|
7273
|
-
if (!isOidcProtocolMode(this.config)) {
|
|
7274
|
-
parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);
|
|
7275
|
-
}
|
|
7276
|
-
// add client_info=1
|
|
7277
|
-
parameterBuilder.addClientInfo();
|
|
7278
|
-
if (request.codeChallenge && request.codeChallengeMethod) {
|
|
7279
|
-
parameterBuilder.addCodeChallengeParams(request.codeChallenge, request.codeChallengeMethod);
|
|
7280
|
-
}
|
|
7281
|
-
if (request.prompt) {
|
|
7282
|
-
parameterBuilder.addPrompt(request.prompt);
|
|
7283
|
-
}
|
|
7284
|
-
if (request.domainHint) {
|
|
7285
|
-
parameterBuilder.addDomainHint(request.domainHint);
|
|
7286
|
-
this.performanceClient?.addFields({ domainHintFromRequest: true }, correlationId);
|
|
7287
|
-
}
|
|
7288
|
-
this.performanceClient?.addFields({ prompt: request.prompt }, correlationId);
|
|
7289
|
-
// Add sid or loginHint with preference for login_hint claim (in request) -> sid -> loginHint (upn/email) -> username of AccountInfo object
|
|
7290
|
-
if (request.prompt !== PromptValue.SELECT_ACCOUNT) {
|
|
7291
|
-
// AAD will throw if prompt=select_account is passed with an account hint
|
|
7292
|
-
if (request.sid && request.prompt === PromptValue.NONE) {
|
|
7293
|
-
// SessionID is only used in silent calls
|
|
7294
|
-
this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from request");
|
|
7295
|
-
parameterBuilder.addSid(request.sid);
|
|
7296
|
-
this.performanceClient?.addFields({ sidFromRequest: true }, correlationId);
|
|
7297
|
-
}
|
|
7298
|
-
else if (request.account) {
|
|
7299
|
-
const accountSid = this.extractAccountSid(request.account);
|
|
7300
|
-
let accountLoginHintClaim = this.extractLoginHint(request.account);
|
|
7301
|
-
if (accountLoginHintClaim && request.domainHint) {
|
|
7302
|
-
this.logger.warning(`AuthorizationCodeClient.createAuthCodeUrlQueryString: "domainHint" param is set, skipping opaque "login_hint" claim. Please consider not passing domainHint`);
|
|
7303
|
-
accountLoginHintClaim = null;
|
|
7304
|
-
}
|
|
7305
|
-
// If login_hint claim is present, use it over sid/username
|
|
7306
|
-
if (accountLoginHintClaim) {
|
|
7307
|
-
this.logger.verbose("createAuthCodeUrlQueryString: login_hint claim present on account");
|
|
7308
|
-
parameterBuilder.addLoginHint(accountLoginHintClaim);
|
|
7309
|
-
this.performanceClient?.addFields({ loginHintFromClaim: true }, correlationId);
|
|
7310
|
-
try {
|
|
7311
|
-
const clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);
|
|
7312
|
-
parameterBuilder.addCcsOid(clientInfo);
|
|
7313
|
-
}
|
|
7314
|
-
catch (e) {
|
|
7315
|
-
this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header");
|
|
7316
|
-
}
|
|
7317
|
-
}
|
|
7318
|
-
else if (accountSid && request.prompt === PromptValue.NONE) {
|
|
7319
|
-
/*
|
|
7320
|
-
* If account and loginHint are provided, we will check account first for sid before adding loginHint
|
|
7321
|
-
* SessionId is only used in silent calls
|
|
7322
|
-
*/
|
|
7323
|
-
this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account");
|
|
7324
|
-
parameterBuilder.addSid(accountSid);
|
|
7325
|
-
this.performanceClient?.addFields({ sidFromClaim: true }, correlationId);
|
|
7326
|
-
try {
|
|
7327
|
-
const clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);
|
|
7328
|
-
parameterBuilder.addCcsOid(clientInfo);
|
|
7329
|
-
}
|
|
7330
|
-
catch (e) {
|
|
7331
|
-
this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header");
|
|
7332
|
-
}
|
|
7333
|
-
}
|
|
7334
|
-
else if (request.loginHint) {
|
|
7335
|
-
this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from request");
|
|
7336
|
-
parameterBuilder.addLoginHint(request.loginHint);
|
|
7337
|
-
parameterBuilder.addCcsUpn(request.loginHint);
|
|
7338
|
-
this.performanceClient?.addFields({ loginHintFromRequest: true }, correlationId);
|
|
7339
|
-
}
|
|
7340
|
-
else if (request.account.username) {
|
|
7341
|
-
// Fallback to account username if provided
|
|
7342
|
-
this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from account");
|
|
7343
|
-
parameterBuilder.addLoginHint(request.account.username);
|
|
7344
|
-
this.performanceClient?.addFields({ loginHintFromUpn: true }, correlationId);
|
|
7345
|
-
try {
|
|
7346
|
-
const clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);
|
|
7347
|
-
parameterBuilder.addCcsOid(clientInfo);
|
|
7348
|
-
}
|
|
7349
|
-
catch (e) {
|
|
7350
|
-
this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header");
|
|
7351
|
-
}
|
|
7352
|
-
}
|
|
7353
|
-
}
|
|
7354
|
-
else if (request.loginHint) {
|
|
7355
|
-
this.logger.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request");
|
|
7356
|
-
parameterBuilder.addLoginHint(request.loginHint);
|
|
7357
|
-
parameterBuilder.addCcsUpn(request.loginHint);
|
|
7358
|
-
this.performanceClient?.addFields({ loginHintFromRequest: true }, correlationId);
|
|
7359
|
-
}
|
|
7360
|
-
}
|
|
7361
|
-
else {
|
|
7362
|
-
this.logger.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints");
|
|
7363
|
-
}
|
|
7364
|
-
if (request.nonce) {
|
|
7365
|
-
parameterBuilder.addNonce(request.nonce);
|
|
7366
|
-
}
|
|
7367
|
-
if (request.state) {
|
|
7368
|
-
parameterBuilder.addState(request.state);
|
|
7369
|
-
}
|
|
7370
|
-
if (request.claims ||
|
|
7371
|
-
(this.config.authOptions.clientCapabilities &&
|
|
7372
|
-
this.config.authOptions.clientCapabilities.length > 0)) {
|
|
7373
|
-
parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);
|
|
7374
|
-
}
|
|
7375
|
-
if (request.embeddedClientId) {
|
|
7376
|
-
parameterBuilder.addBrokerParameters({
|
|
7377
|
-
brokerClientId: this.config.authOptions.clientId,
|
|
7378
|
-
brokerRedirectUri: this.config.authOptions.redirectUri,
|
|
7379
|
-
});
|
|
7380
|
-
}
|
|
7381
|
-
this.addExtraQueryParams(request, parameterBuilder);
|
|
7382
|
-
if (request.platformBroker) {
|
|
7383
|
-
// signal ests that this is a WAM call
|
|
7384
|
-
parameterBuilder.addNativeBroker();
|
|
7385
|
-
// pass the req_cnf for POP
|
|
7386
|
-
if (request.authenticationScheme === AuthenticationScheme.POP) {
|
|
7387
|
-
const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
|
|
7388
|
-
// req_cnf is always sent as a string for SPAs
|
|
7389
|
-
let reqCnfData;
|
|
7390
|
-
if (!request.popKid) {
|
|
7391
|
-
const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
|
|
7392
|
-
reqCnfData = generatedReqCnfData.reqCnfString;
|
|
7393
|
-
}
|
|
7394
|
-
else {
|
|
7395
|
-
reqCnfData = this.cryptoUtils.encodeKid(request.popKid);
|
|
7396
|
-
}
|
|
7397
|
-
parameterBuilder.addPopToken(reqCnfData);
|
|
7398
|
-
}
|
|
7399
|
-
}
|
|
7400
|
-
return parameterBuilder.createQueryString();
|
|
7152
|
+
instrumentBrokerParams(parameters, request.correlationId, this.performanceClient);
|
|
7153
|
+
return mapToQueryString(parameters);
|
|
7401
7154
|
}
|
|
7402
7155
|
/**
|
|
7403
7156
|
* This API validates the `EndSessionRequest` and creates a URL
|
|
7404
7157
|
* @param request
|
|
7405
7158
|
*/
|
|
7406
7159
|
createLogoutUrlQueryString(request) {
|
|
7407
|
-
const
|
|
7160
|
+
const parameters = new Map();
|
|
7408
7161
|
if (request.postLogoutRedirectUri) {
|
|
7409
|
-
|
|
7162
|
+
addPostLogoutRedirectUri(parameters, request.postLogoutRedirectUri);
|
|
7410
7163
|
}
|
|
7411
7164
|
if (request.correlationId) {
|
|
7412
|
-
|
|
7165
|
+
addCorrelationId(parameters, request.correlationId);
|
|
7413
7166
|
}
|
|
7414
7167
|
if (request.idTokenHint) {
|
|
7415
|
-
|
|
7168
|
+
addIdTokenHint(parameters, request.idTokenHint);
|
|
7416
7169
|
}
|
|
7417
7170
|
if (request.state) {
|
|
7418
|
-
|
|
7171
|
+
addState(parameters, request.state);
|
|
7419
7172
|
}
|
|
7420
7173
|
if (request.logoutHint) {
|
|
7421
|
-
|
|
7422
|
-
}
|
|
7423
|
-
this.addExtraQueryParams(request, parameterBuilder);
|
|
7424
|
-
return parameterBuilder.createQueryString();
|
|
7425
|
-
}
|
|
7426
|
-
addExtraQueryParams(request, parameterBuilder) {
|
|
7427
|
-
const hasRequestInstanceAware = request.extraQueryParameters &&
|
|
7428
|
-
request.extraQueryParameters.hasOwnProperty("instance_aware");
|
|
7429
|
-
// Set instance_aware flag if config auth param is set
|
|
7430
|
-
if (!hasRequestInstanceAware && this.config.authOptions.instanceAware) {
|
|
7431
|
-
request.extraQueryParameters = request.extraQueryParameters || {};
|
|
7432
|
-
request.extraQueryParameters["instance_aware"] = "true";
|
|
7174
|
+
addLogoutHint(parameters, request.logoutHint);
|
|
7433
7175
|
}
|
|
7434
7176
|
if (request.extraQueryParameters) {
|
|
7435
|
-
|
|
7177
|
+
addExtraQueryParameters(parameters, request.extraQueryParameters);
|
|
7436
7178
|
}
|
|
7437
|
-
|
|
7438
|
-
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
*/
|
|
7442
|
-
extractAccountSid(account) {
|
|
7443
|
-
return account.idTokenClaims?.sid || null;
|
|
7444
|
-
}
|
|
7445
|
-
extractLoginHint(account) {
|
|
7446
|
-
return account.idTokenClaims?.login_hint || null;
|
|
7179
|
+
if (this.config.authOptions.instanceAware) {
|
|
7180
|
+
addInstanceAware(parameters);
|
|
7181
|
+
}
|
|
7182
|
+
return mapToQueryString(parameters);
|
|
7447
7183
|
}
|
|
7448
7184
|
}
|
|
7449
7185
|
|
|
7450
|
-
/*! @azure/msal-common v15.
|
|
7186
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
7451
7187
|
|
|
7452
7188
|
/*
|
|
7453
7189
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7576,31 +7312,30 @@ class RefreshTokenClient extends BaseClient {
|
|
|
7576
7312
|
*/
|
|
7577
7313
|
async createTokenRequestBody(request) {
|
|
7578
7314
|
this.performanceClient?.addQueueMeasurement(PerformanceEvents.RefreshTokenClientCreateTokenRequestBody, request.correlationId);
|
|
7579
|
-
const
|
|
7580
|
-
|
|
7581
|
-
parameterBuilder.addClientId(request.embeddedClientId ||
|
|
7315
|
+
const parameters = new Map();
|
|
7316
|
+
addClientId(parameters, request.embeddedClientId ||
|
|
7582
7317
|
request.tokenBodyParameters?.[CLIENT_ID] ||
|
|
7583
7318
|
this.config.authOptions.clientId);
|
|
7584
7319
|
if (request.redirectUri) {
|
|
7585
|
-
|
|
7586
|
-
}
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
|
|
7590
|
-
|
|
7591
|
-
|
|
7592
|
-
|
|
7320
|
+
addRedirectUri(parameters, request.redirectUri);
|
|
7321
|
+
}
|
|
7322
|
+
addScopes(parameters, request.scopes, true, this.config.authOptions.authority.options.OIDCOptions?.defaultScopes);
|
|
7323
|
+
addGrantType(parameters, GrantType.REFRESH_TOKEN_GRANT);
|
|
7324
|
+
addClientInfo(parameters);
|
|
7325
|
+
addLibraryInfo(parameters, this.config.libraryInfo);
|
|
7326
|
+
addApplicationTelemetry(parameters, this.config.telemetry.application);
|
|
7327
|
+
addThrottling(parameters);
|
|
7593
7328
|
if (this.serverTelemetryManager && !isOidcProtocolMode(this.config)) {
|
|
7594
|
-
|
|
7329
|
+
addServerTelemetry(parameters, this.serverTelemetryManager);
|
|
7595
7330
|
}
|
|
7596
|
-
|
|
7331
|
+
addRefreshToken(parameters, request.refreshToken);
|
|
7597
7332
|
if (this.config.clientCredentials.clientSecret) {
|
|
7598
|
-
|
|
7333
|
+
addClientSecret(parameters, this.config.clientCredentials.clientSecret);
|
|
7599
7334
|
}
|
|
7600
7335
|
if (this.config.clientCredentials.clientAssertion) {
|
|
7601
7336
|
const clientAssertion = this.config.clientCredentials.clientAssertion;
|
|
7602
|
-
|
|
7603
|
-
|
|
7337
|
+
addClientAssertion(parameters, await getClientAssertion(clientAssertion.assertion, this.config.authOptions.clientId, request.resourceRequestUri));
|
|
7338
|
+
addClientAssertionType(parameters, clientAssertion.assertionType);
|
|
7604
7339
|
}
|
|
7605
7340
|
if (request.authenticationScheme === AuthenticationScheme.POP) {
|
|
7606
7341
|
const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
|
|
@@ -7613,11 +7348,11 @@ class RefreshTokenClient extends BaseClient {
|
|
|
7613
7348
|
reqCnfData = this.cryptoUtils.encodeKid(request.popKid);
|
|
7614
7349
|
}
|
|
7615
7350
|
// SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
|
|
7616
|
-
|
|
7351
|
+
addPopToken(parameters, reqCnfData);
|
|
7617
7352
|
}
|
|
7618
7353
|
else if (request.authenticationScheme === AuthenticationScheme.SSH) {
|
|
7619
7354
|
if (request.sshJwk) {
|
|
7620
|
-
|
|
7355
|
+
addSshJwk(parameters, request.sshJwk);
|
|
7621
7356
|
}
|
|
7622
7357
|
else {
|
|
7623
7358
|
throw createClientConfigurationError(missingSshJwk);
|
|
@@ -7626,7 +7361,7 @@ class RefreshTokenClient extends BaseClient {
|
|
|
7626
7361
|
if (!StringUtils.isEmptyObj(request.claims) ||
|
|
7627
7362
|
(this.config.authOptions.clientCapabilities &&
|
|
7628
7363
|
this.config.authOptions.clientCapabilities.length > 0)) {
|
|
7629
|
-
|
|
7364
|
+
addClaims(parameters, request.claims, this.config.authOptions.clientCapabilities);
|
|
7630
7365
|
}
|
|
7631
7366
|
if (this.config.systemOptions.preventCorsPreflight &&
|
|
7632
7367
|
request.ccsCredential) {
|
|
@@ -7634,7 +7369,7 @@ class RefreshTokenClient extends BaseClient {
|
|
|
7634
7369
|
case CcsCredentialType.HOME_ACCOUNT_ID:
|
|
7635
7370
|
try {
|
|
7636
7371
|
const clientInfo = buildClientInfoFromHomeAccountId(request.ccsCredential.credential);
|
|
7637
|
-
|
|
7372
|
+
addCcsOid(parameters, clientInfo);
|
|
7638
7373
|
}
|
|
7639
7374
|
catch (e) {
|
|
7640
7375
|
this.logger.verbose("Could not parse home account ID for CCS Header: " +
|
|
@@ -7642,24 +7377,22 @@ class RefreshTokenClient extends BaseClient {
|
|
|
7642
7377
|
}
|
|
7643
7378
|
break;
|
|
7644
7379
|
case CcsCredentialType.UPN:
|
|
7645
|
-
|
|
7380
|
+
addCcsUpn(parameters, request.ccsCredential.credential);
|
|
7646
7381
|
break;
|
|
7647
7382
|
}
|
|
7648
7383
|
}
|
|
7649
7384
|
if (request.embeddedClientId) {
|
|
7650
|
-
|
|
7651
|
-
brokerClientId: this.config.authOptions.clientId,
|
|
7652
|
-
brokerRedirectUri: this.config.authOptions.redirectUri,
|
|
7653
|
-
});
|
|
7385
|
+
addBrokerParameters(parameters, this.config.authOptions.clientId, this.config.authOptions.redirectUri);
|
|
7654
7386
|
}
|
|
7655
7387
|
if (request.tokenBodyParameters) {
|
|
7656
|
-
|
|
7388
|
+
addExtraQueryParameters(parameters, request.tokenBodyParameters);
|
|
7657
7389
|
}
|
|
7658
|
-
|
|
7390
|
+
instrumentBrokerParams(parameters, request.correlationId, this.performanceClient);
|
|
7391
|
+
return mapToQueryString(parameters);
|
|
7659
7392
|
}
|
|
7660
7393
|
}
|
|
7661
7394
|
|
|
7662
|
-
/*! @azure/msal-common v15.
|
|
7395
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
7663
7396
|
|
|
7664
7397
|
/*
|
|
7665
7398
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7757,7 +7490,157 @@ class SilentFlowClient extends BaseClient {
|
|
|
7757
7490
|
}
|
|
7758
7491
|
}
|
|
7759
7492
|
|
|
7760
|
-
/*! @azure/msal-common v15.
|
|
7493
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
7494
|
+
|
|
7495
|
+
/*
|
|
7496
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7497
|
+
* Licensed under the MIT License.
|
|
7498
|
+
*/
|
|
7499
|
+
/**
|
|
7500
|
+
* Returns map of parameters that are applicable to all calls to /authorize whether using PKCE or EAR
|
|
7501
|
+
* @param config
|
|
7502
|
+
* @param request
|
|
7503
|
+
* @param logger
|
|
7504
|
+
* @param performanceClient
|
|
7505
|
+
* @returns
|
|
7506
|
+
*/
|
|
7507
|
+
function getStandardAuthorizeRequestParameters(authOptions, request, logger, performanceClient) {
|
|
7508
|
+
// generate the correlationId if not set by the user and add
|
|
7509
|
+
const correlationId = request.correlationId;
|
|
7510
|
+
const parameters = new Map();
|
|
7511
|
+
addClientId(parameters, request.embeddedClientId ||
|
|
7512
|
+
request.extraQueryParameters?.[CLIENT_ID] ||
|
|
7513
|
+
authOptions.clientId);
|
|
7514
|
+
const requestScopes = [
|
|
7515
|
+
...(request.scopes || []),
|
|
7516
|
+
...(request.extraScopesToConsent || []),
|
|
7517
|
+
];
|
|
7518
|
+
addScopes(parameters, requestScopes, true, authOptions.authority.options.OIDCOptions?.defaultScopes);
|
|
7519
|
+
addRedirectUri(parameters, request.redirectUri);
|
|
7520
|
+
addCorrelationId(parameters, correlationId);
|
|
7521
|
+
// add response_mode. If not passed in it defaults to query.
|
|
7522
|
+
addResponseMode(parameters, request.responseMode);
|
|
7523
|
+
// add client_info=1
|
|
7524
|
+
addClientInfo(parameters);
|
|
7525
|
+
if (request.prompt) {
|
|
7526
|
+
addPrompt(parameters, request.prompt);
|
|
7527
|
+
}
|
|
7528
|
+
if (request.domainHint) {
|
|
7529
|
+
addDomainHint(parameters, request.domainHint);
|
|
7530
|
+
}
|
|
7531
|
+
// Add sid or loginHint with preference for login_hint claim (in request) -> sid -> loginHint (upn/email) -> username of AccountInfo object
|
|
7532
|
+
if (request.prompt !== PromptValue.SELECT_ACCOUNT) {
|
|
7533
|
+
// AAD will throw if prompt=select_account is passed with an account hint
|
|
7534
|
+
if (request.sid && request.prompt === PromptValue.NONE) {
|
|
7535
|
+
// SessionID is only used in silent calls
|
|
7536
|
+
logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from request");
|
|
7537
|
+
addSid(parameters, request.sid);
|
|
7538
|
+
}
|
|
7539
|
+
else if (request.account) {
|
|
7540
|
+
const accountSid = extractAccountSid(request.account);
|
|
7541
|
+
let accountLoginHintClaim = extractLoginHint(request.account);
|
|
7542
|
+
if (accountLoginHintClaim && request.domainHint) {
|
|
7543
|
+
logger.warning(`AuthorizationCodeClient.createAuthCodeUrlQueryString: "domainHint" param is set, skipping opaque "login_hint" claim. Please consider not passing domainHint`);
|
|
7544
|
+
accountLoginHintClaim = null;
|
|
7545
|
+
}
|
|
7546
|
+
// If login_hint claim is present, use it over sid/username
|
|
7547
|
+
if (accountLoginHintClaim) {
|
|
7548
|
+
logger.verbose("createAuthCodeUrlQueryString: login_hint claim present on account");
|
|
7549
|
+
addLoginHint(parameters, accountLoginHintClaim);
|
|
7550
|
+
try {
|
|
7551
|
+
const clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);
|
|
7552
|
+
addCcsOid(parameters, clientInfo);
|
|
7553
|
+
}
|
|
7554
|
+
catch (e) {
|
|
7555
|
+
logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header");
|
|
7556
|
+
}
|
|
7557
|
+
}
|
|
7558
|
+
else if (accountSid && request.prompt === PromptValue.NONE) {
|
|
7559
|
+
/*
|
|
7560
|
+
* If account and loginHint are provided, we will check account first for sid before adding loginHint
|
|
7561
|
+
* SessionId is only used in silent calls
|
|
7562
|
+
*/
|
|
7563
|
+
logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account");
|
|
7564
|
+
addSid(parameters, accountSid);
|
|
7565
|
+
try {
|
|
7566
|
+
const clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);
|
|
7567
|
+
addCcsOid(parameters, clientInfo);
|
|
7568
|
+
}
|
|
7569
|
+
catch (e) {
|
|
7570
|
+
logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header");
|
|
7571
|
+
}
|
|
7572
|
+
}
|
|
7573
|
+
else if (request.loginHint) {
|
|
7574
|
+
logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from request");
|
|
7575
|
+
addLoginHint(parameters, request.loginHint);
|
|
7576
|
+
addCcsUpn(parameters, request.loginHint);
|
|
7577
|
+
}
|
|
7578
|
+
else if (request.account.username) {
|
|
7579
|
+
// Fallback to account username if provided
|
|
7580
|
+
logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from account");
|
|
7581
|
+
addLoginHint(parameters, request.account.username);
|
|
7582
|
+
try {
|
|
7583
|
+
const clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);
|
|
7584
|
+
addCcsOid(parameters, clientInfo);
|
|
7585
|
+
}
|
|
7586
|
+
catch (e) {
|
|
7587
|
+
logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header");
|
|
7588
|
+
}
|
|
7589
|
+
}
|
|
7590
|
+
}
|
|
7591
|
+
else if (request.loginHint) {
|
|
7592
|
+
logger.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request");
|
|
7593
|
+
addLoginHint(parameters, request.loginHint);
|
|
7594
|
+
addCcsUpn(parameters, request.loginHint);
|
|
7595
|
+
}
|
|
7596
|
+
}
|
|
7597
|
+
else {
|
|
7598
|
+
logger.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints");
|
|
7599
|
+
}
|
|
7600
|
+
if (request.nonce) {
|
|
7601
|
+
addNonce(parameters, request.nonce);
|
|
7602
|
+
}
|
|
7603
|
+
if (request.state) {
|
|
7604
|
+
addState(parameters, request.state);
|
|
7605
|
+
}
|
|
7606
|
+
if (request.claims ||
|
|
7607
|
+
(authOptions.clientCapabilities &&
|
|
7608
|
+
authOptions.clientCapabilities.length > 0)) {
|
|
7609
|
+
addClaims(parameters, request.claims, authOptions.clientCapabilities);
|
|
7610
|
+
}
|
|
7611
|
+
if (request.embeddedClientId) {
|
|
7612
|
+
addBrokerParameters(parameters, authOptions.clientId, authOptions.redirectUri);
|
|
7613
|
+
}
|
|
7614
|
+
if (request.extraQueryParameters) {
|
|
7615
|
+
addExtraQueryParameters(parameters, request.extraQueryParameters);
|
|
7616
|
+
}
|
|
7617
|
+
if (authOptions.instanceAware) {
|
|
7618
|
+
addInstanceAware(parameters);
|
|
7619
|
+
}
|
|
7620
|
+
return parameters;
|
|
7621
|
+
}
|
|
7622
|
+
/**
|
|
7623
|
+
* Returns authorize endpoint with given request parameters in the query string
|
|
7624
|
+
* @param authority
|
|
7625
|
+
* @param requestParameters
|
|
7626
|
+
* @returns
|
|
7627
|
+
*/
|
|
7628
|
+
function getAuthorizeUrl(authority, requestParameters) {
|
|
7629
|
+
const queryString = mapToQueryString(requestParameters);
|
|
7630
|
+
return UrlString.appendQueryString(authority.authorizationEndpoint, queryString);
|
|
7631
|
+
}
|
|
7632
|
+
/**
|
|
7633
|
+
* Helper to get sid from account. Returns null if idTokenClaims are not present or sid is not present.
|
|
7634
|
+
* @param account
|
|
7635
|
+
*/
|
|
7636
|
+
function extractAccountSid(account) {
|
|
7637
|
+
return account.idTokenClaims?.sid || null;
|
|
7638
|
+
}
|
|
7639
|
+
function extractLoginHint(account) {
|
|
7640
|
+
return account.idTokenClaims?.login_hint || null;
|
|
7641
|
+
}
|
|
7642
|
+
|
|
7643
|
+
/*! @azure/msal-common v15.3.0 2025-03-20 */
|
|
7761
7644
|
|
|
7762
7645
|
/*
|
|
7763
7646
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -10050,7 +9933,7 @@ class ClientAssertion {
|
|
|
10050
9933
|
|
|
10051
9934
|
/* eslint-disable header/header */
|
|
10052
9935
|
const name = "@azure/msal-node";
|
|
10053
|
-
const version = "3.
|
|
9936
|
+
const version = "3.4.0";
|
|
10054
9937
|
|
|
10055
9938
|
/*
|
|
10056
9939
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -10112,42 +9995,76 @@ class UsernamePasswordClient extends BaseClient {
|
|
|
10112
9995
|
* @param request - CommonUsernamePasswordRequest provided by the developer
|
|
10113
9996
|
*/
|
|
10114
9997
|
async createTokenRequestBody(request) {
|
|
10115
|
-
const
|
|
10116
|
-
|
|
10117
|
-
|
|
10118
|
-
|
|
10119
|
-
|
|
10120
|
-
|
|
10121
|
-
|
|
10122
|
-
|
|
10123
|
-
|
|
10124
|
-
|
|
10125
|
-
|
|
9998
|
+
const parameters = new Map();
|
|
9999
|
+
addClientId(parameters, this.config.authOptions.clientId);
|
|
10000
|
+
addUsername(parameters, request.username);
|
|
10001
|
+
addPassword(parameters, request.password);
|
|
10002
|
+
addScopes(parameters, request.scopes);
|
|
10003
|
+
addResponseTypeForTokenAndIdToken(parameters);
|
|
10004
|
+
addGrantType(parameters, GrantType.RESOURCE_OWNER_PASSWORD_GRANT);
|
|
10005
|
+
addClientInfo(parameters);
|
|
10006
|
+
addLibraryInfo(parameters, this.config.libraryInfo);
|
|
10007
|
+
addApplicationTelemetry(parameters, this.config.telemetry.application);
|
|
10008
|
+
addThrottling(parameters);
|
|
10126
10009
|
if (this.serverTelemetryManager) {
|
|
10127
|
-
|
|
10010
|
+
addServerTelemetry(parameters, this.serverTelemetryManager);
|
|
10128
10011
|
}
|
|
10129
10012
|
const correlationId = request.correlationId ||
|
|
10130
10013
|
this.config.cryptoInterface.createNewGuid();
|
|
10131
|
-
|
|
10014
|
+
addCorrelationId(parameters, correlationId);
|
|
10132
10015
|
if (this.config.clientCredentials.clientSecret) {
|
|
10133
|
-
|
|
10016
|
+
addClientSecret(parameters, this.config.clientCredentials.clientSecret);
|
|
10134
10017
|
}
|
|
10135
10018
|
const clientAssertion = this.config.clientCredentials.clientAssertion;
|
|
10136
10019
|
if (clientAssertion) {
|
|
10137
|
-
|
|
10138
|
-
|
|
10020
|
+
addClientAssertion(parameters, await getClientAssertion(clientAssertion.assertion, this.config.authOptions.clientId, request.resourceRequestUri));
|
|
10021
|
+
addClientAssertionType(parameters, clientAssertion.assertionType);
|
|
10139
10022
|
}
|
|
10140
10023
|
if (!StringUtils.isEmptyObj(request.claims) ||
|
|
10141
10024
|
(this.config.authOptions.clientCapabilities &&
|
|
10142
10025
|
this.config.authOptions.clientCapabilities.length > 0)) {
|
|
10143
|
-
|
|
10026
|
+
addClaims(parameters, request.claims, this.config.authOptions.clientCapabilities);
|
|
10144
10027
|
}
|
|
10145
10028
|
if (this.config.systemOptions.preventCorsPreflight &&
|
|
10146
10029
|
request.username) {
|
|
10147
|
-
|
|
10030
|
+
addCcsUpn(parameters, request.username);
|
|
10148
10031
|
}
|
|
10149
|
-
return
|
|
10032
|
+
return mapToQueryString(parameters);
|
|
10033
|
+
}
|
|
10034
|
+
}
|
|
10035
|
+
|
|
10036
|
+
/*
|
|
10037
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10038
|
+
* Licensed under the MIT License.
|
|
10039
|
+
*/
|
|
10040
|
+
/**
|
|
10041
|
+
* Constructs the full /authorize URL with request parameters
|
|
10042
|
+
* @param config
|
|
10043
|
+
* @param authority
|
|
10044
|
+
* @param request
|
|
10045
|
+
* @param logger
|
|
10046
|
+
* @returns
|
|
10047
|
+
*/
|
|
10048
|
+
function getAuthCodeRequestUrl(config, authority, request, logger) {
|
|
10049
|
+
const parameters = getStandardAuthorizeRequestParameters({
|
|
10050
|
+
...config.auth,
|
|
10051
|
+
authority: authority,
|
|
10052
|
+
redirectUri: request.redirectUri || "",
|
|
10053
|
+
}, request, logger);
|
|
10054
|
+
addLibraryInfo(parameters, {
|
|
10055
|
+
sku: Constants.MSAL_SKU,
|
|
10056
|
+
version: version,
|
|
10057
|
+
cpu: process.arch || "",
|
|
10058
|
+
os: process.platform || "",
|
|
10059
|
+
});
|
|
10060
|
+
if (config.auth.protocolMode !== ProtocolMode.OIDC) {
|
|
10061
|
+
addApplicationTelemetry(parameters, config.telemetry.application);
|
|
10062
|
+
}
|
|
10063
|
+
addResponseTypeCode(parameters);
|
|
10064
|
+
if (request.codeChallenge && request.codeChallengeMethod) {
|
|
10065
|
+
addCodeChallengeParams(parameters, request.codeChallenge, request.codeChallengeMethod);
|
|
10150
10066
|
}
|
|
10067
|
+
return getAuthorizeUrl(authority, parameters);
|
|
10151
10068
|
}
|
|
10152
10069
|
|
|
10153
10070
|
/*
|
|
@@ -10186,10 +10103,8 @@ class ClientApplication {
|
|
|
10186
10103
|
responseMode: request.responseMode || ResponseMode.QUERY,
|
|
10187
10104
|
authenticationScheme: AuthenticationScheme.BEARER,
|
|
10188
10105
|
};
|
|
10189
|
-
const
|
|
10190
|
-
|
|
10191
|
-
this.logger.verbose("Auth code client created", validRequest.correlationId);
|
|
10192
|
-
return authorizationCodeClient.getAuthCodeUrl(validRequest);
|
|
10106
|
+
const discoveredAuthority = await this.createAuthority(validRequest.authority, validRequest.correlationId, undefined, request.azureCloudOptions);
|
|
10107
|
+
return getAuthCodeRequestUrl(this.config, discoveredAuthority, validRequest, this.logger);
|
|
10193
10108
|
}
|
|
10194
10109
|
/**
|
|
10195
10110
|
* Acquires a token by exchanging the Authorization Code received from the first step of OAuth2.0
|
|
@@ -10214,7 +10129,8 @@ class ClientApplication {
|
|
|
10214
10129
|
};
|
|
10215
10130
|
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenByCode, validRequest.correlationId);
|
|
10216
10131
|
try {
|
|
10217
|
-
const
|
|
10132
|
+
const discoveredAuthority = await this.createAuthority(validRequest.authority, validRequest.correlationId, undefined, request.azureCloudOptions);
|
|
10133
|
+
const authClientConfig = await this.buildOauthClientConfiguration(discoveredAuthority, validRequest.correlationId, validRequest.redirectUri, serverTelemetryManager);
|
|
10218
10134
|
const authorizationCodeClient = new AuthorizationCodeClient(authClientConfig);
|
|
10219
10135
|
this.logger.verbose("Auth code client created", validRequest.correlationId);
|
|
10220
10136
|
return await authorizationCodeClient.acquireToken(validRequest, authCodePayLoad);
|
|
@@ -10243,7 +10159,8 @@ class ClientApplication {
|
|
|
10243
10159
|
};
|
|
10244
10160
|
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenByRefreshToken, validRequest.correlationId);
|
|
10245
10161
|
try {
|
|
10246
|
-
const
|
|
10162
|
+
const discoveredAuthority = await this.createAuthority(validRequest.authority, validRequest.correlationId, undefined, request.azureCloudOptions);
|
|
10163
|
+
const refreshTokenClientConfig = await this.buildOauthClientConfiguration(discoveredAuthority, validRequest.correlationId, validRequest.redirectUri || "", serverTelemetryManager);
|
|
10247
10164
|
const refreshTokenClient = new RefreshTokenClient(refreshTokenClientConfig);
|
|
10248
10165
|
this.logger.verbose("Refresh token client created", validRequest.correlationId);
|
|
10249
10166
|
return await refreshTokenClient.acquireToken(validRequest);
|
|
@@ -10272,7 +10189,8 @@ class ClientApplication {
|
|
|
10272
10189
|
};
|
|
10273
10190
|
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenSilent, validRequest.correlationId, validRequest.forceRefresh);
|
|
10274
10191
|
try {
|
|
10275
|
-
const
|
|
10192
|
+
const discoveredAuthority = await this.createAuthority(validRequest.authority, validRequest.correlationId, undefined, request.azureCloudOptions);
|
|
10193
|
+
const clientConfiguration = await this.buildOauthClientConfiguration(discoveredAuthority, validRequest.correlationId, validRequest.redirectUri || "", serverTelemetryManager);
|
|
10276
10194
|
const silentFlowClient = new SilentFlowClient(clientConfiguration);
|
|
10277
10195
|
this.logger.verbose("Silent flow client created", validRequest.correlationId);
|
|
10278
10196
|
try {
|
|
@@ -10338,7 +10256,8 @@ class ClientApplication {
|
|
|
10338
10256
|
};
|
|
10339
10257
|
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenByUsernamePassword, validRequest.correlationId);
|
|
10340
10258
|
try {
|
|
10341
|
-
const
|
|
10259
|
+
const discoveredAuthority = await this.createAuthority(validRequest.authority, validRequest.correlationId, undefined, request.azureCloudOptions);
|
|
10260
|
+
const usernamePasswordClientConfig = await this.buildOauthClientConfiguration(discoveredAuthority, validRequest.correlationId, "", serverTelemetryManager);
|
|
10342
10261
|
const usernamePasswordClient = new UsernamePasswordClient(usernamePasswordClientConfig);
|
|
10343
10262
|
this.logger.verbose("Username password client created", validRequest.correlationId);
|
|
10344
10263
|
return await usernamePasswordClient.acquireToken(validRequest);
|
|
@@ -10393,14 +10312,8 @@ class ClientApplication {
|
|
|
10393
10312
|
* @param authority - user passed authority in configuration
|
|
10394
10313
|
* @param serverTelemetryManager - initializes servertelemetry if passed
|
|
10395
10314
|
*/
|
|
10396
|
-
async buildOauthClientConfiguration(
|
|
10315
|
+
async buildOauthClientConfiguration(discoveredAuthority, requestCorrelationId, redirectUri, serverTelemetryManager) {
|
|
10397
10316
|
this.logger.verbose("buildOauthClientConfiguration called", requestCorrelationId);
|
|
10398
|
-
// precedence - azureCloudInstance + tenant >> authority and request >> config
|
|
10399
|
-
const userAzureCloudOptions = azureCloudOptions
|
|
10400
|
-
? azureCloudOptions
|
|
10401
|
-
: this.config.auth.azureCloudOptions;
|
|
10402
|
-
// using null assertion operator as we ensure that all config values have default values in buildConfiguration()
|
|
10403
|
-
const discoveredAuthority = await this.createAuthority(authority, requestCorrelationId, azureRegionConfiguration, userAzureCloudOptions);
|
|
10404
10317
|
this.logger.info(`Building oauth client configuration with the following authority: ${discoveredAuthority.tokenEndpoint}.`, requestCorrelationId);
|
|
10405
10318
|
serverTelemetryManager?.updateRegionDiscoveryMetadata(discoveredAuthority.regionDiscoveryMetadata);
|
|
10406
10319
|
const clientConfiguration = {
|
|
@@ -10502,7 +10415,7 @@ class ClientApplication {
|
|
|
10502
10415
|
async createAuthority(authorityString, requestCorrelationId, azureRegionConfiguration, azureCloudOptions) {
|
|
10503
10416
|
this.logger.verbose("createAuthority called", requestCorrelationId);
|
|
10504
10417
|
// build authority string based on auth params - azureCloudInstance is prioritized if provided
|
|
10505
|
-
const authorityUrl = Authority.generateAuthority(authorityString, azureCloudOptions);
|
|
10418
|
+
const authorityUrl = Authority.generateAuthority(authorityString, azureCloudOptions || this.config.auth.azureCloudOptions);
|
|
10506
10419
|
const authorityOptions = {
|
|
10507
10420
|
protocolMode: this.config.auth.protocolMode,
|
|
10508
10421
|
knownAuthorities: this.config.auth.knownAuthorities,
|
|
@@ -10552,7 +10465,8 @@ class LoopbackClient {
|
|
|
10552
10465
|
}
|
|
10553
10466
|
const redirectUri = this.getRedirectUri();
|
|
10554
10467
|
const parsedUrl = new URL(url, redirectUri);
|
|
10555
|
-
const authCodeResponse = getDeserializedResponse(parsedUrl.search) ||
|
|
10468
|
+
const authCodeResponse = getDeserializedResponse(parsedUrl.search) ||
|
|
10469
|
+
{};
|
|
10556
10470
|
if (authCodeResponse.code) {
|
|
10557
10471
|
res.writeHead(HttpStatus.REDIRECT, {
|
|
10558
10472
|
location: redirectUri,
|
|
@@ -10657,11 +10571,11 @@ class DeviceCodeClient extends BaseClient {
|
|
|
10657
10571
|
* @param request - developer provided CommonDeviceCodeRequest
|
|
10658
10572
|
*/
|
|
10659
10573
|
createExtraQueryParameters(request) {
|
|
10660
|
-
const
|
|
10574
|
+
const parameters = new Map();
|
|
10661
10575
|
if (request.extraQueryParameters) {
|
|
10662
|
-
|
|
10576
|
+
addExtraQueryParameters(parameters, request.extraQueryParameters);
|
|
10663
10577
|
}
|
|
10664
|
-
return
|
|
10578
|
+
return mapToQueryString(parameters);
|
|
10665
10579
|
}
|
|
10666
10580
|
/**
|
|
10667
10581
|
* Executes POST request to device code endpoint
|
|
@@ -10690,18 +10604,18 @@ class DeviceCodeClient extends BaseClient {
|
|
|
10690
10604
|
* @param request - developer provided CommonDeviceCodeRequest
|
|
10691
10605
|
*/
|
|
10692
10606
|
createQueryString(request) {
|
|
10693
|
-
const
|
|
10694
|
-
|
|
10695
|
-
|
|
10607
|
+
const parameters = new Map();
|
|
10608
|
+
addScopes(parameters, request.scopes);
|
|
10609
|
+
addClientId(parameters, this.config.authOptions.clientId);
|
|
10696
10610
|
if (request.extraQueryParameters) {
|
|
10697
|
-
|
|
10611
|
+
addExtraQueryParameters(parameters, request.extraQueryParameters);
|
|
10698
10612
|
}
|
|
10699
10613
|
if (request.claims ||
|
|
10700
10614
|
(this.config.authOptions.clientCapabilities &&
|
|
10701
10615
|
this.config.authOptions.clientCapabilities.length > 0)) {
|
|
10702
|
-
|
|
10616
|
+
addClaims(parameters, request.claims, this.config.authOptions.clientCapabilities);
|
|
10703
10617
|
}
|
|
10704
|
-
return
|
|
10618
|
+
return mapToQueryString(parameters);
|
|
10705
10619
|
}
|
|
10706
10620
|
/**
|
|
10707
10621
|
* Breaks the polling with specific conditions
|
|
@@ -10791,27 +10705,27 @@ class DeviceCodeClient extends BaseClient {
|
|
|
10791
10705
|
* @param deviceCodeResponse - DeviceCodeResponse returned by the security token service device code endpoint
|
|
10792
10706
|
*/
|
|
10793
10707
|
createTokenRequestBody(request, deviceCodeResponse) {
|
|
10794
|
-
const
|
|
10795
|
-
|
|
10796
|
-
|
|
10797
|
-
|
|
10798
|
-
|
|
10708
|
+
const parameters = new Map();
|
|
10709
|
+
addScopes(parameters, request.scopes);
|
|
10710
|
+
addClientId(parameters, this.config.authOptions.clientId);
|
|
10711
|
+
addGrantType(parameters, GrantType.DEVICE_CODE_GRANT);
|
|
10712
|
+
addDeviceCode(parameters, deviceCodeResponse.deviceCode);
|
|
10799
10713
|
const correlationId = request.correlationId ||
|
|
10800
10714
|
this.config.cryptoInterface.createNewGuid();
|
|
10801
|
-
|
|
10802
|
-
|
|
10803
|
-
|
|
10804
|
-
|
|
10805
|
-
|
|
10715
|
+
addCorrelationId(parameters, correlationId);
|
|
10716
|
+
addClientInfo(parameters);
|
|
10717
|
+
addLibraryInfo(parameters, this.config.libraryInfo);
|
|
10718
|
+
addApplicationTelemetry(parameters, this.config.telemetry.application);
|
|
10719
|
+
addThrottling(parameters);
|
|
10806
10720
|
if (this.serverTelemetryManager) {
|
|
10807
|
-
|
|
10721
|
+
addServerTelemetry(parameters, this.serverTelemetryManager);
|
|
10808
10722
|
}
|
|
10809
10723
|
if (!StringUtils.isEmptyObj(request.claims) ||
|
|
10810
10724
|
(this.config.authOptions.clientCapabilities &&
|
|
10811
10725
|
this.config.authOptions.clientCapabilities.length > 0)) {
|
|
10812
|
-
|
|
10726
|
+
addClaims(parameters, request.claims, this.config.authOptions.clientCapabilities);
|
|
10813
10727
|
}
|
|
10814
|
-
return
|
|
10728
|
+
return mapToQueryString(parameters);
|
|
10815
10729
|
}
|
|
10816
10730
|
}
|
|
10817
10731
|
|
|
@@ -10872,7 +10786,8 @@ class PublicClientApplication extends ClientApplication {
|
|
|
10872
10786
|
const validRequest = Object.assign(request, await this.initializeBaseRequest(request));
|
|
10873
10787
|
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenByDeviceCode, validRequest.correlationId);
|
|
10874
10788
|
try {
|
|
10875
|
-
const
|
|
10789
|
+
const discoveredAuthority = await this.createAuthority(validRequest.authority, validRequest.correlationId, undefined, request.azureCloudOptions);
|
|
10790
|
+
const deviceCodeConfig = await this.buildOauthClientConfiguration(discoveredAuthority, validRequest.correlationId, "", serverTelemetryManager);
|
|
10876
10791
|
const deviceCodeClient = new DeviceCodeClient(deviceCodeConfig);
|
|
10877
10792
|
this.logger.verbose("Device code client created", validRequest.correlationId);
|
|
10878
10793
|
return await deviceCodeClient.acquireToken(validRequest);
|
|
@@ -11217,35 +11132,35 @@ class ClientCredentialClient extends BaseClient {
|
|
|
11217
11132
|
* @param request - CommonClientCredentialRequest provided by the developer
|
|
11218
11133
|
*/
|
|
11219
11134
|
async createTokenRequestBody(request) {
|
|
11220
|
-
const
|
|
11221
|
-
|
|
11222
|
-
|
|
11223
|
-
|
|
11224
|
-
|
|
11225
|
-
|
|
11226
|
-
|
|
11135
|
+
const parameters = new Map();
|
|
11136
|
+
addClientId(parameters, this.config.authOptions.clientId);
|
|
11137
|
+
addScopes(parameters, request.scopes, false);
|
|
11138
|
+
addGrantType(parameters, GrantType.CLIENT_CREDENTIALS_GRANT);
|
|
11139
|
+
addLibraryInfo(parameters, this.config.libraryInfo);
|
|
11140
|
+
addApplicationTelemetry(parameters, this.config.telemetry.application);
|
|
11141
|
+
addThrottling(parameters);
|
|
11227
11142
|
if (this.serverTelemetryManager) {
|
|
11228
|
-
|
|
11143
|
+
addServerTelemetry(parameters, this.serverTelemetryManager);
|
|
11229
11144
|
}
|
|
11230
11145
|
const correlationId = request.correlationId ||
|
|
11231
11146
|
this.config.cryptoInterface.createNewGuid();
|
|
11232
|
-
|
|
11147
|
+
addCorrelationId(parameters, correlationId);
|
|
11233
11148
|
if (this.config.clientCredentials.clientSecret) {
|
|
11234
|
-
|
|
11149
|
+
addClientSecret(parameters, this.config.clientCredentials.clientSecret);
|
|
11235
11150
|
}
|
|
11236
11151
|
// Use clientAssertion from request, fallback to client assertion in base configuration
|
|
11237
11152
|
const clientAssertion = request.clientAssertion ||
|
|
11238
11153
|
this.config.clientCredentials.clientAssertion;
|
|
11239
11154
|
if (clientAssertion) {
|
|
11240
|
-
|
|
11241
|
-
|
|
11155
|
+
addClientAssertion(parameters, await getClientAssertion(clientAssertion.assertion, this.config.authOptions.clientId, request.resourceRequestUri));
|
|
11156
|
+
addClientAssertionType(parameters, clientAssertion.assertionType);
|
|
11242
11157
|
}
|
|
11243
11158
|
if (!StringUtils.isEmptyObj(request.claims) ||
|
|
11244
11159
|
(this.config.authOptions.clientCapabilities &&
|
|
11245
11160
|
this.config.authOptions.clientCapabilities.length > 0)) {
|
|
11246
|
-
|
|
11161
|
+
addClaims(parameters, request.claims, this.config.authOptions.clientCapabilities);
|
|
11247
11162
|
}
|
|
11248
|
-
return
|
|
11163
|
+
return mapToQueryString(parameters);
|
|
11249
11164
|
}
|
|
11250
11165
|
}
|
|
11251
11166
|
|
|
@@ -11418,36 +11333,36 @@ class OnBehalfOfClient extends BaseClient {
|
|
|
11418
11333
|
* @param request - developer provided CommonOnBehalfOfRequest
|
|
11419
11334
|
*/
|
|
11420
11335
|
async createTokenRequestBody(request) {
|
|
11421
|
-
const
|
|
11422
|
-
|
|
11423
|
-
|
|
11424
|
-
|
|
11425
|
-
|
|
11426
|
-
|
|
11427
|
-
|
|
11428
|
-
|
|
11336
|
+
const parameters = new Map();
|
|
11337
|
+
addClientId(parameters, this.config.authOptions.clientId);
|
|
11338
|
+
addScopes(parameters, request.scopes);
|
|
11339
|
+
addGrantType(parameters, GrantType.JWT_BEARER);
|
|
11340
|
+
addClientInfo(parameters);
|
|
11341
|
+
addLibraryInfo(parameters, this.config.libraryInfo);
|
|
11342
|
+
addApplicationTelemetry(parameters, this.config.telemetry.application);
|
|
11343
|
+
addThrottling(parameters);
|
|
11429
11344
|
if (this.serverTelemetryManager) {
|
|
11430
|
-
|
|
11345
|
+
addServerTelemetry(parameters, this.serverTelemetryManager);
|
|
11431
11346
|
}
|
|
11432
11347
|
const correlationId = request.correlationId ||
|
|
11433
11348
|
this.config.cryptoInterface.createNewGuid();
|
|
11434
|
-
|
|
11435
|
-
|
|
11436
|
-
|
|
11349
|
+
addCorrelationId(parameters, correlationId);
|
|
11350
|
+
addRequestTokenUse(parameters, ON_BEHALF_OF);
|
|
11351
|
+
addOboAssertion(parameters, request.oboAssertion);
|
|
11437
11352
|
if (this.config.clientCredentials.clientSecret) {
|
|
11438
|
-
|
|
11353
|
+
addClientSecret(parameters, this.config.clientCredentials.clientSecret);
|
|
11439
11354
|
}
|
|
11440
11355
|
const clientAssertion = this.config.clientCredentials.clientAssertion;
|
|
11441
11356
|
if (clientAssertion) {
|
|
11442
|
-
|
|
11443
|
-
|
|
11357
|
+
addClientAssertion(parameters, await getClientAssertion(clientAssertion.assertion, this.config.authOptions.clientId, request.resourceRequestUri));
|
|
11358
|
+
addClientAssertionType(parameters, clientAssertion.assertionType);
|
|
11444
11359
|
}
|
|
11445
11360
|
if (request.claims ||
|
|
11446
11361
|
(this.config.authOptions.clientCapabilities &&
|
|
11447
11362
|
this.config.authOptions.clientCapabilities.length > 0)) {
|
|
11448
|
-
|
|
11363
|
+
addClaims(parameters, request.claims, this.config.authOptions.clientCapabilities);
|
|
11449
11364
|
}
|
|
11450
|
-
return
|
|
11365
|
+
return mapToQueryString(parameters);
|
|
11451
11366
|
}
|
|
11452
11367
|
}
|
|
11453
11368
|
|
|
@@ -11587,7 +11502,8 @@ class ConfidentialClientApplication extends ClientApplication {
|
|
|
11587
11502
|
};
|
|
11588
11503
|
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenByClientCredential, validRequest.correlationId, validRequest.skipCache);
|
|
11589
11504
|
try {
|
|
11590
|
-
const
|
|
11505
|
+
const discoveredAuthority = await this.createAuthority(validRequest.authority, validRequest.correlationId, azureRegionConfiguration, request.azureCloudOptions);
|
|
11506
|
+
const clientCredentialConfig = await this.buildOauthClientConfiguration(discoveredAuthority, validRequest.correlationId, "", serverTelemetryManager);
|
|
11591
11507
|
const clientCredentialClient = new ClientCredentialClient(clientCredentialConfig, this.appTokenProvider);
|
|
11592
11508
|
this.logger.verbose("Client credential client created", validRequest.correlationId);
|
|
11593
11509
|
return await clientCredentialClient.acquireToken(validRequest);
|
|
@@ -11618,7 +11534,8 @@ class ConfidentialClientApplication extends ClientApplication {
|
|
|
11618
11534
|
...(await this.initializeBaseRequest(request)),
|
|
11619
11535
|
};
|
|
11620
11536
|
try {
|
|
11621
|
-
const
|
|
11537
|
+
const discoveredAuthority = await this.createAuthority(validRequest.authority, validRequest.correlationId, undefined, request.azureCloudOptions);
|
|
11538
|
+
const onBehalfOfConfig = await this.buildOauthClientConfiguration(discoveredAuthority, validRequest.correlationId, "", undefined);
|
|
11622
11539
|
const oboClient = new OnBehalfOfClient(onBehalfOfConfig);
|
|
11623
11540
|
this.logger.verbose("On behalf of client created", validRequest.correlationId);
|
|
11624
11541
|
return await oboClient.acquireToken(validRequest);
|
|
@@ -11882,19 +11799,19 @@ class ManagedIdentityRequestParameters {
|
|
|
11882
11799
|
this.retryPolicy = retryPolicy || defaultRetryPolicy;
|
|
11883
11800
|
}
|
|
11884
11801
|
computeUri() {
|
|
11885
|
-
const
|
|
11802
|
+
const parameters = new Map();
|
|
11886
11803
|
if (this.queryParameters) {
|
|
11887
|
-
|
|
11804
|
+
addExtraQueryParameters(parameters, this.queryParameters);
|
|
11888
11805
|
}
|
|
11889
|
-
const queryParametersString =
|
|
11806
|
+
const queryParametersString = mapToQueryString(parameters);
|
|
11890
11807
|
return UrlString.appendQueryString(this._baseEndpoint, queryParametersString);
|
|
11891
11808
|
}
|
|
11892
11809
|
computeParametersBodyString() {
|
|
11893
|
-
const
|
|
11810
|
+
const parameters = new Map();
|
|
11894
11811
|
if (this.bodyParameters) {
|
|
11895
|
-
|
|
11812
|
+
addExtraQueryParameters(parameters, this.bodyParameters);
|
|
11896
11813
|
}
|
|
11897
|
-
return
|
|
11814
|
+
return mapToQueryString(parameters);
|
|
11898
11815
|
}
|
|
11899
11816
|
}
|
|
11900
11817
|
|