@azure/msal-node 3.8.0 → 5.0.0-alpha.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/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 +3 -2
- package/dist/client/ClientCredentialClient.d.ts.map +1 -1
- package/dist/client/ClientCredentialClient.mjs +23 -22
- 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 +2 -1
- package/dist/client/DeviceCodeClient.d.ts.map +1 -1
- package/dist/client/DeviceCodeClient.mjs +19 -18
- 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/ManagedIdentityClient.mjs.map +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 +2 -1
- package/dist/client/OnBehalfOfClient.d.ts.map +1 -1
- package/dist/client/OnBehalfOfClient.mjs +19 -19
- package/dist/client/OnBehalfOfClient.mjs.map +1 -1
- package/dist/client/PublicClientApplication.d.ts.map +1 -1
- package/dist/client/PublicClientApplication.mjs +12 -27
- package/dist/client/PublicClientApplication.mjs.map +1 -1
- package/dist/client/UsernamePasswordClient.d.ts +2 -1
- package/dist/client/UsernamePasswordClient.d.ts.map +1 -1
- package/dist/client/UsernamePasswordClient.mjs +8 -8
- package/dist/client/UsernamePasswordClient.mjs.map +1 -1
- package/dist/config/Configuration.d.ts +2 -13
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.mjs +17 -22
- package/dist/config/Configuration.mjs.map +1 -1
- package/dist/config/ManagedIdentityId.mjs +1 -1
- package/dist/config/ManagedIdentityId.mjs.map +1 -1
- package/dist/config/ManagedIdentityRequestParameters.mjs +1 -1
- 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/GuidGenerator.mjs.map +1 -1
- package/dist/crypto/HashUtils.mjs +1 -1
- package/dist/crypto/HashUtils.mjs.map +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/ManagedIdentityError.mjs.map +1 -1
- package/dist/error/ManagedIdentityErrorCodes.mjs +1 -1
- package/dist/error/ManagedIdentityErrorCodes.mjs.map +1 -1
- package/dist/error/NodeAuthError.d.ts +0 -8
- package/dist/error/NodeAuthError.d.ts.map +1 -1
- package/dist/error/NodeAuthError.mjs +1 -11
- package/dist/error/NodeAuthError.mjs.map +1 -1
- package/dist/index.d.ts +15 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +20 -2
- package/dist/index.mjs.map +1 -1
- package/dist/internals.mjs +1 -1
- package/dist/network/HttpClient.d.ts.map +1 -1
- package/dist/network/HttpClient.mjs +15 -13
- 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 +5 -5
- package/dist/protocol/Authorize.mjs.map +1 -1
- package/dist/request/AuthorizationCodeRequest.d.ts +1 -1
- package/dist/request/AuthorizationCodeRequest.d.ts.map +1 -1
- package/dist/request/AuthorizationUrlRequest.d.ts +1 -1
- package/dist/request/AuthorizationUrlRequest.d.ts.map +1 -1
- package/dist/request/ClientCredentialRequest.d.ts +4 -3
- package/dist/request/ClientCredentialRequest.d.ts.map +1 -1
- package/dist/request/CommonClientCredentialRequest.d.ts +16 -0
- package/dist/request/CommonClientCredentialRequest.d.ts.map +1 -0
- package/dist/request/CommonDeviceCodeRequest.d.ts +20 -0
- package/dist/request/CommonDeviceCodeRequest.d.ts.map +1 -0
- package/dist/request/CommonOnBehalfOfRequest.d.ts +14 -0
- package/dist/request/CommonOnBehalfOfRequest.d.ts.map +1 -0
- package/dist/request/CommonUsernamePasswordRequest.d.ts +18 -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 -2
- package/dist/request/OnBehalfOfRequest.d.ts.map +1 -1
- package/dist/request/RefreshTokenRequest.d.ts +1 -1
- package/dist/request/RefreshTokenRequest.d.ts.map +1 -1
- package/dist/request/SilentFlowRequest.d.ts +1 -1
- package/dist/request/SilentFlowRequest.d.ts.map +1 -1
- package/dist/request/UsernamePasswordRequest.d.ts +2 -2
- 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/ExponentialRetryStrategy.mjs.map +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/retry/LinearRetryStrategy.mjs.map +1 -1
- package/dist/utils/Constants.d.ts +4 -4
- package/dist/utils/Constants.mjs +5 -5
- 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/NetworkUtils.mjs +1 -1
- package/dist/utils/NetworkUtils.mjs.map +1 -1
- package/dist/utils/TimeUtils.mjs +1 -1
- package/dist/utils/TimeUtils.mjs.map +1 -1
- package/lib/msal-node.cjs +1396 -2249
- 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/ClientApplication.d.ts.map +1 -1
- package/lib/types/client/ClientAssertion.d.ts.map +1 -1
- package/lib/types/client/ClientCredentialClient.d.ts +3 -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 +2 -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 +2 -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 +2 -1
- package/lib/types/client/UsernamePasswordClient.d.ts.map +1 -1
- package/lib/types/config/Configuration.d.ts +2 -13
- 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/error/NodeAuthError.d.ts +0 -8
- package/lib/types/error/NodeAuthError.d.ts.map +1 -1
- package/lib/types/index.d.ts +15 -5
- package/lib/types/index.d.ts.map +1 -1
- 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 +1 -1
- package/lib/types/request/AuthorizationCodeRequest.d.ts.map +1 -1
- package/lib/types/request/AuthorizationUrlRequest.d.ts +1 -1
- package/lib/types/request/AuthorizationUrlRequest.d.ts.map +1 -1
- package/lib/types/request/ClientCredentialRequest.d.ts +4 -3
- package/lib/types/request/ClientCredentialRequest.d.ts.map +1 -1
- package/lib/types/request/CommonClientCredentialRequest.d.ts +16 -0
- package/lib/types/request/CommonClientCredentialRequest.d.ts.map +1 -0
- package/lib/types/request/CommonDeviceCodeRequest.d.ts +20 -0
- package/lib/types/request/CommonDeviceCodeRequest.d.ts.map +1 -0
- package/lib/types/request/CommonOnBehalfOfRequest.d.ts +14 -0
- package/lib/types/request/CommonOnBehalfOfRequest.d.ts.map +1 -0
- package/lib/types/request/CommonUsernamePasswordRequest.d.ts +18 -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 -2
- package/lib/types/request/OnBehalfOfRequest.d.ts.map +1 -1
- package/lib/types/request/RefreshTokenRequest.d.ts +1 -1
- package/lib/types/request/RefreshTokenRequest.d.ts.map +1 -1
- package/lib/types/request/SilentFlowRequest.d.ts +1 -1
- package/lib/types/request/SilentFlowRequest.d.ts.map +1 -1
- package/lib/types/request/UsernamePasswordRequest.d.ts +2 -2
- 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 +4 -4
- package/lib/types/utils/EncodingUtils.d.ts.map +1 -1
- package/package.json +88 -90
- package/src/cache/CacheHelpers.ts +3 -5
- package/src/cache/NodeStorage.ts +21 -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/ClientApplication.ts +50 -57
- package/src/client/ClientAssertion.ts +5 -6
- package/src/client/ClientCredentialClient.ts +33 -25
- package/src/client/ConfidentialClientApplication.ts +13 -13
- package/src/client/DeviceCodeClient.ts +32 -19
- 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 +28 -21
- package/src/client/PublicClientApplication.ts +13 -31
- package/src/client/UsernamePasswordClient.ts +15 -8
- package/src/config/Configuration.ts +18 -35
- package/src/crypto/CryptoProvider.ts +5 -3
- package/src/crypto/PkceGenerator.ts +6 -4
- package/src/error/ClientAuthErrorCodes.ts +12 -0
- package/src/error/NodeAuthError.ts +0 -14
- package/src/index.ts +5 -11
- package/src/network/HttpClient.ts +11 -9
- 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 +7 -9
- package/src/request/AuthorizationCodeRequest.ts +0 -1
- package/src/request/AuthorizationUrlRequest.ts +0 -1
- package/src/request/ClientCredentialRequest.ts +3 -6
- package/src/request/CommonClientCredentialRequest.ts +25 -0
- package/src/request/CommonDeviceCodeRequest.ts +33 -0
- package/src/request/CommonOnBehalfOfRequest.ts +19 -0
- package/src/request/CommonUsernamePasswordRequest.ts +23 -0
- package/src/request/DeviceCodeRequest.ts +2 -5
- package/src/request/InteractiveRequest.ts +1 -1
- package/src/request/ManagedIdentityRequest.ts +1 -1
- package/src/request/OnBehalfOfRequest.ts +1 -2
- package/src/request/RefreshTokenRequest.ts +0 -1
- package/src/request/SilentFlowRequest.ts +1 -4
- package/src/request/UsernamePasswordRequest.ts +1 -2
- 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 +5 -5
- package/src/utils/EncodingUtils.ts +8 -4
|
@@ -67,7 +67,8 @@ export class CloudShell extends BaseManagedIdentitySource {
|
|
|
67
67
|
// if the msi endpoint environment variable is undefined, this MSI provider is unavailable.
|
|
68
68
|
if (!msiEndpoint) {
|
|
69
69
|
logger.info(
|
|
70
|
-
`[Managed Identity] ${ManagedIdentitySourceNames.CLOUD_SHELL} managed identity is unavailable because the '${ManagedIdentityEnvironmentVariableNames.MSI_ENDPOINT} environment variable is not defined
|
|
70
|
+
`[Managed Identity] ${ManagedIdentitySourceNames.CLOUD_SHELL} managed identity is unavailable because the '${ManagedIdentityEnvironmentVariableNames.MSI_ENDPOINT} environment variable is not defined.`,
|
|
71
|
+
""
|
|
71
72
|
);
|
|
72
73
|
return null;
|
|
73
74
|
}
|
|
@@ -81,7 +82,8 @@ export class CloudShell extends BaseManagedIdentitySource {
|
|
|
81
82
|
);
|
|
82
83
|
|
|
83
84
|
logger.info(
|
|
84
|
-
`[Managed Identity] Environment variable validation passed for ${ManagedIdentitySourceNames.CLOUD_SHELL} managed identity. Endpoint URI: ${validatedMsiEndpoint}. Creating ${ManagedIdentitySourceNames.CLOUD_SHELL} managed identity
|
|
85
|
+
`[Managed Identity] Environment variable validation passed for ${ManagedIdentitySourceNames.CLOUD_SHELL} managed identity. Endpoint URI: ${validatedMsiEndpoint}. Creating ${ManagedIdentitySourceNames.CLOUD_SHELL} managed identity.`,
|
|
86
|
+
""
|
|
85
87
|
);
|
|
86
88
|
|
|
87
89
|
if (
|
|
@@ -94,7 +94,8 @@ export class Imds extends BaseManagedIdentitySource {
|
|
|
94
94
|
ManagedIdentityEnvironmentVariableNames
|
|
95
95
|
.AZURE_POD_IDENTITY_AUTHORITY_HOST
|
|
96
96
|
]
|
|
97
|
-
}
|
|
97
|
+
}`,
|
|
98
|
+
""
|
|
98
99
|
);
|
|
99
100
|
validatedIdentityEndpoint = Imds.getValidatedEnvVariableUrlString(
|
|
100
101
|
ManagedIdentityEnvironmentVariableNames.AZURE_POD_IDENTITY_AUTHORITY_HOST,
|
|
@@ -109,7 +110,8 @@ export class Imds extends BaseManagedIdentitySource {
|
|
|
109
110
|
);
|
|
110
111
|
} else {
|
|
111
112
|
logger.info(
|
|
112
|
-
`[Managed Identity] Unable to find ${ManagedIdentityEnvironmentVariableNames.AZURE_POD_IDENTITY_AUTHORITY_HOST} environment variable for ${ManagedIdentitySourceNames.IMDS}, using the default endpoint
|
|
113
|
+
`[Managed Identity] Unable to find ${ManagedIdentityEnvironmentVariableNames.AZURE_POD_IDENTITY_AUTHORITY_HOST} environment variable for ${ManagedIdentitySourceNames.IMDS}, using the default endpoint.`,
|
|
114
|
+
""
|
|
113
115
|
);
|
|
114
116
|
validatedIdentityEndpoint = DEFAULT_IMDS_ENDPOINT;
|
|
115
117
|
}
|
|
@@ -72,7 +72,8 @@ export class MachineLearning extends BaseManagedIdentitySource {
|
|
|
72
72
|
// if either of the MSI endpoint or MSI secret variables are undefined, this MSI provider is unavailable.
|
|
73
73
|
if (!msiEndpoint || !secret) {
|
|
74
74
|
logger.info(
|
|
75
|
-
`[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
|
|
75
|
+
`[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.`,
|
|
76
|
+
""
|
|
76
77
|
);
|
|
77
78
|
return null;
|
|
78
79
|
}
|
|
@@ -86,7 +87,8 @@ export class MachineLearning extends BaseManagedIdentitySource {
|
|
|
86
87
|
);
|
|
87
88
|
|
|
88
89
|
logger.info(
|
|
89
|
-
`[Managed Identity] Environment variables validation passed for ${ManagedIdentitySourceNames.MACHINE_LEARNING} managed identity. Endpoint URI: ${validatedMsiEndpoint}. Creating ${ManagedIdentitySourceNames.MACHINE_LEARNING} managed identity
|
|
90
|
+
`[Managed Identity] Environment variables validation passed for ${ManagedIdentitySourceNames.MACHINE_LEARNING} managed identity. Endpoint URI: ${validatedMsiEndpoint}. Creating ${ManagedIdentitySourceNames.MACHINE_LEARNING} managed identity.`,
|
|
91
|
+
""
|
|
90
92
|
);
|
|
91
93
|
|
|
92
94
|
return new MachineLearning(
|
|
@@ -103,7 +103,8 @@ export class ServiceFabric extends BaseManagedIdentitySource {
|
|
|
103
103
|
|
|
104
104
|
if (!identityEndpoint || !identityHeader || !identityServerThumbprint) {
|
|
105
105
|
logger.info(
|
|
106
|
-
`[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
|
|
106
|
+
`[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.`,
|
|
107
|
+
""
|
|
107
108
|
);
|
|
108
109
|
return null;
|
|
109
110
|
}
|
|
@@ -117,14 +118,16 @@ export class ServiceFabric extends BaseManagedIdentitySource {
|
|
|
117
118
|
);
|
|
118
119
|
|
|
119
120
|
logger.info(
|
|
120
|
-
`[Managed Identity] Environment variables validation passed for ${ManagedIdentitySourceNames.SERVICE_FABRIC} managed identity. Endpoint URI: ${validatedIdentityEndpoint}. Creating ${ManagedIdentitySourceNames.SERVICE_FABRIC} managed identity
|
|
121
|
+
`[Managed Identity] Environment variables validation passed for ${ManagedIdentitySourceNames.SERVICE_FABRIC} managed identity. Endpoint URI: ${validatedIdentityEndpoint}. Creating ${ManagedIdentitySourceNames.SERVICE_FABRIC} managed identity.`,
|
|
122
|
+
""
|
|
121
123
|
);
|
|
122
124
|
|
|
123
125
|
if (
|
|
124
126
|
managedIdentityId.idType !== ManagedIdentityIdType.SYSTEM_ASSIGNED
|
|
125
127
|
) {
|
|
126
128
|
logger.warning(
|
|
127
|
-
`[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
|
|
129
|
+
`[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.`,
|
|
130
|
+
""
|
|
128
131
|
);
|
|
129
132
|
}
|
|
130
133
|
|
|
@@ -9,19 +9,14 @@ import {
|
|
|
9
9
|
AccountEntity,
|
|
10
10
|
AccountInfo,
|
|
11
11
|
AuthenticationResult,
|
|
12
|
-
AuthenticationScheme,
|
|
13
12
|
Authority,
|
|
14
13
|
AuthToken,
|
|
15
14
|
BaseClient,
|
|
16
|
-
CacheOutcome,
|
|
17
15
|
ClientAuthErrorCodes,
|
|
18
16
|
ClientConfiguration,
|
|
19
|
-
CommonOnBehalfOfRequest,
|
|
20
|
-
Constants,
|
|
21
17
|
createClientAuthError,
|
|
22
18
|
CredentialFilter,
|
|
23
|
-
|
|
24
|
-
GrantType,
|
|
19
|
+
Constants,
|
|
25
20
|
IdTokenEntity,
|
|
26
21
|
RequestParameterBuilder,
|
|
27
22
|
RequestThumbprint,
|
|
@@ -33,8 +28,10 @@ import {
|
|
|
33
28
|
ClientAssertion,
|
|
34
29
|
getClientAssertion,
|
|
35
30
|
UrlUtils,
|
|
31
|
+
StubPerformanceClient,
|
|
36
32
|
} from "@azure/msal-common/node";
|
|
37
33
|
import { EncodingUtils } from "../utils/EncodingUtils.js";
|
|
34
|
+
import { CommonOnBehalfOfRequest } from "../request/CommonOnBehalfOfRequest.js";
|
|
38
35
|
|
|
39
36
|
/**
|
|
40
37
|
* On-Behalf-Of client
|
|
@@ -45,7 +42,7 @@ export class OnBehalfOfClient extends BaseClient {
|
|
|
45
42
|
private userAssertionHash: string;
|
|
46
43
|
|
|
47
44
|
constructor(configuration: ClientConfiguration) {
|
|
48
|
-
super(configuration);
|
|
45
|
+
super(configuration, new StubPerformanceClient());
|
|
49
46
|
}
|
|
50
47
|
|
|
51
48
|
/**
|
|
@@ -101,10 +98,11 @@ export class OnBehalfOfClient extends BaseClient {
|
|
|
101
98
|
if (!cachedAccessToken) {
|
|
102
99
|
// Must refresh due to non-existent access_token.
|
|
103
100
|
this.serverTelemetryManager?.setCacheOutcome(
|
|
104
|
-
CacheOutcome.NO_CACHED_ACCESS_TOKEN
|
|
101
|
+
Constants.CacheOutcome.NO_CACHED_ACCESS_TOKEN
|
|
105
102
|
);
|
|
106
103
|
this.logger.info(
|
|
107
|
-
"SilentFlowClient:acquireCachedToken - No access token found in cache for the given properties."
|
|
104
|
+
"SilentFlowClient:acquireCachedToken - No access token found in cache for the given properties.",
|
|
105
|
+
request.correlationId
|
|
108
106
|
);
|
|
109
107
|
throw createClientAuthError(
|
|
110
108
|
ClientAuthErrorCodes.tokenRefreshRequired
|
|
@@ -117,10 +115,11 @@ export class OnBehalfOfClient extends BaseClient {
|
|
|
117
115
|
) {
|
|
118
116
|
// Access token expired, will need to renewed
|
|
119
117
|
this.serverTelemetryManager?.setCacheOutcome(
|
|
120
|
-
CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED
|
|
118
|
+
Constants.CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED
|
|
121
119
|
);
|
|
122
120
|
this.logger.info(
|
|
123
|
-
`OnbehalfofFlow:getCachedAuthenticationResult - Cached access token is expired or will expire within ${this.config.systemOptions.tokenRenewalOffsetSeconds} seconds
|
|
121
|
+
`OnbehalfofFlow:getCachedAuthenticationResult - Cached access token is expired or will expire within ${this.config.systemOptions.tokenRenewalOffsetSeconds} seconds.`,
|
|
122
|
+
request.correlationId
|
|
124
123
|
);
|
|
125
124
|
throw createClientAuthError(
|
|
126
125
|
ClientAuthErrorCodes.tokenRefreshRequired
|
|
@@ -144,8 +143,8 @@ export class OnBehalfOfClient extends BaseClient {
|
|
|
144
143
|
homeAccountId: cachedIdToken.homeAccountId,
|
|
145
144
|
environment: cachedIdToken.environment,
|
|
146
145
|
tenantId: cachedIdToken.realm,
|
|
147
|
-
username:
|
|
148
|
-
localAccountId: localAccountId ||
|
|
146
|
+
username: "",
|
|
147
|
+
localAccountId: localAccountId || "",
|
|
149
148
|
};
|
|
150
149
|
|
|
151
150
|
cachedAccount = this.cacheManager.getAccount(
|
|
@@ -171,6 +170,7 @@ export class OnBehalfOfClient extends BaseClient {
|
|
|
171
170
|
},
|
|
172
171
|
true,
|
|
173
172
|
request,
|
|
173
|
+
this.performanceClient,
|
|
174
174
|
idTokenClaims
|
|
175
175
|
);
|
|
176
176
|
}
|
|
@@ -188,7 +188,7 @@ export class OnBehalfOfClient extends BaseClient {
|
|
|
188
188
|
homeAccountId: atHomeAccountId,
|
|
189
189
|
environment:
|
|
190
190
|
this.authority.canonicalAuthorityUrlComponents.HostNameAndPort,
|
|
191
|
-
credentialType: CredentialType.ID_TOKEN,
|
|
191
|
+
credentialType: Constants.CredentialType.ID_TOKEN,
|
|
192
192
|
clientId: this.config.authOptions.clientId,
|
|
193
193
|
realm: this.authority.tenant,
|
|
194
194
|
};
|
|
@@ -213,7 +213,8 @@ export class OnBehalfOfClient extends BaseClient {
|
|
|
213
213
|
request: CommonOnBehalfOfRequest
|
|
214
214
|
) {
|
|
215
215
|
const authScheme =
|
|
216
|
-
request.authenticationScheme ||
|
|
216
|
+
request.authenticationScheme ||
|
|
217
|
+
Constants.AuthenticationScheme.BEARER;
|
|
217
218
|
/*
|
|
218
219
|
* Distinguish between Bearer and PoP/SSH token cache types
|
|
219
220
|
* Cast to lowercase to handle "bearer" from ADFS
|
|
@@ -221,9 +222,9 @@ export class OnBehalfOfClient extends BaseClient {
|
|
|
221
222
|
const credentialType =
|
|
222
223
|
authScheme &&
|
|
223
224
|
authScheme.toLowerCase() !==
|
|
224
|
-
AuthenticationScheme.BEARER.toLowerCase()
|
|
225
|
-
? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME
|
|
226
|
-
: CredentialType.ACCESS_TOKEN;
|
|
225
|
+
Constants.AuthenticationScheme.BEARER.toLowerCase()
|
|
226
|
+
? Constants.CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME
|
|
227
|
+
: Constants.CredentialType.ACCESS_TOKEN;
|
|
227
228
|
|
|
228
229
|
const accessTokenFilter: CredentialFilter = {
|
|
229
230
|
credentialType: credentialType,
|
|
@@ -231,7 +232,6 @@ export class OnBehalfOfClient extends BaseClient {
|
|
|
231
232
|
target: ScopeSet.createSearchScopes(this.scopeSet.asArray()),
|
|
232
233
|
tokenType: authScheme,
|
|
233
234
|
keyId: request.sshKid,
|
|
234
|
-
requestedClaimsHash: request.requestedClaimsHash,
|
|
235
235
|
userAssertionHash: this.userAssertionHash,
|
|
236
236
|
};
|
|
237
237
|
|
|
@@ -296,11 +296,15 @@ export class OnBehalfOfClient extends BaseClient {
|
|
|
296
296
|
this.cacheManager,
|
|
297
297
|
this.cryptoUtils,
|
|
298
298
|
this.logger,
|
|
299
|
+
this.performanceClient,
|
|
299
300
|
this.config.serializableCache,
|
|
300
301
|
this.config.persistencePlugin
|
|
301
302
|
);
|
|
302
303
|
|
|
303
|
-
responseHandler.validateTokenResponse(
|
|
304
|
+
responseHandler.validateTokenResponse(
|
|
305
|
+
response.body,
|
|
306
|
+
request.correlationId
|
|
307
|
+
);
|
|
304
308
|
const tokenResponse = await responseHandler.handleServerTokenResponse(
|
|
305
309
|
response.body,
|
|
306
310
|
this.authority,
|
|
@@ -329,7 +333,10 @@ export class OnBehalfOfClient extends BaseClient {
|
|
|
329
333
|
|
|
330
334
|
RequestParameterBuilder.addScopes(parameters, request.scopes);
|
|
331
335
|
|
|
332
|
-
RequestParameterBuilder.addGrantType(
|
|
336
|
+
RequestParameterBuilder.addGrantType(
|
|
337
|
+
parameters,
|
|
338
|
+
Constants.GrantType.JWT_BEARER
|
|
339
|
+
);
|
|
333
340
|
|
|
334
341
|
RequestParameterBuilder.addClientInfo(parameters);
|
|
335
342
|
|
|
@@ -10,11 +10,7 @@ import {
|
|
|
10
10
|
} from "../utils/Constants.js";
|
|
11
11
|
import {
|
|
12
12
|
AuthenticationResult,
|
|
13
|
-
CommonDeviceCodeRequest,
|
|
14
13
|
AuthError,
|
|
15
|
-
ResponseMode,
|
|
16
|
-
OIDC_DEFAULT_SCOPES,
|
|
17
|
-
CodeChallengeMethodValues,
|
|
18
14
|
Constants as CommonConstants,
|
|
19
15
|
ServerError,
|
|
20
16
|
NativeRequest,
|
|
@@ -29,6 +25,7 @@ import { Configuration } from "../config/Configuration.js";
|
|
|
29
25
|
import { ClientApplication } from "./ClientApplication.js";
|
|
30
26
|
import { IPublicClientApplication } from "./IPublicClientApplication.js";
|
|
31
27
|
import { DeviceCodeRequest } from "../request/DeviceCodeRequest.js";
|
|
28
|
+
import { CommonDeviceCodeRequest } from "../request/CommonDeviceCodeRequest.js";
|
|
32
29
|
import { AuthorizationUrlRequest } from "../request/AuthorizationUrlRequest.js";
|
|
33
30
|
import { AuthorizationCodeRequest } from "../request/AuthorizationCodeRequest.js";
|
|
34
31
|
import { InteractiveRequest } from "../request/InteractiveRequest.js";
|
|
@@ -78,7 +75,8 @@ export class PublicClientApplication
|
|
|
78
75
|
);
|
|
79
76
|
} else {
|
|
80
77
|
this.logger.warning(
|
|
81
|
-
"NativeBroker implementation was provided but the broker is unavailable."
|
|
78
|
+
"NativeBroker implementation was provided but the broker is unavailable.",
|
|
79
|
+
""
|
|
82
80
|
);
|
|
83
81
|
}
|
|
84
82
|
}
|
|
@@ -102,7 +100,7 @@ export class PublicClientApplication
|
|
|
102
100
|
): Promise<AuthenticationResult | null> {
|
|
103
101
|
this.logger.info(
|
|
104
102
|
"acquireTokenByDeviceCode called",
|
|
105
|
-
request.correlationId
|
|
103
|
+
request.correlationId || ""
|
|
106
104
|
);
|
|
107
105
|
const validRequest: CommonDeviceCodeRequest = Object.assign(
|
|
108
106
|
request,
|
|
@@ -162,8 +160,8 @@ export class PublicClientApplication
|
|
|
162
160
|
const brokerRequest: NativeRequest = {
|
|
163
161
|
...remainingProperties,
|
|
164
162
|
clientId: this.config.auth.clientId,
|
|
165
|
-
scopes: request.scopes || OIDC_DEFAULT_SCOPES,
|
|
166
|
-
redirectUri:
|
|
163
|
+
scopes: request.scopes || CommonConstants.OIDC_DEFAULT_SCOPES,
|
|
164
|
+
redirectUri: `${Constants.HTTP_PROTOCOL}${Constants.LOCALHOST}`,
|
|
167
165
|
authority: request.authority || this.config.auth.authority,
|
|
168
166
|
correlationId: correlationId,
|
|
169
167
|
extraParameters: {
|
|
@@ -179,15 +177,6 @@ export class PublicClientApplication
|
|
|
179
177
|
);
|
|
180
178
|
}
|
|
181
179
|
|
|
182
|
-
if (request.redirectUri) {
|
|
183
|
-
// If its not a broker fallback scenario, we throw a error
|
|
184
|
-
if (!this.config.broker.nativeBrokerPlugin) {
|
|
185
|
-
throw NodeAuthError.createRedirectUriNotSupportedError();
|
|
186
|
-
}
|
|
187
|
-
// If a redirect URI is provided for a broker flow but MSAL runtime startup failed, we fall back to the browser flow and will ignore the redirect URI provided for the broker flow
|
|
188
|
-
request.redirectUri = "";
|
|
189
|
-
}
|
|
190
|
-
|
|
191
180
|
const { verifier, challenge } =
|
|
192
181
|
await this.cryptoProvider.generatePkceCodes();
|
|
193
182
|
|
|
@@ -213,11 +202,12 @@ export class PublicClientApplication
|
|
|
213
202
|
const validRequest: AuthorizationUrlRequest = {
|
|
214
203
|
...remainingProperties,
|
|
215
204
|
correlationId: correlationId,
|
|
216
|
-
scopes: request.scopes || OIDC_DEFAULT_SCOPES,
|
|
205
|
+
scopes: request.scopes || CommonConstants.OIDC_DEFAULT_SCOPES,
|
|
217
206
|
redirectUri: redirectUri,
|
|
218
|
-
responseMode: ResponseMode.QUERY,
|
|
207
|
+
responseMode: CommonConstants.ResponseMode.QUERY,
|
|
219
208
|
codeChallenge: challenge,
|
|
220
|
-
codeChallengeMethod:
|
|
209
|
+
codeChallengeMethod:
|
|
210
|
+
CommonConstants.CodeChallengeMethodValues.S256,
|
|
221
211
|
};
|
|
222
212
|
|
|
223
213
|
const authCodeUrl = await this.getAuthCodeUrl(validRequest);
|
|
@@ -241,7 +231,7 @@ export class PublicClientApplication
|
|
|
241
231
|
const tokenRequest: AuthorizationCodeRequest = {
|
|
242
232
|
code: authCodeResponse.code,
|
|
243
233
|
codeVerifier: verifier,
|
|
244
|
-
clientInfo: clientInfo ||
|
|
234
|
+
clientInfo: clientInfo || "",
|
|
245
235
|
...validRequest,
|
|
246
236
|
};
|
|
247
237
|
return await this.acquireTokenByCode(tokenRequest); // Await this so the server doesn't close prematurely
|
|
@@ -266,8 +256,8 @@ export class PublicClientApplication
|
|
|
266
256
|
const brokerRequest: NativeRequest = {
|
|
267
257
|
...request,
|
|
268
258
|
clientId: this.config.auth.clientId,
|
|
269
|
-
scopes: request.scopes || OIDC_DEFAULT_SCOPES,
|
|
270
|
-
redirectUri:
|
|
259
|
+
scopes: request.scopes || CommonConstants.OIDC_DEFAULT_SCOPES,
|
|
260
|
+
redirectUri: `${Constants.HTTP_PROTOCOL}${Constants.LOCALHOST}`,
|
|
271
261
|
authority: request.authority || this.config.auth.authority,
|
|
272
262
|
correlationId: correlationId,
|
|
273
263
|
extraParameters: {
|
|
@@ -280,14 +270,6 @@ export class PublicClientApplication
|
|
|
280
270
|
return this.nativeBrokerPlugin.acquireTokenSilent(brokerRequest);
|
|
281
271
|
}
|
|
282
272
|
|
|
283
|
-
if (request.redirectUri) {
|
|
284
|
-
// If its not a broker fallback scenario, we throw a error
|
|
285
|
-
if (!this.config.broker.nativeBrokerPlugin) {
|
|
286
|
-
throw NodeAuthError.createRedirectUriNotSupportedError();
|
|
287
|
-
}
|
|
288
|
-
request.redirectUri = "";
|
|
289
|
-
}
|
|
290
|
-
|
|
291
273
|
return super.acquireTokenSilent(request);
|
|
292
274
|
}
|
|
293
275
|
|
|
@@ -10,10 +10,8 @@ import {
|
|
|
10
10
|
CcsCredentialType,
|
|
11
11
|
ClientAssertion,
|
|
12
12
|
ClientConfiguration,
|
|
13
|
-
CommonUsernamePasswordRequest,
|
|
14
|
-
GrantType,
|
|
15
13
|
NetworkResponse,
|
|
16
|
-
|
|
14
|
+
Constants,
|
|
17
15
|
RequestParameterBuilder,
|
|
18
16
|
RequestThumbprint,
|
|
19
17
|
ResponseHandler,
|
|
@@ -23,7 +21,9 @@ import {
|
|
|
23
21
|
UrlString,
|
|
24
22
|
UrlUtils,
|
|
25
23
|
getClientAssertion,
|
|
24
|
+
StubPerformanceClient,
|
|
26
25
|
} from "@azure/msal-common/node";
|
|
26
|
+
import { CommonUsernamePasswordRequest } from "../request/CommonUsernamePasswordRequest.js";
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Oauth2.0 Password grant client
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
*/
|
|
34
34
|
export class UsernamePasswordClient extends BaseClient {
|
|
35
35
|
constructor(configuration: ClientConfiguration) {
|
|
36
|
-
super(configuration);
|
|
36
|
+
super(configuration, new StubPerformanceClient());
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
/**
|
|
@@ -44,7 +44,10 @@ export class UsernamePasswordClient extends BaseClient {
|
|
|
44
44
|
async acquireToken(
|
|
45
45
|
request: CommonUsernamePasswordRequest
|
|
46
46
|
): Promise<AuthenticationResult | null> {
|
|
47
|
-
this.logger.info(
|
|
47
|
+
this.logger.info(
|
|
48
|
+
"in acquireToken call in username-password client",
|
|
49
|
+
request.correlationId
|
|
50
|
+
);
|
|
48
51
|
|
|
49
52
|
const reqTimestamp = TimeUtils.nowSeconds();
|
|
50
53
|
const response = await this.executeTokenRequest(
|
|
@@ -57,12 +60,16 @@ export class UsernamePasswordClient extends BaseClient {
|
|
|
57
60
|
this.cacheManager,
|
|
58
61
|
this.cryptoUtils,
|
|
59
62
|
this.logger,
|
|
63
|
+
this.performanceClient,
|
|
60
64
|
this.config.serializableCache,
|
|
61
65
|
this.config.persistencePlugin
|
|
62
66
|
);
|
|
63
67
|
|
|
64
68
|
// Validate response. This function throws a server error if an error is returned by the server.
|
|
65
|
-
responseHandler.validateTokenResponse(
|
|
69
|
+
responseHandler.validateTokenResponse(
|
|
70
|
+
response.body,
|
|
71
|
+
request.correlationId
|
|
72
|
+
);
|
|
66
73
|
const tokenResponse = responseHandler.handleServerTokenResponse(
|
|
67
74
|
response.body,
|
|
68
75
|
this.authority,
|
|
@@ -133,12 +140,12 @@ export class UsernamePasswordClient extends BaseClient {
|
|
|
133
140
|
|
|
134
141
|
RequestParameterBuilder.addResponseType(
|
|
135
142
|
parameters,
|
|
136
|
-
OAuthResponseType.IDTOKEN_TOKEN
|
|
143
|
+
Constants.OAuthResponseType.IDTOKEN_TOKEN
|
|
137
144
|
);
|
|
138
145
|
|
|
139
146
|
RequestParameterBuilder.addGrantType(
|
|
140
147
|
parameters,
|
|
141
|
-
GrantType.RESOURCE_OWNER_PASSWORD_GRANT
|
|
148
|
+
Constants.GrantType.RESOURCE_OWNER_PASSWORD_GRANT
|
|
142
149
|
);
|
|
143
150
|
RequestParameterBuilder.addClientInfo(parameters);
|
|
144
151
|
|
|
@@ -9,12 +9,12 @@ import {
|
|
|
9
9
|
LogLevel,
|
|
10
10
|
ProtocolMode,
|
|
11
11
|
ICachePlugin,
|
|
12
|
-
Constants,
|
|
13
12
|
AzureCloudInstance,
|
|
14
13
|
AzureCloudOptions,
|
|
15
14
|
ApplicationTelemetry,
|
|
16
15
|
INativeBrokerPlugin,
|
|
17
16
|
ClientAssertionCallback,
|
|
17
|
+
Constants,
|
|
18
18
|
} from "@azure/msal-common/node";
|
|
19
19
|
import { HttpClient } from "../network/HttpClient.js";
|
|
20
20
|
import http from "http";
|
|
@@ -29,9 +29,6 @@ import { NodeAuthError } from "../error/NodeAuthError.js";
|
|
|
29
29
|
* - clientSecret - Secret string that the application uses when requesting a token. Only used in confidential client applications. Can be created in the Azure app registration portal.
|
|
30
30
|
* - clientAssertion - A ClientAssertion object containing an assertion string or a callback function that returns an assertion string that the application uses when requesting a token, as well as the assertion's type (urn:ietf:params:oauth:client-assertion-type:jwt-bearer). Only used in confidential client applications.
|
|
31
31
|
* - clientCertificate - Certificate that the application uses when requesting a token. Only used in confidential client applications. Requires hex encoded X.509 SHA-1 or SHA-256 thumbprint of the certificate, and the PEM encoded private key (string should contain -----BEGIN PRIVATE KEY----- ... -----END PRIVATE KEY----- )
|
|
32
|
-
* - protocolMode - Enum that represents the protocol that msal follows. Used for configuring proper endpoints.
|
|
33
|
-
* - skipAuthorityMetadataCache - A flag to choose whether to use or not use the local metadata cache during authority initialization. Defaults to false.
|
|
34
|
-
* - encodeExtraQueryParams - A flag to choose whether to encode extra query parameters in the request URL. Defaults to false.
|
|
35
32
|
* @public
|
|
36
33
|
*/
|
|
37
34
|
export type NodeAuthOptions = {
|
|
@@ -53,13 +50,7 @@ export type NodeAuthOptions = {
|
|
|
53
50
|
cloudDiscoveryMetadata?: string;
|
|
54
51
|
authorityMetadata?: string;
|
|
55
52
|
clientCapabilities?: Array<string>;
|
|
56
|
-
protocolMode?: ProtocolMode;
|
|
57
53
|
azureCloudOptions?: AzureCloudOptions;
|
|
58
|
-
skipAuthorityMetadataCache?: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* @deprecated This flag is deprecated and will be removed in the next major version where all extra query params will be encoded by default.
|
|
61
|
-
*/
|
|
62
|
-
encodeExtraQueryParams?: boolean;
|
|
63
54
|
};
|
|
64
55
|
|
|
65
56
|
/**
|
|
@@ -70,10 +61,6 @@ export type NodeAuthOptions = {
|
|
|
70
61
|
*/
|
|
71
62
|
export type CacheOptions = {
|
|
72
63
|
cachePlugin?: ICachePlugin;
|
|
73
|
-
/**
|
|
74
|
-
* @deprecated claims-based-caching functionality will be removed in the next version of MSALJS
|
|
75
|
-
*/
|
|
76
|
-
claimsBasedCachingEnabled?: boolean;
|
|
77
64
|
};
|
|
78
65
|
|
|
79
66
|
/**
|
|
@@ -92,6 +79,7 @@ export type BrokerOptions = {
|
|
|
92
79
|
*
|
|
93
80
|
* - logger - Used to initialize the Logger object; TODO: Expand on logger details or link to the documentation on logger
|
|
94
81
|
* - networkClient - Http client used for all http get and post calls. Defaults to using MSAL's default http client.
|
|
82
|
+
* - protocolMode - Enum that represents the protocol that msal follows. Used for configuring proper endpoints.
|
|
95
83
|
* @public
|
|
96
84
|
*/
|
|
97
85
|
export type NodeSystemOptions = {
|
|
@@ -100,6 +88,7 @@ export type NodeSystemOptions = {
|
|
|
100
88
|
proxyUrl?: string;
|
|
101
89
|
customAgentOptions?: http.AgentOptions | https.AgentOptions;
|
|
102
90
|
disableInternalRetries?: boolean;
|
|
91
|
+
protocolMode?: ProtocolMode;
|
|
103
92
|
};
|
|
104
93
|
|
|
105
94
|
/** @public */
|
|
@@ -140,31 +129,24 @@ export type ManagedIdentityConfiguration = {
|
|
|
140
129
|
};
|
|
141
130
|
|
|
142
131
|
const DEFAULT_AUTH_OPTIONS: Required<NodeAuthOptions> = {
|
|
143
|
-
clientId:
|
|
132
|
+
clientId: "",
|
|
144
133
|
authority: Constants.DEFAULT_AUTHORITY,
|
|
145
|
-
clientSecret:
|
|
146
|
-
clientAssertion:
|
|
134
|
+
clientSecret: "",
|
|
135
|
+
clientAssertion: "",
|
|
147
136
|
clientCertificate: {
|
|
148
|
-
thumbprint:
|
|
149
|
-
thumbprintSha256:
|
|
150
|
-
privateKey:
|
|
151
|
-
x5c:
|
|
137
|
+
thumbprint: "",
|
|
138
|
+
thumbprintSha256: "",
|
|
139
|
+
privateKey: "",
|
|
140
|
+
x5c: "",
|
|
152
141
|
},
|
|
153
142
|
knownAuthorities: [],
|
|
154
|
-
cloudDiscoveryMetadata:
|
|
155
|
-
authorityMetadata:
|
|
143
|
+
cloudDiscoveryMetadata: "",
|
|
144
|
+
authorityMetadata: "",
|
|
156
145
|
clientCapabilities: [],
|
|
157
|
-
protocolMode: ProtocolMode.AAD,
|
|
158
146
|
azureCloudOptions: {
|
|
159
147
|
azureCloudInstance: AzureCloudInstance.None,
|
|
160
|
-
tenant:
|
|
148
|
+
tenant: "",
|
|
161
149
|
},
|
|
162
|
-
skipAuthorityMetadataCache: false,
|
|
163
|
-
encodeExtraQueryParams: false,
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
const DEFAULT_CACHE_OPTIONS: CacheOptions = {
|
|
167
|
-
claimsBasedCachingEnabled: false,
|
|
168
150
|
};
|
|
169
151
|
|
|
170
152
|
const DEFAULT_LOGGER_OPTIONS: LoggerOptions = {
|
|
@@ -178,15 +160,16 @@ const DEFAULT_LOGGER_OPTIONS: LoggerOptions = {
|
|
|
178
160
|
const DEFAULT_SYSTEM_OPTIONS: Required<NodeSystemOptions> = {
|
|
179
161
|
loggerOptions: DEFAULT_LOGGER_OPTIONS,
|
|
180
162
|
networkClient: new HttpClient(),
|
|
181
|
-
proxyUrl:
|
|
163
|
+
proxyUrl: "",
|
|
182
164
|
customAgentOptions: {} as http.AgentOptions | https.AgentOptions,
|
|
183
165
|
disableInternalRetries: false,
|
|
166
|
+
protocolMode: ProtocolMode.AAD,
|
|
184
167
|
};
|
|
185
168
|
|
|
186
169
|
const DEFAULT_TELEMETRY_OPTIONS: Required<NodeTelemetryOptions> = {
|
|
187
170
|
application: {
|
|
188
|
-
appName:
|
|
189
|
-
appVersion:
|
|
171
|
+
appName: "",
|
|
172
|
+
appVersion: "",
|
|
190
173
|
},
|
|
191
174
|
};
|
|
192
175
|
|
|
@@ -239,7 +222,7 @@ export function buildAppConfiguration({
|
|
|
239
222
|
return {
|
|
240
223
|
auth: { ...DEFAULT_AUTH_OPTIONS, ...auth },
|
|
241
224
|
broker: { ...broker },
|
|
242
|
-
cache: { ...
|
|
225
|
+
cache: { ...cache },
|
|
243
226
|
system: { ...systemOptions, ...system },
|
|
244
227
|
telemetry: { ...DEFAULT_TELEMETRY_OPTIONS, ...telemetry },
|
|
245
228
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { Constants, ICrypto, PkceCodes } from "@azure/msal-common/node";
|
|
7
7
|
import { GuidGenerator } from "./GuidGenerator.js";
|
|
8
8
|
import { EncodingUtils } from "../utils/EncodingUtils.js";
|
|
9
9
|
import { PkceGenerator } from "./PkceGenerator.js";
|
|
@@ -106,8 +106,10 @@ export class CryptoProvider implements ICrypto {
|
|
|
106
106
|
*/
|
|
107
107
|
async hashString(plainText: string): Promise<string> {
|
|
108
108
|
return EncodingUtils.base64EncodeUrl(
|
|
109
|
-
this.hashUtils
|
|
110
|
-
|
|
109
|
+
this.hashUtils
|
|
110
|
+
.sha256(plainText)
|
|
111
|
+
.toString(Constants.EncodingTypes.BASE64),
|
|
112
|
+
Constants.EncodingTypes.BASE64
|
|
111
113
|
);
|
|
112
114
|
}
|
|
113
115
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { PkceCodes, Constants } from "@azure/msal-common/node";
|
|
7
7
|
import { CharSet, RANDOM_OCTET_SIZE } from "../utils/Constants.js";
|
|
8
8
|
import { EncodingUtils } from "../utils/EncodingUtils.js";
|
|
9
9
|
import { HashUtils } from "./HashUtils.js";
|
|
@@ -46,7 +46,7 @@ export class PkceGenerator {
|
|
|
46
46
|
const index = byte % CharSet.CV_CHARSET.length;
|
|
47
47
|
charArr.push(CharSet.CV_CHARSET[index]);
|
|
48
48
|
}
|
|
49
|
-
const verifier: string = charArr.join(
|
|
49
|
+
const verifier: string = charArr.join("");
|
|
50
50
|
return EncodingUtils.base64EncodeUrl(verifier);
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -56,8 +56,10 @@ export class PkceGenerator {
|
|
|
56
56
|
*/
|
|
57
57
|
private generateCodeChallengeFromVerifier(codeVerifier: string): string {
|
|
58
58
|
return EncodingUtils.base64EncodeUrl(
|
|
59
|
-
this.hashUtils
|
|
60
|
-
|
|
59
|
+
this.hashUtils
|
|
60
|
+
.sha256(codeVerifier)
|
|
61
|
+
.toString(Constants.EncodingTypes.BASE64),
|
|
62
|
+
Constants.EncodingTypes.BASE64
|
|
61
63
|
);
|
|
62
64
|
}
|
|
63
65
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export const missingTenantIdError = "missing_tenant_id_error";
|
|
7
|
+
export const userTimeoutReached = "user_timeout_reached";
|
|
8
|
+
export const invalidAssertion = "invalid_assertion";
|
|
9
|
+
export const invalidClientCredential = "invalid_client_credential";
|
|
10
|
+
export const deviceCodePollingCancelled = "device_code_polling_cancelled";
|
|
11
|
+
export const deviceCodeExpired = "device_code_expired";
|
|
12
|
+
export const deviceCodeUnknownError = "device_code_unknown_error";
|
|
@@ -41,10 +41,6 @@ export const NodeAuthErrorMessage = {
|
|
|
41
41
|
code: "thumbprint_missing_from_client_certificate",
|
|
42
42
|
desc: "Client certificate does not contain a SHA-1 or SHA-256 thumbprint.",
|
|
43
43
|
},
|
|
44
|
-
redirectUriNotSupported: {
|
|
45
|
-
code: "redirect_uri_not_supported",
|
|
46
|
-
desc: "RedirectUri is not supported in this scenario. Please remove redirectUri from the request.",
|
|
47
|
-
},
|
|
48
44
|
};
|
|
49
45
|
|
|
50
46
|
export class NodeAuthError extends AuthError {
|
|
@@ -132,14 +128,4 @@ export class NodeAuthError extends AuthError {
|
|
|
132
128
|
NodeAuthErrorMessage.thumbprintMissing.desc
|
|
133
129
|
);
|
|
134
130
|
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Creates an error thrown when redirectUri is provided in an unsupported scenario
|
|
138
|
-
*/
|
|
139
|
-
static createRedirectUriNotSupportedError(): NodeAuthError {
|
|
140
|
-
return new NodeAuthError(
|
|
141
|
-
NodeAuthErrorMessage.redirectUriNotSupported.code,
|
|
142
|
-
NodeAuthErrorMessage.redirectUriNotSupported.desc
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
131
|
}
|