@azure/msal-node 2.7.0-alpha.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cache/ITokenCache.d.ts +15 -15
- package/dist/cache/NodeStorage.cjs +423 -423
- package/dist/cache/NodeStorage.cjs.map +1 -1
- package/dist/cache/NodeStorage.d.ts +193 -193
- package/dist/cache/NodeStorage.d.ts.map +1 -1
- package/dist/cache/NodeStorage.mjs +424 -424
- package/dist/cache/NodeStorage.mjs.map +1 -1
- package/dist/cache/TokenCache.cjs +265 -265
- package/dist/cache/TokenCache.d.ts +90 -90
- package/dist/cache/TokenCache.mjs +265 -265
- package/dist/cache/distributed/DistributedCachePlugin.cjs +26 -26
- package/dist/cache/distributed/DistributedCachePlugin.d.ts +10 -10
- package/dist/cache/distributed/DistributedCachePlugin.mjs +26 -26
- package/dist/cache/distributed/ICacheClient.d.ts +17 -17
- package/dist/cache/distributed/IPartitionManager.d.ts +28 -28
- package/dist/cache/serializer/Deserializer.cjs +167 -170
- package/dist/cache/serializer/Deserializer.cjs.map +1 -1
- package/dist/cache/serializer/Deserializer.d.ts +42 -42
- package/dist/cache/serializer/Deserializer.d.ts.map +1 -1
- package/dist/cache/serializer/Deserializer.mjs +168 -171
- package/dist/cache/serializer/Deserializer.mjs.map +1 -1
- package/dist/cache/serializer/Serializer.cjs +137 -137
- package/dist/cache/serializer/Serializer.d.ts +39 -39
- package/dist/cache/serializer/Serializer.mjs +137 -137
- package/dist/cache/serializer/SerializerTypes.d.ts +102 -102
- package/dist/client/ClientApplication.cjs +333 -333
- package/dist/client/ClientApplication.cjs.map +1 -1
- package/dist/client/ClientApplication.d.ts +142 -142
- package/dist/client/ClientApplication.d.ts.map +1 -1
- package/dist/client/ClientApplication.mjs +333 -333
- package/dist/client/ClientApplication.mjs.map +1 -1
- package/dist/client/ClientAssertion.cjs +116 -116
- package/dist/client/ClientAssertion.d.ts +46 -46
- package/dist/client/ClientAssertion.mjs +116 -116
- package/dist/client/ClientCredentialClient.cjs +194 -194
- package/dist/client/ClientCredentialClient.d.ts +33 -33
- package/dist/client/ClientCredentialClient.mjs +194 -194
- package/dist/client/ConfidentialClientApplication.cjs +163 -163
- package/dist/client/ConfidentialClientApplication.d.ts +58 -58
- package/dist/client/ConfidentialClientApplication.mjs +163 -163
- package/dist/client/DeviceCodeClient.cjs +207 -207
- package/dist/client/DeviceCodeClient.d.ts +53 -53
- package/dist/client/DeviceCodeClient.mjs +207 -207
- package/dist/client/IConfidentialClientApplication.d.ts +39 -39
- package/dist/client/IPublicClientApplication.d.ts +42 -42
- package/dist/client/ManagedIdentityApplication.cjs +79 -78
- package/dist/client/ManagedIdentityApplication.cjs.map +1 -1
- package/dist/client/ManagedIdentityApplication.d.ts +23 -23
- package/dist/client/ManagedIdentityApplication.d.ts.map +1 -1
- package/dist/client/ManagedIdentityApplication.mjs +79 -78
- package/dist/client/ManagedIdentityApplication.mjs.map +1 -1
- package/dist/client/ManagedIdentityClient.cjs +40 -36
- package/dist/client/ManagedIdentityClient.cjs.map +1 -1
- package/dist/client/ManagedIdentityClient.d.ts +19 -24
- package/dist/client/ManagedIdentityClient.d.ts.map +1 -1
- package/dist/client/ManagedIdentityClient.mjs +40 -36
- package/dist/client/ManagedIdentityClient.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/AppService.cjs +42 -69
- package/dist/client/ManagedIdentitySources/AppService.cjs.map +1 -1
- package/dist/client/ManagedIdentitySources/AppService.d.ts +16 -16
- package/dist/client/ManagedIdentitySources/AppService.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/AppService.mjs +43 -70
- package/dist/client/ManagedIdentitySources/AppService.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/AzureArc.cjs +81 -92
- package/dist/client/ManagedIdentitySources/AzureArc.cjs.map +1 -1
- package/dist/client/ManagedIdentitySources/AzureArc.d.ts +18 -18
- package/dist/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/AzureArc.mjs +84 -95
- package/dist/client/ManagedIdentitySources/AzureArc.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.cjs +112 -77
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.cjs.map +1 -1
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts +30 -18
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +114 -80
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/CloudShell.cjs +47 -0
- package/dist/client/ManagedIdentitySources/CloudShell.cjs.map +1 -0
- package/dist/client/ManagedIdentitySources/CloudShell.d.ts +15 -6
- package/dist/client/ManagedIdentitySources/CloudShell.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/CloudShell.mjs +45 -0
- package/dist/client/ManagedIdentitySources/CloudShell.mjs.map +1 -0
- package/dist/client/ManagedIdentitySources/Imds.cjs +43 -52
- package/dist/client/ManagedIdentitySources/Imds.cjs.map +1 -1
- package/dist/client/ManagedIdentitySources/Imds.d.ts +12 -12
- package/dist/client/ManagedIdentitySources/Imds.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/Imds.mjs +44 -53
- package/dist/client/ManagedIdentitySources/Imds.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/ServiceFabric.cjs +61 -0
- package/dist/client/ManagedIdentitySources/ServiceFabric.cjs.map +1 -0
- package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts +16 -6
- package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +59 -0
- package/dist/client/ManagedIdentitySources/ServiceFabric.mjs.map +1 -0
- package/dist/client/OnBehalfOfClient.cjs +202 -202
- package/dist/client/OnBehalfOfClient.d.ts +47 -47
- package/dist/client/OnBehalfOfClient.mjs +202 -202
- package/dist/client/PublicClientApplication.cjs +229 -229
- package/dist/client/PublicClientApplication.d.ts +71 -71
- package/dist/client/PublicClientApplication.mjs +229 -229
- package/dist/client/UsernamePasswordClient.cjs +95 -95
- package/dist/client/UsernamePasswordClient.d.ts +25 -25
- package/dist/client/UsernamePasswordClient.mjs +95 -95
- package/dist/config/Configuration.cjs +102 -86
- package/dist/config/Configuration.cjs.map +1 -1
- package/dist/config/Configuration.d.ts +123 -122
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.mjs +102 -86
- package/dist/config/Configuration.mjs.map +1 -1
- package/dist/config/ManagedIdentityId.cjs +48 -48
- package/dist/config/ManagedIdentityId.d.ts +11 -11
- package/dist/config/ManagedIdentityId.mjs +48 -48
- package/dist/config/ManagedIdentityRequestParameters.cjs +28 -29
- package/dist/config/ManagedIdentityRequestParameters.cjs.map +1 -1
- package/dist/config/ManagedIdentityRequestParameters.d.ts +11 -11
- package/dist/config/ManagedIdentityRequestParameters.d.ts.map +1 -1
- package/dist/config/ManagedIdentityRequestParameters.mjs +28 -29
- package/dist/config/ManagedIdentityRequestParameters.mjs.map +1 -1
- package/dist/crypto/CryptoProvider.cjs +75 -75
- package/dist/crypto/CryptoProvider.d.ts +52 -52
- package/dist/crypto/CryptoProvider.mjs +75 -75
- package/dist/crypto/GuidGenerator.cjs +22 -22
- package/dist/crypto/GuidGenerator.d.ts +14 -14
- package/dist/crypto/GuidGenerator.mjs +22 -22
- package/dist/crypto/HashUtils.cjs +13 -13
- package/dist/crypto/HashUtils.d.ts +8 -8
- package/dist/crypto/HashUtils.mjs +13 -13
- package/dist/crypto/PkceGenerator.cjs +49 -49
- package/dist/crypto/PkceGenerator.d.ts +22 -22
- package/dist/crypto/PkceGenerator.mjs +49 -49
- package/dist/error/ManagedIdentityError.cjs +39 -28
- package/dist/error/ManagedIdentityError.cjs.map +1 -1
- package/dist/error/ManagedIdentityError.d.ts +27 -21
- package/dist/error/ManagedIdentityError.d.ts.map +1 -1
- package/dist/error/ManagedIdentityError.mjs +40 -29
- package/dist/error/ManagedIdentityError.mjs.map +1 -1
- package/dist/error/ManagedIdentityErrorCodes.cjs +27 -14
- package/dist/error/ManagedIdentityErrorCodes.cjs.map +1 -1
- package/dist/error/ManagedIdentityErrorCodes.d.ts +19 -9
- package/dist/error/ManagedIdentityErrorCodes.d.ts.map +1 -1
- package/dist/error/ManagedIdentityErrorCodes.mjs +24 -14
- package/dist/error/ManagedIdentityErrorCodes.mjs.map +1 -1
- package/dist/error/NodeAuthError.cjs +85 -85
- package/dist/error/NodeAuthError.d.ts +65 -65
- package/dist/error/NodeAuthError.mjs +85 -85
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +44 -44
- package/dist/index.mjs +1 -1
- package/dist/internals.cjs +8 -8
- package/dist/internals.d.ts +6 -6
- package/dist/internals.mjs +8 -8
- package/dist/network/HttpClient.cjs +283 -283
- package/dist/network/HttpClient.cjs.map +1 -1
- package/dist/network/HttpClient.d.ts +25 -26
- package/dist/network/HttpClient.d.ts.map +1 -1
- package/dist/network/HttpClient.mjs +283 -283
- package/dist/network/HttpClient.mjs.map +1 -1
- package/dist/network/HttpClientWithRetries.cjs +44 -0
- package/dist/network/HttpClientWithRetries.cjs.map +1 -0
- package/dist/network/HttpClientWithRetries.d.ts +12 -0
- package/dist/network/HttpClientWithRetries.d.ts.map +1 -0
- package/dist/network/HttpClientWithRetries.mjs +42 -0
- package/dist/network/HttpClientWithRetries.mjs.map +1 -0
- package/dist/network/ILoopbackClient.d.ts +10 -10
- package/dist/network/LoopbackClient.cjs +77 -77
- package/dist/network/LoopbackClient.d.ts +21 -21
- package/dist/network/LoopbackClient.mjs +77 -77
- package/dist/packageMetadata.cjs +4 -4
- package/dist/packageMetadata.d.ts +2 -2
- package/dist/packageMetadata.d.ts.map +1 -1
- package/dist/packageMetadata.mjs +4 -4
- package/dist/request/AuthorizationCodeRequest.d.ts +21 -21
- package/dist/request/AuthorizationUrlRequest.d.ts +33 -33
- package/dist/request/ClientCredentialRequest.d.ts +14 -14
- package/dist/request/DeviceCodeRequest.d.ts +15 -15
- package/dist/request/InteractiveRequest.d.ts +22 -22
- package/dist/request/ManagedIdentityRequest.d.ts +8 -8
- package/dist/request/ManagedIdentityRequestParams.d.ts +9 -9
- package/dist/request/OnBehalfOfRequest.d.ts +14 -14
- package/dist/request/RefreshTokenRequest.d.ts +17 -17
- package/dist/request/SignOutRequest.d.ts +5 -5
- package/dist/request/SilentFlowRequest.d.ts +16 -16
- package/dist/request/UsernamePasswordRequest.d.ts +19 -19
- package/dist/response/ManagedIdentityTokenResponse.d.ts +24 -24
- package/dist/retry/IHttpRetryPolicy.d.ts +6 -0
- package/dist/retry/IHttpRetryPolicy.d.ts.map +1 -0
- package/dist/retry/LinearRetryPolicy.cjs +47 -0
- package/dist/retry/LinearRetryPolicy.cjs.map +1 -0
- package/dist/retry/LinearRetryPolicy.d.ts +12 -0
- package/dist/retry/LinearRetryPolicy.d.ts.map +1 -0
- package/dist/retry/LinearRetryPolicy.mjs +45 -0
- package/dist/retry/LinearRetryPolicy.mjs.map +1 -0
- package/dist/utils/Constants.cjs +141 -103
- package/dist/utils/Constants.cjs.map +1 -1
- package/dist/utils/Constants.d.ts +131 -106
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.mjs +133 -100
- package/dist/utils/Constants.mjs.map +1 -1
- package/dist/utils/EncodingUtils.cjs +44 -44
- package/dist/utils/EncodingUtils.d.ts +26 -26
- package/dist/utils/EncodingUtils.mjs +44 -44
- package/dist/utils/NetworkUtils.cjs +38 -38
- package/dist/utils/NetworkUtils.d.ts +5 -5
- package/dist/utils/NetworkUtils.mjs +38 -38
- package/package.json +5 -5
- package/src/cache/NodeStorage.ts +4 -9
- package/src/cache/serializer/Deserializer.ts +1 -5
- package/src/client/ClientApplication.ts +5 -4
- package/src/client/ManagedIdentityApplication.ts +3 -3
- package/src/client/ManagedIdentityClient.ts +23 -11
- package/src/client/ManagedIdentitySources/AppService.ts +68 -97
- package/src/client/ManagedIdentitySources/AzureArc.ts +59 -68
- package/src/client/ManagedIdentitySources/BaseManagedIdentitySource.ts +70 -2
- package/src/client/ManagedIdentitySources/CloudShell.ts +93 -8
- package/src/client/ManagedIdentitySources/Imds.ts +54 -40
- package/src/client/ManagedIdentitySources/ServiceFabric.ts +126 -5
- package/src/config/Configuration.ts +44 -16
- package/src/config/ManagedIdentityRequestParameters.ts +1 -6
- package/src/error/ManagedIdentityError.ts +15 -2
- package/src/error/ManagedIdentityErrorCodes.ts +19 -0
- package/src/network/HttpClient.ts +6 -11
- package/src/network/HttpClientWithRetries.ts +80 -0
- package/src/packageMetadata.ts +1 -1
- package/src/retry/IHttpRetryPolicy.ts +18 -0
- package/src/retry/LinearRetryPolicy.ts +71 -0
- package/src/utils/Constants.ts +43 -7
package/dist/utils/Constants.mjs
CHANGED
|
@@ -1,104 +1,137 @@
|
|
|
1
|
-
/*! @azure/msal-node v2.7.0
|
|
1
|
+
/*! @azure/msal-node v2.7.0 2024-04-11 */
|
|
2
2
|
'use strict';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
*
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
3
|
+
import { HttpStatus } from '@azure/msal-common';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7
|
+
* Licensed under the MIT License.
|
|
8
|
+
*/
|
|
9
|
+
// MSI Constants. Docs for MSI are available here https://docs.microsoft.com/azure/app-service/overview-managed-identity
|
|
10
|
+
const AUTHORIZATION_HEADER_NAME = "Authorization";
|
|
11
|
+
const METADATA_HEADER_NAME = "Metadata";
|
|
12
|
+
const APP_SERVICE_SECRET_HEADER_NAME = "X-IDENTITY-HEADER";
|
|
13
|
+
const SERVICE_FABRIC_SECRET_HEADER_NAME = "secret";
|
|
14
|
+
const API_VERSION_QUERY_PARAMETER_NAME = "api-version";
|
|
15
|
+
const RESOURCE_BODY_OR_QUERY_PARAMETER_NAME = "resource";
|
|
16
|
+
const DEFAULT_MANAGED_IDENTITY_ID = "system_assigned_managed_identity";
|
|
17
|
+
const MANAGED_IDENTITY_DEFAULT_TENANT = "managed_identity";
|
|
18
|
+
const DEFAULT_AUTHORITY_FOR_MANAGED_IDENTITY = `https://login.microsoftonline.com/${MANAGED_IDENTITY_DEFAULT_TENANT}/`;
|
|
19
|
+
/**
|
|
20
|
+
* Managed Identity Environment Variable Names
|
|
21
|
+
*/
|
|
22
|
+
const ManagedIdentityEnvironmentVariableNames = {
|
|
23
|
+
AZURE_POD_IDENTITY_AUTHORITY_HOST: "AZURE_POD_IDENTITY_AUTHORITY_HOST",
|
|
24
|
+
IDENTITY_ENDPOINT: "IDENTITY_ENDPOINT",
|
|
25
|
+
IDENTITY_HEADER: "IDENTITY_HEADER",
|
|
26
|
+
IDENTITY_SERVER_THUMBPRINT: "IDENTITY_SERVER_THUMBPRINT",
|
|
27
|
+
IMDS_ENDPOINT: "IMDS_ENDPOINT",
|
|
28
|
+
MSI_ENDPOINT: "MSI_ENDPOINT",
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Managed Identity Source Names
|
|
32
|
+
*/
|
|
33
|
+
const ManagedIdentitySourceNames = {
|
|
34
|
+
APP_SERVICE: "App Service",
|
|
35
|
+
AZURE_ARC: "Azure Arc",
|
|
36
|
+
CLOUD_SHELL: "Cloud Shell",
|
|
37
|
+
IMDS: "IMDS",
|
|
38
|
+
SERVICE_FABRIC: "Service Fabric",
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Managed Identity Ids
|
|
42
|
+
*/
|
|
43
|
+
const ManagedIdentityIdType = {
|
|
44
|
+
SYSTEM_ASSIGNED: "system-assigned",
|
|
45
|
+
USER_ASSIGNED_CLIENT_ID: "user-assigned-client-id",
|
|
46
|
+
USER_ASSIGNED_RESOURCE_ID: "user-assigned-resource-id",
|
|
47
|
+
USER_ASSIGNED_OBJECT_ID: "user-assigned-object-id",
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* http methods
|
|
51
|
+
*/
|
|
52
|
+
const HttpMethod = {
|
|
53
|
+
GET: "get",
|
|
54
|
+
POST: "post",
|
|
55
|
+
};
|
|
56
|
+
const ProxyStatus = {
|
|
57
|
+
SUCCESS_RANGE_START: 200,
|
|
58
|
+
SUCCESS_RANGE_END: 299,
|
|
59
|
+
SERVER_ERROR: 500,
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Constants used for region discovery
|
|
63
|
+
*/
|
|
64
|
+
const REGION_ENVIRONMENT_VARIABLE = "REGION_NAME";
|
|
65
|
+
/**
|
|
66
|
+
* Constant used for PKCE
|
|
67
|
+
*/
|
|
68
|
+
const RANDOM_OCTET_SIZE = 32;
|
|
69
|
+
/**
|
|
70
|
+
* Constants used in PKCE
|
|
71
|
+
*/
|
|
72
|
+
const Hash = {
|
|
73
|
+
SHA256: "sha256",
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Constants for encoding schemes
|
|
77
|
+
*/
|
|
78
|
+
const CharSet = {
|
|
79
|
+
CV_CHARSET: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Constants
|
|
83
|
+
*/
|
|
84
|
+
const Constants = {
|
|
85
|
+
MSAL_SKU: "msal.js.node",
|
|
86
|
+
JWT_BEARER_ASSERTION_TYPE: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
|
|
87
|
+
AUTHORIZATION_PENDING: "authorization_pending",
|
|
88
|
+
HTTP_PROTOCOL: "http://",
|
|
89
|
+
LOCALHOST: "localhost",
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* API Codes for Telemetry purposes.
|
|
93
|
+
* Before adding a new code you must claim it in the MSAL Telemetry tracker as these number spaces are shared across all MSALs
|
|
94
|
+
* 0-99 Silent Flow
|
|
95
|
+
* 600-699 Device Code Flow
|
|
96
|
+
* 800-899 Auth Code Flow
|
|
97
|
+
*/
|
|
98
|
+
const ApiId = {
|
|
99
|
+
acquireTokenSilent: 62,
|
|
100
|
+
acquireTokenByUsernamePassword: 371,
|
|
101
|
+
acquireTokenByDeviceCode: 671,
|
|
102
|
+
acquireTokenByClientCredential: 771,
|
|
103
|
+
acquireTokenByCode: 871,
|
|
104
|
+
acquireTokenByRefreshToken: 872,
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* JWT constants
|
|
108
|
+
*/
|
|
109
|
+
const JwtConstants = {
|
|
110
|
+
ALGORITHM: "alg",
|
|
111
|
+
RSA_256: "RS256",
|
|
112
|
+
X5T: "x5t",
|
|
113
|
+
X5C: "x5c",
|
|
114
|
+
AUDIENCE: "aud",
|
|
115
|
+
EXPIRATION_TIME: "exp",
|
|
116
|
+
ISSUER: "iss",
|
|
117
|
+
SUBJECT: "sub",
|
|
118
|
+
NOT_BEFORE: "nbf",
|
|
119
|
+
JWT_ID: "jti",
|
|
120
|
+
};
|
|
121
|
+
const LOOPBACK_SERVER_CONSTANTS = {
|
|
122
|
+
INTERVAL_MS: 100,
|
|
123
|
+
TIMEOUT_MS: 5000,
|
|
101
124
|
};
|
|
125
|
+
const MANAGED_IDENTITY_MAX_RETRIES = 3;
|
|
126
|
+
const MANAGED_IDENTITY_RETRY_DELAY = 1000;
|
|
127
|
+
const MANAGED_IDENTITY_HTTP_STATUS_CODES_TO_RETRY_ON = [
|
|
128
|
+
HttpStatus.NOT_FOUND,
|
|
129
|
+
HttpStatus.REQUEST_TIMEOUT,
|
|
130
|
+
HttpStatus.TOO_MANY_REQUESTS,
|
|
131
|
+
HttpStatus.INTERNAL_SERVER_ERROR,
|
|
132
|
+
HttpStatus.SERVICE_UNAVAILABLE,
|
|
133
|
+
HttpStatus.GATEWAY_TIMEOUT,
|
|
134
|
+
];
|
|
102
135
|
|
|
103
|
-
export { AUTHORIZATION_HEADER_NAME, ApiId, CharSet, Constants, DEFAULT_AUTHORITY_FOR_MANAGED_IDENTITY, DEFAULT_MANAGED_IDENTITY_ID, Hash, HttpMethod, JwtConstants, LOOPBACK_SERVER_CONSTANTS,
|
|
136
|
+
export { API_VERSION_QUERY_PARAMETER_NAME, APP_SERVICE_SECRET_HEADER_NAME, AUTHORIZATION_HEADER_NAME, ApiId, CharSet, Constants, DEFAULT_AUTHORITY_FOR_MANAGED_IDENTITY, DEFAULT_MANAGED_IDENTITY_ID, Hash, HttpMethod, JwtConstants, LOOPBACK_SERVER_CONSTANTS, MANAGED_IDENTITY_DEFAULT_TENANT, MANAGED_IDENTITY_HTTP_STATUS_CODES_TO_RETRY_ON, MANAGED_IDENTITY_MAX_RETRIES, MANAGED_IDENTITY_RETRY_DELAY, METADATA_HEADER_NAME, ManagedIdentityEnvironmentVariableNames, ManagedIdentityIdType, ManagedIdentitySourceNames, ProxyStatus, RANDOM_OCTET_SIZE, REGION_ENVIRONMENT_VARIABLE, RESOURCE_BODY_OR_QUERY_PARAMETER_NAME, SERVICE_FABRIC_SECRET_HEADER_NAME };
|
|
104
137
|
//# sourceMappingURL=Constants.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Constants.mjs","sources":["../../src/utils/Constants.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Constants.mjs","sources":["../../src/utils/Constants.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAAA;;;AAGG;AAIH;AACO,MAAM,yBAAyB,GAAW,gBAAgB;AAC1D,MAAM,oBAAoB,GAAW,WAAW;AAChD,MAAM,8BAA8B,GAAW,oBAAoB;AACnE,MAAM,iCAAiC,GAAW,SAAS;AAC3D,MAAM,gCAAgC,GAAW,cAAc;AAC/D,MAAM,qCAAqC,GAAW,WAAW;AACjE,MAAM,2BAA2B,GAAG,mCAAmC;AACvE,MAAM,+BAA+B,GAAG,mBAAmB;AACrD,MAAA,sCAAsC,GAAG,CAAqC,kCAAA,EAAA,+BAA+B,IAAI;AAE9H;;AAEG;AACU,MAAA,uCAAuC,GAAG;AACnD,IAAA,iCAAiC,EAAE,mCAAmC;AACtE,IAAA,iBAAiB,EAAE,mBAAmB;AACtC,IAAA,eAAe,EAAE,iBAAiB;AAClC,IAAA,0BAA0B,EAAE,4BAA4B;AACxD,IAAA,aAAa,EAAE,eAAe;AAC9B,IAAA,YAAY,EAAE,cAAc;EACrB;AAIX;;AAEG;AACU,MAAA,0BAA0B,GAAG;AACtC,IAAA,WAAW,EAAE,aAAa;AAC1B,IAAA,SAAS,EAAE,WAAW;AACtB,IAAA,WAAW,EAAE,aAAa;AAC1B,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,cAAc,EAAE,gBAAgB;EACzB;AAIX;;AAEG;AACU,MAAA,qBAAqB,GAAG;AACjC,IAAA,eAAe,EAAE,iBAAiB;AAClC,IAAA,uBAAuB,EAAE,yBAAyB;AAClD,IAAA,yBAAyB,EAAE,2BAA2B;AACtD,IAAA,uBAAuB,EAAE,yBAAyB;EAC3C;AAIX;;AAEG;AACU,MAAA,UAAU,GAAG;AACtB,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,IAAI,EAAE,MAAM;EACL;AAGE,MAAA,WAAW,GAAG;AACvB,IAAA,mBAAmB,EAAE,GAAG;AACxB,IAAA,iBAAiB,EAAE,GAAG;AACtB,IAAA,YAAY,EAAE,GAAG;EACV;AAGX;;AAEG;AACI,MAAM,2BAA2B,GAAG,cAAc;AAEzD;;AAEG;AACI,MAAM,iBAAiB,GAAG,GAAG;AAEpC;;AAEG;AACU,MAAA,IAAI,GAAG;AAChB,IAAA,MAAM,EAAE,QAAQ;EAClB;AAEF;;AAEG;AACU,MAAA,OAAO,GAAG;AACnB,IAAA,UAAU,EACN,oEAAoE;EAC1E;AAUF;;AAEG;AACU,MAAA,SAAS,GAAG;AACrB,IAAA,QAAQ,EAAE,cAAc;AACxB,IAAA,yBAAyB,EACrB,wDAAwD;AAC5D,IAAA,qBAAqB,EAAE,uBAAuB;AAC9C,IAAA,aAAa,EAAE,SAAS;AACxB,IAAA,SAAS,EAAE,WAAW;EACxB;AAEF;;;;;;AAMG;AACU,MAAA,KAAK,GAAG;AACjB,IAAA,kBAAkB,EAAE,EAAE;AACtB,IAAA,8BAA8B,EAAE,GAAG;AACnC,IAAA,wBAAwB,EAAE,GAAG;AAC7B,IAAA,8BAA8B,EAAE,GAAG;AACnC,IAAA,kBAAkB,EAAE,GAAG;AACvB,IAAA,0BAA0B,EAAE,GAAG;EACjC;AAGF;;AAEG;AACU,MAAA,YAAY,GAAG;AACxB,IAAA,SAAS,EAAE,KAAK;AAChB,IAAA,OAAO,EAAE,OAAO;AAChB,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,QAAQ,EAAE,KAAK;AACf,IAAA,eAAe,EAAE,KAAK;AACtB,IAAA,MAAM,EAAE,KAAK;AACb,IAAA,OAAO,EAAE,KAAK;AACd,IAAA,UAAU,EAAE,KAAK;AACjB,IAAA,MAAM,EAAE,KAAK;EACf;AAEW,MAAA,yBAAyB,GAAG;AACrC,IAAA,WAAW,EAAE,GAAG;AAChB,IAAA,UAAU,EAAE,IAAI;EAClB;AAEK,MAAM,4BAA4B,GAAG,EAAE;AACvC,MAAM,4BAA4B,GAAG,KAAK;AACpC,MAAA,8CAA8C,GAAG;AAC1D,IAAA,UAAU,CAAC,SAAS;AACpB,IAAA,UAAU,CAAC,eAAe;AAC1B,IAAA,UAAU,CAAC,iBAAiB;AAC5B,IAAA,UAAU,CAAC,qBAAqB;AAChC,IAAA,UAAU,CAAC,mBAAmB;AAC9B,IAAA,UAAU,CAAC,eAAe;;;;;"}
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
/*! @azure/msal-node v2.7.0
|
|
1
|
+
/*! @azure/msal-node v2.7.0 2024-04-11 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
5
|
var msalCommon = require('@azure/msal-common');
|
|
6
6
|
|
|
7
|
-
/*
|
|
8
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9
|
-
* Licensed under the MIT License.
|
|
10
|
-
*/
|
|
11
|
-
class EncodingUtils {
|
|
12
|
-
/**
|
|
13
|
-
* 'utf8': Multibyte encoded Unicode characters. Many web pages and other document formats use UTF-8.
|
|
14
|
-
* 'base64': Base64 encoding.
|
|
15
|
-
*
|
|
16
|
-
* @param str text
|
|
17
|
-
*/
|
|
18
|
-
static base64Encode(str, encoding) {
|
|
19
|
-
return Buffer.from(str, encoding).toString("base64");
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* encode a URL
|
|
23
|
-
* @param str
|
|
24
|
-
*/
|
|
25
|
-
static base64EncodeUrl(str, encoding) {
|
|
26
|
-
return EncodingUtils.base64Encode(str, encoding)
|
|
27
|
-
.replace(/=/g, msalCommon.Constants.EMPTY_STRING)
|
|
28
|
-
.replace(/\+/g, "-")
|
|
29
|
-
.replace(/\//g, "_");
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* 'utf8': Multibyte encoded Unicode characters. Many web pages and other document formats use UTF-8.
|
|
33
|
-
* 'base64': Base64 encoding.
|
|
34
|
-
*
|
|
35
|
-
* @param base64Str Base64 encoded text
|
|
36
|
-
*/
|
|
37
|
-
static base64Decode(base64Str) {
|
|
38
|
-
return Buffer.from(base64Str, "base64").toString("utf8");
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* @param base64Str Base64 encoded Url
|
|
42
|
-
*/
|
|
43
|
-
static base64DecodeUrl(base64Str) {
|
|
44
|
-
let str = base64Str.replace(/-/g, "+").replace(/_/g, "/");
|
|
45
|
-
while (str.length % 4) {
|
|
46
|
-
str += "=";
|
|
47
|
-
}
|
|
48
|
-
return EncodingUtils.base64Decode(str);
|
|
49
|
-
}
|
|
7
|
+
/*
|
|
8
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9
|
+
* Licensed under the MIT License.
|
|
10
|
+
*/
|
|
11
|
+
class EncodingUtils {
|
|
12
|
+
/**
|
|
13
|
+
* 'utf8': Multibyte encoded Unicode characters. Many web pages and other document formats use UTF-8.
|
|
14
|
+
* 'base64': Base64 encoding.
|
|
15
|
+
*
|
|
16
|
+
* @param str text
|
|
17
|
+
*/
|
|
18
|
+
static base64Encode(str, encoding) {
|
|
19
|
+
return Buffer.from(str, encoding).toString("base64");
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* encode a URL
|
|
23
|
+
* @param str
|
|
24
|
+
*/
|
|
25
|
+
static base64EncodeUrl(str, encoding) {
|
|
26
|
+
return EncodingUtils.base64Encode(str, encoding)
|
|
27
|
+
.replace(/=/g, msalCommon.Constants.EMPTY_STRING)
|
|
28
|
+
.replace(/\+/g, "-")
|
|
29
|
+
.replace(/\//g, "_");
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 'utf8': Multibyte encoded Unicode characters. Many web pages and other document formats use UTF-8.
|
|
33
|
+
* 'base64': Base64 encoding.
|
|
34
|
+
*
|
|
35
|
+
* @param base64Str Base64 encoded text
|
|
36
|
+
*/
|
|
37
|
+
static base64Decode(base64Str) {
|
|
38
|
+
return Buffer.from(base64Str, "base64").toString("utf8");
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @param base64Str Base64 encoded Url
|
|
42
|
+
*/
|
|
43
|
+
static base64DecodeUrl(base64Str) {
|
|
44
|
+
let str = base64Str.replace(/-/g, "+").replace(/_/g, "/");
|
|
45
|
+
while (str.length % 4) {
|
|
46
|
+
str += "=";
|
|
47
|
+
}
|
|
48
|
+
return EncodingUtils.base64Decode(str);
|
|
49
|
+
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
exports.EncodingUtils = EncodingUtils;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
export declare class EncodingUtils {
|
|
3
|
-
/**
|
|
4
|
-
* 'utf8': Multibyte encoded Unicode characters. Many web pages and other document formats use UTF-8.
|
|
5
|
-
* 'base64': Base64 encoding.
|
|
6
|
-
*
|
|
7
|
-
* @param str text
|
|
8
|
-
*/
|
|
9
|
-
static base64Encode(str: string, encoding?: BufferEncoding): string;
|
|
10
|
-
/**
|
|
11
|
-
* encode a URL
|
|
12
|
-
* @param str
|
|
13
|
-
*/
|
|
14
|
-
static base64EncodeUrl(str: string, encoding?: BufferEncoding): string;
|
|
15
|
-
/**
|
|
16
|
-
* 'utf8': Multibyte encoded Unicode characters. Many web pages and other document formats use UTF-8.
|
|
17
|
-
* 'base64': Base64 encoding.
|
|
18
|
-
*
|
|
19
|
-
* @param base64Str Base64 encoded text
|
|
20
|
-
*/
|
|
21
|
-
static base64Decode(base64Str: string): string;
|
|
22
|
-
/**
|
|
23
|
-
* @param base64Str Base64 encoded Url
|
|
24
|
-
*/
|
|
25
|
-
static base64DecodeUrl(base64Str: string): string;
|
|
26
|
-
}
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare class EncodingUtils {
|
|
3
|
+
/**
|
|
4
|
+
* 'utf8': Multibyte encoded Unicode characters. Many web pages and other document formats use UTF-8.
|
|
5
|
+
* 'base64': Base64 encoding.
|
|
6
|
+
*
|
|
7
|
+
* @param str text
|
|
8
|
+
*/
|
|
9
|
+
static base64Encode(str: string, encoding?: BufferEncoding): string;
|
|
10
|
+
/**
|
|
11
|
+
* encode a URL
|
|
12
|
+
* @param str
|
|
13
|
+
*/
|
|
14
|
+
static base64EncodeUrl(str: string, encoding?: BufferEncoding): string;
|
|
15
|
+
/**
|
|
16
|
+
* 'utf8': Multibyte encoded Unicode characters. Many web pages and other document formats use UTF-8.
|
|
17
|
+
* 'base64': Base64 encoding.
|
|
18
|
+
*
|
|
19
|
+
* @param base64Str Base64 encoded text
|
|
20
|
+
*/
|
|
21
|
+
static base64Decode(base64Str: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* @param base64Str Base64 encoded Url
|
|
24
|
+
*/
|
|
25
|
+
static base64DecodeUrl(base64Str: string): string;
|
|
26
|
+
}
|
|
27
27
|
//# sourceMappingURL=EncodingUtils.d.ts.map
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
/*! @azure/msal-node v2.7.0
|
|
1
|
+
/*! @azure/msal-node v2.7.0 2024-04-11 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { Constants } from '@azure/msal-common';
|
|
4
4
|
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7
|
-
* Licensed under the MIT License.
|
|
8
|
-
*/
|
|
9
|
-
class EncodingUtils {
|
|
10
|
-
/**
|
|
11
|
-
* 'utf8': Multibyte encoded Unicode characters. Many web pages and other document formats use UTF-8.
|
|
12
|
-
* 'base64': Base64 encoding.
|
|
13
|
-
*
|
|
14
|
-
* @param str text
|
|
15
|
-
*/
|
|
16
|
-
static base64Encode(str, encoding) {
|
|
17
|
-
return Buffer.from(str, encoding).toString("base64");
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* encode a URL
|
|
21
|
-
* @param str
|
|
22
|
-
*/
|
|
23
|
-
static base64EncodeUrl(str, encoding) {
|
|
24
|
-
return EncodingUtils.base64Encode(str, encoding)
|
|
25
|
-
.replace(/=/g, Constants.EMPTY_STRING)
|
|
26
|
-
.replace(/\+/g, "-")
|
|
27
|
-
.replace(/\//g, "_");
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* 'utf8': Multibyte encoded Unicode characters. Many web pages and other document formats use UTF-8.
|
|
31
|
-
* 'base64': Base64 encoding.
|
|
32
|
-
*
|
|
33
|
-
* @param base64Str Base64 encoded text
|
|
34
|
-
*/
|
|
35
|
-
static base64Decode(base64Str) {
|
|
36
|
-
return Buffer.from(base64Str, "base64").toString("utf8");
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* @param base64Str Base64 encoded Url
|
|
40
|
-
*/
|
|
41
|
-
static base64DecodeUrl(base64Str) {
|
|
42
|
-
let str = base64Str.replace(/-/g, "+").replace(/_/g, "/");
|
|
43
|
-
while (str.length % 4) {
|
|
44
|
-
str += "=";
|
|
45
|
-
}
|
|
46
|
-
return EncodingUtils.base64Decode(str);
|
|
47
|
-
}
|
|
5
|
+
/*
|
|
6
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7
|
+
* Licensed under the MIT License.
|
|
8
|
+
*/
|
|
9
|
+
class EncodingUtils {
|
|
10
|
+
/**
|
|
11
|
+
* 'utf8': Multibyte encoded Unicode characters. Many web pages and other document formats use UTF-8.
|
|
12
|
+
* 'base64': Base64 encoding.
|
|
13
|
+
*
|
|
14
|
+
* @param str text
|
|
15
|
+
*/
|
|
16
|
+
static base64Encode(str, encoding) {
|
|
17
|
+
return Buffer.from(str, encoding).toString("base64");
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* encode a URL
|
|
21
|
+
* @param str
|
|
22
|
+
*/
|
|
23
|
+
static base64EncodeUrl(str, encoding) {
|
|
24
|
+
return EncodingUtils.base64Encode(str, encoding)
|
|
25
|
+
.replace(/=/g, Constants.EMPTY_STRING)
|
|
26
|
+
.replace(/\+/g, "-")
|
|
27
|
+
.replace(/\//g, "_");
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 'utf8': Multibyte encoded Unicode characters. Many web pages and other document formats use UTF-8.
|
|
31
|
+
* 'base64': Base64 encoding.
|
|
32
|
+
*
|
|
33
|
+
* @param base64Str Base64 encoded text
|
|
34
|
+
*/
|
|
35
|
+
static base64Decode(base64Str) {
|
|
36
|
+
return Buffer.from(base64Str, "base64").toString("utf8");
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @param base64Str Base64 encoded Url
|
|
40
|
+
*/
|
|
41
|
+
static base64DecodeUrl(base64Str) {
|
|
42
|
+
let str = base64Str.replace(/-/g, "+").replace(/_/g, "/");
|
|
43
|
+
while (str.length % 4) {
|
|
44
|
+
str += "=";
|
|
45
|
+
}
|
|
46
|
+
return EncodingUtils.base64Decode(str);
|
|
47
|
+
}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
export { EncodingUtils };
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
/*! @azure/msal-node v2.7.0
|
|
1
|
+
/*! @azure/msal-node v2.7.0 2024-04-11 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7
|
-
* Licensed under the MIT License.
|
|
8
|
-
*/
|
|
9
|
-
class NetworkUtils {
|
|
10
|
-
static getNetworkResponse(headers, body, statusCode) {
|
|
11
|
-
return {
|
|
12
|
-
headers: headers,
|
|
13
|
-
body: body,
|
|
14
|
-
status: statusCode,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
/*
|
|
18
|
-
* Utility function that converts a URL object into an ordinary options object as expected by the
|
|
19
|
-
* http.request and https.request APIs.
|
|
20
|
-
* https://github.com/nodejs/node/blob/main/lib/internal/url.js#L1090
|
|
21
|
-
*/
|
|
22
|
-
static urlToHttpOptions(url) {
|
|
23
|
-
const options = {
|
|
24
|
-
protocol: url.protocol,
|
|
25
|
-
hostname: url.hostname && url.hostname.startsWith("[")
|
|
26
|
-
? url.hostname.slice(1, -1)
|
|
27
|
-
: url.hostname,
|
|
28
|
-
hash: url.hash,
|
|
29
|
-
search: url.search,
|
|
30
|
-
pathname: url.pathname,
|
|
31
|
-
path: `${url.pathname || ""}${url.search || ""}`,
|
|
32
|
-
href: url.href,
|
|
33
|
-
};
|
|
34
|
-
if (url.port !== "") {
|
|
35
|
-
options.port = Number(url.port);
|
|
36
|
-
}
|
|
37
|
-
if (url.username || url.password) {
|
|
38
|
-
options.auth = `${decodeURIComponent(url.username)}:${decodeURIComponent(url.password)}`;
|
|
39
|
-
}
|
|
40
|
-
return options;
|
|
41
|
-
}
|
|
5
|
+
/*
|
|
6
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7
|
+
* Licensed under the MIT License.
|
|
8
|
+
*/
|
|
9
|
+
class NetworkUtils {
|
|
10
|
+
static getNetworkResponse(headers, body, statusCode) {
|
|
11
|
+
return {
|
|
12
|
+
headers: headers,
|
|
13
|
+
body: body,
|
|
14
|
+
status: statusCode,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/*
|
|
18
|
+
* Utility function that converts a URL object into an ordinary options object as expected by the
|
|
19
|
+
* http.request and https.request APIs.
|
|
20
|
+
* https://github.com/nodejs/node/blob/main/lib/internal/url.js#L1090
|
|
21
|
+
*/
|
|
22
|
+
static urlToHttpOptions(url) {
|
|
23
|
+
const options = {
|
|
24
|
+
protocol: url.protocol,
|
|
25
|
+
hostname: url.hostname && url.hostname.startsWith("[")
|
|
26
|
+
? url.hostname.slice(1, -1)
|
|
27
|
+
: url.hostname,
|
|
28
|
+
hash: url.hash,
|
|
29
|
+
search: url.search,
|
|
30
|
+
pathname: url.pathname,
|
|
31
|
+
path: `${url.pathname || ""}${url.search || ""}`,
|
|
32
|
+
href: url.href,
|
|
33
|
+
};
|
|
34
|
+
if (url.port !== "") {
|
|
35
|
+
options.port = Number(url.port);
|
|
36
|
+
}
|
|
37
|
+
if (url.username || url.password) {
|
|
38
|
+
options.auth = `${decodeURIComponent(url.username)}:${decodeURIComponent(url.password)}`;
|
|
39
|
+
}
|
|
40
|
+
return options;
|
|
41
|
+
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
exports.NetworkUtils = NetworkUtils;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NetworkResponse, UrlToHttpRequestOptions } from "@azure/msal-common";
|
|
2
|
-
export declare class NetworkUtils {
|
|
3
|
-
static getNetworkResponse<T>(headers: Record<string, string>, body: T, statusCode: number): NetworkResponse<T>;
|
|
4
|
-
static urlToHttpOptions(url: URL): UrlToHttpRequestOptions;
|
|
5
|
-
}
|
|
1
|
+
import { NetworkResponse, UrlToHttpRequestOptions } from "@azure/msal-common";
|
|
2
|
+
export declare class NetworkUtils {
|
|
3
|
+
static getNetworkResponse<T>(headers: Record<string, string>, body: T, statusCode: number): NetworkResponse<T>;
|
|
4
|
+
static urlToHttpOptions(url: URL): UrlToHttpRequestOptions;
|
|
5
|
+
}
|
|
6
6
|
//# sourceMappingURL=NetworkUtils.d.ts.map
|