@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
|
@@ -6,13 +6,8 @@
|
|
|
6
6
|
import {
|
|
7
7
|
AuthErrorCodes,
|
|
8
8
|
AuthenticationResult,
|
|
9
|
-
BaseClient,
|
|
10
|
-
ClientAuthErrorCodes,
|
|
11
9
|
ClientConfiguration,
|
|
12
|
-
CommonDeviceCodeRequest,
|
|
13
|
-
Constants,
|
|
14
10
|
DeviceCodeResponse,
|
|
15
|
-
GrantType,
|
|
16
11
|
RequestParameterBuilder,
|
|
17
12
|
RequestThumbprint,
|
|
18
13
|
ResponseHandler,
|
|
@@ -24,7 +19,11 @@ import {
|
|
|
24
19
|
UrlUtils,
|
|
25
20
|
createAuthError,
|
|
26
21
|
createClientAuthError,
|
|
22
|
+
Constants,
|
|
27
23
|
} from "@azure/msal-common/node";
|
|
24
|
+
import { CommonDeviceCodeRequest } from "../request/CommonDeviceCodeRequest.js";
|
|
25
|
+
import * as NodeClientAuthErrorCodes from "../error/ClientAuthErrorCodes.js";
|
|
26
|
+
import { BaseClient } from "./BaseClient.js";
|
|
28
27
|
|
|
29
28
|
/**
|
|
30
29
|
* OAuth2.0 Device code client
|
|
@@ -56,12 +55,13 @@ export class DeviceCodeClient extends BaseClient {
|
|
|
56
55
|
this.cacheManager,
|
|
57
56
|
this.cryptoUtils,
|
|
58
57
|
this.logger,
|
|
58
|
+
this.performanceClient,
|
|
59
59
|
this.config.serializableCache,
|
|
60
60
|
this.config.persistencePlugin
|
|
61
61
|
);
|
|
62
62
|
|
|
63
63
|
// Validate response. This function throws a server error if an error is returned by the server.
|
|
64
|
-
responseHandler.validateTokenResponse(response);
|
|
64
|
+
responseHandler.validateTokenResponse(response, request.correlationId);
|
|
65
65
|
return responseHandler.handleServerTokenResponse(
|
|
66
66
|
response,
|
|
67
67
|
this.authority,
|
|
@@ -115,7 +115,7 @@ export class DeviceCodeClient extends BaseClient {
|
|
|
115
115
|
const parameters = new Map<string, string>();
|
|
116
116
|
|
|
117
117
|
if (request.extraQueryParameters) {
|
|
118
|
-
RequestParameterBuilder.
|
|
118
|
+
RequestParameterBuilder.addExtraParameters(
|
|
119
119
|
parameters,
|
|
120
120
|
request.extraQueryParameters
|
|
121
121
|
);
|
|
@@ -182,7 +182,7 @@ export class DeviceCodeClient extends BaseClient {
|
|
|
182
182
|
);
|
|
183
183
|
|
|
184
184
|
if (request.extraQueryParameters) {
|
|
185
|
-
RequestParameterBuilder.
|
|
185
|
+
RequestParameterBuilder.addExtraParameters(
|
|
186
186
|
parameters,
|
|
187
187
|
request.extraQueryParameters
|
|
188
188
|
);
|
|
@@ -216,10 +216,11 @@ export class DeviceCodeClient extends BaseClient {
|
|
|
216
216
|
): boolean {
|
|
217
217
|
if (userSpecifiedCancelFlag) {
|
|
218
218
|
this.logger.error(
|
|
219
|
-
"Token request cancelled by setting DeviceCodeRequest.cancel = true"
|
|
219
|
+
"Token request cancelled by setting DeviceCodeRequest.cancel = true",
|
|
220
|
+
""
|
|
220
221
|
);
|
|
221
222
|
throw createClientAuthError(
|
|
222
|
-
|
|
223
|
+
NodeClientAuthErrorCodes.deviceCodePollingCancelled
|
|
223
224
|
);
|
|
224
225
|
} else if (
|
|
225
226
|
userSpecifiedTimeout &&
|
|
@@ -227,21 +228,26 @@ export class DeviceCodeClient extends BaseClient {
|
|
|
227
228
|
TimeUtils.nowSeconds() > userSpecifiedTimeout
|
|
228
229
|
) {
|
|
229
230
|
this.logger.error(
|
|
230
|
-
`User defined timeout for device code polling reached. The timeout was set for ${userSpecifiedTimeout}
|
|
231
|
+
`User defined timeout for device code polling reached. The timeout was set for ${userSpecifiedTimeout}`,
|
|
232
|
+
""
|
|
231
233
|
);
|
|
232
234
|
throw createClientAuthError(
|
|
233
|
-
|
|
235
|
+
NodeClientAuthErrorCodes.userTimeoutReached
|
|
234
236
|
);
|
|
235
237
|
} else if (TimeUtils.nowSeconds() > deviceCodeExpirationTime) {
|
|
236
238
|
if (userSpecifiedTimeout) {
|
|
237
239
|
this.logger.verbose(
|
|
238
|
-
`User specified timeout ignored as the device code has expired before the timeout elapsed. The user specified timeout was set for ${userSpecifiedTimeout}
|
|
240
|
+
`User specified timeout ignored as the device code has expired before the timeout elapsed. The user specified timeout was set for ${userSpecifiedTimeout}`,
|
|
241
|
+
""
|
|
239
242
|
);
|
|
240
243
|
}
|
|
241
244
|
this.logger.error(
|
|
242
|
-
`Device code expired. Expiration time of device code was ${deviceCodeExpirationTime}
|
|
245
|
+
`Device code expired. Expiration time of device code was ${deviceCodeExpirationTime}`,
|
|
246
|
+
""
|
|
247
|
+
);
|
|
248
|
+
throw createClientAuthError(
|
|
249
|
+
NodeClientAuthErrorCodes.deviceCodeExpired
|
|
243
250
|
);
|
|
244
|
-
throw createClientAuthError(ClientAuthErrorCodes.deviceCodeExpired);
|
|
245
251
|
}
|
|
246
252
|
return true;
|
|
247
253
|
}
|
|
@@ -308,13 +314,15 @@ export class DeviceCodeClient extends BaseClient {
|
|
|
308
314
|
// user authorization is pending. Sleep for polling interval and try again
|
|
309
315
|
if (response.body.error === Constants.AUTHORIZATION_PENDING) {
|
|
310
316
|
this.logger.info(
|
|
311
|
-
"Authorization pending. Continue polling."
|
|
317
|
+
"Authorization pending. Continue polling.",
|
|
318
|
+
request.correlationId
|
|
312
319
|
);
|
|
313
320
|
await TimeUtils.delay(pollingIntervalMilli);
|
|
314
321
|
} else {
|
|
315
322
|
// for any other error, throw
|
|
316
323
|
this.logger.info(
|
|
317
|
-
"Unexpected error in polling from the server"
|
|
324
|
+
"Unexpected error in polling from the server",
|
|
325
|
+
request.correlationId
|
|
318
326
|
);
|
|
319
327
|
throw createAuthError(
|
|
320
328
|
AuthErrorCodes.postRequestFailed,
|
|
@@ -323,7 +331,8 @@ export class DeviceCodeClient extends BaseClient {
|
|
|
323
331
|
}
|
|
324
332
|
} else {
|
|
325
333
|
this.logger.verbose(
|
|
326
|
-
"Authorization completed successfully. Polling stopped."
|
|
334
|
+
"Authorization completed successfully. Polling stopped.",
|
|
335
|
+
request.correlationId
|
|
327
336
|
);
|
|
328
337
|
return response.body;
|
|
329
338
|
}
|
|
@@ -333,9 +342,12 @@ export class DeviceCodeClient extends BaseClient {
|
|
|
333
342
|
* The above code should've thrown by this point, but to satisfy TypeScript,
|
|
334
343
|
* and in the rare case the conditionals in continuePolling() may not catch everything...
|
|
335
344
|
*/
|
|
336
|
-
this.logger.error(
|
|
345
|
+
this.logger.error(
|
|
346
|
+
"Polling stopped for unknown reasons.",
|
|
347
|
+
request.correlationId
|
|
348
|
+
);
|
|
337
349
|
throw createClientAuthError(
|
|
338
|
-
|
|
350
|
+
NodeClientAuthErrorCodes.deviceCodeUnknownError
|
|
339
351
|
);
|
|
340
352
|
}
|
|
341
353
|
|
|
@@ -357,7 +369,7 @@ export class DeviceCodeClient extends BaseClient {
|
|
|
357
369
|
);
|
|
358
370
|
RequestParameterBuilder.addGrantType(
|
|
359
371
|
parameters,
|
|
360
|
-
GrantType.DEVICE_CODE_GRANT
|
|
372
|
+
Constants.GrantType.DEVICE_CODE_GRANT
|
|
361
373
|
);
|
|
362
374
|
RequestParameterBuilder.addDeviceCode(
|
|
363
375
|
parameters,
|
|
@@ -7,9 +7,7 @@ import {
|
|
|
7
7
|
AuthOptions,
|
|
8
8
|
Authority,
|
|
9
9
|
AuthorityOptions,
|
|
10
|
-
CacheOutcome,
|
|
11
10
|
ClientConfiguration,
|
|
12
|
-
Constants,
|
|
13
11
|
DEFAULT_CRYPTO_IMPLEMENTATION,
|
|
14
12
|
INetworkModule,
|
|
15
13
|
Logger,
|
|
@@ -18,7 +16,8 @@ import {
|
|
|
18
16
|
AuthenticationResult,
|
|
19
17
|
createClientConfigurationError,
|
|
20
18
|
ClientConfigurationErrorCodes,
|
|
21
|
-
|
|
19
|
+
Constants,
|
|
20
|
+
StubPerformanceClient,
|
|
22
21
|
} from "@azure/msal-common/node";
|
|
23
22
|
import {
|
|
24
23
|
ManagedIdentityConfiguration,
|
|
@@ -104,7 +103,7 @@ export class ManagedIdentityApplication {
|
|
|
104
103
|
fakeAuthorityOptions,
|
|
105
104
|
this.logger,
|
|
106
105
|
this.cryptoProvider.createNewGuid(), // correlationID
|
|
107
|
-
|
|
106
|
+
new StubPerformanceClient(),
|
|
108
107
|
true
|
|
109
108
|
);
|
|
110
109
|
|
|
@@ -190,7 +189,7 @@ export class ManagedIdentityApplication {
|
|
|
190
189
|
) {
|
|
191
190
|
const revokedTokenSha256Hash: string = this.hashUtils
|
|
192
191
|
.sha256(cachedAuthenticationResult.accessToken)
|
|
193
|
-
.toString(EncodingTypes.HEX);
|
|
192
|
+
.toString(Constants.EncodingTypes.HEX);
|
|
194
193
|
managedIdentityRequest.revokedTokenSha256Hash =
|
|
195
194
|
revokedTokenSha256Hash;
|
|
196
195
|
}
|
|
@@ -204,9 +203,13 @@ export class ManagedIdentityApplication {
|
|
|
204
203
|
|
|
205
204
|
if (cachedAuthenticationResult) {
|
|
206
205
|
// if the token is not expired but must be refreshed; get a new one in the background
|
|
207
|
-
if (
|
|
206
|
+
if (
|
|
207
|
+
lastCacheOutcome ===
|
|
208
|
+
Constants.CacheOutcome.PROACTIVELY_REFRESHED
|
|
209
|
+
) {
|
|
208
210
|
this.logger.info(
|
|
209
|
-
"ClientCredentialClient:getCachedAuthenticationResult - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed."
|
|
211
|
+
"ClientCredentialClient:getCachedAuthenticationResult - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed.",
|
|
212
|
+
managedIdentityRequest.correlationId
|
|
210
213
|
);
|
|
211
214
|
|
|
212
215
|
// force refresh; will run in the background
|
|
@@ -117,7 +117,8 @@ export class AppService extends BaseManagedIdentitySource {
|
|
|
117
117
|
// if either of the identity endpoint or identity header variables are undefined, this MSI provider is unavailable.
|
|
118
118
|
if (!identityEndpoint || !identityHeader) {
|
|
119
119
|
logger.info(
|
|
120
|
-
`[Managed Identity] ${ManagedIdentitySourceNames.APP_SERVICE} managed identity is unavailable because one or both of the '${ManagedIdentityEnvironmentVariableNames.IDENTITY_HEADER}' and '${ManagedIdentityEnvironmentVariableNames.IDENTITY_ENDPOINT}' environment variables are not defined
|
|
120
|
+
`[Managed Identity] ${ManagedIdentitySourceNames.APP_SERVICE} managed identity is unavailable because one or both of the '${ManagedIdentityEnvironmentVariableNames.IDENTITY_HEADER}' and '${ManagedIdentityEnvironmentVariableNames.IDENTITY_ENDPOINT}' environment variables are not defined.`,
|
|
121
|
+
""
|
|
121
122
|
);
|
|
122
123
|
return null;
|
|
123
124
|
}
|
|
@@ -131,7 +132,8 @@ export class AppService extends BaseManagedIdentitySource {
|
|
|
131
132
|
);
|
|
132
133
|
|
|
133
134
|
logger.info(
|
|
134
|
-
`[Managed Identity] Environment variables validation passed for ${ManagedIdentitySourceNames.APP_SERVICE} managed identity. Endpoint URI: ${validatedIdentityEndpoint}. Creating ${ManagedIdentitySourceNames.APP_SERVICE} managed identity
|
|
135
|
+
`[Managed Identity] Environment variables validation passed for ${ManagedIdentitySourceNames.APP_SERVICE} managed identity. Endpoint URI: ${validatedIdentityEndpoint}. Creating ${ManagedIdentitySourceNames.APP_SERVICE} managed identity.`,
|
|
136
|
+
""
|
|
135
137
|
);
|
|
136
138
|
|
|
137
139
|
return new AppService(
|
|
@@ -7,13 +7,12 @@ import {
|
|
|
7
7
|
AuthError,
|
|
8
8
|
ClientAuthErrorCodes,
|
|
9
9
|
createClientAuthError,
|
|
10
|
-
HttpStatus,
|
|
11
10
|
INetworkModule,
|
|
12
11
|
NetworkResponse,
|
|
13
12
|
NetworkRequestOptions,
|
|
14
13
|
Logger,
|
|
15
14
|
ServerAuthorizationTokenResponse,
|
|
16
|
-
|
|
15
|
+
Constants,
|
|
17
16
|
} from "@azure/msal-common/node";
|
|
18
17
|
import { ManagedIdentityRequestParameters } from "../../config/ManagedIdentityRequestParameters.js";
|
|
19
18
|
import { BaseManagedIdentitySource } from "./BaseManagedIdentitySource.js";
|
|
@@ -183,7 +182,8 @@ export class AzureArc extends BaseManagedIdentitySource {
|
|
|
183
182
|
// if either of the identity or imds endpoints are undefined (even after himds file detection)
|
|
184
183
|
if (!identityEndpoint || !imdsEndpoint) {
|
|
185
184
|
logger.info(
|
|
186
|
-
`[Managed Identity] ${ManagedIdentitySourceNames.AZURE_ARC} managed identity is unavailable through environment variables because one or both of '${ManagedIdentityEnvironmentVariableNames.IDENTITY_ENDPOINT}' and '${ManagedIdentityEnvironmentVariableNames.IMDS_ENDPOINT}' are not defined. ${ManagedIdentitySourceNames.AZURE_ARC} managed identity is also unavailable through file detection
|
|
185
|
+
`[Managed Identity] ${ManagedIdentitySourceNames.AZURE_ARC} managed identity is unavailable through environment variables because one or both of '${ManagedIdentityEnvironmentVariableNames.IDENTITY_ENDPOINT}' and '${ManagedIdentityEnvironmentVariableNames.IMDS_ENDPOINT}' are not defined. ${ManagedIdentitySourceNames.AZURE_ARC} managed identity is also unavailable through file detection.`,
|
|
186
|
+
""
|
|
187
187
|
);
|
|
188
188
|
|
|
189
189
|
return null;
|
|
@@ -192,7 +192,8 @@ export class AzureArc extends BaseManagedIdentitySource {
|
|
|
192
192
|
// check if the imds endpoint is set to the default for file detection
|
|
193
193
|
if (imdsEndpoint === HIMDS_EXECUTABLE_HELPER_STRING) {
|
|
194
194
|
logger.info(
|
|
195
|
-
`[Managed Identity] ${ManagedIdentitySourceNames.AZURE_ARC} managed identity is available through file detection. Defaulting to known ${ManagedIdentitySourceNames.AZURE_ARC} endpoint: ${DEFAULT_AZURE_ARC_IDENTITY_ENDPOINT}. Creating ${ManagedIdentitySourceNames.AZURE_ARC} managed identity
|
|
195
|
+
`[Managed Identity] ${ManagedIdentitySourceNames.AZURE_ARC} managed identity is available through file detection. Defaulting to known ${ManagedIdentitySourceNames.AZURE_ARC} endpoint: ${DEFAULT_AZURE_ARC_IDENTITY_ENDPOINT}. Creating ${ManagedIdentitySourceNames.AZURE_ARC} managed identity.`,
|
|
196
|
+
""
|
|
196
197
|
);
|
|
197
198
|
} else {
|
|
198
199
|
// otherwise, both the identity and imds endpoints are defined without file detection; validate them
|
|
@@ -217,7 +218,8 @@ export class AzureArc extends BaseManagedIdentitySource {
|
|
|
217
218
|
);
|
|
218
219
|
|
|
219
220
|
logger.info(
|
|
220
|
-
`[Managed Identity] Environment variables validation passed for ${ManagedIdentitySourceNames.AZURE_ARC} managed identity. Endpoint URI: ${validatedIdentityEndpoint}. Creating ${ManagedIdentitySourceNames.AZURE_ARC} managed identity
|
|
221
|
+
`[Managed Identity] Environment variables validation passed for ${ManagedIdentitySourceNames.AZURE_ARC} managed identity. Endpoint URI: ${validatedIdentityEndpoint}. Creating ${ManagedIdentitySourceNames.AZURE_ARC} managed identity.`,
|
|
222
|
+
""
|
|
221
223
|
);
|
|
222
224
|
}
|
|
223
225
|
|
|
@@ -303,7 +305,7 @@ export class AzureArc extends BaseManagedIdentitySource {
|
|
|
303
305
|
| NetworkResponse<ManagedIdentityTokenResponse>
|
|
304
306
|
| undefined;
|
|
305
307
|
|
|
306
|
-
if (originalResponse.status ===
|
|
308
|
+
if (originalResponse.status === Constants.HTTP_UNAUTHORIZED) {
|
|
307
309
|
const wwwAuthHeader: string =
|
|
308
310
|
originalResponse.headers["www-authenticate"];
|
|
309
311
|
if (!wwwAuthHeader) {
|
|
@@ -372,7 +374,10 @@ export class AzureArc extends BaseManagedIdentitySource {
|
|
|
372
374
|
// attempt to read the contents of the secret file
|
|
373
375
|
let secret;
|
|
374
376
|
try {
|
|
375
|
-
secret = readFileSync(
|
|
377
|
+
secret = readFileSync(
|
|
378
|
+
secretFilePath,
|
|
379
|
+
Constants.EncodingTypes.UTF8
|
|
380
|
+
);
|
|
376
381
|
} catch (e) {
|
|
377
382
|
throw createManagedIdentityError(
|
|
378
383
|
ManagedIdentityErrorCodes.unableToReadSecretFile
|
|
@@ -381,7 +386,8 @@ export class AzureArc extends BaseManagedIdentitySource {
|
|
|
381
386
|
const authHeaderValue = `Basic ${secret}`;
|
|
382
387
|
|
|
383
388
|
this.logger.info(
|
|
384
|
-
`[Managed Identity] Adding authorization header to the request
|
|
389
|
+
`[Managed Identity] Adding authorization header to the request.`,
|
|
390
|
+
""
|
|
385
391
|
);
|
|
386
392
|
networkRequest.headers[
|
|
387
393
|
ManagedIdentityHeaders.AUTHORIZATION_HEADER_NAME
|
|
@@ -7,8 +7,6 @@ import {
|
|
|
7
7
|
AuthError,
|
|
8
8
|
Authority,
|
|
9
9
|
ClientAuthErrorCodes,
|
|
10
|
-
Constants,
|
|
11
|
-
HeaderNames,
|
|
12
10
|
INetworkModule,
|
|
13
11
|
Logger,
|
|
14
12
|
NetworkRequestOptions,
|
|
@@ -19,6 +17,8 @@ import {
|
|
|
19
17
|
createClientAuthError,
|
|
20
18
|
AuthenticationResult,
|
|
21
19
|
UrlString,
|
|
20
|
+
Constants,
|
|
21
|
+
StubPerformanceClient,
|
|
22
22
|
} from "@azure/msal-common/node";
|
|
23
23
|
import { ManagedIdentityId } from "../../config/ManagedIdentityId.js";
|
|
24
24
|
import { ManagedIdentityRequestParameters } from "../../config/ManagedIdentityRequestParameters.js";
|
|
@@ -215,7 +215,8 @@ export abstract class BaseManagedIdentitySource {
|
|
|
215
215
|
|
|
216
216
|
if (managedIdentityRequest.revokedTokenSha256Hash) {
|
|
217
217
|
this.logger.info(
|
|
218
|
-
`[Managed Identity] The following claims are present in the request: ${managedIdentityRequest.claims}
|
|
218
|
+
`[Managed Identity] The following claims are present in the request: ${managedIdentityRequest.claims}`,
|
|
219
|
+
""
|
|
219
220
|
);
|
|
220
221
|
|
|
221
222
|
networkRequest.queryParameters[
|
|
@@ -228,7 +229,8 @@ export abstract class BaseManagedIdentitySource {
|
|
|
228
229
|
managedIdentityRequest.clientCapabilities.toString();
|
|
229
230
|
|
|
230
231
|
this.logger.info(
|
|
231
|
-
`[Managed Identity] The following client capabilities are present in the request: ${clientCapabilities}
|
|
232
|
+
`[Managed Identity] The following client capabilities are present in the request: ${clientCapabilities}`,
|
|
233
|
+
""
|
|
232
234
|
);
|
|
233
235
|
|
|
234
236
|
networkRequest.queryParameters[
|
|
@@ -237,7 +239,8 @@ export abstract class BaseManagedIdentitySource {
|
|
|
237
239
|
}
|
|
238
240
|
|
|
239
241
|
const headers: Record<string, string> = networkRequest.headers;
|
|
240
|
-
headers[HeaderNames.CONTENT_TYPE] =
|
|
242
|
+
headers[Constants.HeaderNames.CONTENT_TYPE] =
|
|
243
|
+
Constants.URL_FORM_CONTENT_TYPE;
|
|
241
244
|
|
|
242
245
|
const networkRequestOptions: NetworkRequestOptions = { headers };
|
|
243
246
|
|
|
@@ -290,6 +293,7 @@ export abstract class BaseManagedIdentitySource {
|
|
|
290
293
|
this.nodeStorage,
|
|
291
294
|
this.cryptoProvider,
|
|
292
295
|
this.logger,
|
|
296
|
+
new StubPerformanceClient(),
|
|
293
297
|
null,
|
|
294
298
|
null
|
|
295
299
|
);
|
|
@@ -304,6 +308,7 @@ export abstract class BaseManagedIdentitySource {
|
|
|
304
308
|
|
|
305
309
|
responseHandler.validateTokenResponse(
|
|
306
310
|
serverTokenResponse,
|
|
311
|
+
serverTokenResponse.correlation_id || "",
|
|
307
312
|
refreshAccessToken
|
|
308
313
|
);
|
|
309
314
|
|
|
@@ -339,7 +344,8 @@ export abstract class BaseManagedIdentitySource {
|
|
|
339
344
|
this.logger.info(
|
|
340
345
|
`[Managed Identity] [API version ${
|
|
341
346
|
usesApi2017 ? "2017+" : "2019+"
|
|
342
|
-
}] Adding user assigned client id to the request
|
|
347
|
+
}] Adding user assigned client id to the request.`,
|
|
348
|
+
""
|
|
343
349
|
);
|
|
344
350
|
// The Machine Learning source uses the 2017-09-01 API version, which uses "clientid" instead of "client_id"
|
|
345
351
|
return usesApi2017
|
|
@@ -348,7 +354,8 @@ export abstract class BaseManagedIdentitySource {
|
|
|
348
354
|
|
|
349
355
|
case ManagedIdentityIdType.USER_ASSIGNED_RESOURCE_ID:
|
|
350
356
|
this.logger.info(
|
|
351
|
-
"[Managed Identity] Adding user assigned resource id to the request."
|
|
357
|
+
"[Managed Identity] Adding user assigned resource id to the request.",
|
|
358
|
+
""
|
|
352
359
|
);
|
|
353
360
|
return isImds
|
|
354
361
|
? ManagedIdentityUserAssignedIdQueryParameterNames.MANAGED_IDENTITY_RESOURCE_ID_IMDS
|
|
@@ -356,7 +363,8 @@ export abstract class BaseManagedIdentitySource {
|
|
|
356
363
|
|
|
357
364
|
case ManagedIdentityIdType.USER_ASSIGNED_OBJECT_ID:
|
|
358
365
|
this.logger.info(
|
|
359
|
-
"[Managed Identity] Adding user assigned object id to the request."
|
|
366
|
+
"[Managed Identity] Adding user assigned object id to the request.",
|
|
367
|
+
""
|
|
360
368
|
);
|
|
361
369
|
return ManagedIdentityUserAssignedIdQueryParameterNames.MANAGED_IDENTITY_OBJECT_ID;
|
|
362
370
|
default:
|
|
@@ -390,7 +398,8 @@ export abstract class BaseManagedIdentitySource {
|
|
|
390
398
|
return new UrlString(envVariable).urlString;
|
|
391
399
|
} catch (error) {
|
|
392
400
|
logger.info(
|
|
393
|
-
`[Managed Identity] ${sourceName} managed identity is unavailable because the '${envVariableStringName}' environment variable is malformed
|
|
401
|
+
`[Managed Identity] ${sourceName} managed identity is unavailable because the '${envVariableStringName}' environment variable is malformed.`,
|
|
402
|
+
""
|
|
394
403
|
);
|
|
395
404
|
|
|
396
405
|
throw createManagedIdentityError(
|
|
@@ -110,7 +110,8 @@ export class CloudShell extends BaseManagedIdentitySource {
|
|
|
110
110
|
// if the msi endpoint environment variable is undefined, this MSI provider is unavailable.
|
|
111
111
|
if (!msiEndpoint) {
|
|
112
112
|
logger.info(
|
|
113
|
-
`[Managed Identity] ${ManagedIdentitySourceNames.CLOUD_SHELL} managed identity is unavailable because the '${ManagedIdentityEnvironmentVariableNames.MSI_ENDPOINT} environment variable is not defined
|
|
113
|
+
`[Managed Identity] ${ManagedIdentitySourceNames.CLOUD_SHELL} managed identity is unavailable because the '${ManagedIdentityEnvironmentVariableNames.MSI_ENDPOINT} environment variable is not defined.`,
|
|
114
|
+
""
|
|
114
115
|
);
|
|
115
116
|
return null;
|
|
116
117
|
}
|
|
@@ -124,7 +125,8 @@ export class CloudShell extends BaseManagedIdentitySource {
|
|
|
124
125
|
);
|
|
125
126
|
|
|
126
127
|
logger.info(
|
|
127
|
-
`[Managed Identity] Environment variable validation passed for ${ManagedIdentitySourceNames.CLOUD_SHELL} managed identity. Endpoint URI: ${validatedMsiEndpoint}. Creating ${ManagedIdentitySourceNames.CLOUD_SHELL} managed identity
|
|
128
|
+
`[Managed Identity] Environment variable validation passed for ${ManagedIdentitySourceNames.CLOUD_SHELL} managed identity. Endpoint URI: ${validatedMsiEndpoint}. Creating ${ManagedIdentitySourceNames.CLOUD_SHELL} managed identity.`,
|
|
129
|
+
""
|
|
128
130
|
);
|
|
129
131
|
|
|
130
132
|
if (
|
|
@@ -105,7 +105,8 @@ export class Imds extends BaseManagedIdentitySource {
|
|
|
105
105
|
ManagedIdentityEnvironmentVariableNames
|
|
106
106
|
.AZURE_POD_IDENTITY_AUTHORITY_HOST
|
|
107
107
|
]
|
|
108
|
-
}
|
|
108
|
+
}`,
|
|
109
|
+
""
|
|
109
110
|
);
|
|
110
111
|
validatedIdentityEndpoint = Imds.getValidatedEnvVariableUrlString(
|
|
111
112
|
ManagedIdentityEnvironmentVariableNames.AZURE_POD_IDENTITY_AUTHORITY_HOST,
|
|
@@ -120,7 +121,8 @@ export class Imds extends BaseManagedIdentitySource {
|
|
|
120
121
|
);
|
|
121
122
|
} else {
|
|
122
123
|
logger.info(
|
|
123
|
-
`[Managed Identity] Unable to find ${ManagedIdentityEnvironmentVariableNames.AZURE_POD_IDENTITY_AUTHORITY_HOST} environment variable for ${ManagedIdentitySourceNames.IMDS}, using the default endpoint
|
|
124
|
+
`[Managed Identity] Unable to find ${ManagedIdentityEnvironmentVariableNames.AZURE_POD_IDENTITY_AUTHORITY_HOST} environment variable for ${ManagedIdentitySourceNames.IMDS}, using the default endpoint.`,
|
|
125
|
+
""
|
|
124
126
|
);
|
|
125
127
|
validatedIdentityEndpoint = DEFAULT_IMDS_ENDPOINT;
|
|
126
128
|
}
|
|
@@ -117,7 +117,8 @@ export class MachineLearning extends BaseManagedIdentitySource {
|
|
|
117
117
|
// if either of the MSI endpoint or MSI secret variables are undefined, this MSI provider is unavailable.
|
|
118
118
|
if (!msiEndpoint || !secret) {
|
|
119
119
|
logger.info(
|
|
120
|
-
`[Managed Identity] ${ManagedIdentitySourceNames.MACHINE_LEARNING} managed identity is unavailable because one or both of the '${ManagedIdentityEnvironmentVariableNames.MSI_ENDPOINT}' and '${ManagedIdentityEnvironmentVariableNames.MSI_SECRET}' environment variables are not defined
|
|
120
|
+
`[Managed Identity] ${ManagedIdentitySourceNames.MACHINE_LEARNING} managed identity is unavailable because one or both of the '${ManagedIdentityEnvironmentVariableNames.MSI_ENDPOINT}' and '${ManagedIdentityEnvironmentVariableNames.MSI_SECRET}' environment variables are not defined.`,
|
|
121
|
+
""
|
|
121
122
|
);
|
|
122
123
|
return null;
|
|
123
124
|
}
|
|
@@ -131,7 +132,8 @@ export class MachineLearning extends BaseManagedIdentitySource {
|
|
|
131
132
|
);
|
|
132
133
|
|
|
133
134
|
logger.info(
|
|
134
|
-
`[Managed Identity] Environment variables validation passed for ${ManagedIdentitySourceNames.MACHINE_LEARNING} managed identity. Endpoint URI: ${validatedMsiEndpoint}. Creating ${ManagedIdentitySourceNames.MACHINE_LEARNING} managed identity
|
|
135
|
+
`[Managed Identity] Environment variables validation passed for ${ManagedIdentitySourceNames.MACHINE_LEARNING} managed identity. Endpoint URI: ${validatedMsiEndpoint}. Creating ${ManagedIdentitySourceNames.MACHINE_LEARNING} managed identity.`,
|
|
136
|
+
""
|
|
135
137
|
);
|
|
136
138
|
|
|
137
139
|
return new MachineLearning(
|
|
@@ -125,7 +125,8 @@ export class ServiceFabric extends BaseManagedIdentitySource {
|
|
|
125
125
|
|
|
126
126
|
if (!identityEndpoint || !identityHeader || !identityServerThumbprint) {
|
|
127
127
|
logger.info(
|
|
128
|
-
`[Managed Identity] ${ManagedIdentitySourceNames.SERVICE_FABRIC} managed identity is unavailable because one or all of the '${ManagedIdentityEnvironmentVariableNames.IDENTITY_HEADER}', '${ManagedIdentityEnvironmentVariableNames.IDENTITY_ENDPOINT}' or '${ManagedIdentityEnvironmentVariableNames.IDENTITY_SERVER_THUMBPRINT}' environment variables are not defined
|
|
128
|
+
`[Managed Identity] ${ManagedIdentitySourceNames.SERVICE_FABRIC} managed identity is unavailable because one or all of the '${ManagedIdentityEnvironmentVariableNames.IDENTITY_HEADER}', '${ManagedIdentityEnvironmentVariableNames.IDENTITY_ENDPOINT}' or '${ManagedIdentityEnvironmentVariableNames.IDENTITY_SERVER_THUMBPRINT}' environment variables are not defined.`,
|
|
129
|
+
""
|
|
129
130
|
);
|
|
130
131
|
return null;
|
|
131
132
|
}
|
|
@@ -139,14 +140,16 @@ export class ServiceFabric extends BaseManagedIdentitySource {
|
|
|
139
140
|
);
|
|
140
141
|
|
|
141
142
|
logger.info(
|
|
142
|
-
`[Managed Identity] Environment variables validation passed for ${ManagedIdentitySourceNames.SERVICE_FABRIC} managed identity. Endpoint URI: ${validatedIdentityEndpoint}. Creating ${ManagedIdentitySourceNames.SERVICE_FABRIC} managed identity
|
|
143
|
+
`[Managed Identity] Environment variables validation passed for ${ManagedIdentitySourceNames.SERVICE_FABRIC} managed identity. Endpoint URI: ${validatedIdentityEndpoint}. Creating ${ManagedIdentitySourceNames.SERVICE_FABRIC} managed identity.`,
|
|
144
|
+
""
|
|
143
145
|
);
|
|
144
146
|
|
|
145
147
|
if (
|
|
146
148
|
managedIdentityId.idType !== ManagedIdentityIdType.SYSTEM_ASSIGNED
|
|
147
149
|
) {
|
|
148
150
|
logger.warning(
|
|
149
|
-
`[Managed Identity] ${ManagedIdentitySourceNames.SERVICE_FABRIC} user assigned managed identity is configured in the cluster, not during runtime. See also: https://learn.microsoft.com/en-us/azure/service-fabric/configure-existing-cluster-enable-managed-identity-token-service
|
|
151
|
+
`[Managed Identity] ${ManagedIdentitySourceNames.SERVICE_FABRIC} user assigned managed identity is configured in the cluster, not during runtime. See also: https://learn.microsoft.com/en-us/azure/service-fabric/configure-existing-cluster-enable-managed-identity-token-service.`,
|
|
152
|
+
""
|
|
150
153
|
);
|
|
151
154
|
}
|
|
152
155
|
|
|
@@ -9,19 +9,13 @@ import {
|
|
|
9
9
|
AccountEntity,
|
|
10
10
|
AccountInfo,
|
|
11
11
|
AuthenticationResult,
|
|
12
|
-
AuthenticationScheme,
|
|
13
12
|
Authority,
|
|
14
13
|
AuthToken,
|
|
15
|
-
BaseClient,
|
|
16
|
-
CacheOutcome,
|
|
17
14
|
ClientAuthErrorCodes,
|
|
18
15
|
ClientConfiguration,
|
|
19
|
-
CommonOnBehalfOfRequest,
|
|
20
|
-
Constants,
|
|
21
16
|
createClientAuthError,
|
|
22
17
|
CredentialFilter,
|
|
23
|
-
|
|
24
|
-
GrantType,
|
|
18
|
+
Constants,
|
|
25
19
|
IdTokenEntity,
|
|
26
20
|
RequestParameterBuilder,
|
|
27
21
|
RequestThumbprint,
|
|
@@ -35,6 +29,8 @@ import {
|
|
|
35
29
|
UrlUtils,
|
|
36
30
|
} from "@azure/msal-common/node";
|
|
37
31
|
import { EncodingUtils } from "../utils/EncodingUtils.js";
|
|
32
|
+
import { CommonOnBehalfOfRequest } from "../request/CommonOnBehalfOfRequest.js";
|
|
33
|
+
import { BaseClient } from "./BaseClient.js";
|
|
38
34
|
|
|
39
35
|
/**
|
|
40
36
|
* On-Behalf-Of client
|
|
@@ -101,10 +97,11 @@ export class OnBehalfOfClient extends BaseClient {
|
|
|
101
97
|
if (!cachedAccessToken) {
|
|
102
98
|
// Must refresh due to non-existent access_token.
|
|
103
99
|
this.serverTelemetryManager?.setCacheOutcome(
|
|
104
|
-
CacheOutcome.NO_CACHED_ACCESS_TOKEN
|
|
100
|
+
Constants.CacheOutcome.NO_CACHED_ACCESS_TOKEN
|
|
105
101
|
);
|
|
106
102
|
this.logger.info(
|
|
107
|
-
"SilentFlowClient:acquireCachedToken - No access token found in cache for the given properties."
|
|
103
|
+
"SilentFlowClient:acquireCachedToken - No access token found in cache for the given properties.",
|
|
104
|
+
request.correlationId
|
|
108
105
|
);
|
|
109
106
|
throw createClientAuthError(
|
|
110
107
|
ClientAuthErrorCodes.tokenRefreshRequired
|
|
@@ -117,10 +114,11 @@ export class OnBehalfOfClient extends BaseClient {
|
|
|
117
114
|
) {
|
|
118
115
|
// Access token expired, will need to renewed
|
|
119
116
|
this.serverTelemetryManager?.setCacheOutcome(
|
|
120
|
-
CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED
|
|
117
|
+
Constants.CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED
|
|
121
118
|
);
|
|
122
119
|
this.logger.info(
|
|
123
|
-
`OnbehalfofFlow:getCachedAuthenticationResult - Cached access token is expired or will expire within ${this.config.systemOptions.tokenRenewalOffsetSeconds} seconds
|
|
120
|
+
`OnbehalfofFlow:getCachedAuthenticationResult - Cached access token is expired or will expire within ${this.config.systemOptions.tokenRenewalOffsetSeconds} seconds.`,
|
|
121
|
+
request.correlationId
|
|
124
122
|
);
|
|
125
123
|
throw createClientAuthError(
|
|
126
124
|
ClientAuthErrorCodes.tokenRefreshRequired
|
|
@@ -144,8 +142,8 @@ export class OnBehalfOfClient extends BaseClient {
|
|
|
144
142
|
homeAccountId: cachedIdToken.homeAccountId,
|
|
145
143
|
environment: cachedIdToken.environment,
|
|
146
144
|
tenantId: cachedIdToken.realm,
|
|
147
|
-
username:
|
|
148
|
-
localAccountId: localAccountId ||
|
|
145
|
+
username: "",
|
|
146
|
+
localAccountId: localAccountId || "",
|
|
149
147
|
};
|
|
150
148
|
|
|
151
149
|
cachedAccount = this.cacheManager.getAccount(
|
|
@@ -171,6 +169,7 @@ export class OnBehalfOfClient extends BaseClient {
|
|
|
171
169
|
},
|
|
172
170
|
true,
|
|
173
171
|
request,
|
|
172
|
+
this.performanceClient,
|
|
174
173
|
idTokenClaims
|
|
175
174
|
);
|
|
176
175
|
}
|
|
@@ -188,7 +187,7 @@ export class OnBehalfOfClient extends BaseClient {
|
|
|
188
187
|
homeAccountId: atHomeAccountId,
|
|
189
188
|
environment:
|
|
190
189
|
this.authority.canonicalAuthorityUrlComponents.HostNameAndPort,
|
|
191
|
-
credentialType: CredentialType.ID_TOKEN,
|
|
190
|
+
credentialType: Constants.CredentialType.ID_TOKEN,
|
|
192
191
|
clientId: this.config.authOptions.clientId,
|
|
193
192
|
realm: this.authority.tenant,
|
|
194
193
|
};
|
|
@@ -213,7 +212,8 @@ export class OnBehalfOfClient extends BaseClient {
|
|
|
213
212
|
request: CommonOnBehalfOfRequest
|
|
214
213
|
) {
|
|
215
214
|
const authScheme =
|
|
216
|
-
request.authenticationScheme ||
|
|
215
|
+
request.authenticationScheme ||
|
|
216
|
+
Constants.AuthenticationScheme.BEARER;
|
|
217
217
|
/*
|
|
218
218
|
* Distinguish between Bearer and PoP/SSH token cache types
|
|
219
219
|
* Cast to lowercase to handle "bearer" from ADFS
|
|
@@ -221,9 +221,9 @@ export class OnBehalfOfClient extends BaseClient {
|
|
|
221
221
|
const credentialType =
|
|
222
222
|
authScheme &&
|
|
223
223
|
authScheme.toLowerCase() !==
|
|
224
|
-
AuthenticationScheme.BEARER.toLowerCase()
|
|
225
|
-
? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME
|
|
226
|
-
: CredentialType.ACCESS_TOKEN;
|
|
224
|
+
Constants.AuthenticationScheme.BEARER.toLowerCase()
|
|
225
|
+
? Constants.CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME
|
|
226
|
+
: Constants.CredentialType.ACCESS_TOKEN;
|
|
227
227
|
|
|
228
228
|
const accessTokenFilter: CredentialFilter = {
|
|
229
229
|
credentialType: credentialType,
|
|
@@ -231,7 +231,6 @@ export class OnBehalfOfClient extends BaseClient {
|
|
|
231
231
|
target: ScopeSet.createSearchScopes(this.scopeSet.asArray()),
|
|
232
232
|
tokenType: authScheme,
|
|
233
233
|
keyId: request.sshKid,
|
|
234
|
-
requestedClaimsHash: request.requestedClaimsHash,
|
|
235
234
|
userAssertionHash: this.userAssertionHash,
|
|
236
235
|
};
|
|
237
236
|
|
|
@@ -296,11 +295,15 @@ export class OnBehalfOfClient extends BaseClient {
|
|
|
296
295
|
this.cacheManager,
|
|
297
296
|
this.cryptoUtils,
|
|
298
297
|
this.logger,
|
|
298
|
+
this.performanceClient,
|
|
299
299
|
this.config.serializableCache,
|
|
300
300
|
this.config.persistencePlugin
|
|
301
301
|
);
|
|
302
302
|
|
|
303
|
-
responseHandler.validateTokenResponse(
|
|
303
|
+
responseHandler.validateTokenResponse(
|
|
304
|
+
response.body,
|
|
305
|
+
request.correlationId
|
|
306
|
+
);
|
|
304
307
|
const tokenResponse = await responseHandler.handleServerTokenResponse(
|
|
305
308
|
response.body,
|
|
306
309
|
this.authority,
|
|
@@ -329,7 +332,10 @@ export class OnBehalfOfClient extends BaseClient {
|
|
|
329
332
|
|
|
330
333
|
RequestParameterBuilder.addScopes(parameters, request.scopes);
|
|
331
334
|
|
|
332
|
-
RequestParameterBuilder.addGrantType(
|
|
335
|
+
RequestParameterBuilder.addGrantType(
|
|
336
|
+
parameters,
|
|
337
|
+
Constants.GrantType.JWT_BEARER
|
|
338
|
+
);
|
|
333
339
|
|
|
334
340
|
RequestParameterBuilder.addClientInfo(parameters);
|
|
335
341
|
|