@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
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
|
-
|
|
7
|
+
Constants,
|
|
8
8
|
INetworkModule,
|
|
9
9
|
Logger,
|
|
10
10
|
NetworkRequestOptions,
|
|
@@ -59,7 +59,7 @@ export class HttpClientWithRetries implements INetworkModule {
|
|
|
59
59
|
response.status,
|
|
60
60
|
currentRetry,
|
|
61
61
|
this.logger,
|
|
62
|
-
response.headers[HeaderNames.RETRY_AFTER]
|
|
62
|
+
response.headers[Constants.HeaderNames.RETRY_AFTER]
|
|
63
63
|
)
|
|
64
64
|
) {
|
|
65
65
|
response = await this.sendNetworkRequestAsyncHelper(
|
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
|
-
Constants as CommonConstants,
|
|
8
7
|
AuthorizeResponse,
|
|
9
|
-
|
|
8
|
+
Constants as CommonConstants,
|
|
10
9
|
UrlUtils,
|
|
11
10
|
} from "@azure/msal-common/node";
|
|
12
11
|
import http from "http";
|
|
@@ -58,7 +57,7 @@ export class LoopbackClient implements ILoopbackClient {
|
|
|
58
57
|
UrlUtils.getDeserializedResponse(parsedUrl.search) ||
|
|
59
58
|
{};
|
|
60
59
|
if (authCodeResponse.code) {
|
|
61
|
-
res.writeHead(
|
|
60
|
+
res.writeHead(CommonConstants.HTTP_REDIRECT, {
|
|
62
61
|
location: redirectUri,
|
|
63
62
|
}); // Prevent auth code from being saved in the browser history
|
|
64
63
|
res.end();
|
package/src/packageMetadata.ts
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
AuthorizeProtocol,
|
|
9
9
|
CommonAuthorizationUrlRequest,
|
|
10
10
|
Logger,
|
|
11
|
-
|
|
11
|
+
Constants,
|
|
12
12
|
ProtocolMode,
|
|
13
13
|
RequestParameterBuilder,
|
|
14
14
|
} from "@azure/msal-common/node";
|
|
@@ -45,13 +45,16 @@ export function getAuthCodeRequestUrl(
|
|
|
45
45
|
cpu: process.arch || "",
|
|
46
46
|
os: process.platform || "",
|
|
47
47
|
});
|
|
48
|
-
if (config.
|
|
48
|
+
if (config.system.protocolMode !== ProtocolMode.OIDC) {
|
|
49
49
|
RequestParameterBuilder.addApplicationTelemetry(
|
|
50
50
|
parameters,
|
|
51
51
|
config.telemetry.application
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
|
-
RequestParameterBuilder.addResponseType(
|
|
54
|
+
RequestParameterBuilder.addResponseType(
|
|
55
|
+
parameters,
|
|
56
|
+
Constants.OAuthResponseType.CODE
|
|
57
|
+
);
|
|
55
58
|
if (request.codeChallenge && request.codeChallengeMethod) {
|
|
56
59
|
RequestParameterBuilder.addCodeChallengeParams(
|
|
57
60
|
parameters,
|
|
@@ -60,15 +63,10 @@ export function getAuthCodeRequestUrl(
|
|
|
60
63
|
);
|
|
61
64
|
}
|
|
62
65
|
|
|
63
|
-
RequestParameterBuilder.
|
|
66
|
+
RequestParameterBuilder.addExtraParameters(
|
|
64
67
|
parameters,
|
|
65
68
|
request.extraQueryParameters || {}
|
|
66
69
|
);
|
|
67
70
|
|
|
68
|
-
return AuthorizeProtocol.getAuthorizeUrl(
|
|
69
|
-
authority,
|
|
70
|
-
parameters,
|
|
71
|
-
config.auth.encodeExtraQueryParams,
|
|
72
|
-
request.extraQueryParameters
|
|
73
|
-
);
|
|
71
|
+
return AuthorizeProtocol.getAuthorizeUrl(authority, parameters);
|
|
74
72
|
}
|
|
@@ -13,7 +13,8 @@ import { CommonAuthorizationCodeRequest } from "@azure/msal-common/node";
|
|
|
13
13
|
* - authority: - URL of the authority, the security token service (STS) from which MSAL will acquire tokens. If authority is set on client application object, this will override that value. Overriding the value will cause for authority validation to happen each time. If the same authority will be used for all request, set on the application object instead of the requests.
|
|
14
14
|
* - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
|
|
15
15
|
* - redirectUri - The redirect URI of your app, where the authority will redirect to after the user inputs credentials and consents. It must exactly match one of the redirect URIs you registered in the portal.
|
|
16
|
-
* -
|
|
16
|
+
* - extraQueryParameters - String to string map of custom query parameters added to outgoing token service requests
|
|
17
|
+
* - extraParameters - String to string map of custom query parameters added to outgoing token service requests
|
|
17
18
|
* - code - The authorization_code that the user acquired in the first leg of the flow.
|
|
18
19
|
* - codeVerifier - The same code_verifier that was used to obtain the authorization_code. Required if PKCE was used in the authorization code grant request.For more information, see the PKCE RFC: https://tools.ietf.org/html/rfc7636
|
|
19
20
|
* - state - Unique GUID generated by the user that is cached by the user and sent to the server during the first leg of the flow. This string is sent back by the server with the authorization code. The user cached state is then compared with the state received from the server to mitigate the risk of CSRF attacks. See https://datatracker.ietf.org/doc/html/rfc6819#section-3.6.
|
|
@@ -28,7 +29,6 @@ export type AuthorizationCodeRequest = Partial<
|
|
|
28
29
|
| "authenticationScheme"
|
|
29
30
|
| "resourceRequestMethod"
|
|
30
31
|
| "resourceRequestUri"
|
|
31
|
-
| "requestedClaimsHash"
|
|
32
32
|
| "storeInCache"
|
|
33
33
|
>
|
|
34
34
|
> & {
|
|
@@ -28,8 +28,8 @@ import { CommonAuthorizationUrlRequest } from "@azure/msal-common/node";
|
|
|
28
28
|
* - loginHint - Can be used to pre-fill the username/email address field of the sign-in page for the user, if you know the username/email address ahead of time. Often apps use this parameter during re-authentication, having already extracted the username from a previous sign-in using the preferred_username claim.
|
|
29
29
|
* - sid - Session ID, unique identifier for the session. Available as an optional claim on ID tokens.
|
|
30
30
|
* - domainHint - Provides a hint about the tenant or domain that the user should use to sign in. The value of the domain hint is a registered domain for the tenant.
|
|
31
|
-
* - extraQueryParameters - String to string map of custom query parameters added to
|
|
32
|
-
* -
|
|
31
|
+
* - extraQueryParameters - String to string map of custom query parameters added to outgoing token service requests
|
|
32
|
+
* - extraParameters - String to string map of custom query parameters added to outgoing token service requests
|
|
33
33
|
* - nonce - A value included in the request that is returned in the id token. A randomly generated unique value is typically used to mitigate replay attacks.
|
|
34
34
|
* @public
|
|
35
35
|
*/
|
|
@@ -41,7 +41,6 @@ export type AuthorizationUrlRequest = Partial<
|
|
|
41
41
|
| "resourceRequestMethod"
|
|
42
42
|
| "resourceRequestUri"
|
|
43
43
|
| "authenticationScheme"
|
|
44
|
-
| "requestedClaimsHash"
|
|
45
44
|
| "storeInCache"
|
|
46
45
|
>
|
|
47
46
|
> & {
|
|
@@ -3,19 +3,16 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
CommonClientCredentialRequest,
|
|
9
|
-
} from "@azure/msal-common/node";
|
|
6
|
+
import { ClientAssertionCallback } from "@azure/msal-common/node";
|
|
7
|
+
import { CommonClientCredentialRequest } from "./CommonClientCredentialRequest.js";
|
|
10
8
|
|
|
11
9
|
/**
|
|
12
|
-
*
|
|
10
|
+
* ClientCredentialRequest
|
|
13
11
|
* - scopes - Array of scopes the application is requesting access to. Typically contains only the .default scope for a single resource. See: https://learn.microsoft.com/azure/active-directory/develop/scopes-oidc#the-default-scope
|
|
14
12
|
* - authority - URL of the authority, the security token service (STS) from which MSAL will acquire tokens.
|
|
15
13
|
* - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
|
|
16
14
|
* - skipCache - Skip token cache lookup and force request to authority to get a a new token. Defaults to false.
|
|
17
15
|
* - clientAssertion - An assertion string or a callback function that returns an assertion string (both are Base64Url-encoded signed JWTs) used in the Client Credential flow
|
|
18
|
-
* - tokenQueryParameters - String to string map of custom query parameters added to the /token call
|
|
19
16
|
* @public
|
|
20
17
|
*/
|
|
21
18
|
export type ClientCredentialRequest = Partial<
|
|
@@ -23,7 +20,6 @@ export type ClientCredentialRequest = Partial<
|
|
|
23
20
|
CommonClientCredentialRequest,
|
|
24
21
|
| "resourceRequestMethod"
|
|
25
22
|
| "resourceRequestUri"
|
|
26
|
-
| "requestedClaimsHash"
|
|
27
23
|
| "clientAssertion"
|
|
28
24
|
| "storeInCache"
|
|
29
25
|
>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
BaseAuthRequest,
|
|
8
|
+
AzureRegion,
|
|
9
|
+
ClientAssertion,
|
|
10
|
+
} from "@azure/msal-common/node";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* CommonClientCredentialRequest
|
|
14
|
+
* - scopes - Array of scopes the application is requesting access to.
|
|
15
|
+
* - authority - URL of the authority, the security token service (STS) from which MSAL will acquire tokens.
|
|
16
|
+
* - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
|
|
17
|
+
* - skipCache - Skip token cache lookup and force request to authority to get a a new token. Defaults to false.
|
|
18
|
+
* - preferredAzureRegionOptions - Options of the user's preferred azure region
|
|
19
|
+
* - clientAssertion - An assertion string or a callback function that returns an assertion string (both are Base64Url-encoded signed JWTs) used in the Client Credential flow
|
|
20
|
+
* - azureRegion - Azure region to be used for regional authentication
|
|
21
|
+
*/
|
|
22
|
+
export type CommonClientCredentialRequest = Omit<
|
|
23
|
+
BaseAuthRequest,
|
|
24
|
+
"extraQueryParameters" | "extraParameters"
|
|
25
|
+
> & {
|
|
26
|
+
skipCache?: boolean;
|
|
27
|
+
azureRegion?: AzureRegion;
|
|
28
|
+
clientAssertion?: ClientAssertion;
|
|
29
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
DeviceCodeResponse,
|
|
8
|
+
StringDict,
|
|
9
|
+
BaseAuthRequest,
|
|
10
|
+
} from "@azure/msal-common/node";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Parameters for Oauth2 device code flow.
|
|
14
|
+
* - scopes - Array of scopes the application is requesting access to.
|
|
15
|
+
* - authority: - URL of the authority, the security token service (STS) from which MSAL will acquire tokens. If authority is set on client application object, this will override that value. Overriding the value will cause for authority validation to happen each time. If the same authority will be used for all request, set on the application object instead of the requests.
|
|
16
|
+
* - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
|
|
17
|
+
* - deviceCodeCallback - Callback containing device code response. Message should be shown to end user. End user can then navigate to the verification_uri, input the user_code, and input credentials.
|
|
18
|
+
* - cancel - Boolean to cancel polling of device code endpoint. While the user authenticates on a separate device, MSAL polls the the token endpoint of security token service for the interval specified in the device code response (usually 15 minutes). To stop polling and cancel the request, set cancel=true.
|
|
19
|
+
* - resourceRequestMethod - HTTP Request type used to request data from the resource (i.e. "GET", "POST", etc.). Used for proof-of-possession flows.
|
|
20
|
+
* - resourceRequestUri - URI that token will be used for. Used for proof-of-possession flows.
|
|
21
|
+
* - timeout - Timeout period in seconds which the user explicitly configures for the polling of the device code endpoint. At the end of this period; assuming the device code has not expired yet; the device code polling is stopped and the request cancelled. The device code expiration window will always take precedence over this set period.
|
|
22
|
+
* - extraQueryParameters - String to string map of custom query parameters added to outgoing token service requests
|
|
23
|
+
* - extraParameters - String to string map of custom query parameters added to outgoing token service requests
|
|
24
|
+
*/
|
|
25
|
+
export type CommonDeviceCodeRequest = BaseAuthRequest & {
|
|
26
|
+
deviceCodeCallback: (response: DeviceCodeResponse) => void;
|
|
27
|
+
cancel?: boolean;
|
|
28
|
+
timeout?: number;
|
|
29
|
+
extraQueryParameters?: StringDict;
|
|
30
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { BaseAuthRequest } from "@azure/msal-common/node";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* - scopes - Array of scopes the application is requesting access to.
|
|
10
|
+
* - authority - URL of the authority, the security token service (STS) from which MSAL will acquire tokens.
|
|
11
|
+
* - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
|
|
12
|
+
* - oboAssertion - The access token that was sent to the middle-tier API. This token must have an audience of the app making this OBO request.
|
|
13
|
+
* - skipCache - Skip token cache lookup and force request to authority to get a a new token. Defaults to false.
|
|
14
|
+
*/
|
|
15
|
+
export type CommonOnBehalfOfRequest = Omit<
|
|
16
|
+
BaseAuthRequest,
|
|
17
|
+
"extraQueryParameters" | "extraParameters"
|
|
18
|
+
> & {
|
|
19
|
+
oboAssertion: string;
|
|
20
|
+
skipCache?: boolean;
|
|
21
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { BaseAuthRequest } from "@azure/msal-common/node";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* CommonUsernamePassword parameters passed by the user to retrieve credentials
|
|
10
|
+
* Note: The latest OAuth 2.0 Security Best Current Practice disallows the password grant entirely. This flow is added for internal testing.
|
|
11
|
+
*
|
|
12
|
+
* - scopes - Array of scopes the application is requesting access to.
|
|
13
|
+
* - claims - A stringified claims request which will be added to all /authorize and /token calls. When included on a silent request, cache lookup will be skipped and token will be refreshed.
|
|
14
|
+
* - authority - Url of the authority which the application acquires tokens from.
|
|
15
|
+
* - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
|
|
16
|
+
* - username - username of the client
|
|
17
|
+
* - password - credentials
|
|
18
|
+
* - extraQueryParameters - String to string map of custom query parameters added to outgoing token service requests
|
|
19
|
+
* - extraParameters - String to string map of custom query parameters added to outgoing token service requests
|
|
20
|
+
*/
|
|
21
|
+
export type CommonUsernamePasswordRequest = BaseAuthRequest & {
|
|
22
|
+
username: string;
|
|
23
|
+
password: string;
|
|
24
|
+
};
|
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
DeviceCodeResponse,
|
|
9
|
-
} from "@azure/msal-common/node";
|
|
6
|
+
import { DeviceCodeResponse } from "@azure/msal-common/node";
|
|
7
|
+
import { CommonDeviceCodeRequest } from "./CommonDeviceCodeRequest.js";
|
|
10
8
|
|
|
11
9
|
/**
|
|
12
10
|
* Parameters for Oauth2 device code flow.
|
|
@@ -25,7 +23,6 @@ export type DeviceCodeRequest = Partial<
|
|
|
25
23
|
| "deviceCodeCallback"
|
|
26
24
|
| "resourceRequestMethod"
|
|
27
25
|
| "resourceRequestUri"
|
|
28
|
-
| "requestedClaimsHash"
|
|
29
26
|
| "storeInCache"
|
|
30
27
|
>
|
|
31
28
|
> & {
|
|
@@ -18,10 +18,7 @@ import { ILoopbackClient } from "../network/ILoopbackClient.js";
|
|
|
18
18
|
* @public
|
|
19
19
|
*/
|
|
20
20
|
export type InteractiveRequest = Partial<
|
|
21
|
-
Omit<
|
|
22
|
-
CommonAuthorizationUrlRequest,
|
|
23
|
-
"scopes" | "requestedClaimsHash" | "storeInCache"
|
|
24
|
-
>
|
|
21
|
+
Omit<CommonAuthorizationUrlRequest, "scopes" | "storeInCache">
|
|
25
22
|
> & {
|
|
26
23
|
openBrowser: (url: string) => Promise<void>;
|
|
27
24
|
scopes?: Array<string>;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { CommonClientCredentialRequest } from "
|
|
6
|
+
import { CommonClientCredentialRequest } from "./CommonClientCredentialRequest.js";
|
|
7
7
|
import { ManagedIdentityRequestParams } from "./ManagedIdentityRequestParams.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { CommonOnBehalfOfRequest } from "
|
|
6
|
+
import { CommonOnBehalfOfRequest } from "./CommonOnBehalfOfRequest.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* - scopes - Array of scopes the application is requesting access to.
|
|
@@ -11,7 +11,6 @@ import { CommonOnBehalfOfRequest } from "@azure/msal-common/node";
|
|
|
11
11
|
* - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
|
|
12
12
|
* - oboAssertion - The access token that was sent to the middle-tier API. This token must have an audience of the app making this OBO request.
|
|
13
13
|
* - skipCache - Skip token cache lookup and force request to authority to get a a new token. Defaults to false.
|
|
14
|
-
* - tokenQueryParameters - String to string map of custom query parameters added to the /token call
|
|
15
14
|
* @public
|
|
16
15
|
*/
|
|
17
16
|
export type OnBehalfOfRequest = Partial<
|
|
@@ -21,7 +20,6 @@ export type OnBehalfOfRequest = Partial<
|
|
|
21
20
|
| "scopes"
|
|
22
21
|
| "resourceRequestMethod"
|
|
23
22
|
| "resourceRequestUri"
|
|
24
|
-
| "requestedClaimsHash"
|
|
25
23
|
| "storeInCache"
|
|
26
24
|
>
|
|
27
25
|
> & {
|
|
@@ -12,7 +12,8 @@ import { CommonRefreshTokenRequest } from "@azure/msal-common/node";
|
|
|
12
12
|
* - authority - URL of the authority, the security token service (STS) from which MSAL will acquire tokens.
|
|
13
13
|
* - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
|
|
14
14
|
* - refreshToken - A refresh token returned from a previous request to the Identity provider.
|
|
15
|
-
* -
|
|
15
|
+
* - extraQueryParameters - String to string map of custom query parameters added to outgoing token service requests
|
|
16
|
+
* - extraParameters - String to string map of custom query parameters added to outgoing token service requests
|
|
16
17
|
* - forceCache - Force MSAL to cache a refresh token flow response when there is no account in the cache. Used for migration scenarios.
|
|
17
18
|
* @public
|
|
18
19
|
*/
|
|
@@ -24,7 +25,6 @@ export type RefreshTokenRequest = Partial<
|
|
|
24
25
|
| "authenticationScheme"
|
|
25
26
|
| "resourceRequestMethod"
|
|
26
27
|
| "resourceRequestUri"
|
|
27
|
-
| "requestedClaimsHash"
|
|
28
28
|
| "storeInCache"
|
|
29
29
|
>
|
|
30
30
|
> & {
|
|
@@ -11,16 +11,14 @@ import { AccountInfo, CommonSilentFlowRequest } from "@azure/msal-common/node";
|
|
|
11
11
|
* - claims - A stringified claims request which will be added to all /authorize and /token calls. When included on a silent request, cache lookup will be skipped and token will be refreshed.
|
|
12
12
|
* - authority - Url of the authority which the application acquires tokens from.
|
|
13
13
|
* - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
|
|
14
|
-
* -
|
|
14
|
+
* - extraQueryParameters - String to string map of custom query parameters added to outgoing token service requests
|
|
15
|
+
* - extraParameters - String to string map of custom query parameters added to outgoing token service requests
|
|
15
16
|
* - account - Account entity to lookup the credentials.
|
|
16
17
|
* - forceRefresh - Forces silent requests to make network calls if true.
|
|
17
18
|
* @public
|
|
18
19
|
*/
|
|
19
20
|
export type SilentFlowRequest = Partial<
|
|
20
|
-
Omit<
|
|
21
|
-
CommonSilentFlowRequest,
|
|
22
|
-
"account" | "scopes" | "requestedClaimsHash" | "storeInCache"
|
|
23
|
-
>
|
|
21
|
+
Omit<CommonSilentFlowRequest, "account" | "scopes" | "storeInCache">
|
|
24
22
|
> & {
|
|
25
23
|
account: AccountInfo;
|
|
26
24
|
scopes: Array<string>;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { CommonUsernamePasswordRequest } from "
|
|
6
|
+
import { CommonUsernamePasswordRequest } from "./CommonUsernamePasswordRequest.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* UsernamePassword parameters passed by the user to retrieve credentials
|
|
@@ -15,7 +15,8 @@ import { CommonUsernamePasswordRequest } from "@azure/msal-common/node";
|
|
|
15
15
|
* - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
|
|
16
16
|
* - username - username of the client
|
|
17
17
|
* - password - credentials
|
|
18
|
-
* -
|
|
18
|
+
* - extraQueryParameters - String to string map of custom query parameters added to outgoing token service requests
|
|
19
|
+
* - extraParameters - String to string map of custom query parameters added to outgoing token service requests
|
|
19
20
|
* @public
|
|
20
21
|
*/
|
|
21
22
|
export type UsernamePasswordRequest = Partial<
|
|
@@ -26,7 +27,6 @@ export type UsernamePasswordRequest = Partial<
|
|
|
26
27
|
| "resourceRequestUri"
|
|
27
28
|
| "username"
|
|
28
29
|
| "password"
|
|
29
|
-
| "requestedClaimsHash"
|
|
30
30
|
| "storeInCache"
|
|
31
31
|
>
|
|
32
32
|
> & {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { Constants } from "@azure/msal-common/node";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Deserialized response object from server managed identity request.
|
|
@@ -25,7 +25,7 @@ export type ManagedIdentityTokenResponse = {
|
|
|
25
25
|
client_id?: string;
|
|
26
26
|
expires_on?: number; // will be converted to expires_in
|
|
27
27
|
resource?: string; // equivalent to ServerAuthorizationTokenResponse's "scope" field
|
|
28
|
-
token_type?: AuthenticationScheme;
|
|
28
|
+
token_type?: Constants.AuthenticationScheme;
|
|
29
29
|
|
|
30
30
|
// error
|
|
31
31
|
|
|
@@ -4,19 +4,19 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { IncomingHttpHeaders } from "http";
|
|
7
|
-
import {
|
|
7
|
+
import { Constants, Logger } from "@azure/msal-common/node";
|
|
8
8
|
import { IHttpRetryPolicy } from "./IHttpRetryPolicy.js";
|
|
9
9
|
import { LinearRetryStrategy } from "./LinearRetryStrategy.js";
|
|
10
10
|
|
|
11
11
|
export const DEFAULT_MANAGED_IDENTITY_MAX_RETRIES: number = 3; // referenced in unit test
|
|
12
12
|
const DEFAULT_MANAGED_IDENTITY_RETRY_DELAY_MS: number = 1000;
|
|
13
13
|
const DEFAULT_MANAGED_IDENTITY_HTTP_STATUS_CODES_TO_RETRY_ON: Array<number> = [
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
Constants.HTTP_NOT_FOUND,
|
|
15
|
+
Constants.HTTP_REQUEST_TIMEOUT,
|
|
16
|
+
Constants.HTTP_TOO_MANY_REQUESTS,
|
|
17
|
+
Constants.HTTP_SERVER_ERROR,
|
|
18
|
+
Constants.HTTP_SERVICE_UNAVAILABLE,
|
|
19
|
+
Constants.HTTP_GATEWAY_TIMEOUT,
|
|
20
20
|
];
|
|
21
21
|
|
|
22
22
|
export class DefaultManagedIdentityRetryPolicy implements IHttpRetryPolicy {
|
|
@@ -52,7 +52,8 @@ export class DefaultManagedIdentityRetryPolicy implements IHttpRetryPolicy {
|
|
|
52
52
|
logger.verbose(
|
|
53
53
|
`Retrying request in ${retryAfterDelay}ms (retry attempt: ${
|
|
54
54
|
currentRetry + 1
|
|
55
|
-
})
|
|
55
|
+
})`,
|
|
56
|
+
""
|
|
56
57
|
);
|
|
57
58
|
|
|
58
59
|
// pause execution for the calculated delay
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { Constants, Logger } from "@azure/msal-common/node";
|
|
7
7
|
import { ExponentialRetryStrategy } from "./ExponentialRetryStrategy.js";
|
|
8
8
|
import { IHttpRetryPolicy } from "./IHttpRetryPolicy.js";
|
|
9
9
|
|
|
10
10
|
const HTTP_STATUS_400_CODES_FOR_EXPONENTIAL_STRATEGY: Array<number> = [
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
Constants.HTTP_NOT_FOUND,
|
|
12
|
+
Constants.HTTP_REQUEST_TIMEOUT,
|
|
13
|
+
Constants.HTTP_GONE,
|
|
14
|
+
Constants.HTTP_TOO_MANY_REQUESTS,
|
|
15
15
|
];
|
|
16
16
|
|
|
17
17
|
const EXPONENTIAL_STRATEGY_NUM_RETRIES = 3;
|
|
@@ -73,7 +73,7 @@ export class ImdsRetryPolicy implements IHttpRetryPolicy {
|
|
|
73
73
|
|
|
74
74
|
// calculate the maxRetries based on the status code, once per request
|
|
75
75
|
this.maxRetries =
|
|
76
|
-
httpStatusCode ===
|
|
76
|
+
httpStatusCode === Constants.HTTP_GONE
|
|
77
77
|
? LINEAR_STRATEGY_NUM_RETRIES
|
|
78
78
|
: EXPONENTIAL_STRATEGY_NUM_RETRIES;
|
|
79
79
|
}
|
|
@@ -89,13 +89,13 @@ export class ImdsRetryPolicy implements IHttpRetryPolicy {
|
|
|
89
89
|
(HTTP_STATUS_400_CODES_FOR_EXPONENTIAL_STRATEGY.includes(
|
|
90
90
|
httpStatusCode
|
|
91
91
|
) ||
|
|
92
|
-
(httpStatusCode >=
|
|
93
|
-
httpStatusCode <=
|
|
92
|
+
(httpStatusCode >= Constants.HTTP_SERVER_ERROR_RANGE_START &&
|
|
93
|
+
httpStatusCode <= Constants.HTTP_SERVER_ERROR_RANGE_END &&
|
|
94
94
|
currentRetry < this.maxRetries)) &&
|
|
95
95
|
currentRetry < this.maxRetries
|
|
96
96
|
) {
|
|
97
97
|
const retryAfterDelay: number =
|
|
98
|
-
httpStatusCode ===
|
|
98
|
+
httpStatusCode === Constants.HTTP_GONE
|
|
99
99
|
? ImdsRetryPolicy.HTTP_STATUS_GONE_RETRY_AFTER_MS
|
|
100
100
|
: this.exponentialRetryStrategy.calculateDelay(
|
|
101
101
|
currentRetry
|
|
@@ -104,7 +104,8 @@ export class ImdsRetryPolicy implements IHttpRetryPolicy {
|
|
|
104
104
|
logger.verbose(
|
|
105
105
|
`Retrying request in ${retryAfterDelay}ms (retry attempt: ${
|
|
106
106
|
currentRetry + 1
|
|
107
|
-
})
|
|
107
|
+
})`,
|
|
108
|
+
""
|
|
108
109
|
);
|
|
109
110
|
|
|
110
111
|
// pause execution for the calculated delay
|
package/src/utils/Constants.ts
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { HttpStatus } from "@azure/msal-common/node";
|
|
7
6
|
import { DefaultManagedIdentityRetryPolicy } from "../retry/DefaultManagedIdentityRetryPolicy.js";
|
|
8
7
|
import { ImdsRetryPolicy } from "../retry/ImdsRetryPolicy.js";
|
|
9
8
|
|
|
@@ -88,19 +87,11 @@ export type ManagedIdentityIdType =
|
|
|
88
87
|
* http methods
|
|
89
88
|
*/
|
|
90
89
|
export const HttpMethod = {
|
|
91
|
-
GET: "
|
|
92
|
-
POST: "
|
|
90
|
+
GET: "GET",
|
|
91
|
+
POST: "POST",
|
|
93
92
|
} as const;
|
|
94
93
|
export type HttpMethod = (typeof HttpMethod)[keyof typeof HttpMethod];
|
|
95
94
|
|
|
96
|
-
export const ProxyStatus = {
|
|
97
|
-
SUCCESS: HttpStatus.SUCCESS,
|
|
98
|
-
SUCCESS_RANGE_START: HttpStatus.SUCCESS_RANGE_START,
|
|
99
|
-
SUCCESS_RANGE_END: HttpStatus.SUCCESS_RANGE_END,
|
|
100
|
-
SERVER_ERROR: HttpStatus.SERVER_ERROR,
|
|
101
|
-
} as const;
|
|
102
|
-
export type ProxyStatus = (typeof ProxyStatus)[keyof typeof ProxyStatus];
|
|
103
|
-
|
|
104
95
|
/**
|
|
105
96
|
* Constants used for region discovery
|
|
106
97
|
*/
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { Constants
|
|
6
|
+
import { Constants } from "@azure/msal-common/node";
|
|
7
7
|
|
|
8
8
|
export class EncodingUtils {
|
|
9
9
|
/**
|
|
@@ -13,7 +13,9 @@ export class EncodingUtils {
|
|
|
13
13
|
* @param str text
|
|
14
14
|
*/
|
|
15
15
|
static base64Encode(str: string, encoding?: BufferEncoding): string {
|
|
16
|
-
return Buffer.from(str, encoding).toString(
|
|
16
|
+
return Buffer.from(str, encoding).toString(
|
|
17
|
+
Constants.EncodingTypes.BASE64
|
|
18
|
+
);
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
/**
|
|
@@ -22,7 +24,7 @@ export class EncodingUtils {
|
|
|
22
24
|
*/
|
|
23
25
|
static base64EncodeUrl(str: string, encoding?: BufferEncoding): string {
|
|
24
26
|
return EncodingUtils.base64Encode(str, encoding)
|
|
25
|
-
.replace(/=/g,
|
|
27
|
+
.replace(/=/g, "")
|
|
26
28
|
.replace(/\+/g, "-")
|
|
27
29
|
.replace(/\//g, "_");
|
|
28
30
|
}
|
|
@@ -34,7 +36,9 @@ export class EncodingUtils {
|
|
|
34
36
|
* @param base64Str Base64 encoded text
|
|
35
37
|
*/
|
|
36
38
|
static base64Decode(base64Str: string): string {
|
|
37
|
-
return Buffer.from(base64Str, EncodingTypes.BASE64).toString(
|
|
39
|
+
return Buffer.from(base64Str, Constants.EncodingTypes.BASE64).toString(
|
|
40
|
+
"utf8"
|
|
41
|
+
);
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
/**
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/*! @azure/msal-node v3.8.4 2025-12-04 */
|
|
2
|
-
'use strict';
|
|
3
|
-
/*
|
|
4
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
-
* Licensed under the MIT License.
|
|
6
|
-
*/
|
|
7
|
-
class NetworkUtils {
|
|
8
|
-
static getNetworkResponse(headers, body, statusCode) {
|
|
9
|
-
return {
|
|
10
|
-
headers: headers,
|
|
11
|
-
body: body,
|
|
12
|
-
status: statusCode,
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
/*
|
|
16
|
-
* Utility function that converts a URL object into an ordinary options object as expected by the
|
|
17
|
-
* http.request and https.request APIs.
|
|
18
|
-
* https://github.com/nodejs/node/blob/main/lib/internal/url.js#L1090
|
|
19
|
-
*/
|
|
20
|
-
static urlToHttpOptions(url) {
|
|
21
|
-
const options = {
|
|
22
|
-
protocol: url.protocol,
|
|
23
|
-
hostname: url.hostname && url.hostname.startsWith("[")
|
|
24
|
-
? url.hostname.slice(1, -1)
|
|
25
|
-
: url.hostname,
|
|
26
|
-
hash: url.hash,
|
|
27
|
-
search: url.search,
|
|
28
|
-
pathname: url.pathname,
|
|
29
|
-
path: `${url.pathname || ""}${url.search || ""}`,
|
|
30
|
-
href: url.href,
|
|
31
|
-
};
|
|
32
|
-
if (url.port !== "") {
|
|
33
|
-
options.port = Number(url.port);
|
|
34
|
-
}
|
|
35
|
-
if (url.username || url.password) {
|
|
36
|
-
options.auth = `${decodeURIComponent(url.username)}:${decodeURIComponent(url.password)}`;
|
|
37
|
-
}
|
|
38
|
-
return options;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export { NetworkUtils };
|
|
43
|
-
//# sourceMappingURL=NetworkUtils.mjs.map
|