@azure/msal-node 2.7.0-alpha.0 → 2.7.1-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 +1 -1
- 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 +335 -333
- package/dist/client/ClientApplication.cjs.map +1 -1
- package/dist/client/ClientApplication.d.ts +143 -142
- package/dist/client/ClientApplication.d.ts.map +1 -1
- package/dist/client/ClientApplication.mjs +336 -334
- 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.cjs.map +1 -1
- package/dist/client/ClientCredentialClient.d.ts +33 -33
- package/dist/client/ClientCredentialClient.d.ts.map +1 -1
- package/dist/client/ClientCredentialClient.mjs +195 -195
- package/dist/client/ClientCredentialClient.mjs.map +1 -1
- package/dist/client/ConfidentialClientApplication.cjs +166 -163
- package/dist/client/ConfidentialClientApplication.cjs.map +1 -1
- package/dist/client/ConfidentialClientApplication.d.ts +58 -58
- package/dist/client/ConfidentialClientApplication.d.ts.map +1 -1
- package/dist/client/ConfidentialClientApplication.mjs +168 -165
- package/dist/client/ConfidentialClientApplication.mjs.map +1 -1
- 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 +75 -80
- 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 +76 -81
- 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 +116 -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 +118 -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.cjs.map +1 -1
- package/dist/client/OnBehalfOfClient.d.ts +47 -47
- package/dist/client/OnBehalfOfClient.d.ts.map +1 -1
- package/dist/client/OnBehalfOfClient.mjs +203 -203
- package/dist/client/OnBehalfOfClient.mjs.map +1 -1
- 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.cjs.map +1 -1
- package/dist/client/UsernamePasswordClient.d.ts +25 -25
- package/dist/client/UsernamePasswordClient.d.ts.map +1 -1
- package/dist/client/UsernamePasswordClient.mjs +96 -96
- package/dist/client/UsernamePasswordClient.mjs.map +1 -1
- package/dist/config/Configuration.cjs +102 -86
- package/dist/config/Configuration.cjs.map +1 -1
- package/dist/config/Configuration.d.ts +126 -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 +38 -28
- package/dist/error/ManagedIdentityError.cjs.map +1 -1
- package/dist/error/ManagedIdentityError.d.ts +26 -21
- package/dist/error/ManagedIdentityError.d.ts.map +1 -1
- package/dist/error/ManagedIdentityError.mjs +39 -29
- package/dist/error/ManagedIdentityError.mjs.map +1 -1
- package/dist/error/ManagedIdentityErrorCodes.cjs +26 -15
- package/dist/error/ManagedIdentityErrorCodes.cjs.map +1 -1
- package/dist/error/ManagedIdentityErrorCodes.d.ts +18 -9
- package/dist/error/ManagedIdentityErrorCodes.d.ts.map +1 -1
- package/dist/error/ManagedIdentityErrorCodes.mjs +23 -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 +21 -21
- package/dist/index.d.ts +44 -44
- package/dist/index.d.ts.map +1 -1
- 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 +281 -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 +281 -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.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/ClientCredentialRequest.d.ts.map +1 -1
- 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 +142 -103
- package/dist/utils/Constants.cjs.map +1 -1
- package/dist/utils/Constants.d.ts +132 -106
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.mjs +134 -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 +24 -10
- package/src/client/ClientCredentialClient.ts +14 -6
- package/src/client/ConfidentialClientApplication.ts +10 -5
- package/src/client/ManagedIdentityApplication.ts +8 -16
- 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 +82 -11
- 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/client/OnBehalfOfClient.ts +18 -7
- package/src/client/UsernamePasswordClient.ts +16 -7
- package/src/config/Configuration.ts +50 -18
- package/src/config/ManagedIdentityRequestParameters.ts +1 -6
- package/src/error/ManagedIdentityError.ts +15 -4
- package/src/error/ManagedIdentityErrorCodes.ts +19 -1
- package/src/index.ts +1 -0
- package/src/network/HttpClient.ts +27 -39
- package/src/network/HttpClientWithRetries.ts +80 -0
- package/src/packageMetadata.ts +1 -1
- package/src/request/ClientCredentialRequest.ts +6 -3
- package/src/retry/IHttpRetryPolicy.ts +18 -0
- package/src/retry/LinearRetryPolicy.ts +71 -0
- package/src/utils/Constants.ts +47 -10
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*! @azure/msal-node v2.7.1-alpha.0 2024-05-01 */
|
|
2
|
+
'use strict';
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
var msalCommon = require('@azure/msal-common');
|
|
6
|
+
var Constants = require('../utils/Constants.cjs');
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10
|
+
* Licensed under the MIT License.
|
|
11
|
+
*/
|
|
12
|
+
class HttpClientWithRetries {
|
|
13
|
+
constructor(httpClientNoRetries, retryPolicy) {
|
|
14
|
+
this.httpClientNoRetries = httpClientNoRetries;
|
|
15
|
+
this.retryPolicy = retryPolicy;
|
|
16
|
+
}
|
|
17
|
+
async sendNetworkRequestAsyncHelper(httpMethod, url, options) {
|
|
18
|
+
if (httpMethod === Constants.HttpMethod.GET) {
|
|
19
|
+
return this.httpClientNoRetries.sendGetRequestAsync(url, options);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
return this.httpClientNoRetries.sendPostRequestAsync(url, options);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
async sendNetworkRequestAsync(httpMethod, url, options) {
|
|
26
|
+
// the underlying network module (custom or HttpClient) will make the call
|
|
27
|
+
let response = await this.sendNetworkRequestAsyncHelper(httpMethod, url, options);
|
|
28
|
+
let currentRetry = 0;
|
|
29
|
+
while (await this.retryPolicy.pauseForRetry(response.status, currentRetry, response.headers[msalCommon.HeaderNames.RETRY_AFTER])) {
|
|
30
|
+
response = await this.sendNetworkRequestAsyncHelper(httpMethod, url, options);
|
|
31
|
+
currentRetry++;
|
|
32
|
+
}
|
|
33
|
+
return response;
|
|
34
|
+
}
|
|
35
|
+
async sendGetRequestAsync(url, options) {
|
|
36
|
+
return this.sendNetworkRequestAsync(Constants.HttpMethod.GET, url, options);
|
|
37
|
+
}
|
|
38
|
+
async sendPostRequestAsync(url, options) {
|
|
39
|
+
return this.sendNetworkRequestAsync(Constants.HttpMethod.POST, url, options);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
exports.HttpClientWithRetries = HttpClientWithRetries;
|
|
44
|
+
//# sourceMappingURL=HttpClientWithRetries.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpClientWithRetries.cjs","sources":["../../src/network/HttpClientWithRetries.ts"],"sourcesContent":[null],"names":["HttpMethod","HeaderNames"],"mappings":";;;;;;;AAAA;;;AAGG;MAWU,qBAAqB,CAAA;IAI9B,WACI,CAAA,mBAAmC,EACnC,WAA6B,EAAA;AAE7B,QAAA,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;AAC/C,QAAA,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;KAClC;AAEO,IAAA,MAAM,6BAA6B,CACvC,UAAsB,EACtB,GAAW,EACX,OAA+B,EAAA;AAE/B,QAAA,IAAI,UAAU,KAAKA,oBAAU,CAAC,GAAG,EAAE;YAC/B,OAAO,IAAI,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACrE,SAAA;AAAM,aAAA;YACH,OAAO,IAAI,CAAC,mBAAmB,CAAC,oBAAoB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACtE,SAAA;KACJ;AAEO,IAAA,MAAM,uBAAuB,CACjC,UAAsB,EACtB,GAAW,EACX,OAA+B,EAAA;;AAG/B,QAAA,IAAI,QAAQ,GACR,MAAM,IAAI,CAAC,6BAA6B,CAAC,UAAU,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;QAEvE,IAAI,YAAY,GAAW,CAAC,CAAC;QAC7B,OACI,MAAM,IAAI,CAAC,WAAW,CAAC,aAAa,CAChC,QAAQ,CAAC,MAAM,EACf,YAAY,EACZ,QAAQ,CAAC,OAAO,CAACC,sBAAW,CAAC,WAAW,CAAC,CAC5C,EACH;AACE,YAAA,QAAQ,GAAG,MAAM,IAAI,CAAC,6BAA6B,CAC/C,UAAU,EACV,GAAG,EACH,OAAO,CACV,CAAC;AACF,YAAA,YAAY,EAAE,CAAC;AAClB,SAAA;AAED,QAAA,OAAO,QAAQ,CAAC;KACnB;AAEM,IAAA,MAAM,mBAAmB,CAC5B,GAAW,EACX,OAA+B,EAAA;AAE/B,QAAA,OAAO,IAAI,CAAC,uBAAuB,CAACD,oBAAU,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;KACrE;AAEM,IAAA,MAAM,oBAAoB,CAC7B,GAAW,EACX,OAA+B,EAAA;AAE/B,QAAA,OAAO,IAAI,CAAC,uBAAuB,CAACA,oBAAU,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;KACtE;AACJ;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { INetworkModule, NetworkRequestOptions, NetworkResponse } from "@azure/msal-common";
|
|
2
|
+
import { IHttpRetryPolicy } from "../retry/IHttpRetryPolicy";
|
|
3
|
+
export declare class HttpClientWithRetries implements INetworkModule {
|
|
4
|
+
private httpClientNoRetries;
|
|
5
|
+
private retryPolicy;
|
|
6
|
+
constructor(httpClientNoRetries: INetworkModule, retryPolicy: IHttpRetryPolicy);
|
|
7
|
+
private sendNetworkRequestAsyncHelper;
|
|
8
|
+
private sendNetworkRequestAsync;
|
|
9
|
+
sendGetRequestAsync<T>(url: string, options?: NetworkRequestOptions): Promise<NetworkResponse<T>>;
|
|
10
|
+
sendPostRequestAsync<T>(url: string, options?: NetworkRequestOptions): Promise<NetworkResponse<T>>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=HttpClientWithRetries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpClientWithRetries.d.ts","sourceRoot":"","sources":["../../src/network/HttpClientWithRetries.ts"],"names":[],"mappings":"AAKA,OAAO,EAEH,cAAc,EACd,qBAAqB,EACrB,eAAe,EAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAG7D,qBAAa,qBAAsB,YAAW,cAAc;IACxD,OAAO,CAAC,mBAAmB,CAAiB;IAC5C,OAAO,CAAC,WAAW,CAAmB;gBAGlC,mBAAmB,EAAE,cAAc,EACnC,WAAW,EAAE,gBAAgB;YAMnB,6BAA6B;YAY7B,uBAAuB;IA4BxB,mBAAmB,CAAC,CAAC,EAC9B,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,qBAAqB,GAChC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAIjB,oBAAoB,CAAC,CAAC,EAC/B,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,qBAAqB,GAChC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;CAGjC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*! @azure/msal-node v2.7.1-alpha.0 2024-05-01 */
|
|
2
|
+
'use strict';
|
|
3
|
+
import { HeaderNames } from '@azure/msal-common';
|
|
4
|
+
import { HttpMethod } from '../utils/Constants.mjs';
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8
|
+
* Licensed under the MIT License.
|
|
9
|
+
*/
|
|
10
|
+
class HttpClientWithRetries {
|
|
11
|
+
constructor(httpClientNoRetries, retryPolicy) {
|
|
12
|
+
this.httpClientNoRetries = httpClientNoRetries;
|
|
13
|
+
this.retryPolicy = retryPolicy;
|
|
14
|
+
}
|
|
15
|
+
async sendNetworkRequestAsyncHelper(httpMethod, url, options) {
|
|
16
|
+
if (httpMethod === HttpMethod.GET) {
|
|
17
|
+
return this.httpClientNoRetries.sendGetRequestAsync(url, options);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
return this.httpClientNoRetries.sendPostRequestAsync(url, options);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
async sendNetworkRequestAsync(httpMethod, url, options) {
|
|
24
|
+
// the underlying network module (custom or HttpClient) will make the call
|
|
25
|
+
let response = await this.sendNetworkRequestAsyncHelper(httpMethod, url, options);
|
|
26
|
+
let currentRetry = 0;
|
|
27
|
+
while (await this.retryPolicy.pauseForRetry(response.status, currentRetry, response.headers[HeaderNames.RETRY_AFTER])) {
|
|
28
|
+
response = await this.sendNetworkRequestAsyncHelper(httpMethod, url, options);
|
|
29
|
+
currentRetry++;
|
|
30
|
+
}
|
|
31
|
+
return response;
|
|
32
|
+
}
|
|
33
|
+
async sendGetRequestAsync(url, options) {
|
|
34
|
+
return this.sendNetworkRequestAsync(HttpMethod.GET, url, options);
|
|
35
|
+
}
|
|
36
|
+
async sendPostRequestAsync(url, options) {
|
|
37
|
+
return this.sendNetworkRequestAsync(HttpMethod.POST, url, options);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { HttpClientWithRetries };
|
|
42
|
+
//# sourceMappingURL=HttpClientWithRetries.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpClientWithRetries.mjs","sources":["../../src/network/HttpClientWithRetries.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAAA;;;AAGG;MAWU,qBAAqB,CAAA;IAI9B,WACI,CAAA,mBAAmC,EACnC,WAA6B,EAAA;AAE7B,QAAA,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;AAC/C,QAAA,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;KAClC;AAEO,IAAA,MAAM,6BAA6B,CACvC,UAAsB,EACtB,GAAW,EACX,OAA+B,EAAA;AAE/B,QAAA,IAAI,UAAU,KAAK,UAAU,CAAC,GAAG,EAAE;YAC/B,OAAO,IAAI,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACrE,SAAA;AAAM,aAAA;YACH,OAAO,IAAI,CAAC,mBAAmB,CAAC,oBAAoB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACtE,SAAA;KACJ;AAEO,IAAA,MAAM,uBAAuB,CACjC,UAAsB,EACtB,GAAW,EACX,OAA+B,EAAA;;AAG/B,QAAA,IAAI,QAAQ,GACR,MAAM,IAAI,CAAC,6BAA6B,CAAC,UAAU,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;QAEvE,IAAI,YAAY,GAAW,CAAC,CAAC;QAC7B,OACI,MAAM,IAAI,CAAC,WAAW,CAAC,aAAa,CAChC,QAAQ,CAAC,MAAM,EACf,YAAY,EACZ,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAC5C,EACH;AACE,YAAA,QAAQ,GAAG,MAAM,IAAI,CAAC,6BAA6B,CAC/C,UAAU,EACV,GAAG,EACH,OAAO,CACV,CAAC;AACF,YAAA,YAAY,EAAE,CAAC;AAClB,SAAA;AAED,QAAA,OAAO,QAAQ,CAAC;KACnB;AAEM,IAAA,MAAM,mBAAmB,CAC5B,GAAW,EACX,OAA+B,EAAA;AAE/B,QAAA,OAAO,IAAI,CAAC,uBAAuB,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;KACrE;AAEM,IAAA,MAAM,oBAAoB,CAC7B,GAAW,EACX,OAA+B,EAAA;AAE/B,QAAA,OAAO,IAAI,CAAC,uBAAuB,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;KACtE;AACJ;;;;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ServerAuthorizationCodeResponse } from "@azure/msal-common";
|
|
2
|
-
/**
|
|
3
|
-
* Interface for LoopbackClient allowing to replace the default loopback server with a custom implementation.
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
export interface ILoopbackClient {
|
|
7
|
-
listenForAuthCode(successTemplate?: string, errorTemplate?: string): Promise<ServerAuthorizationCodeResponse>;
|
|
8
|
-
getRedirectUri(): string;
|
|
9
|
-
closeServer(): void;
|
|
10
|
-
}
|
|
1
|
+
import { ServerAuthorizationCodeResponse } from "@azure/msal-common";
|
|
2
|
+
/**
|
|
3
|
+
* Interface for LoopbackClient allowing to replace the default loopback server with a custom implementation.
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export interface ILoopbackClient {
|
|
7
|
+
listenForAuthCode(successTemplate?: string, errorTemplate?: string): Promise<ServerAuthorizationCodeResponse>;
|
|
8
|
+
getRedirectUri(): string;
|
|
9
|
+
closeServer(): void;
|
|
10
|
+
}
|
|
11
11
|
//# sourceMappingURL=ILoopbackClient.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-node v2.7.
|
|
1
|
+
/*! @azure/msal-node v2.7.1-alpha.0 2024-05-01 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -7,82 +7,82 @@ var http = require('http');
|
|
|
7
7
|
var NodeAuthError = require('../error/NodeAuthError.cjs');
|
|
8
8
|
var Constants = require('../utils/Constants.cjs');
|
|
9
9
|
|
|
10
|
-
/*
|
|
11
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12
|
-
* Licensed under the MIT License.
|
|
13
|
-
*/
|
|
14
|
-
class LoopbackClient {
|
|
15
|
-
/**
|
|
16
|
-
* Spins up a loopback server which returns the server response when the localhost redirectUri is hit
|
|
17
|
-
* @param successTemplate
|
|
18
|
-
* @param errorTemplate
|
|
19
|
-
* @returns
|
|
20
|
-
*/
|
|
21
|
-
async listenForAuthCode(successTemplate, errorTemplate) {
|
|
22
|
-
if (this.server) {
|
|
23
|
-
throw NodeAuthError.NodeAuthError.createLoopbackServerAlreadyExistsError();
|
|
24
|
-
}
|
|
25
|
-
return new Promise((resolve, reject) => {
|
|
26
|
-
this.server = http.createServer((req, res) => {
|
|
27
|
-
const url = req.url;
|
|
28
|
-
if (!url) {
|
|
29
|
-
res.end(errorTemplate ||
|
|
30
|
-
"Error occurred loading redirectUrl");
|
|
31
|
-
reject(NodeAuthError.NodeAuthError.createUnableToLoadRedirectUrlError());
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
else if (url === msalCommon.Constants.FORWARD_SLASH) {
|
|
35
|
-
res.end(successTemplate ||
|
|
36
|
-
"Auth code was successfully acquired. You can close this window now.");
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
const redirectUri = this.getRedirectUri();
|
|
40
|
-
const parsedUrl = new URL(url, redirectUri);
|
|
41
|
-
const authCodeResponse = msalCommon.UrlUtils.getDeserializedResponse(parsedUrl.search) || {};
|
|
42
|
-
if (authCodeResponse.code) {
|
|
43
|
-
res.writeHead(msalCommon.HttpStatus.REDIRECT, {
|
|
44
|
-
location: redirectUri,
|
|
45
|
-
}); // Prevent auth code from being saved in the browser history
|
|
46
|
-
res.end();
|
|
47
|
-
}
|
|
48
|
-
resolve(authCodeResponse);
|
|
49
|
-
});
|
|
50
|
-
this.server.listen(0); // Listen on any available port
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Get the port that the loopback server is running on
|
|
55
|
-
* @returns
|
|
56
|
-
*/
|
|
57
|
-
getRedirectUri() {
|
|
58
|
-
if (!this.server || !this.server.listening) {
|
|
59
|
-
throw NodeAuthError.NodeAuthError.createNoLoopbackServerExistsError();
|
|
60
|
-
}
|
|
61
|
-
const address = this.server.address();
|
|
62
|
-
if (!address || typeof address === "string" || !address.port) {
|
|
63
|
-
this.closeServer();
|
|
64
|
-
throw NodeAuthError.NodeAuthError.createInvalidLoopbackAddressTypeError();
|
|
65
|
-
}
|
|
66
|
-
const port = address && address.port;
|
|
67
|
-
return `${Constants.Constants.HTTP_PROTOCOL}${Constants.Constants.LOCALHOST}:${port}`;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Close the loopback server
|
|
71
|
-
*/
|
|
72
|
-
closeServer() {
|
|
73
|
-
if (this.server) {
|
|
74
|
-
// Only stops accepting new connections, server will close once open/idle connections are closed.
|
|
75
|
-
this.server.close();
|
|
76
|
-
if (typeof this.server.closeAllConnections === "function") {
|
|
77
|
-
/*
|
|
78
|
-
* Close open/idle connections. This API is available in Node versions 18.2 and higher
|
|
79
|
-
*/
|
|
80
|
-
this.server.closeAllConnections();
|
|
81
|
-
}
|
|
82
|
-
this.server.unref();
|
|
83
|
-
this.server = undefined;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
10
|
+
/*
|
|
11
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12
|
+
* Licensed under the MIT License.
|
|
13
|
+
*/
|
|
14
|
+
class LoopbackClient {
|
|
15
|
+
/**
|
|
16
|
+
* Spins up a loopback server which returns the server response when the localhost redirectUri is hit
|
|
17
|
+
* @param successTemplate
|
|
18
|
+
* @param errorTemplate
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
async listenForAuthCode(successTemplate, errorTemplate) {
|
|
22
|
+
if (this.server) {
|
|
23
|
+
throw NodeAuthError.NodeAuthError.createLoopbackServerAlreadyExistsError();
|
|
24
|
+
}
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
this.server = http.createServer((req, res) => {
|
|
27
|
+
const url = req.url;
|
|
28
|
+
if (!url) {
|
|
29
|
+
res.end(errorTemplate ||
|
|
30
|
+
"Error occurred loading redirectUrl");
|
|
31
|
+
reject(NodeAuthError.NodeAuthError.createUnableToLoadRedirectUrlError());
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
else if (url === msalCommon.Constants.FORWARD_SLASH) {
|
|
35
|
+
res.end(successTemplate ||
|
|
36
|
+
"Auth code was successfully acquired. You can close this window now.");
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const redirectUri = this.getRedirectUri();
|
|
40
|
+
const parsedUrl = new URL(url, redirectUri);
|
|
41
|
+
const authCodeResponse = msalCommon.UrlUtils.getDeserializedResponse(parsedUrl.search) || {};
|
|
42
|
+
if (authCodeResponse.code) {
|
|
43
|
+
res.writeHead(msalCommon.HttpStatus.REDIRECT, {
|
|
44
|
+
location: redirectUri,
|
|
45
|
+
}); // Prevent auth code from being saved in the browser history
|
|
46
|
+
res.end();
|
|
47
|
+
}
|
|
48
|
+
resolve(authCodeResponse);
|
|
49
|
+
});
|
|
50
|
+
this.server.listen(0); // Listen on any available port
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Get the port that the loopback server is running on
|
|
55
|
+
* @returns
|
|
56
|
+
*/
|
|
57
|
+
getRedirectUri() {
|
|
58
|
+
if (!this.server || !this.server.listening) {
|
|
59
|
+
throw NodeAuthError.NodeAuthError.createNoLoopbackServerExistsError();
|
|
60
|
+
}
|
|
61
|
+
const address = this.server.address();
|
|
62
|
+
if (!address || typeof address === "string" || !address.port) {
|
|
63
|
+
this.closeServer();
|
|
64
|
+
throw NodeAuthError.NodeAuthError.createInvalidLoopbackAddressTypeError();
|
|
65
|
+
}
|
|
66
|
+
const port = address && address.port;
|
|
67
|
+
return `${Constants.Constants.HTTP_PROTOCOL}${Constants.Constants.LOCALHOST}:${port}`;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Close the loopback server
|
|
71
|
+
*/
|
|
72
|
+
closeServer() {
|
|
73
|
+
if (this.server) {
|
|
74
|
+
// Only stops accepting new connections, server will close once open/idle connections are closed.
|
|
75
|
+
this.server.close();
|
|
76
|
+
if (typeof this.server.closeAllConnections === "function") {
|
|
77
|
+
/*
|
|
78
|
+
* Close open/idle connections. This API is available in Node versions 18.2 and higher
|
|
79
|
+
*/
|
|
80
|
+
this.server.closeAllConnections();
|
|
81
|
+
}
|
|
82
|
+
this.server.unref();
|
|
83
|
+
this.server = undefined;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
exports.LoopbackClient = LoopbackClient;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { ServerAuthorizationCodeResponse } from "@azure/msal-common";
|
|
2
|
-
import { ILoopbackClient } from "./ILoopbackClient.js";
|
|
3
|
-
export declare class LoopbackClient implements ILoopbackClient {
|
|
4
|
-
private server;
|
|
5
|
-
/**
|
|
6
|
-
* Spins up a loopback server which returns the server response when the localhost redirectUri is hit
|
|
7
|
-
* @param successTemplate
|
|
8
|
-
* @param errorTemplate
|
|
9
|
-
* @returns
|
|
10
|
-
*/
|
|
11
|
-
listenForAuthCode(successTemplate?: string, errorTemplate?: string): Promise<ServerAuthorizationCodeResponse>;
|
|
12
|
-
/**
|
|
13
|
-
* Get the port that the loopback server is running on
|
|
14
|
-
* @returns
|
|
15
|
-
*/
|
|
16
|
-
getRedirectUri(): string;
|
|
17
|
-
/**
|
|
18
|
-
* Close the loopback server
|
|
19
|
-
*/
|
|
20
|
-
closeServer(): void;
|
|
21
|
-
}
|
|
1
|
+
import { ServerAuthorizationCodeResponse } from "@azure/msal-common";
|
|
2
|
+
import { ILoopbackClient } from "./ILoopbackClient.js";
|
|
3
|
+
export declare class LoopbackClient implements ILoopbackClient {
|
|
4
|
+
private server;
|
|
5
|
+
/**
|
|
6
|
+
* Spins up a loopback server which returns the server response when the localhost redirectUri is hit
|
|
7
|
+
* @param successTemplate
|
|
8
|
+
* @param errorTemplate
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
listenForAuthCode(successTemplate?: string, errorTemplate?: string): Promise<ServerAuthorizationCodeResponse>;
|
|
12
|
+
/**
|
|
13
|
+
* Get the port that the loopback server is running on
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
getRedirectUri(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Close the loopback server
|
|
19
|
+
*/
|
|
20
|
+
closeServer(): void;
|
|
21
|
+
}
|
|
22
22
|
//# sourceMappingURL=LoopbackClient.d.ts.map
|
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
/*! @azure/msal-node v2.7.
|
|
1
|
+
/*! @azure/msal-node v2.7.1-alpha.0 2024-05-01 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { Constants, UrlUtils, HttpStatus } from '@azure/msal-common';
|
|
4
4
|
import http from 'http';
|
|
5
5
|
import { NodeAuthError } from '../error/NodeAuthError.mjs';
|
|
6
6
|
import { Constants as Constants$1 } from '../utils/Constants.mjs';
|
|
7
7
|
|
|
8
|
-
/*
|
|
9
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10
|
-
* Licensed under the MIT License.
|
|
11
|
-
*/
|
|
12
|
-
class LoopbackClient {
|
|
13
|
-
/**
|
|
14
|
-
* Spins up a loopback server which returns the server response when the localhost redirectUri is hit
|
|
15
|
-
* @param successTemplate
|
|
16
|
-
* @param errorTemplate
|
|
17
|
-
* @returns
|
|
18
|
-
*/
|
|
19
|
-
async listenForAuthCode(successTemplate, errorTemplate) {
|
|
20
|
-
if (this.server) {
|
|
21
|
-
throw NodeAuthError.createLoopbackServerAlreadyExistsError();
|
|
22
|
-
}
|
|
23
|
-
return new Promise((resolve, reject) => {
|
|
24
|
-
this.server = http.createServer((req, res) => {
|
|
25
|
-
const url = req.url;
|
|
26
|
-
if (!url) {
|
|
27
|
-
res.end(errorTemplate ||
|
|
28
|
-
"Error occurred loading redirectUrl");
|
|
29
|
-
reject(NodeAuthError.createUnableToLoadRedirectUrlError());
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
else if (url === Constants.FORWARD_SLASH) {
|
|
33
|
-
res.end(successTemplate ||
|
|
34
|
-
"Auth code was successfully acquired. You can close this window now.");
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
const redirectUri = this.getRedirectUri();
|
|
38
|
-
const parsedUrl = new URL(url, redirectUri);
|
|
39
|
-
const authCodeResponse = UrlUtils.getDeserializedResponse(parsedUrl.search) || {};
|
|
40
|
-
if (authCodeResponse.code) {
|
|
41
|
-
res.writeHead(HttpStatus.REDIRECT, {
|
|
42
|
-
location: redirectUri,
|
|
43
|
-
}); // Prevent auth code from being saved in the browser history
|
|
44
|
-
res.end();
|
|
45
|
-
}
|
|
46
|
-
resolve(authCodeResponse);
|
|
47
|
-
});
|
|
48
|
-
this.server.listen(0); // Listen on any available port
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Get the port that the loopback server is running on
|
|
53
|
-
* @returns
|
|
54
|
-
*/
|
|
55
|
-
getRedirectUri() {
|
|
56
|
-
if (!this.server || !this.server.listening) {
|
|
57
|
-
throw NodeAuthError.createNoLoopbackServerExistsError();
|
|
58
|
-
}
|
|
59
|
-
const address = this.server.address();
|
|
60
|
-
if (!address || typeof address === "string" || !address.port) {
|
|
61
|
-
this.closeServer();
|
|
62
|
-
throw NodeAuthError.createInvalidLoopbackAddressTypeError();
|
|
63
|
-
}
|
|
64
|
-
const port = address && address.port;
|
|
65
|
-
return `${Constants$1.HTTP_PROTOCOL}${Constants$1.LOCALHOST}:${port}`;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Close the loopback server
|
|
69
|
-
*/
|
|
70
|
-
closeServer() {
|
|
71
|
-
if (this.server) {
|
|
72
|
-
// Only stops accepting new connections, server will close once open/idle connections are closed.
|
|
73
|
-
this.server.close();
|
|
74
|
-
if (typeof this.server.closeAllConnections === "function") {
|
|
75
|
-
/*
|
|
76
|
-
* Close open/idle connections. This API is available in Node versions 18.2 and higher
|
|
77
|
-
*/
|
|
78
|
-
this.server.closeAllConnections();
|
|
79
|
-
}
|
|
80
|
-
this.server.unref();
|
|
81
|
-
this.server = undefined;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
8
|
+
/*
|
|
9
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10
|
+
* Licensed under the MIT License.
|
|
11
|
+
*/
|
|
12
|
+
class LoopbackClient {
|
|
13
|
+
/**
|
|
14
|
+
* Spins up a loopback server which returns the server response when the localhost redirectUri is hit
|
|
15
|
+
* @param successTemplate
|
|
16
|
+
* @param errorTemplate
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
async listenForAuthCode(successTemplate, errorTemplate) {
|
|
20
|
+
if (this.server) {
|
|
21
|
+
throw NodeAuthError.createLoopbackServerAlreadyExistsError();
|
|
22
|
+
}
|
|
23
|
+
return new Promise((resolve, reject) => {
|
|
24
|
+
this.server = http.createServer((req, res) => {
|
|
25
|
+
const url = req.url;
|
|
26
|
+
if (!url) {
|
|
27
|
+
res.end(errorTemplate ||
|
|
28
|
+
"Error occurred loading redirectUrl");
|
|
29
|
+
reject(NodeAuthError.createUnableToLoadRedirectUrlError());
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
else if (url === Constants.FORWARD_SLASH) {
|
|
33
|
+
res.end(successTemplate ||
|
|
34
|
+
"Auth code was successfully acquired. You can close this window now.");
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const redirectUri = this.getRedirectUri();
|
|
38
|
+
const parsedUrl = new URL(url, redirectUri);
|
|
39
|
+
const authCodeResponse = UrlUtils.getDeserializedResponse(parsedUrl.search) || {};
|
|
40
|
+
if (authCodeResponse.code) {
|
|
41
|
+
res.writeHead(HttpStatus.REDIRECT, {
|
|
42
|
+
location: redirectUri,
|
|
43
|
+
}); // Prevent auth code from being saved in the browser history
|
|
44
|
+
res.end();
|
|
45
|
+
}
|
|
46
|
+
resolve(authCodeResponse);
|
|
47
|
+
});
|
|
48
|
+
this.server.listen(0); // Listen on any available port
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Get the port that the loopback server is running on
|
|
53
|
+
* @returns
|
|
54
|
+
*/
|
|
55
|
+
getRedirectUri() {
|
|
56
|
+
if (!this.server || !this.server.listening) {
|
|
57
|
+
throw NodeAuthError.createNoLoopbackServerExistsError();
|
|
58
|
+
}
|
|
59
|
+
const address = this.server.address();
|
|
60
|
+
if (!address || typeof address === "string" || !address.port) {
|
|
61
|
+
this.closeServer();
|
|
62
|
+
throw NodeAuthError.createInvalidLoopbackAddressTypeError();
|
|
63
|
+
}
|
|
64
|
+
const port = address && address.port;
|
|
65
|
+
return `${Constants$1.HTTP_PROTOCOL}${Constants$1.LOCALHOST}:${port}`;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Close the loopback server
|
|
69
|
+
*/
|
|
70
|
+
closeServer() {
|
|
71
|
+
if (this.server) {
|
|
72
|
+
// Only stops accepting new connections, server will close once open/idle connections are closed.
|
|
73
|
+
this.server.close();
|
|
74
|
+
if (typeof this.server.closeAllConnections === "function") {
|
|
75
|
+
/*
|
|
76
|
+
* Close open/idle connections. This API is available in Node versions 18.2 and higher
|
|
77
|
+
*/
|
|
78
|
+
this.server.closeAllConnections();
|
|
79
|
+
}
|
|
80
|
+
this.server.unref();
|
|
81
|
+
this.server = undefined;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
export { LoopbackClient };
|
package/dist/packageMetadata.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/*! @azure/msal-node v2.7.
|
|
1
|
+
/*! @azure/msal-node v2.7.1-alpha.0 2024-05-01 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
/* eslint-disable header/header */
|
|
6
|
-
const name = "@azure/msal-node";
|
|
7
|
-
const version = "2.7.
|
|
5
|
+
/* eslint-disable header/header */
|
|
6
|
+
const name = "@azure/msal-node";
|
|
7
|
+
const version = "2.7.1-alpha.0";
|
|
8
8
|
|
|
9
9
|
exports.name = name;
|
|
10
10
|
exports.version = version;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const name = "@azure/msal-node";
|
|
2
|
-
export declare const version = "2.7.
|
|
1
|
+
export declare const name = "@azure/msal-node";
|
|
2
|
+
export declare const version = "2.7.1-alpha.0";
|
|
3
3
|
//# sourceMappingURL=packageMetadata.d.ts.map
|
package/dist/packageMetadata.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! @azure/msal-node v2.7.
|
|
1
|
+
/*! @azure/msal-node v2.7.1-alpha.0 2024-05-01 */
|
|
2
2
|
'use strict';
|
|
3
|
-
/* eslint-disable header/header */
|
|
4
|
-
const name = "@azure/msal-node";
|
|
5
|
-
const version = "2.7.
|
|
3
|
+
/* eslint-disable header/header */
|
|
4
|
+
const name = "@azure/msal-node";
|
|
5
|
+
const version = "2.7.1-alpha.0";
|
|
6
6
|
|
|
7
7
|
export { name, version };
|
|
8
8
|
//# sourceMappingURL=packageMetadata.mjs.map
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { CommonAuthorizationCodeRequest } from "@azure/msal-common";
|
|
2
|
-
/**
|
|
3
|
-
* Request object passed by user to acquire a token from the server exchanging a valid authorization code (second leg of OAuth2.0 Authorization Code flow)
|
|
4
|
-
*
|
|
5
|
-
* - scopes - Array of scopes the application is requesting access to.
|
|
6
|
-
* - claims - A stringified claims request which will be added to all /authorize and /token calls
|
|
7
|
-
* - 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.
|
|
8
|
-
* - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
|
|
9
|
-
* - 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.
|
|
10
|
-
* - tokenQueryParameters - String to string map of custom query parameters added to the /token call
|
|
11
|
-
* - code - The authorization_code that the user acquired in the first leg of the flow.
|
|
12
|
-
* - 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
|
|
13
|
-
* - 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.
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
export type AuthorizationCodeRequest = Partial<Omit<CommonAuthorizationCodeRequest, "scopes" | "redirectUri" | "code" | "authenticationScheme" | "resourceRequestMethod" | "resourceRequestUri" | "requestedClaimsHash" | "storeInCache">> & {
|
|
17
|
-
scopes: Array<string>;
|
|
18
|
-
redirectUri: string;
|
|
19
|
-
code: string;
|
|
20
|
-
state?: string;
|
|
21
|
-
};
|
|
1
|
+
import { CommonAuthorizationCodeRequest } from "@azure/msal-common";
|
|
2
|
+
/**
|
|
3
|
+
* Request object passed by user to acquire a token from the server exchanging a valid authorization code (second leg of OAuth2.0 Authorization Code flow)
|
|
4
|
+
*
|
|
5
|
+
* - scopes - Array of scopes the application is requesting access to.
|
|
6
|
+
* - claims - A stringified claims request which will be added to all /authorize and /token calls
|
|
7
|
+
* - 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.
|
|
8
|
+
* - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
|
|
9
|
+
* - 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.
|
|
10
|
+
* - tokenQueryParameters - String to string map of custom query parameters added to the /token call
|
|
11
|
+
* - code - The authorization_code that the user acquired in the first leg of the flow.
|
|
12
|
+
* - 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
|
|
13
|
+
* - 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.
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export type AuthorizationCodeRequest = Partial<Omit<CommonAuthorizationCodeRequest, "scopes" | "redirectUri" | "code" | "authenticationScheme" | "resourceRequestMethod" | "resourceRequestUri" | "requestedClaimsHash" | "storeInCache">> & {
|
|
17
|
+
scopes: Array<string>;
|
|
18
|
+
redirectUri: string;
|
|
19
|
+
code: string;
|
|
20
|
+
state?: string;
|
|
21
|
+
};
|
|
22
22
|
//# sourceMappingURL=AuthorizationCodeRequest.d.ts.map
|