@azure/msal-node 3.8.4 → 5.0.0-beta.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/README.md +2 -1
- package/dist/cache/CacheHelpers.d.ts.map +1 -1
- package/dist/cache/CacheHelpers.mjs +4 -5
- package/dist/cache/CacheHelpers.mjs.map +1 -1
- package/dist/cache/NodeStorage.d.ts.map +1 -1
- package/dist/cache/NodeStorage.mjs +17 -18
- package/dist/cache/NodeStorage.mjs.map +1 -1
- package/dist/cache/TokenCache.d.ts.map +1 -1
- package/dist/cache/TokenCache.mjs +15 -15
- package/dist/cache/TokenCache.mjs.map +1 -1
- package/dist/cache/distributed/DistributedCachePlugin.d.ts.map +1 -1
- package/dist/cache/distributed/DistributedCachePlugin.mjs +3 -3
- package/dist/cache/distributed/DistributedCachePlugin.mjs.map +1 -1
- package/dist/cache/serializer/Deserializer.d.ts.map +1 -1
- package/dist/cache/serializer/Deserializer.mjs +3 -5
- package/dist/cache/serializer/Deserializer.mjs.map +1 -1
- package/dist/cache/serializer/Serializer.d.ts.map +1 -1
- package/dist/cache/serializer/Serializer.mjs +1 -3
- package/dist/cache/serializer/Serializer.mjs.map +1 -1
- package/dist/cache/serializer/SerializerTypes.d.ts +0 -2
- package/dist/cache/serializer/SerializerTypes.d.ts.map +1 -1
- package/dist/client/BaseClient.d.ts +42 -0
- package/dist/client/BaseClient.d.ts.map +1 -0
- package/dist/client/BaseClient.mjs +68 -0
- package/dist/client/BaseClient.mjs.map +1 -0
- package/dist/client/ClientApplication.d.ts.map +1 -1
- package/dist/client/ClientApplication.mjs +33 -43
- package/dist/client/ClientApplication.mjs.map +1 -1
- package/dist/client/ClientAssertion.d.ts.map +1 -1
- package/dist/client/ClientAssertion.mjs +6 -5
- package/dist/client/ClientAssertion.mjs.map +1 -1
- package/dist/client/ClientCredentialClient.d.ts +4 -2
- package/dist/client/ClientCredentialClient.d.ts.map +1 -1
- package/dist/client/ClientCredentialClient.mjs +23 -21
- package/dist/client/ClientCredentialClient.mjs.map +1 -1
- package/dist/client/ConfidentialClientApplication.d.ts.map +1 -1
- package/dist/client/ConfidentialClientApplication.mjs +10 -9
- package/dist/client/ConfidentialClientApplication.mjs.map +1 -1
- package/dist/client/DeviceCodeClient.d.ts +3 -1
- package/dist/client/DeviceCodeClient.d.ts.map +1 -1
- package/dist/client/DeviceCodeClient.mjs +21 -19
- package/dist/client/DeviceCodeClient.mjs.map +1 -1
- package/dist/client/ManagedIdentityApplication.d.ts.map +1 -1
- package/dist/client/ManagedIdentityApplication.mjs +7 -6
- package/dist/client/ManagedIdentityApplication.mjs.map +1 -1
- package/dist/client/ManagedIdentityClient.mjs +1 -1
- package/dist/client/ManagedIdentitySources/AppService.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/AppService.mjs +3 -3
- package/dist/client/ManagedIdentitySources/AppService.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/AzureArc.mjs +8 -8
- package/dist/client/ManagedIdentitySources/AzureArc.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +12 -11
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/CloudShell.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/CloudShell.mjs +3 -3
- package/dist/client/ManagedIdentitySources/CloudShell.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/Imds.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/Imds.mjs +3 -3
- package/dist/client/ManagedIdentitySources/Imds.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/MachineLearning.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/MachineLearning.mjs +3 -3
- package/dist/client/ManagedIdentitySources/MachineLearning.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +4 -4
- package/dist/client/ManagedIdentitySources/ServiceFabric.mjs.map +1 -1
- package/dist/client/OnBehalfOfClient.d.ts +3 -1
- package/dist/client/OnBehalfOfClient.d.ts.map +1 -1
- package/dist/client/OnBehalfOfClient.mjs +19 -18
- package/dist/client/OnBehalfOfClient.mjs.map +1 -1
- package/dist/client/PublicClientApplication.d.ts.map +1 -1
- package/dist/client/PublicClientApplication.mjs +15 -14
- package/dist/client/PublicClientApplication.mjs.map +1 -1
- package/dist/client/UsernamePasswordClient.d.ts +3 -1
- package/dist/client/UsernamePasswordClient.d.ts.map +1 -1
- package/dist/client/UsernamePasswordClient.mjs +8 -7
- package/dist/client/UsernamePasswordClient.mjs.map +1 -1
- package/dist/config/Configuration.d.ts +2 -19
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.mjs +18 -25
- package/dist/config/Configuration.mjs.map +1 -1
- package/dist/config/ManagedIdentityId.mjs +1 -1
- package/dist/config/ManagedIdentityRequestParameters.mjs +3 -3
- package/dist/config/ManagedIdentityRequestParameters.mjs.map +1 -1
- package/dist/crypto/CryptoProvider.d.ts.map +1 -1
- package/dist/crypto/CryptoProvider.mjs +5 -3
- package/dist/crypto/CryptoProvider.mjs.map +1 -1
- package/dist/crypto/GuidGenerator.mjs +1 -1
- package/dist/crypto/HashUtils.mjs +1 -1
- package/dist/crypto/PkceGenerator.d.ts.map +1 -1
- package/dist/crypto/PkceGenerator.mjs +6 -4
- package/dist/crypto/PkceGenerator.mjs.map +1 -1
- package/dist/error/ClientAuthErrorCodes.d.ts +8 -0
- package/dist/error/ClientAuthErrorCodes.d.ts.map +1 -0
- package/dist/error/ClientAuthErrorCodes.mjs +16 -0
- package/dist/error/ClientAuthErrorCodes.mjs.map +1 -0
- 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 +15 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +20 -8
- package/dist/index.mjs.map +1 -1
- package/dist/internals.mjs +1 -1
- package/dist/network/HttpClient.d.ts +53 -40
- package/dist/network/HttpClient.d.ts.map +1 -1
- package/dist/network/HttpClient.mjs +149 -315
- package/dist/network/HttpClient.mjs.map +1 -1
- package/dist/network/HttpClientWithRetries.mjs +3 -3
- package/dist/network/HttpClientWithRetries.mjs.map +1 -1
- package/dist/network/LoopbackClient.d.ts.map +1 -1
- package/dist/network/LoopbackClient.mjs +3 -3
- package/dist/network/LoopbackClient.mjs.map +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.d.ts.map +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/protocol/Authorize.d.ts.map +1 -1
- package/dist/protocol/Authorize.mjs +6 -6
- package/dist/protocol/Authorize.mjs.map +1 -1
- package/dist/request/AuthorizationCodeRequest.d.ts +3 -2
- package/dist/request/AuthorizationCodeRequest.d.ts.map +1 -1
- package/dist/request/AuthorizationUrlRequest.d.ts +3 -3
- package/dist/request/AuthorizationUrlRequest.d.ts.map +1 -1
- package/dist/request/ClientCredentialRequest.d.ts +4 -4
- package/dist/request/ClientCredentialRequest.d.ts.map +1 -1
- package/dist/request/CommonClientCredentialRequest.d.ts +17 -0
- package/dist/request/CommonClientCredentialRequest.d.ts.map +1 -0
- package/dist/request/CommonDeviceCodeRequest.d.ts +21 -0
- package/dist/request/CommonDeviceCodeRequest.d.ts.map +1 -0
- package/dist/request/CommonOnBehalfOfRequest.d.ts +13 -0
- package/dist/request/CommonOnBehalfOfRequest.d.ts.map +1 -0
- package/dist/request/CommonUsernamePasswordRequest.d.ts +19 -0
- package/dist/request/CommonUsernamePasswordRequest.d.ts.map +1 -0
- package/dist/request/DeviceCodeRequest.d.ts +3 -2
- package/dist/request/DeviceCodeRequest.d.ts.map +1 -1
- package/dist/request/InteractiveRequest.d.ts +1 -1
- package/dist/request/InteractiveRequest.d.ts.map +1 -1
- package/dist/request/ManagedIdentityRequest.d.ts +1 -1
- package/dist/request/ManagedIdentityRequest.d.ts.map +1 -1
- package/dist/request/OnBehalfOfRequest.d.ts +2 -3
- package/dist/request/OnBehalfOfRequest.d.ts.map +1 -1
- package/dist/request/RefreshTokenRequest.d.ts +3 -2
- package/dist/request/RefreshTokenRequest.d.ts.map +1 -1
- package/dist/request/SilentFlowRequest.d.ts +3 -2
- package/dist/request/SilentFlowRequest.d.ts.map +1 -1
- package/dist/request/UsernamePasswordRequest.d.ts +4 -3
- package/dist/request/UsernamePasswordRequest.d.ts.map +1 -1
- package/dist/response/ManagedIdentityTokenResponse.d.ts +2 -2
- package/dist/response/ManagedIdentityTokenResponse.d.ts.map +1 -1
- package/dist/retry/DefaultManagedIdentityRetryPolicy.d.ts +1 -1
- package/dist/retry/DefaultManagedIdentityRetryPolicy.d.ts.map +1 -1
- package/dist/retry/DefaultManagedIdentityRetryPolicy.mjs +9 -9
- package/dist/retry/DefaultManagedIdentityRetryPolicy.mjs.map +1 -1
- package/dist/retry/ExponentialRetryStrategy.mjs +1 -1
- package/dist/retry/IHttpRetryPolicy.d.ts +1 -1
- package/dist/retry/IHttpRetryPolicy.d.ts.map +1 -1
- package/dist/retry/ImdsRetryPolicy.d.ts +1 -1
- package/dist/retry/ImdsRetryPolicy.d.ts.map +1 -1
- package/dist/retry/ImdsRetryPolicy.mjs +11 -11
- package/dist/retry/ImdsRetryPolicy.mjs.map +1 -1
- package/dist/retry/LinearRetryStrategy.mjs +1 -1
- package/dist/utils/Constants.d.ts +2 -9
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.mjs +4 -12
- package/dist/utils/Constants.mjs.map +1 -1
- package/dist/utils/EncodingUtils.d.ts.map +1 -1
- package/dist/utils/EncodingUtils.mjs +5 -5
- package/dist/utils/EncodingUtils.mjs.map +1 -1
- package/dist/utils/TimeUtils.mjs +1 -1
- package/lib/msal-node.cjs +5378 -6289
- package/lib/msal-node.cjs.map +1 -1
- package/lib/types/cache/CacheHelpers.d.ts.map +1 -1
- package/lib/types/cache/NodeStorage.d.ts.map +1 -1
- package/lib/types/cache/TokenCache.d.ts.map +1 -1
- package/lib/types/cache/distributed/DistributedCachePlugin.d.ts.map +1 -1
- package/lib/types/cache/serializer/Deserializer.d.ts.map +1 -1
- package/lib/types/cache/serializer/Serializer.d.ts.map +1 -1
- package/lib/types/cache/serializer/SerializerTypes.d.ts +0 -2
- package/lib/types/cache/serializer/SerializerTypes.d.ts.map +1 -1
- package/lib/types/client/BaseClient.d.ts +42 -0
- package/lib/types/client/BaseClient.d.ts.map +1 -0
- package/lib/types/client/ClientApplication.d.ts.map +1 -1
- package/lib/types/client/ClientAssertion.d.ts.map +1 -1
- package/lib/types/client/ClientCredentialClient.d.ts +4 -2
- 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 +3 -1
- package/lib/types/client/DeviceCodeClient.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentityApplication.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/AppService.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/CloudShell.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/Imds.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/MachineLearning.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/ServiceFabric.d.ts.map +1 -1
- package/lib/types/client/OnBehalfOfClient.d.ts +3 -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 +3 -1
- package/lib/types/client/UsernamePasswordClient.d.ts.map +1 -1
- package/lib/types/config/Configuration.d.ts +2 -19
- package/lib/types/config/Configuration.d.ts.map +1 -1
- package/lib/types/crypto/CryptoProvider.d.ts.map +1 -1
- package/lib/types/crypto/PkceGenerator.d.ts.map +1 -1
- package/lib/types/error/ClientAuthErrorCodes.d.ts +8 -0
- package/lib/types/error/ClientAuthErrorCodes.d.ts.map +1 -0
- package/lib/types/index.d.ts +15 -11
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/network/HttpClient.d.ts +53 -40
- package/lib/types/network/HttpClient.d.ts.map +1 -1
- package/lib/types/network/LoopbackClient.d.ts.map +1 -1
- package/lib/types/packageMetadata.d.ts +1 -1
- package/lib/types/packageMetadata.d.ts.map +1 -1
- package/lib/types/protocol/Authorize.d.ts.map +1 -1
- package/lib/types/request/AuthorizationCodeRequest.d.ts +3 -2
- package/lib/types/request/AuthorizationCodeRequest.d.ts.map +1 -1
- package/lib/types/request/AuthorizationUrlRequest.d.ts +3 -3
- package/lib/types/request/AuthorizationUrlRequest.d.ts.map +1 -1
- package/lib/types/request/ClientCredentialRequest.d.ts +4 -4
- package/lib/types/request/ClientCredentialRequest.d.ts.map +1 -1
- package/lib/types/request/CommonClientCredentialRequest.d.ts +17 -0
- package/lib/types/request/CommonClientCredentialRequest.d.ts.map +1 -0
- package/lib/types/request/CommonDeviceCodeRequest.d.ts +21 -0
- package/lib/types/request/CommonDeviceCodeRequest.d.ts.map +1 -0
- package/lib/types/request/CommonOnBehalfOfRequest.d.ts +13 -0
- package/lib/types/request/CommonOnBehalfOfRequest.d.ts.map +1 -0
- package/lib/types/request/CommonUsernamePasswordRequest.d.ts +19 -0
- package/lib/types/request/CommonUsernamePasswordRequest.d.ts.map +1 -0
- package/lib/types/request/DeviceCodeRequest.d.ts +3 -2
- package/lib/types/request/DeviceCodeRequest.d.ts.map +1 -1
- package/lib/types/request/InteractiveRequest.d.ts +1 -1
- package/lib/types/request/InteractiveRequest.d.ts.map +1 -1
- package/lib/types/request/ManagedIdentityRequest.d.ts +1 -1
- package/lib/types/request/ManagedIdentityRequest.d.ts.map +1 -1
- package/lib/types/request/OnBehalfOfRequest.d.ts +2 -3
- package/lib/types/request/OnBehalfOfRequest.d.ts.map +1 -1
- package/lib/types/request/RefreshTokenRequest.d.ts +3 -2
- package/lib/types/request/RefreshTokenRequest.d.ts.map +1 -1
- package/lib/types/request/SilentFlowRequest.d.ts +3 -2
- package/lib/types/request/SilentFlowRequest.d.ts.map +1 -1
- package/lib/types/request/UsernamePasswordRequest.d.ts +4 -3
- package/lib/types/request/UsernamePasswordRequest.d.ts.map +1 -1
- package/lib/types/response/ManagedIdentityTokenResponse.d.ts +2 -2
- package/lib/types/response/ManagedIdentityTokenResponse.d.ts.map +1 -1
- package/lib/types/retry/DefaultManagedIdentityRetryPolicy.d.ts +1 -1
- package/lib/types/retry/DefaultManagedIdentityRetryPolicy.d.ts.map +1 -1
- package/lib/types/retry/IHttpRetryPolicy.d.ts +1 -1
- package/lib/types/retry/IHttpRetryPolicy.d.ts.map +1 -1
- package/lib/types/retry/ImdsRetryPolicy.d.ts +1 -1
- package/lib/types/retry/ImdsRetryPolicy.d.ts.map +1 -1
- package/lib/types/utils/Constants.d.ts +2 -9
- package/lib/types/utils/Constants.d.ts.map +1 -1
- package/lib/types/utils/EncodingUtils.d.ts.map +1 -1
- package/package.json +4 -6
- package/src/cache/CacheHelpers.ts +3 -5
- package/src/cache/NodeStorage.ts +19 -16
- package/src/cache/TokenCache.ts +18 -14
- package/src/cache/distributed/DistributedCachePlugin.ts +2 -1
- package/src/cache/serializer/Deserializer.ts +7 -9
- package/src/cache/serializer/Serializer.ts +0 -2
- package/src/cache/serializer/SerializerTypes.ts +0 -2
- package/src/client/BaseClient.ts +158 -0
- package/src/client/ClientApplication.ts +50 -57
- package/src/client/ClientAssertion.ts +5 -6
- package/src/client/ClientCredentialClient.ts +32 -25
- package/src/client/ConfidentialClientApplication.ts +13 -13
- package/src/client/DeviceCodeClient.ts +33 -21
- package/src/client/ManagedIdentityApplication.ts +10 -7
- package/src/client/ManagedIdentitySources/AppService.ts +4 -2
- package/src/client/ManagedIdentitySources/AzureArc.ts +14 -8
- package/src/client/ManagedIdentitySources/BaseManagedIdentitySource.ts +18 -9
- package/src/client/ManagedIdentitySources/CloudShell.ts +4 -2
- package/src/client/ManagedIdentitySources/Imds.ts +4 -2
- package/src/client/ManagedIdentitySources/MachineLearning.ts +4 -2
- package/src/client/ManagedIdentitySources/ServiceFabric.ts +6 -3
- package/src/client/OnBehalfOfClient.ts +27 -21
- package/src/client/PublicClientApplication.ts +16 -16
- package/src/client/UsernamePasswordClient.ts +14 -8
- package/src/config/Configuration.ts +19 -48
- package/src/config/ManagedIdentityRequestParameters.ts +2 -2
- package/src/crypto/CryptoProvider.ts +5 -3
- package/src/crypto/PkceGenerator.ts +6 -4
- package/src/error/ClientAuthErrorCodes.ts +12 -0
- package/src/index.ts +5 -19
- package/src/network/HttpClient.ts +168 -457
- package/src/network/HttpClientWithRetries.ts +2 -2
- package/src/network/LoopbackClient.ts +2 -3
- package/src/packageMetadata.ts +1 -1
- package/src/protocol/Authorize.ts +8 -10
- package/src/request/AuthorizationCodeRequest.ts +2 -2
- package/src/request/AuthorizationUrlRequest.ts +2 -3
- package/src/request/ClientCredentialRequest.ts +3 -7
- package/src/request/CommonClientCredentialRequest.ts +29 -0
- package/src/request/CommonDeviceCodeRequest.ts +30 -0
- package/src/request/CommonOnBehalfOfRequest.ts +21 -0
- package/src/request/CommonUsernamePasswordRequest.ts +24 -0
- package/src/request/DeviceCodeRequest.ts +2 -5
- package/src/request/InteractiveRequest.ts +1 -4
- package/src/request/ManagedIdentityRequest.ts +1 -1
- package/src/request/OnBehalfOfRequest.ts +1 -3
- package/src/request/RefreshTokenRequest.ts +2 -2
- package/src/request/SilentFlowRequest.ts +3 -5
- package/src/request/UsernamePasswordRequest.ts +3 -3
- package/src/response/ManagedIdentityTokenResponse.ts +2 -2
- package/src/retry/DefaultManagedIdentityRetryPolicy.ts +9 -8
- package/src/retry/IHttpRetryPolicy.ts +1 -1
- package/src/retry/ImdsRetryPolicy.ts +11 -10
- package/src/utils/Constants.ts +2 -11
- package/src/utils/EncodingUtils.ts +8 -4
- package/dist/utils/NetworkUtils.mjs +0 -43
- package/dist/utils/NetworkUtils.mjs.map +0 -1
|
@@ -19,25 +19,20 @@ import {
|
|
|
19
19
|
CommonRefreshTokenRequest,
|
|
20
20
|
CommonAuthorizationCodeRequest,
|
|
21
21
|
CommonAuthorizationUrlRequest,
|
|
22
|
-
CommonUsernamePasswordRequest,
|
|
23
|
-
AuthenticationScheme,
|
|
24
|
-
ResponseMode,
|
|
25
22
|
AuthorityOptions,
|
|
26
|
-
OIDC_DEFAULT_SCOPES,
|
|
27
23
|
AzureRegionConfiguration,
|
|
28
24
|
AuthError,
|
|
29
25
|
AzureCloudOptions,
|
|
30
26
|
AuthorizationCodePayload,
|
|
31
|
-
Constants,
|
|
32
|
-
StringUtils,
|
|
33
27
|
createClientAuthError,
|
|
34
28
|
ClientAuthErrorCodes,
|
|
35
29
|
buildStaticAuthorityOptions,
|
|
36
30
|
ClientAssertion as ClientAssertionType,
|
|
37
31
|
getClientAssertion,
|
|
38
32
|
ClientAssertionCallback,
|
|
39
|
-
|
|
33
|
+
Constants,
|
|
40
34
|
ClientAuthError,
|
|
35
|
+
StubPerformanceClient,
|
|
41
36
|
} from "@azure/msal-common/node";
|
|
42
37
|
import {
|
|
43
38
|
Configuration,
|
|
@@ -55,6 +50,7 @@ import { RefreshTokenRequest } from "../request/RefreshTokenRequest.js";
|
|
|
55
50
|
import { SilentFlowRequest } from "../request/SilentFlowRequest.js";
|
|
56
51
|
import { version, name } from "../packageMetadata.js";
|
|
57
52
|
import { UsernamePasswordRequest } from "../request/UsernamePasswordRequest.js";
|
|
53
|
+
import { CommonUsernamePasswordRequest } from "../request/CommonUsernamePasswordRequest.js";
|
|
58
54
|
import { NodeAuthError } from "../error/NodeAuthError.js";
|
|
59
55
|
import { UsernamePasswordClient } from "./UsernamePasswordClient.js";
|
|
60
56
|
import { getAuthCodeRequestUrl } from "../protocol/Authorize.js";
|
|
@@ -125,12 +121,12 @@ export abstract class ClientApplication {
|
|
|
125
121
|
* `acquireTokenByCode(AuthorizationCodeRequest)`.
|
|
126
122
|
*/
|
|
127
123
|
async getAuthCodeUrl(request: AuthorizationUrlRequest): Promise<string> {
|
|
128
|
-
this.logger.info("getAuthCodeUrl called", request.correlationId);
|
|
124
|
+
this.logger.info("getAuthCodeUrl called", request.correlationId || "");
|
|
129
125
|
const validRequest: CommonAuthorizationUrlRequest = {
|
|
130
126
|
...request,
|
|
131
127
|
...(await this.initializeBaseRequest(request)),
|
|
132
|
-
responseMode: request.responseMode || ResponseMode.QUERY,
|
|
133
|
-
authenticationScheme: AuthenticationScheme.BEARER,
|
|
128
|
+
responseMode: request.responseMode || Constants.ResponseMode.QUERY,
|
|
129
|
+
authenticationScheme: Constants.AuthenticationScheme.BEARER,
|
|
134
130
|
state: request.state || "",
|
|
135
131
|
nonce: request.nonce || "",
|
|
136
132
|
};
|
|
@@ -161,9 +157,15 @@ export abstract class ClientApplication {
|
|
|
161
157
|
request: AuthorizationCodeRequest,
|
|
162
158
|
authCodePayLoad?: AuthorizationCodePayload
|
|
163
159
|
): Promise<AuthenticationResult> {
|
|
164
|
-
this.logger.info(
|
|
160
|
+
this.logger.info(
|
|
161
|
+
"acquireTokenByCode called",
|
|
162
|
+
request.correlationId || ""
|
|
163
|
+
);
|
|
165
164
|
if (request.state && authCodePayLoad) {
|
|
166
|
-
this.logger.info(
|
|
165
|
+
this.logger.info(
|
|
166
|
+
"acquireTokenByCode - validating state",
|
|
167
|
+
request.correlationId || ""
|
|
168
|
+
);
|
|
167
169
|
this.validateState(request.state, authCodePayLoad.state || "");
|
|
168
170
|
// eslint-disable-next-line no-param-reassign
|
|
169
171
|
authCodePayLoad = { ...authCodePayLoad, state: "" };
|
|
@@ -171,7 +173,7 @@ export abstract class ClientApplication {
|
|
|
171
173
|
const validRequest: CommonAuthorizationCodeRequest = {
|
|
172
174
|
...request,
|
|
173
175
|
...(await this.initializeBaseRequest(request)),
|
|
174
|
-
authenticationScheme: AuthenticationScheme.BEARER,
|
|
176
|
+
authenticationScheme: Constants.AuthenticationScheme.BEARER,
|
|
175
177
|
};
|
|
176
178
|
|
|
177
179
|
const serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
@@ -192,7 +194,8 @@ export abstract class ClientApplication {
|
|
|
192
194
|
serverTelemetryManager
|
|
193
195
|
);
|
|
194
196
|
const authorizationCodeClient = new AuthorizationCodeClient(
|
|
195
|
-
authClientConfig
|
|
197
|
+
authClientConfig,
|
|
198
|
+
new StubPerformanceClient()
|
|
196
199
|
);
|
|
197
200
|
this.logger.verbose(
|
|
198
201
|
"Auth code client created",
|
|
@@ -223,12 +226,12 @@ export abstract class ClientApplication {
|
|
|
223
226
|
): Promise<AuthenticationResult | null> {
|
|
224
227
|
this.logger.info(
|
|
225
228
|
"acquireTokenByRefreshToken called",
|
|
226
|
-
request.correlationId
|
|
229
|
+
request.correlationId || ""
|
|
227
230
|
);
|
|
228
231
|
const validRequest: CommonRefreshTokenRequest = {
|
|
229
232
|
...request,
|
|
230
233
|
...(await this.initializeBaseRequest(request)),
|
|
231
|
-
authenticationScheme: AuthenticationScheme.BEARER,
|
|
234
|
+
authenticationScheme: Constants.AuthenticationScheme.BEARER,
|
|
232
235
|
};
|
|
233
236
|
|
|
234
237
|
const serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
@@ -250,7 +253,8 @@ export abstract class ClientApplication {
|
|
|
250
253
|
serverTelemetryManager
|
|
251
254
|
);
|
|
252
255
|
const refreshTokenClient = new RefreshTokenClient(
|
|
253
|
-
refreshTokenClientConfig
|
|
256
|
+
refreshTokenClientConfig,
|
|
257
|
+
new StubPerformanceClient()
|
|
254
258
|
);
|
|
255
259
|
this.logger.verbose(
|
|
256
260
|
"Refresh token client created",
|
|
@@ -303,7 +307,10 @@ export abstract class ClientApplication {
|
|
|
303
307
|
validRequest.redirectUri || "",
|
|
304
308
|
serverTelemetryManager
|
|
305
309
|
);
|
|
306
|
-
const silentFlowClient = new SilentFlowClient(
|
|
310
|
+
const silentFlowClient = new SilentFlowClient(
|
|
311
|
+
clientConfiguration,
|
|
312
|
+
new StubPerformanceClient()
|
|
313
|
+
);
|
|
307
314
|
this.logger.verbose(
|
|
308
315
|
"Silent flow client created",
|
|
309
316
|
validRequest.correlationId
|
|
@@ -323,7 +330,8 @@ export abstract class ClientApplication {
|
|
|
323
330
|
ClientAuthErrorCodes.tokenRefreshRequired
|
|
324
331
|
) {
|
|
325
332
|
const refreshTokenClient = new RefreshTokenClient(
|
|
326
|
-
clientConfiguration
|
|
333
|
+
clientConfiguration,
|
|
334
|
+
new StubPerformanceClient()
|
|
327
335
|
);
|
|
328
336
|
return refreshTokenClient.acquireTokenByRefreshToken(
|
|
329
337
|
validRequest
|
|
@@ -350,16 +358,18 @@ export abstract class ClientApplication {
|
|
|
350
358
|
...validRequest,
|
|
351
359
|
scopes: validRequest.scopes?.length
|
|
352
360
|
? validRequest.scopes
|
|
353
|
-
: [...OIDC_DEFAULT_SCOPES],
|
|
361
|
+
: [...Constants.OIDC_DEFAULT_SCOPES],
|
|
354
362
|
});
|
|
355
363
|
|
|
356
|
-
if (cacheOutcome === CacheOutcome.PROACTIVELY_REFRESHED) {
|
|
364
|
+
if (cacheOutcome === Constants.CacheOutcome.PROACTIVELY_REFRESHED) {
|
|
357
365
|
this.logger.info(
|
|
358
|
-
"ClientApplication:acquireCachedTokenSilent - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed."
|
|
366
|
+
"ClientApplication:acquireCachedTokenSilent - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed.",
|
|
367
|
+
validRequest.correlationId
|
|
359
368
|
);
|
|
360
369
|
// refresh the access token in the background
|
|
361
370
|
const refreshTokenClient = new RefreshTokenClient(
|
|
362
|
-
clientConfiguration
|
|
371
|
+
clientConfiguration,
|
|
372
|
+
new StubPerformanceClient()
|
|
363
373
|
);
|
|
364
374
|
|
|
365
375
|
try {
|
|
@@ -391,7 +401,7 @@ export abstract class ClientApplication {
|
|
|
391
401
|
): Promise<AuthenticationResult | null> {
|
|
392
402
|
this.logger.info(
|
|
393
403
|
"acquireTokenByUsernamePassword called",
|
|
394
|
-
request.correlationId
|
|
404
|
+
request.correlationId || ""
|
|
395
405
|
);
|
|
396
406
|
const validRequest: CommonUsernamePasswordRequest = {
|
|
397
407
|
...request,
|
|
@@ -436,7 +446,7 @@ export abstract class ClientApplication {
|
|
|
436
446
|
* Gets the token cache for the application.
|
|
437
447
|
*/
|
|
438
448
|
getTokenCache(): TokenCache {
|
|
439
|
-
this.logger.info("getTokenCache called");
|
|
449
|
+
this.logger.info("getTokenCache called", "");
|
|
440
450
|
return this.tokenCache;
|
|
441
451
|
}
|
|
442
452
|
|
|
@@ -513,10 +523,6 @@ export abstract class ClientApplication {
|
|
|
513
523
|
this.config.system.loggerOptions.piiLoggingEnabled,
|
|
514
524
|
correlationId: requestCorrelationId,
|
|
515
525
|
},
|
|
516
|
-
cacheOptions: {
|
|
517
|
-
claimsBasedCachingEnabled:
|
|
518
|
-
this.config.cache.claimsBasedCachingEnabled,
|
|
519
|
-
},
|
|
520
526
|
cryptoInterface: this.cryptoProvider,
|
|
521
527
|
networkInterface: this.config.system.networkClient,
|
|
522
528
|
storageInterface: this.storage,
|
|
@@ -530,8 +536,8 @@ export abstract class ClientApplication {
|
|
|
530
536
|
libraryInfo: {
|
|
531
537
|
sku: NodeConstants.MSAL_SKU,
|
|
532
538
|
version: version,
|
|
533
|
-
cpu: process.arch ||
|
|
534
|
-
os: process.platform ||
|
|
539
|
+
cpu: process.arch || "",
|
|
540
|
+
os: process.platform || "",
|
|
535
541
|
},
|
|
536
542
|
telemetry: this.config.telemetry,
|
|
537
543
|
persistencePlugin: this.config.cache.cachePlugin,
|
|
@@ -573,43 +579,31 @@ export abstract class ClientApplication {
|
|
|
573
579
|
protected async initializeBaseRequest(
|
|
574
580
|
authRequest: Partial<BaseAuthRequest>
|
|
575
581
|
): Promise<BaseAuthRequest> {
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
);
|
|
582
|
+
const correlationId =
|
|
583
|
+
authRequest.correlationId || this.cryptoProvider.createNewGuid();
|
|
584
|
+
this.logger.verbose("initializeRequestScopes called", correlationId);
|
|
580
585
|
// Default authenticationScheme to Bearer, log that POP isn't supported yet
|
|
581
586
|
if (
|
|
582
587
|
authRequest.authenticationScheme &&
|
|
583
|
-
authRequest.authenticationScheme ===
|
|
588
|
+
authRequest.authenticationScheme ===
|
|
589
|
+
Constants.AuthenticationScheme.POP
|
|
584
590
|
) {
|
|
585
591
|
this.logger.verbose(
|
|
586
592
|
"Authentication Scheme 'pop' is not supported yet, setting Authentication Scheme to 'Bearer' for request",
|
|
587
|
-
|
|
593
|
+
correlationId
|
|
588
594
|
);
|
|
589
595
|
}
|
|
590
596
|
|
|
591
|
-
authRequest.authenticationScheme =
|
|
592
|
-
|
|
593
|
-
// Set requested claims hash if claims-based caching is enabled and claims were requested
|
|
594
|
-
if (
|
|
595
|
-
this.config.cache.claimsBasedCachingEnabled &&
|
|
596
|
-
authRequest.claims &&
|
|
597
|
-
// Checks for empty stringified object "{}" which doesn't qualify as requested claims
|
|
598
|
-
!StringUtils.isEmptyObj(authRequest.claims)
|
|
599
|
-
) {
|
|
600
|
-
authRequest.requestedClaimsHash =
|
|
601
|
-
await this.cryptoProvider.hashString(authRequest.claims);
|
|
602
|
-
}
|
|
597
|
+
authRequest.authenticationScheme =
|
|
598
|
+
Constants.AuthenticationScheme.BEARER;
|
|
603
599
|
|
|
604
600
|
return {
|
|
605
601
|
...authRequest,
|
|
606
602
|
scopes: [
|
|
607
603
|
...((authRequest && authRequest.scopes) || []),
|
|
608
|
-
...OIDC_DEFAULT_SCOPES,
|
|
604
|
+
...Constants.OIDC_DEFAULT_SCOPES,
|
|
609
605
|
],
|
|
610
|
-
correlationId
|
|
611
|
-
(authRequest && authRequest.correlationId) ||
|
|
612
|
-
this.cryptoProvider.createNewGuid(),
|
|
606
|
+
correlationId,
|
|
613
607
|
authority: authRequest.authority || this.config.auth.authority,
|
|
614
608
|
};
|
|
615
609
|
}
|
|
@@ -655,13 +649,11 @@ export abstract class ClientApplication {
|
|
|
655
649
|
);
|
|
656
650
|
|
|
657
651
|
const authorityOptions: AuthorityOptions = {
|
|
658
|
-
protocolMode: this.config.
|
|
652
|
+
protocolMode: this.config.system.protocolMode,
|
|
659
653
|
knownAuthorities: this.config.auth.knownAuthorities,
|
|
660
654
|
cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
|
|
661
655
|
authorityMetadata: this.config.auth.authorityMetadata,
|
|
662
656
|
azureRegionConfiguration,
|
|
663
|
-
skipAuthorityMetadataCache:
|
|
664
|
-
this.config.auth.skipAuthorityMetadataCache,
|
|
665
657
|
};
|
|
666
658
|
|
|
667
659
|
return AuthorityFactory.createDiscoveredInstance(
|
|
@@ -670,7 +662,8 @@ export abstract class ClientApplication {
|
|
|
670
662
|
this.storage,
|
|
671
663
|
authorityOptions,
|
|
672
664
|
this.logger,
|
|
673
|
-
requestCorrelationId
|
|
665
|
+
requestCorrelationId,
|
|
666
|
+
new StubPerformanceClient()
|
|
674
667
|
);
|
|
675
668
|
}
|
|
676
669
|
|
|
@@ -6,14 +6,13 @@
|
|
|
6
6
|
import jwt from "jsonwebtoken";
|
|
7
7
|
import {
|
|
8
8
|
TimeUtils,
|
|
9
|
-
Constants,
|
|
10
9
|
createClientAuthError,
|
|
11
|
-
|
|
12
|
-
EncodingTypes,
|
|
10
|
+
Constants,
|
|
13
11
|
} from "@azure/msal-common/node";
|
|
14
12
|
import { CryptoProvider } from "../crypto/CryptoProvider.js";
|
|
15
13
|
import { EncodingUtils } from "../utils/EncodingUtils.js";
|
|
16
14
|
import { JwtConstants } from "../utils/Constants.js";
|
|
15
|
+
import * as NodeClientAuthErrorCodes from "../error/ClientAuthErrorCodes.js";
|
|
17
16
|
|
|
18
17
|
/**
|
|
19
18
|
* Client assertion of type jwt-bearer used in confidential client flows
|
|
@@ -117,7 +116,7 @@ export class ClientAssertion {
|
|
|
117
116
|
return this.jwt;
|
|
118
117
|
}
|
|
119
118
|
|
|
120
|
-
throw createClientAuthError(
|
|
119
|
+
throw createClientAuthError(NodeClientAuthErrorCodes.invalidAssertion);
|
|
121
120
|
}
|
|
122
121
|
|
|
123
122
|
/**
|
|
@@ -146,7 +145,7 @@ export class ClientAssertion {
|
|
|
146
145
|
Object.assign(header, {
|
|
147
146
|
[thumbprintHeader]: EncodingUtils.base64EncodeUrl(
|
|
148
147
|
this.thumbprint,
|
|
149
|
-
EncodingTypes.HEX
|
|
148
|
+
Constants.EncodingTypes.HEX
|
|
150
149
|
),
|
|
151
150
|
} as Partial<jwt.JwtHeader>);
|
|
152
151
|
|
|
@@ -195,7 +194,7 @@ export class ClientAssertion {
|
|
|
195
194
|
let matches;
|
|
196
195
|
while ((matches = regexToFindCerts.exec(publicCertificate)) !== null) {
|
|
197
196
|
// matches[1] represents the first parens capture group in the regex.
|
|
198
|
-
certs.push(matches[1].replace(/\r*\n/g,
|
|
197
|
+
certs.push(matches[1].replace(/\r*\n/g, ""));
|
|
199
198
|
}
|
|
200
199
|
|
|
201
200
|
return certs;
|
|
@@ -6,19 +6,12 @@
|
|
|
6
6
|
import {
|
|
7
7
|
AccessTokenEntity,
|
|
8
8
|
AuthenticationResult,
|
|
9
|
-
AuthenticationScheme,
|
|
10
9
|
Authority,
|
|
11
|
-
BaseClient,
|
|
12
10
|
CacheManager,
|
|
13
|
-
CacheOutcome,
|
|
14
11
|
ClientAuthErrorCodes,
|
|
15
12
|
ClientConfiguration,
|
|
16
|
-
CommonClientCredentialRequest,
|
|
17
13
|
Constants,
|
|
18
14
|
CredentialFilter,
|
|
19
|
-
CredentialType,
|
|
20
|
-
DEFAULT_TOKEN_RENEWAL_OFFSET_SEC,
|
|
21
|
-
GrantType,
|
|
22
15
|
IAppTokenProvider,
|
|
23
16
|
ICrypto,
|
|
24
17
|
RequestParameterBuilder,
|
|
@@ -40,6 +33,8 @@ import {
|
|
|
40
33
|
ManagedIdentityConfiguration,
|
|
41
34
|
ManagedIdentityNodeConfiguration,
|
|
42
35
|
} from "../config/Configuration.js";
|
|
36
|
+
import { CommonClientCredentialRequest } from "../request/CommonClientCredentialRequest.js";
|
|
37
|
+
import { BaseClient } from "./BaseClient.js";
|
|
43
38
|
|
|
44
39
|
/**
|
|
45
40
|
* OAuth2.0 client credential grant
|
|
@@ -79,9 +74,13 @@ export class ClientCredentialClient extends BaseClient {
|
|
|
79
74
|
|
|
80
75
|
if (cachedAuthenticationResult) {
|
|
81
76
|
// if the token is not expired but must be refreshed; get a new one in the background
|
|
82
|
-
if (
|
|
77
|
+
if (
|
|
78
|
+
lastCacheOutcome ===
|
|
79
|
+
Constants.CacheOutcome.PROACTIVELY_REFRESHED
|
|
80
|
+
) {
|
|
83
81
|
this.logger.info(
|
|
84
|
-
"ClientCredentialClient:getCachedAuthenticationResult - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed."
|
|
82
|
+
"ClientCredentialClient:getCachedAuthenticationResult - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed.",
|
|
83
|
+
request.correlationId
|
|
85
84
|
);
|
|
86
85
|
|
|
87
86
|
// refresh the access token in the background
|
|
@@ -110,12 +109,13 @@ export class ClientCredentialClient extends BaseClient {
|
|
|
110
109
|
authority: Authority,
|
|
111
110
|
cacheManager: CacheManager,
|
|
112
111
|
serverTelemetryManager?: ServerTelemetryManager | null
|
|
113
|
-
): Promise<[AuthenticationResult | null, CacheOutcome]> {
|
|
112
|
+
): Promise<[AuthenticationResult | null, Constants.CacheOutcome]> {
|
|
114
113
|
const clientConfiguration = config as ClientConfiguration;
|
|
115
114
|
const managedIdentityConfiguration =
|
|
116
115
|
config as ManagedIdentityNodeConfiguration;
|
|
117
116
|
|
|
118
|
-
let lastCacheOutcome: CacheOutcome =
|
|
117
|
+
let lastCacheOutcome: Constants.CacheOutcome =
|
|
118
|
+
Constants.CacheOutcome.NOT_APPLICABLE;
|
|
119
119
|
|
|
120
120
|
// read the user-supplied cache into memory, if applicable
|
|
121
121
|
let cacheContext;
|
|
@@ -154,9 +154,9 @@ export class ClientCredentialClient extends BaseClient {
|
|
|
154
154
|
// must refresh due to non-existent access_token
|
|
155
155
|
if (!cachedAccessToken) {
|
|
156
156
|
serverTelemetryManager?.setCacheOutcome(
|
|
157
|
-
CacheOutcome.NO_CACHED_ACCESS_TOKEN
|
|
157
|
+
Constants.CacheOutcome.NO_CACHED_ACCESS_TOKEN
|
|
158
158
|
);
|
|
159
|
-
return [null, CacheOutcome.NO_CACHED_ACCESS_TOKEN];
|
|
159
|
+
return [null, Constants.CacheOutcome.NO_CACHED_ACCESS_TOKEN];
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
// must refresh due to the expires_in value
|
|
@@ -164,13 +164,13 @@ export class ClientCredentialClient extends BaseClient {
|
|
|
164
164
|
TimeUtils.isTokenExpired(
|
|
165
165
|
cachedAccessToken.expiresOn,
|
|
166
166
|
clientConfiguration.systemOptions?.tokenRenewalOffsetSeconds ||
|
|
167
|
-
DEFAULT_TOKEN_RENEWAL_OFFSET_SEC
|
|
167
|
+
Constants.DEFAULT_TOKEN_RENEWAL_OFFSET_SEC
|
|
168
168
|
)
|
|
169
169
|
) {
|
|
170
170
|
serverTelemetryManager?.setCacheOutcome(
|
|
171
|
-
CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED
|
|
171
|
+
Constants.CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED
|
|
172
172
|
);
|
|
173
|
-
return [null, CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED];
|
|
173
|
+
return [null, Constants.CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED];
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
// must refresh (in the background) due to the refresh_in value
|
|
@@ -178,9 +178,9 @@ export class ClientCredentialClient extends BaseClient {
|
|
|
178
178
|
cachedAccessToken.refreshOn &&
|
|
179
179
|
TimeUtils.isTokenExpired(cachedAccessToken.refreshOn.toString(), 0)
|
|
180
180
|
) {
|
|
181
|
-
lastCacheOutcome = CacheOutcome.PROACTIVELY_REFRESHED;
|
|
181
|
+
lastCacheOutcome = Constants.CacheOutcome.PROACTIVELY_REFRESHED;
|
|
182
182
|
serverTelemetryManager?.setCacheOutcome(
|
|
183
|
-
CacheOutcome.PROACTIVELY_REFRESHED
|
|
183
|
+
Constants.CacheOutcome.PROACTIVELY_REFRESHED
|
|
184
184
|
);
|
|
185
185
|
}
|
|
186
186
|
|
|
@@ -196,7 +196,8 @@ export class ClientCredentialClient extends BaseClient {
|
|
|
196
196
|
appMetadata: null,
|
|
197
197
|
},
|
|
198
198
|
true,
|
|
199
|
-
request
|
|
199
|
+
request,
|
|
200
|
+
this.performanceClient
|
|
200
201
|
),
|
|
201
202
|
lastCacheOutcome,
|
|
202
203
|
];
|
|
@@ -213,10 +214,10 @@ export class ClientCredentialClient extends BaseClient {
|
|
|
213
214
|
correlationId: string
|
|
214
215
|
): AccessTokenEntity | null {
|
|
215
216
|
const accessTokenFilter: CredentialFilter = {
|
|
216
|
-
homeAccountId:
|
|
217
|
+
homeAccountId: "",
|
|
217
218
|
environment:
|
|
218
219
|
authority.canonicalAuthorityUrlComponents.HostNameAndPort,
|
|
219
|
-
credentialType: CredentialType.ACCESS_TOKEN,
|
|
220
|
+
credentialType: Constants.CredentialType.ACCESS_TOKEN,
|
|
220
221
|
clientId: id,
|
|
221
222
|
realm: authority.tenant,
|
|
222
223
|
target: ScopeSet.createSearchScopes(scopeSet.asArray()),
|
|
@@ -250,7 +251,10 @@ export class ClientCredentialClient extends BaseClient {
|
|
|
250
251
|
let reqTimestamp: number;
|
|
251
252
|
|
|
252
253
|
if (this.appTokenProvider) {
|
|
253
|
-
this.logger.info(
|
|
254
|
+
this.logger.info(
|
|
255
|
+
"Using appTokenProvider extensibility.",
|
|
256
|
+
request.correlationId
|
|
257
|
+
);
|
|
254
258
|
|
|
255
259
|
const appTokenPropviderParameters = {
|
|
256
260
|
correlationId: request.correlationId,
|
|
@@ -268,7 +272,7 @@ export class ClientCredentialClient extends BaseClient {
|
|
|
268
272
|
access_token: appTokenProviderResult.accessToken,
|
|
269
273
|
expires_in: appTokenProviderResult.expiresInSeconds,
|
|
270
274
|
refresh_in: appTokenProviderResult.refreshInSeconds,
|
|
271
|
-
token_type: AuthenticationScheme.BEARER,
|
|
275
|
+
token_type: Constants.AuthenticationScheme.BEARER,
|
|
272
276
|
};
|
|
273
277
|
} else {
|
|
274
278
|
const queryParametersString =
|
|
@@ -294,7 +298,8 @@ export class ClientCredentialClient extends BaseClient {
|
|
|
294
298
|
};
|
|
295
299
|
|
|
296
300
|
this.logger.info(
|
|
297
|
-
"Sending token request to endpoint: " + authority.tokenEndpoint
|
|
301
|
+
"Sending token request to endpoint: " + authority.tokenEndpoint,
|
|
302
|
+
request.correlationId
|
|
298
303
|
);
|
|
299
304
|
|
|
300
305
|
reqTimestamp = TimeUtils.nowSeconds();
|
|
@@ -315,12 +320,14 @@ export class ClientCredentialClient extends BaseClient {
|
|
|
315
320
|
this.cacheManager,
|
|
316
321
|
this.cryptoUtils,
|
|
317
322
|
this.logger,
|
|
323
|
+
this.performanceClient,
|
|
318
324
|
this.config.serializableCache,
|
|
319
325
|
this.config.persistencePlugin
|
|
320
326
|
);
|
|
321
327
|
|
|
322
328
|
responseHandler.validateTokenResponse(
|
|
323
329
|
serverTokenResponse,
|
|
330
|
+
request.correlationId,
|
|
324
331
|
refreshAccessToken
|
|
325
332
|
);
|
|
326
333
|
|
|
@@ -352,7 +359,7 @@ export class ClientCredentialClient extends BaseClient {
|
|
|
352
359
|
|
|
353
360
|
RequestParameterBuilder.addGrantType(
|
|
354
361
|
parameters,
|
|
355
|
-
GrantType.CLIENT_CREDENTIALS_GRANT
|
|
362
|
+
Constants.GrantType.CLIENT_CREDENTIALS_GRANT
|
|
356
363
|
);
|
|
357
364
|
|
|
358
365
|
RequestParameterBuilder.addLibraryInfo(
|
|
@@ -15,26 +15,25 @@ import {
|
|
|
15
15
|
MSAL_FORCE_REGION,
|
|
16
16
|
} from "../utils/Constants.js";
|
|
17
17
|
import {
|
|
18
|
-
CommonClientCredentialRequest,
|
|
19
|
-
CommonOnBehalfOfRequest,
|
|
20
18
|
AuthenticationResult,
|
|
21
19
|
AzureRegionConfiguration,
|
|
22
20
|
AuthError,
|
|
23
21
|
IAppTokenProvider,
|
|
24
|
-
|
|
22
|
+
Constants,
|
|
25
23
|
UrlString,
|
|
26
|
-
AADAuthorityConstants,
|
|
27
24
|
createClientAuthError,
|
|
28
|
-
ClientAuthErrorCodes,
|
|
29
25
|
ClientAssertion as ClientAssertionType,
|
|
30
26
|
getClientAssertion,
|
|
31
27
|
AzureRegion,
|
|
32
28
|
} from "@azure/msal-common/node";
|
|
33
29
|
import { IConfidentialClientApplication } from "./IConfidentialClientApplication.js";
|
|
34
30
|
import { OnBehalfOfRequest } from "../request/OnBehalfOfRequest.js";
|
|
31
|
+
import { CommonOnBehalfOfRequest } from "../request/CommonOnBehalfOfRequest.js";
|
|
32
|
+
import { CommonClientCredentialRequest } from "../request/CommonClientCredentialRequest.js";
|
|
35
33
|
import { ClientCredentialRequest } from "../request/ClientCredentialRequest.js";
|
|
36
34
|
import { ClientCredentialClient } from "./ClientCredentialClient.js";
|
|
37
35
|
import { OnBehalfOfClient } from "./OnBehalfOfClient.js";
|
|
36
|
+
import * as NodeClientAuthErrorCodes from "../error/ClientAuthErrorCodes.js";
|
|
38
37
|
|
|
39
38
|
/**
|
|
40
39
|
* This class is to be used to acquire tokens for confidential client applications (webApp, webAPI). Confidential client applications
|
|
@@ -91,7 +90,7 @@ export class ConfidentialClientApplication
|
|
|
91
90
|
(clientSecretNotEmpty && certificateNotEmpty)
|
|
92
91
|
) {
|
|
93
92
|
throw createClientAuthError(
|
|
94
|
-
|
|
93
|
+
NodeClientAuthErrorCodes.invalidClientCredential
|
|
95
94
|
);
|
|
96
95
|
}
|
|
97
96
|
|
|
@@ -108,7 +107,7 @@ export class ConfidentialClientApplication
|
|
|
108
107
|
|
|
109
108
|
if (!certificateNotEmpty) {
|
|
110
109
|
throw createClientAuthError(
|
|
111
|
-
|
|
110
|
+
NodeClientAuthErrorCodes.invalidClientCredential
|
|
112
111
|
);
|
|
113
112
|
} else {
|
|
114
113
|
this.clientAssertion = !!this.config.auth.clientCertificate
|
|
@@ -146,7 +145,7 @@ export class ConfidentialClientApplication
|
|
|
146
145
|
): Promise<AuthenticationResult | null> {
|
|
147
146
|
this.logger.info(
|
|
148
147
|
"acquireTokenByClientCredential called",
|
|
149
|
-
request.correlationId
|
|
148
|
+
request.correlationId || ""
|
|
150
149
|
);
|
|
151
150
|
|
|
152
151
|
// If there is a client assertion present in the request, it overrides the one present in the client configuration
|
|
@@ -168,7 +167,8 @@ export class ConfidentialClientApplication
|
|
|
168
167
|
const validBaseRequest = {
|
|
169
168
|
...baseRequest,
|
|
170
169
|
scopes: baseRequest.scopes.filter(
|
|
171
|
-
(scope: string) =>
|
|
170
|
+
(scope: string) =>
|
|
171
|
+
!Constants.OIDC_DEFAULT_SCOPES.includes(scope)
|
|
172
172
|
),
|
|
173
173
|
};
|
|
174
174
|
|
|
@@ -185,12 +185,12 @@ export class ConfidentialClientApplication
|
|
|
185
185
|
const authority = new UrlString(validRequest.authority);
|
|
186
186
|
const tenantId = authority.getUrlComponents().PathSegments[0];
|
|
187
187
|
if (
|
|
188
|
-
Object.values(
|
|
189
|
-
tenantId as
|
|
188
|
+
Object.values(Constants.AADAuthority).includes(
|
|
189
|
+
tenantId as Constants.AADAuthority
|
|
190
190
|
)
|
|
191
191
|
) {
|
|
192
192
|
throw createClientAuthError(
|
|
193
|
-
|
|
193
|
+
NodeClientAuthErrorCodes.missingTenantIdError
|
|
194
194
|
);
|
|
195
195
|
}
|
|
196
196
|
|
|
@@ -268,7 +268,7 @@ export class ConfidentialClientApplication
|
|
|
268
268
|
): Promise<AuthenticationResult | null> {
|
|
269
269
|
this.logger.info(
|
|
270
270
|
"acquireTokenOnBehalfOf called",
|
|
271
|
-
request.correlationId
|
|
271
|
+
request.correlationId || ""
|
|
272
272
|
);
|
|
273
273
|
const validRequest: CommonOnBehalfOfRequest = {
|
|
274
274
|
...request,
|