@azure/msal-node 3.2.2 → 3.3.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 +3 -1
- package/dist/cache/NodeStorage.mjs +1 -1
- package/dist/cache/TokenCache.mjs +1 -1
- package/dist/cache/distributed/DistributedCachePlugin.mjs +1 -1
- package/dist/cache/serializer/Deserializer.mjs +1 -1
- package/dist/cache/serializer/Serializer.mjs +1 -1
- package/dist/client/ClientApplication.d.ts +1 -0
- package/dist/client/ClientApplication.d.ts.map +1 -1
- package/dist/client/ClientApplication.mjs +2 -1
- package/dist/client/ClientApplication.mjs.map +1 -1
- package/dist/client/ClientAssertion.mjs +1 -1
- package/dist/client/ClientCredentialClient.mjs +1 -1
- package/dist/client/ConfidentialClientApplication.mjs +1 -1
- package/dist/client/DeviceCodeClient.mjs +1 -1
- package/dist/client/IConfidentialClientApplication.d.ts +4 -1
- package/dist/client/IConfidentialClientApplication.d.ts.map +1 -1
- package/dist/client/IPublicClientApplication.d.ts +4 -1
- package/dist/client/IPublicClientApplication.d.ts.map +1 -1
- package/dist/client/ManagedIdentityApplication.d.ts.map +1 -1
- package/dist/client/ManagedIdentityApplication.mjs +2 -2
- package/dist/client/ManagedIdentityApplication.mjs.map +1 -1
- package/dist/client/ManagedIdentityClient.d.ts +2 -1
- package/dist/client/ManagedIdentityClient.d.ts.map +1 -1
- package/dist/client/ManagedIdentityClient.mjs +11 -10
- package/dist/client/ManagedIdentityClient.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/AppService.d.ts +2 -2
- package/dist/client/ManagedIdentitySources/AppService.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/AppService.mjs +5 -5
- package/dist/client/ManagedIdentitySources/AppService.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/AzureArc.d.ts +2 -2
- package/dist/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/AzureArc.mjs +5 -5
- package/dist/client/ManagedIdentitySources/AzureArc.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts +2 -1
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +15 -5
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/CloudShell.d.ts +2 -2
- package/dist/client/ManagedIdentitySources/CloudShell.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/CloudShell.mjs +5 -5
- package/dist/client/ManagedIdentitySources/CloudShell.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/Imds.d.ts +2 -2
- package/dist/client/ManagedIdentitySources/Imds.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/Imds.mjs +5 -5
- package/dist/client/ManagedIdentitySources/Imds.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/MachineLearning.d.ts +2 -2
- package/dist/client/ManagedIdentitySources/MachineLearning.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/MachineLearning.mjs +5 -5
- package/dist/client/ManagedIdentitySources/MachineLearning.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts +2 -2
- package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +5 -5
- package/dist/client/ManagedIdentitySources/ServiceFabric.mjs.map +1 -1
- package/dist/client/OnBehalfOfClient.mjs +1 -1
- package/dist/client/PublicClientApplication.mjs +1 -1
- package/dist/client/UsernamePasswordClient.d.ts +1 -0
- package/dist/client/UsernamePasswordClient.d.ts.map +1 -1
- package/dist/client/UsernamePasswordClient.mjs +2 -1
- package/dist/client/UsernamePasswordClient.mjs.map +1 -1
- package/dist/config/Configuration.d.ts +1 -0
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.mjs +2 -9
- package/dist/config/Configuration.mjs.map +1 -1
- package/dist/config/ManagedIdentityId.mjs +1 -1
- package/dist/config/ManagedIdentityRequestParameters.d.ts +3 -2
- package/dist/config/ManagedIdentityRequestParameters.d.ts.map +1 -1
- package/dist/config/ManagedIdentityRequestParameters.mjs +6 -2
- package/dist/config/ManagedIdentityRequestParameters.mjs.map +1 -1
- package/dist/crypto/CryptoProvider.mjs +1 -1
- package/dist/crypto/GuidGenerator.mjs +1 -1
- package/dist/crypto/HashUtils.mjs +1 -1
- package/dist/crypto/PkceGenerator.mjs +1 -1
- package/dist/error/ManagedIdentityError.mjs +1 -1
- package/dist/error/ManagedIdentityErrorCodes.mjs +1 -1
- package/dist/error/NodeAuthError.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/internals.mjs +1 -1
- package/dist/network/HttpClient.mjs +1 -1
- package/dist/network/HttpClientWithRetries.mjs +1 -1
- package/dist/network/LoopbackClient.mjs +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/retry/LinearRetryPolicy.mjs +1 -1
- package/dist/utils/Constants.d.ts +5 -0
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.mjs +1 -1
- package/dist/utils/Constants.mjs.map +1 -1
- package/dist/utils/EncodingUtils.mjs +1 -1
- package/dist/utils/NetworkUtils.mjs +1 -1
- package/dist/utils/TimeUtils.mjs +1 -1
- package/lib/msal-node.cjs +227 -218
- package/lib/msal-node.cjs.map +1 -1
- package/lib/types/client/ClientApplication.d.ts +1 -0
- package/lib/types/client/ClientApplication.d.ts.map +1 -1
- package/lib/types/client/IConfidentialClientApplication.d.ts +4 -1
- package/lib/types/client/IConfidentialClientApplication.d.ts.map +1 -1
- package/lib/types/client/IPublicClientApplication.d.ts +4 -1
- package/lib/types/client/IPublicClientApplication.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentityApplication.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentityClient.d.ts +2 -1
- package/lib/types/client/ManagedIdentityClient.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/AppService.d.ts +2 -2
- package/lib/types/client/ManagedIdentitySources/AppService.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/AzureArc.d.ts +2 -2
- package/lib/types/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts +2 -1
- package/lib/types/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/CloudShell.d.ts +2 -2
- package/lib/types/client/ManagedIdentitySources/CloudShell.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/Imds.d.ts +2 -2
- package/lib/types/client/ManagedIdentitySources/Imds.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/MachineLearning.d.ts +2 -2
- package/lib/types/client/ManagedIdentitySources/MachineLearning.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/ServiceFabric.d.ts +2 -2
- package/lib/types/client/ManagedIdentitySources/ServiceFabric.d.ts.map +1 -1
- package/lib/types/client/UsernamePasswordClient.d.ts +1 -0
- package/lib/types/client/UsernamePasswordClient.d.ts.map +1 -1
- package/lib/types/config/Configuration.d.ts +1 -0
- package/lib/types/config/Configuration.d.ts.map +1 -1
- package/lib/types/config/ManagedIdentityRequestParameters.d.ts +3 -2
- package/lib/types/config/ManagedIdentityRequestParameters.d.ts.map +1 -1
- package/lib/types/packageMetadata.d.ts +1 -1
- package/lib/types/utils/Constants.d.ts +5 -0
- package/lib/types/utils/Constants.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/client/ClientApplication.ts +1 -0
- package/src/client/IConfidentialClientApplication.ts +4 -1
- package/src/client/IPublicClientApplication.ts +4 -1
- package/src/client/ManagedIdentityApplication.ts +2 -1
- package/src/client/ManagedIdentityClient.ts +20 -4
- package/src/client/ManagedIdentitySources/AppService.ts +11 -2
- package/src/client/ManagedIdentitySources/AzureArc.ts +10 -1
- package/src/client/ManagedIdentitySources/BaseManagedIdentitySource.ts +20 -4
- package/src/client/ManagedIdentitySources/CloudShell.ts +10 -1
- package/src/client/ManagedIdentitySources/Imds.ts +11 -2
- package/src/client/ManagedIdentitySources/MachineLearning.ts +11 -2
- package/src/client/ManagedIdentitySources/ServiceFabric.ts +10 -1
- package/src/client/UsernamePasswordClient.ts +1 -0
- package/src/config/Configuration.ts +2 -20
- package/src/config/ManagedIdentityRequestParameters.ts +21 -2
- package/src/packageMetadata.ts +1 -1
- package/src/utils/Constants.ts +6 -0
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
createManagedIdentityError,
|
|
33
33
|
} from "../../error/ManagedIdentityError.js";
|
|
34
34
|
import { isIso8601 } from "../../utils/TimeUtils.js";
|
|
35
|
+
import { HttpClientWithRetries } from "../../network/HttpClientWithRetries.js";
|
|
35
36
|
|
|
36
37
|
/**
|
|
37
38
|
* Managed Identity User Assigned Id Query Parameter Names
|
|
@@ -50,17 +51,20 @@ export abstract class BaseManagedIdentitySource {
|
|
|
50
51
|
private nodeStorage: NodeStorage;
|
|
51
52
|
private networkClient: INetworkModule;
|
|
52
53
|
private cryptoProvider: CryptoProvider;
|
|
54
|
+
private disableInternalRetries: boolean;
|
|
53
55
|
|
|
54
56
|
constructor(
|
|
55
57
|
logger: Logger,
|
|
56
58
|
nodeStorage: NodeStorage,
|
|
57
59
|
networkClient: INetworkModule,
|
|
58
|
-
cryptoProvider: CryptoProvider
|
|
60
|
+
cryptoProvider: CryptoProvider,
|
|
61
|
+
disableInternalRetries: boolean
|
|
59
62
|
) {
|
|
60
63
|
this.logger = logger;
|
|
61
64
|
this.nodeStorage = nodeStorage;
|
|
62
65
|
this.networkClient = networkClient;
|
|
63
66
|
this.cryptoProvider = cryptoProvider;
|
|
67
|
+
this.disableInternalRetries = disableInternalRetries;
|
|
64
68
|
}
|
|
65
69
|
|
|
66
70
|
abstract createRequest(
|
|
@@ -151,20 +155,32 @@ export abstract class BaseManagedIdentitySource {
|
|
|
151
155
|
networkRequest.computeParametersBodyString();
|
|
152
156
|
}
|
|
153
157
|
|
|
158
|
+
/**
|
|
159
|
+
* Initializes the network client helper based on the retry policy configuration.
|
|
160
|
+
* If internal retries are disabled, it uses the provided network client directly.
|
|
161
|
+
* Otherwise, it wraps the network client with an HTTP client that supports retries.
|
|
162
|
+
*/
|
|
163
|
+
const networkClientHelper: INetworkModule = this.disableInternalRetries
|
|
164
|
+
? this.networkClient
|
|
165
|
+
: new HttpClientWithRetries(
|
|
166
|
+
this.networkClient,
|
|
167
|
+
networkRequest.retryPolicy
|
|
168
|
+
);
|
|
169
|
+
|
|
154
170
|
const reqTimestamp = TimeUtils.nowSeconds();
|
|
155
171
|
let response: NetworkResponse<ManagedIdentityTokenResponse>;
|
|
156
172
|
try {
|
|
157
173
|
// Sources that send POST requests: Cloud Shell
|
|
158
174
|
if (networkRequest.httpMethod === HttpMethod.POST) {
|
|
159
175
|
response =
|
|
160
|
-
await
|
|
176
|
+
await networkClientHelper.sendPostRequestAsync<ManagedIdentityTokenResponse>(
|
|
161
177
|
networkRequest.computeUri(),
|
|
162
178
|
networkRequestOptions
|
|
163
179
|
);
|
|
164
180
|
// Sources that send GET requests: App Service, Azure Arc, IMDS, Service Fabric
|
|
165
181
|
} else {
|
|
166
182
|
response =
|
|
167
|
-
await
|
|
183
|
+
await networkClientHelper.sendGetRequestAsync<ManagedIdentityTokenResponse>(
|
|
168
184
|
networkRequest.computeUri(),
|
|
169
185
|
networkRequestOptions
|
|
170
186
|
);
|
|
@@ -189,7 +205,7 @@ export abstract class BaseManagedIdentitySource {
|
|
|
189
205
|
const serverTokenResponse: ServerAuthorizationTokenResponse =
|
|
190
206
|
await this.getServerTokenResponseAsync(
|
|
191
207
|
response,
|
|
192
|
-
|
|
208
|
+
networkClientHelper,
|
|
193
209
|
networkRequest,
|
|
194
210
|
networkRequestOptions
|
|
195
211
|
);
|
|
@@ -33,9 +33,16 @@ export class CloudShell extends BaseManagedIdentitySource {
|
|
|
33
33
|
nodeStorage: NodeStorage,
|
|
34
34
|
networkClient: INetworkModule,
|
|
35
35
|
cryptoProvider: CryptoProvider,
|
|
36
|
+
disableInternalRetries: boolean,
|
|
36
37
|
msiEndpoint: string
|
|
37
38
|
) {
|
|
38
|
-
super(
|
|
39
|
+
super(
|
|
40
|
+
logger,
|
|
41
|
+
nodeStorage,
|
|
42
|
+
networkClient,
|
|
43
|
+
cryptoProvider,
|
|
44
|
+
disableInternalRetries
|
|
45
|
+
);
|
|
39
46
|
|
|
40
47
|
this.msiEndpoint = msiEndpoint;
|
|
41
48
|
}
|
|
@@ -52,6 +59,7 @@ export class CloudShell extends BaseManagedIdentitySource {
|
|
|
52
59
|
nodeStorage: NodeStorage,
|
|
53
60
|
networkClient: INetworkModule,
|
|
54
61
|
cryptoProvider: CryptoProvider,
|
|
62
|
+
disableInternalRetries: boolean,
|
|
55
63
|
managedIdentityId: ManagedIdentityId
|
|
56
64
|
): CloudShell | null {
|
|
57
65
|
const [msiEndpoint] = CloudShell.getEnvironmentVariables();
|
|
@@ -89,6 +97,7 @@ export class CloudShell extends BaseManagedIdentitySource {
|
|
|
89
97
|
nodeStorage,
|
|
90
98
|
networkClient,
|
|
91
99
|
cryptoProvider,
|
|
100
|
+
disableInternalRetries,
|
|
92
101
|
msiEndpoint
|
|
93
102
|
);
|
|
94
103
|
}
|
|
@@ -34,9 +34,16 @@ export class Imds extends BaseManagedIdentitySource {
|
|
|
34
34
|
nodeStorage: NodeStorage,
|
|
35
35
|
networkClient: INetworkModule,
|
|
36
36
|
cryptoProvider: CryptoProvider,
|
|
37
|
+
disableInternalRetries: boolean,
|
|
37
38
|
identityEndpoint: string
|
|
38
39
|
) {
|
|
39
|
-
super(
|
|
40
|
+
super(
|
|
41
|
+
logger,
|
|
42
|
+
nodeStorage,
|
|
43
|
+
networkClient,
|
|
44
|
+
cryptoProvider,
|
|
45
|
+
disableInternalRetries
|
|
46
|
+
);
|
|
40
47
|
|
|
41
48
|
this.identityEndpoint = identityEndpoint;
|
|
42
49
|
}
|
|
@@ -45,7 +52,8 @@ export class Imds extends BaseManagedIdentitySource {
|
|
|
45
52
|
logger: Logger,
|
|
46
53
|
nodeStorage: NodeStorage,
|
|
47
54
|
networkClient: INetworkModule,
|
|
48
|
-
cryptoProvider: CryptoProvider
|
|
55
|
+
cryptoProvider: CryptoProvider,
|
|
56
|
+
disableInternalRetries: boolean
|
|
49
57
|
): Imds {
|
|
50
58
|
let validatedIdentityEndpoint: string;
|
|
51
59
|
|
|
@@ -88,6 +96,7 @@ export class Imds extends BaseManagedIdentitySource {
|
|
|
88
96
|
nodeStorage,
|
|
89
97
|
networkClient,
|
|
90
98
|
cryptoProvider,
|
|
99
|
+
disableInternalRetries,
|
|
91
100
|
validatedIdentityEndpoint
|
|
92
101
|
);
|
|
93
102
|
}
|
|
@@ -31,10 +31,17 @@ export class MachineLearning extends BaseManagedIdentitySource {
|
|
|
31
31
|
nodeStorage: NodeStorage,
|
|
32
32
|
networkClient: INetworkModule,
|
|
33
33
|
cryptoProvider: CryptoProvider,
|
|
34
|
+
disableInternalRetries: boolean,
|
|
34
35
|
msiEndpoint: string,
|
|
35
36
|
secret: string
|
|
36
37
|
) {
|
|
37
|
-
super(
|
|
38
|
+
super(
|
|
39
|
+
logger,
|
|
40
|
+
nodeStorage,
|
|
41
|
+
networkClient,
|
|
42
|
+
cryptoProvider,
|
|
43
|
+
disableInternalRetries
|
|
44
|
+
);
|
|
38
45
|
|
|
39
46
|
this.msiEndpoint = msiEndpoint;
|
|
40
47
|
this.secret = secret;
|
|
@@ -54,7 +61,8 @@ export class MachineLearning extends BaseManagedIdentitySource {
|
|
|
54
61
|
logger: Logger,
|
|
55
62
|
nodeStorage: NodeStorage,
|
|
56
63
|
networkClient: INetworkModule,
|
|
57
|
-
cryptoProvider: CryptoProvider
|
|
64
|
+
cryptoProvider: CryptoProvider,
|
|
65
|
+
disableInternalRetries: boolean
|
|
58
66
|
): MachineLearning | null {
|
|
59
67
|
const [msiEndpoint, secret] = MachineLearning.getEnvironmentVariables();
|
|
60
68
|
|
|
@@ -83,6 +91,7 @@ export class MachineLearning extends BaseManagedIdentitySource {
|
|
|
83
91
|
nodeStorage,
|
|
84
92
|
networkClient,
|
|
85
93
|
cryptoProvider,
|
|
94
|
+
disableInternalRetries,
|
|
86
95
|
msiEndpoint,
|
|
87
96
|
secret
|
|
88
97
|
);
|
|
@@ -34,10 +34,17 @@ export class ServiceFabric extends BaseManagedIdentitySource {
|
|
|
34
34
|
nodeStorage: NodeStorage,
|
|
35
35
|
networkClient: INetworkModule,
|
|
36
36
|
cryptoProvider: CryptoProvider,
|
|
37
|
+
disableInternalRetries: boolean,
|
|
37
38
|
identityEndpoint: string,
|
|
38
39
|
identityHeader: string
|
|
39
40
|
) {
|
|
40
|
-
super(
|
|
41
|
+
super(
|
|
42
|
+
logger,
|
|
43
|
+
nodeStorage,
|
|
44
|
+
networkClient,
|
|
45
|
+
cryptoProvider,
|
|
46
|
+
disableInternalRetries
|
|
47
|
+
);
|
|
41
48
|
|
|
42
49
|
this.identityEndpoint = identityEndpoint;
|
|
43
50
|
this.identityHeader = identityHeader;
|
|
@@ -66,6 +73,7 @@ export class ServiceFabric extends BaseManagedIdentitySource {
|
|
|
66
73
|
nodeStorage: NodeStorage,
|
|
67
74
|
networkClient: INetworkModule,
|
|
68
75
|
cryptoProvider: CryptoProvider,
|
|
76
|
+
disableInternalRetries: boolean,
|
|
69
77
|
managedIdentityId: ManagedIdentityId
|
|
70
78
|
): ServiceFabric | null {
|
|
71
79
|
const [identityEndpoint, identityHeader, identityServerThumbprint] =
|
|
@@ -107,6 +115,7 @@ export class ServiceFabric extends BaseManagedIdentitySource {
|
|
|
107
115
|
nodeStorage,
|
|
108
116
|
networkClient,
|
|
109
117
|
cryptoProvider,
|
|
118
|
+
disableInternalRetries,
|
|
110
119
|
identityEndpoint,
|
|
111
120
|
identityHeader
|
|
112
121
|
);
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
* Oauth2.0 Password grant client
|
|
28
28
|
* Note: We are only supporting public clients for password grant and for purely testing purposes
|
|
29
29
|
* @public
|
|
30
|
+
* @deprecated - Use a more secure flow instead
|
|
30
31
|
*/
|
|
31
32
|
export class UsernamePasswordClient extends BaseClient {
|
|
32
33
|
constructor(configuration: ClientConfiguration) {
|
|
@@ -20,13 +20,6 @@ import { HttpClient } from "../network/HttpClient.js";
|
|
|
20
20
|
import http from "http";
|
|
21
21
|
import https from "https";
|
|
22
22
|
import { ManagedIdentityId } from "./ManagedIdentityId.js";
|
|
23
|
-
import {
|
|
24
|
-
MANAGED_IDENTITY_HTTP_STATUS_CODES_TO_RETRY_ON,
|
|
25
|
-
MANAGED_IDENTITY_MAX_RETRIES,
|
|
26
|
-
MANAGED_IDENTITY_RETRY_DELAY,
|
|
27
|
-
} from "../utils/Constants.js";
|
|
28
|
-
import { LinearRetryPolicy } from "../retry/LinearRetryPolicy.js";
|
|
29
|
-
import { HttpClientWithRetries } from "../network/HttpClientWithRetries.js";
|
|
30
23
|
import { NodeAuthError } from "../error/NodeAuthError.js";
|
|
31
24
|
|
|
32
25
|
/**
|
|
@@ -251,6 +244,7 @@ export type ManagedIdentityNodeConfiguration = {
|
|
|
251
244
|
system: Required<
|
|
252
245
|
Pick<NodeSystemOptions, "loggerOptions" | "networkClient">
|
|
253
246
|
>;
|
|
247
|
+
disableInternalRetries: boolean;
|
|
254
248
|
};
|
|
255
249
|
|
|
256
250
|
export function buildManagedIdentityConfiguration({
|
|
@@ -276,24 +270,12 @@ export function buildManagedIdentityConfiguration({
|
|
|
276
270
|
);
|
|
277
271
|
}
|
|
278
272
|
|
|
279
|
-
// wrap the network client with a retry policy if the developer has not disabled the option to do so
|
|
280
|
-
if (!system?.disableInternalRetries) {
|
|
281
|
-
const linearRetryPolicy: LinearRetryPolicy = new LinearRetryPolicy(
|
|
282
|
-
MANAGED_IDENTITY_MAX_RETRIES,
|
|
283
|
-
MANAGED_IDENTITY_RETRY_DELAY,
|
|
284
|
-
MANAGED_IDENTITY_HTTP_STATUS_CODES_TO_RETRY_ON
|
|
285
|
-
);
|
|
286
|
-
networkClient = new HttpClientWithRetries(
|
|
287
|
-
networkClient,
|
|
288
|
-
linearRetryPolicy
|
|
289
|
-
);
|
|
290
|
-
}
|
|
291
|
-
|
|
292
273
|
return {
|
|
293
274
|
managedIdentityId: managedIdentityId,
|
|
294
275
|
system: {
|
|
295
276
|
loggerOptions,
|
|
296
277
|
networkClient,
|
|
297
278
|
},
|
|
279
|
+
disableInternalRetries: system?.disableInternalRetries || false,
|
|
298
280
|
};
|
|
299
281
|
}
|
|
@@ -4,7 +4,14 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { RequestParameterBuilder, UrlString } from "@azure/msal-common/node";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
HttpMethod,
|
|
9
|
+
MANAGED_IDENTITY_HTTP_STATUS_CODES_TO_RETRY_ON,
|
|
10
|
+
MANAGED_IDENTITY_MAX_RETRIES,
|
|
11
|
+
MANAGED_IDENTITY_RETRY_DELAY,
|
|
12
|
+
RetryPolicies,
|
|
13
|
+
} from "../utils/Constants.js";
|
|
14
|
+
import { LinearRetryPolicy } from "../retry/LinearRetryPolicy.js";
|
|
8
15
|
|
|
9
16
|
export class ManagedIdentityRequestParameters {
|
|
10
17
|
private _baseEndpoint: string;
|
|
@@ -12,13 +19,25 @@ export class ManagedIdentityRequestParameters {
|
|
|
12
19
|
public headers: Record<string, string>;
|
|
13
20
|
public bodyParameters: Record<string, string>;
|
|
14
21
|
public queryParameters: Record<string, string>;
|
|
22
|
+
public retryPolicy: RetryPolicies;
|
|
15
23
|
|
|
16
|
-
constructor(
|
|
24
|
+
constructor(
|
|
25
|
+
httpMethod: HttpMethod,
|
|
26
|
+
endpoint: string,
|
|
27
|
+
retryPolicy?: RetryPolicies
|
|
28
|
+
) {
|
|
17
29
|
this.httpMethod = httpMethod;
|
|
18
30
|
this._baseEndpoint = endpoint;
|
|
19
31
|
this.headers = {} as Record<string, string>;
|
|
20
32
|
this.bodyParameters = {} as Record<string, string>;
|
|
21
33
|
this.queryParameters = {} as Record<string, string>;
|
|
34
|
+
|
|
35
|
+
const defaultRetryPolicy: LinearRetryPolicy = new LinearRetryPolicy(
|
|
36
|
+
MANAGED_IDENTITY_MAX_RETRIES,
|
|
37
|
+
MANAGED_IDENTITY_RETRY_DELAY,
|
|
38
|
+
MANAGED_IDENTITY_HTTP_STATUS_CODES_TO_RETRY_ON
|
|
39
|
+
);
|
|
40
|
+
this.retryPolicy = retryPolicy || defaultRetryPolicy;
|
|
22
41
|
}
|
|
23
42
|
|
|
24
43
|
public computeUri(): string {
|
package/src/packageMetadata.ts
CHANGED
package/src/utils/Constants.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { HttpStatus } from "@azure/msal-common/node";
|
|
7
|
+
import { LinearRetryPolicy } from "../retry/LinearRetryPolicy.js";
|
|
7
8
|
|
|
8
9
|
// MSI Constants. Docs for MSI are available here https://docs.microsoft.com/azure/app-service/overview-managed-identity
|
|
9
10
|
export const AUTHORIZATION_HEADER_NAME: string = "Authorization";
|
|
@@ -178,3 +179,8 @@ export const MANAGED_IDENTITY_HTTP_STATUS_CODES_TO_RETRY_ON = [
|
|
|
178
179
|
HttpStatus.SERVICE_UNAVAILABLE,
|
|
179
180
|
HttpStatus.GATEWAY_TIMEOUT,
|
|
180
181
|
];
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Retry Policy Types
|
|
185
|
+
*/
|
|
186
|
+
export type RetryPolicies = LinearRetryPolicy;
|