@azure/identity 4.10.3-alpha.20250708.2 → 4.10.3-alpha.20250714.3
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/browser/credentials/managedIdentityCredential/imdsRetryPolicy.d.ts +5 -4
- package/dist/browser/credentials/managedIdentityCredential/imdsRetryPolicy.d.ts.map +1 -1
- package/dist/browser/credentials/managedIdentityCredential/imdsRetryPolicy.js +16 -6
- package/dist/browser/credentials/managedIdentityCredential/imdsRetryPolicy.js.map +1 -1
- package/dist/commonjs/credentials/managedIdentityCredential/imdsRetryPolicy.d.ts +5 -4
- package/dist/commonjs/credentials/managedIdentityCredential/imdsRetryPolicy.d.ts.map +1 -1
- package/dist/commonjs/credentials/managedIdentityCredential/imdsRetryPolicy.js +16 -6
- package/dist/commonjs/credentials/managedIdentityCredential/imdsRetryPolicy.js.map +1 -1
- package/dist/esm/credentials/managedIdentityCredential/imdsRetryPolicy.d.ts +5 -4
- package/dist/esm/credentials/managedIdentityCredential/imdsRetryPolicy.d.ts.map +1 -1
- package/dist/esm/credentials/managedIdentityCredential/imdsRetryPolicy.js +16 -6
- package/dist/esm/credentials/managedIdentityCredential/imdsRetryPolicy.js.map +1 -1
- package/dist/workerd/credentials/managedIdentityCredential/imdsRetryPolicy.d.ts +5 -4
- package/dist/workerd/credentials/managedIdentityCredential/imdsRetryPolicy.d.ts.map +1 -1
- package/dist/workerd/credentials/managedIdentityCredential/imdsRetryPolicy.js +16 -6
- package/dist/workerd/credentials/managedIdentityCredential/imdsRetryPolicy.js.map +1 -1
- package/package.json +1 -1
@@ -1,12 +1,13 @@
|
|
1
1
|
import type { PipelinePolicy } from "@azure/core-rest-pipeline";
|
2
2
|
import type { MSIConfiguration } from "./models.js";
|
3
3
|
/**
|
4
|
-
* An additional policy that retries on 404 errors. The default retry policy does not retry on
|
5
|
-
* 404s, but the IMDS endpoint can return
|
6
|
-
* will retry on 404s with an exponential backoff.
|
4
|
+
* An additional policy that retries on 404 and 410 errors. The default retry policy does not retry on
|
5
|
+
* 404s or 410s, but the IMDS endpoint can return these when the token is not yet available or when
|
6
|
+
* the identity is still being set up. This policy will retry on 404s and 410s with an exponential backoff.
|
7
|
+
* For 410 responses, it uses a minimum 3-second initial delay to ensure at least 70 seconds total duration.
|
7
8
|
*
|
8
9
|
* @param msiRetryConfig - The retry configuration for the MSI credential.
|
9
|
-
* @returns - The policy that will retry on 404s.
|
10
|
+
* @returns - The policy that will retry on 404s and 410s.
|
10
11
|
*/
|
11
12
|
export declare function imdsRetryPolicy(msiRetryConfig: MSIConfiguration["retryConfig"]): PipelinePolicy;
|
12
13
|
//# sourceMappingURL=imdsRetryPolicy.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"imdsRetryPolicy.d.ts","sourceRoot":"","sources":["../../../../src/credentials/managedIdentityCredential/imdsRetryPolicy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
1
|
+
{"version":3,"file":"imdsRetryPolicy.d.ts","sourceRoot":"","sources":["../../../../src/credentials/managedIdentityCredential/imdsRetryPolicy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAYpD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,cAAc,EAAE,gBAAgB,CAAC,aAAa,CAAC,GAAG,cAAc,CA2B/F"}
|
@@ -4,24 +4,34 @@ import { retryPolicy } from "@azure/core-rest-pipeline";
|
|
4
4
|
import { calculateRetryDelay } from "@azure/core-util";
|
5
5
|
// Matches the default retry configuration in expontentialRetryStrategy.ts
|
6
6
|
const DEFAULT_CLIENT_MAX_RETRY_INTERVAL = 1000 * 64;
|
7
|
+
// For 410 responses, we need at least 70 seconds total retry duration
|
8
|
+
// With 5 retries using exponential backoff: delays of d, 2d, 4d, 8d, 16d sum to 31d
|
9
|
+
// Accounting for jitter (which can reduce delays by 20%), we need 31d * 0.8 >= 70
|
10
|
+
// So we need d >= 70/24.8 = 2.82 seconds. Using 3 seconds to be safe.
|
11
|
+
const MIN_DELAY_FOR_410_MS = 3000;
|
7
12
|
/**
|
8
|
-
* An additional policy that retries on 404 errors. The default retry policy does not retry on
|
9
|
-
* 404s, but the IMDS endpoint can return
|
10
|
-
* will retry on 404s with an exponential backoff.
|
13
|
+
* An additional policy that retries on 404 and 410 errors. The default retry policy does not retry on
|
14
|
+
* 404s or 410s, but the IMDS endpoint can return these when the token is not yet available or when
|
15
|
+
* the identity is still being set up. This policy will retry on 404s and 410s with an exponential backoff.
|
16
|
+
* For 410 responses, it uses a minimum 3-second initial delay to ensure at least 70 seconds total duration.
|
11
17
|
*
|
12
18
|
* @param msiRetryConfig - The retry configuration for the MSI credential.
|
13
|
-
* @returns - The policy that will retry on 404s.
|
19
|
+
* @returns - The policy that will retry on 404s and 410s.
|
14
20
|
*/
|
15
21
|
export function imdsRetryPolicy(msiRetryConfig) {
|
16
22
|
return retryPolicy([
|
17
23
|
{
|
18
24
|
name: "imdsRetryPolicy",
|
19
25
|
retry: ({ retryCount, response }) => {
|
20
|
-
if ((response === null || response === void 0 ? void 0 : response.status) !== 404) {
|
26
|
+
if ((response === null || response === void 0 ? void 0 : response.status) !== 404 && (response === null || response === void 0 ? void 0 : response.status) !== 410) {
|
21
27
|
return { skipStrategy: true };
|
22
28
|
}
|
29
|
+
// For 410 responses, use a minimum 3-second delay to ensure at least 70 seconds total retry duration
|
30
|
+
const initialDelayMs = (response === null || response === void 0 ? void 0 : response.status) === 410
|
31
|
+
? Math.max(MIN_DELAY_FOR_410_MS, msiRetryConfig.startDelayInMs)
|
32
|
+
: msiRetryConfig.startDelayInMs;
|
23
33
|
return calculateRetryDelay(retryCount, {
|
24
|
-
retryDelayInMs:
|
34
|
+
retryDelayInMs: initialDelayMs,
|
25
35
|
maxRetryDelayInMs: DEFAULT_CLIENT_MAX_RETRY_INTERVAL,
|
26
36
|
});
|
27
37
|
},
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"imdsRetryPolicy.js","sourceRoot":"","sources":["../../../../src/credentials/managedIdentityCredential/imdsRetryPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,0EAA0E;AAC1E,MAAM,iCAAiC,GAAG,IAAI,GAAG,EAAE,CAAC;AAEpD
|
1
|
+
{"version":3,"file":"imdsRetryPolicy.js","sourceRoot":"","sources":["../../../../src/credentials/managedIdentityCredential/imdsRetryPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,0EAA0E;AAC1E,MAAM,iCAAiC,GAAG,IAAI,GAAG,EAAE,CAAC;AAEpD,sEAAsE;AACtE,oFAAoF;AACpF,kFAAkF;AAClF,sEAAsE;AACtE,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAElC;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,cAA+C;IAC7E,OAAO,WAAW,CAChB;QACE;YACE,IAAI,EAAE,iBAAiB;YACvB,KAAK,EAAE,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE;gBAClC,IAAI,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,MAAK,GAAG,IAAI,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,MAAK,GAAG,EAAE,CAAC;oBACzD,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;gBAChC,CAAC;gBAED,qGAAqG;gBACrG,MAAM,cAAc,GAClB,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,MAAK,GAAG;oBACtB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,oBAAoB,EAAE,cAAc,CAAC,cAAc,CAAC;oBAC/D,CAAC,CAAC,cAAc,CAAC,cAAc,CAAC;gBAEpC,OAAO,mBAAmB,CAAC,UAAU,EAAE;oBACrC,cAAc,EAAE,cAAc;oBAC9B,iBAAiB,EAAE,iCAAiC;iBACrD,CAAC,CAAC;YACL,CAAC;SACF;KACF,EACD;QACE,UAAU,EAAE,cAAc,CAAC,UAAU;KACtC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelinePolicy } from \"@azure/core-rest-pipeline\";\nimport { retryPolicy } from \"@azure/core-rest-pipeline\";\n\nimport type { MSIConfiguration } from \"./models.js\";\nimport { calculateRetryDelay } from \"@azure/core-util\";\n\n// Matches the default retry configuration in expontentialRetryStrategy.ts\nconst DEFAULT_CLIENT_MAX_RETRY_INTERVAL = 1000 * 64;\n\n// For 410 responses, we need at least 70 seconds total retry duration\n// With 5 retries using exponential backoff: delays of d, 2d, 4d, 8d, 16d sum to 31d\n// Accounting for jitter (which can reduce delays by 20%), we need 31d * 0.8 >= 70\n// So we need d >= 70/24.8 = 2.82 seconds. Using 3 seconds to be safe.\nconst MIN_DELAY_FOR_410_MS = 3000;\n\n/**\n * An additional policy that retries on 404 and 410 errors. The default retry policy does not retry on\n * 404s or 410s, but the IMDS endpoint can return these when the token is not yet available or when\n * the identity is still being set up. This policy will retry on 404s and 410s with an exponential backoff.\n * For 410 responses, it uses a minimum 3-second initial delay to ensure at least 70 seconds total duration.\n *\n * @param msiRetryConfig - The retry configuration for the MSI credential.\n * @returns - The policy that will retry on 404s and 410s.\n */\nexport function imdsRetryPolicy(msiRetryConfig: MSIConfiguration[\"retryConfig\"]): PipelinePolicy {\n return retryPolicy(\n [\n {\n name: \"imdsRetryPolicy\",\n retry: ({ retryCount, response }) => {\n if (response?.status !== 404 && response?.status !== 410) {\n return { skipStrategy: true };\n }\n\n // For 410 responses, use a minimum 3-second delay to ensure at least 70 seconds total retry duration\n const initialDelayMs =\n response?.status === 410\n ? Math.max(MIN_DELAY_FOR_410_MS, msiRetryConfig.startDelayInMs)\n : msiRetryConfig.startDelayInMs;\n\n return calculateRetryDelay(retryCount, {\n retryDelayInMs: initialDelayMs,\n maxRetryDelayInMs: DEFAULT_CLIENT_MAX_RETRY_INTERVAL,\n });\n },\n },\n ],\n {\n maxRetries: msiRetryConfig.maxRetries,\n },\n );\n}\n"]}
|
@@ -1,12 +1,13 @@
|
|
1
1
|
import type { PipelinePolicy } from "@azure/core-rest-pipeline";
|
2
2
|
import type { MSIConfiguration } from "./models.js";
|
3
3
|
/**
|
4
|
-
* An additional policy that retries on 404 errors. The default retry policy does not retry on
|
5
|
-
* 404s, but the IMDS endpoint can return
|
6
|
-
* will retry on 404s with an exponential backoff.
|
4
|
+
* An additional policy that retries on 404 and 410 errors. The default retry policy does not retry on
|
5
|
+
* 404s or 410s, but the IMDS endpoint can return these when the token is not yet available or when
|
6
|
+
* the identity is still being set up. This policy will retry on 404s and 410s with an exponential backoff.
|
7
|
+
* For 410 responses, it uses a minimum 3-second initial delay to ensure at least 70 seconds total duration.
|
7
8
|
*
|
8
9
|
* @param msiRetryConfig - The retry configuration for the MSI credential.
|
9
|
-
* @returns - The policy that will retry on 404s.
|
10
|
+
* @returns - The policy that will retry on 404s and 410s.
|
10
11
|
*/
|
11
12
|
export declare function imdsRetryPolicy(msiRetryConfig: MSIConfiguration["retryConfig"]): PipelinePolicy;
|
12
13
|
//# sourceMappingURL=imdsRetryPolicy.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"imdsRetryPolicy.d.ts","sourceRoot":"","sources":["../../../../src/credentials/managedIdentityCredential/imdsRetryPolicy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
1
|
+
{"version":3,"file":"imdsRetryPolicy.d.ts","sourceRoot":"","sources":["../../../../src/credentials/managedIdentityCredential/imdsRetryPolicy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAYpD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,cAAc,EAAE,gBAAgB,CAAC,aAAa,CAAC,GAAG,cAAc,CA2B/F"}
|
@@ -7,24 +7,34 @@ const core_rest_pipeline_1 = require("@azure/core-rest-pipeline");
|
|
7
7
|
const core_util_1 = require("@azure/core-util");
|
8
8
|
// Matches the default retry configuration in expontentialRetryStrategy.ts
|
9
9
|
const DEFAULT_CLIENT_MAX_RETRY_INTERVAL = 1000 * 64;
|
10
|
+
// For 410 responses, we need at least 70 seconds total retry duration
|
11
|
+
// With 5 retries using exponential backoff: delays of d, 2d, 4d, 8d, 16d sum to 31d
|
12
|
+
// Accounting for jitter (which can reduce delays by 20%), we need 31d * 0.8 >= 70
|
13
|
+
// So we need d >= 70/24.8 = 2.82 seconds. Using 3 seconds to be safe.
|
14
|
+
const MIN_DELAY_FOR_410_MS = 3000;
|
10
15
|
/**
|
11
|
-
* An additional policy that retries on 404 errors. The default retry policy does not retry on
|
12
|
-
* 404s, but the IMDS endpoint can return
|
13
|
-
* will retry on 404s with an exponential backoff.
|
16
|
+
* An additional policy that retries on 404 and 410 errors. The default retry policy does not retry on
|
17
|
+
* 404s or 410s, but the IMDS endpoint can return these when the token is not yet available or when
|
18
|
+
* the identity is still being set up. This policy will retry on 404s and 410s with an exponential backoff.
|
19
|
+
* For 410 responses, it uses a minimum 3-second initial delay to ensure at least 70 seconds total duration.
|
14
20
|
*
|
15
21
|
* @param msiRetryConfig - The retry configuration for the MSI credential.
|
16
|
-
* @returns - The policy that will retry on 404s.
|
22
|
+
* @returns - The policy that will retry on 404s and 410s.
|
17
23
|
*/
|
18
24
|
function imdsRetryPolicy(msiRetryConfig) {
|
19
25
|
return (0, core_rest_pipeline_1.retryPolicy)([
|
20
26
|
{
|
21
27
|
name: "imdsRetryPolicy",
|
22
28
|
retry: ({ retryCount, response }) => {
|
23
|
-
if ((response === null || response === void 0 ? void 0 : response.status) !== 404) {
|
29
|
+
if ((response === null || response === void 0 ? void 0 : response.status) !== 404 && (response === null || response === void 0 ? void 0 : response.status) !== 410) {
|
24
30
|
return { skipStrategy: true };
|
25
31
|
}
|
32
|
+
// For 410 responses, use a minimum 3-second delay to ensure at least 70 seconds total retry duration
|
33
|
+
const initialDelayMs = (response === null || response === void 0 ? void 0 : response.status) === 410
|
34
|
+
? Math.max(MIN_DELAY_FOR_410_MS, msiRetryConfig.startDelayInMs)
|
35
|
+
: msiRetryConfig.startDelayInMs;
|
26
36
|
return (0, core_util_1.calculateRetryDelay)(retryCount, {
|
27
|
-
retryDelayInMs:
|
37
|
+
retryDelayInMs: initialDelayMs,
|
28
38
|
maxRetryDelayInMs: DEFAULT_CLIENT_MAX_RETRY_INTERVAL,
|
29
39
|
});
|
30
40
|
},
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"imdsRetryPolicy.js","sourceRoot":"","sources":["../../../../src/credentials/managedIdentityCredential/imdsRetryPolicy.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;
|
1
|
+
{"version":3,"file":"imdsRetryPolicy.js","sourceRoot":"","sources":["../../../../src/credentials/managedIdentityCredential/imdsRetryPolicy.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AA0BlC,0CA2BC;AAlDD,kEAAwD;AAGxD,gDAAuD;AAEvD,0EAA0E;AAC1E,MAAM,iCAAiC,GAAG,IAAI,GAAG,EAAE,CAAC;AAEpD,sEAAsE;AACtE,oFAAoF;AACpF,kFAAkF;AAClF,sEAAsE;AACtE,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAElC;;;;;;;;GAQG;AACH,SAAgB,eAAe,CAAC,cAA+C;IAC7E,OAAO,IAAA,gCAAW,EAChB;QACE;YACE,IAAI,EAAE,iBAAiB;YACvB,KAAK,EAAE,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE;gBAClC,IAAI,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,MAAK,GAAG,IAAI,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,MAAK,GAAG,EAAE,CAAC;oBACzD,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;gBAChC,CAAC;gBAED,qGAAqG;gBACrG,MAAM,cAAc,GAClB,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,MAAK,GAAG;oBACtB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,oBAAoB,EAAE,cAAc,CAAC,cAAc,CAAC;oBAC/D,CAAC,CAAC,cAAc,CAAC,cAAc,CAAC;gBAEpC,OAAO,IAAA,+BAAmB,EAAC,UAAU,EAAE;oBACrC,cAAc,EAAE,cAAc;oBAC9B,iBAAiB,EAAE,iCAAiC;iBACrD,CAAC,CAAC;YACL,CAAC;SACF;KACF,EACD;QACE,UAAU,EAAE,cAAc,CAAC,UAAU;KACtC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelinePolicy } from \"@azure/core-rest-pipeline\";\nimport { retryPolicy } from \"@azure/core-rest-pipeline\";\n\nimport type { MSIConfiguration } from \"./models.js\";\nimport { calculateRetryDelay } from \"@azure/core-util\";\n\n// Matches the default retry configuration in expontentialRetryStrategy.ts\nconst DEFAULT_CLIENT_MAX_RETRY_INTERVAL = 1000 * 64;\n\n// For 410 responses, we need at least 70 seconds total retry duration\n// With 5 retries using exponential backoff: delays of d, 2d, 4d, 8d, 16d sum to 31d\n// Accounting for jitter (which can reduce delays by 20%), we need 31d * 0.8 >= 70\n// So we need d >= 70/24.8 = 2.82 seconds. Using 3 seconds to be safe.\nconst MIN_DELAY_FOR_410_MS = 3000;\n\n/**\n * An additional policy that retries on 404 and 410 errors. The default retry policy does not retry on\n * 404s or 410s, but the IMDS endpoint can return these when the token is not yet available or when\n * the identity is still being set up. This policy will retry on 404s and 410s with an exponential backoff.\n * For 410 responses, it uses a minimum 3-second initial delay to ensure at least 70 seconds total duration.\n *\n * @param msiRetryConfig - The retry configuration for the MSI credential.\n * @returns - The policy that will retry on 404s and 410s.\n */\nexport function imdsRetryPolicy(msiRetryConfig: MSIConfiguration[\"retryConfig\"]): PipelinePolicy {\n return retryPolicy(\n [\n {\n name: \"imdsRetryPolicy\",\n retry: ({ retryCount, response }) => {\n if (response?.status !== 404 && response?.status !== 410) {\n return { skipStrategy: true };\n }\n\n // For 410 responses, use a minimum 3-second delay to ensure at least 70 seconds total retry duration\n const initialDelayMs =\n response?.status === 410\n ? Math.max(MIN_DELAY_FOR_410_MS, msiRetryConfig.startDelayInMs)\n : msiRetryConfig.startDelayInMs;\n\n return calculateRetryDelay(retryCount, {\n retryDelayInMs: initialDelayMs,\n maxRetryDelayInMs: DEFAULT_CLIENT_MAX_RETRY_INTERVAL,\n });\n },\n },\n ],\n {\n maxRetries: msiRetryConfig.maxRetries,\n },\n );\n}\n"]}
|
@@ -1,12 +1,13 @@
|
|
1
1
|
import type { PipelinePolicy } from "@azure/core-rest-pipeline";
|
2
2
|
import type { MSIConfiguration } from "./models.js";
|
3
3
|
/**
|
4
|
-
* An additional policy that retries on 404 errors. The default retry policy does not retry on
|
5
|
-
* 404s, but the IMDS endpoint can return
|
6
|
-
* will retry on 404s with an exponential backoff.
|
4
|
+
* An additional policy that retries on 404 and 410 errors. The default retry policy does not retry on
|
5
|
+
* 404s or 410s, but the IMDS endpoint can return these when the token is not yet available or when
|
6
|
+
* the identity is still being set up. This policy will retry on 404s and 410s with an exponential backoff.
|
7
|
+
* For 410 responses, it uses a minimum 3-second initial delay to ensure at least 70 seconds total duration.
|
7
8
|
*
|
8
9
|
* @param msiRetryConfig - The retry configuration for the MSI credential.
|
9
|
-
* @returns - The policy that will retry on 404s.
|
10
|
+
* @returns - The policy that will retry on 404s and 410s.
|
10
11
|
*/
|
11
12
|
export declare function imdsRetryPolicy(msiRetryConfig: MSIConfiguration["retryConfig"]): PipelinePolicy;
|
12
13
|
//# sourceMappingURL=imdsRetryPolicy.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"imdsRetryPolicy.d.ts","sourceRoot":"","sources":["../../../../src/credentials/managedIdentityCredential/imdsRetryPolicy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
1
|
+
{"version":3,"file":"imdsRetryPolicy.d.ts","sourceRoot":"","sources":["../../../../src/credentials/managedIdentityCredential/imdsRetryPolicy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAYpD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,cAAc,EAAE,gBAAgB,CAAC,aAAa,CAAC,GAAG,cAAc,CA2B/F"}
|
@@ -4,24 +4,34 @@ import { retryPolicy } from "@azure/core-rest-pipeline";
|
|
4
4
|
import { calculateRetryDelay } from "@azure/core-util";
|
5
5
|
// Matches the default retry configuration in expontentialRetryStrategy.ts
|
6
6
|
const DEFAULT_CLIENT_MAX_RETRY_INTERVAL = 1000 * 64;
|
7
|
+
// For 410 responses, we need at least 70 seconds total retry duration
|
8
|
+
// With 5 retries using exponential backoff: delays of d, 2d, 4d, 8d, 16d sum to 31d
|
9
|
+
// Accounting for jitter (which can reduce delays by 20%), we need 31d * 0.8 >= 70
|
10
|
+
// So we need d >= 70/24.8 = 2.82 seconds. Using 3 seconds to be safe.
|
11
|
+
const MIN_DELAY_FOR_410_MS = 3000;
|
7
12
|
/**
|
8
|
-
* An additional policy that retries on 404 errors. The default retry policy does not retry on
|
9
|
-
* 404s, but the IMDS endpoint can return
|
10
|
-
* will retry on 404s with an exponential backoff.
|
13
|
+
* An additional policy that retries on 404 and 410 errors. The default retry policy does not retry on
|
14
|
+
* 404s or 410s, but the IMDS endpoint can return these when the token is not yet available or when
|
15
|
+
* the identity is still being set up. This policy will retry on 404s and 410s with an exponential backoff.
|
16
|
+
* For 410 responses, it uses a minimum 3-second initial delay to ensure at least 70 seconds total duration.
|
11
17
|
*
|
12
18
|
* @param msiRetryConfig - The retry configuration for the MSI credential.
|
13
|
-
* @returns - The policy that will retry on 404s.
|
19
|
+
* @returns - The policy that will retry on 404s and 410s.
|
14
20
|
*/
|
15
21
|
export function imdsRetryPolicy(msiRetryConfig) {
|
16
22
|
return retryPolicy([
|
17
23
|
{
|
18
24
|
name: "imdsRetryPolicy",
|
19
25
|
retry: ({ retryCount, response }) => {
|
20
|
-
if ((response === null || response === void 0 ? void 0 : response.status) !== 404) {
|
26
|
+
if ((response === null || response === void 0 ? void 0 : response.status) !== 404 && (response === null || response === void 0 ? void 0 : response.status) !== 410) {
|
21
27
|
return { skipStrategy: true };
|
22
28
|
}
|
29
|
+
// For 410 responses, use a minimum 3-second delay to ensure at least 70 seconds total retry duration
|
30
|
+
const initialDelayMs = (response === null || response === void 0 ? void 0 : response.status) === 410
|
31
|
+
? Math.max(MIN_DELAY_FOR_410_MS, msiRetryConfig.startDelayInMs)
|
32
|
+
: msiRetryConfig.startDelayInMs;
|
23
33
|
return calculateRetryDelay(retryCount, {
|
24
|
-
retryDelayInMs:
|
34
|
+
retryDelayInMs: initialDelayMs,
|
25
35
|
maxRetryDelayInMs: DEFAULT_CLIENT_MAX_RETRY_INTERVAL,
|
26
36
|
});
|
27
37
|
},
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"imdsRetryPolicy.js","sourceRoot":"","sources":["../../../../src/credentials/managedIdentityCredential/imdsRetryPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,0EAA0E;AAC1E,MAAM,iCAAiC,GAAG,IAAI,GAAG,EAAE,CAAC;AAEpD
|
1
|
+
{"version":3,"file":"imdsRetryPolicy.js","sourceRoot":"","sources":["../../../../src/credentials/managedIdentityCredential/imdsRetryPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,0EAA0E;AAC1E,MAAM,iCAAiC,GAAG,IAAI,GAAG,EAAE,CAAC;AAEpD,sEAAsE;AACtE,oFAAoF;AACpF,kFAAkF;AAClF,sEAAsE;AACtE,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAElC;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,cAA+C;IAC7E,OAAO,WAAW,CAChB;QACE;YACE,IAAI,EAAE,iBAAiB;YACvB,KAAK,EAAE,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE;gBAClC,IAAI,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,MAAK,GAAG,IAAI,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,MAAK,GAAG,EAAE,CAAC;oBACzD,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;gBAChC,CAAC;gBAED,qGAAqG;gBACrG,MAAM,cAAc,GAClB,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,MAAK,GAAG;oBACtB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,oBAAoB,EAAE,cAAc,CAAC,cAAc,CAAC;oBAC/D,CAAC,CAAC,cAAc,CAAC,cAAc,CAAC;gBAEpC,OAAO,mBAAmB,CAAC,UAAU,EAAE;oBACrC,cAAc,EAAE,cAAc;oBAC9B,iBAAiB,EAAE,iCAAiC;iBACrD,CAAC,CAAC;YACL,CAAC;SACF;KACF,EACD;QACE,UAAU,EAAE,cAAc,CAAC,UAAU;KACtC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelinePolicy } from \"@azure/core-rest-pipeline\";\nimport { retryPolicy } from \"@azure/core-rest-pipeline\";\n\nimport type { MSIConfiguration } from \"./models.js\";\nimport { calculateRetryDelay } from \"@azure/core-util\";\n\n// Matches the default retry configuration in expontentialRetryStrategy.ts\nconst DEFAULT_CLIENT_MAX_RETRY_INTERVAL = 1000 * 64;\n\n// For 410 responses, we need at least 70 seconds total retry duration\n// With 5 retries using exponential backoff: delays of d, 2d, 4d, 8d, 16d sum to 31d\n// Accounting for jitter (which can reduce delays by 20%), we need 31d * 0.8 >= 70\n// So we need d >= 70/24.8 = 2.82 seconds. Using 3 seconds to be safe.\nconst MIN_DELAY_FOR_410_MS = 3000;\n\n/**\n * An additional policy that retries on 404 and 410 errors. The default retry policy does not retry on\n * 404s or 410s, but the IMDS endpoint can return these when the token is not yet available or when\n * the identity is still being set up. This policy will retry on 404s and 410s with an exponential backoff.\n * For 410 responses, it uses a minimum 3-second initial delay to ensure at least 70 seconds total duration.\n *\n * @param msiRetryConfig - The retry configuration for the MSI credential.\n * @returns - The policy that will retry on 404s and 410s.\n */\nexport function imdsRetryPolicy(msiRetryConfig: MSIConfiguration[\"retryConfig\"]): PipelinePolicy {\n return retryPolicy(\n [\n {\n name: \"imdsRetryPolicy\",\n retry: ({ retryCount, response }) => {\n if (response?.status !== 404 && response?.status !== 410) {\n return { skipStrategy: true };\n }\n\n // For 410 responses, use a minimum 3-second delay to ensure at least 70 seconds total retry duration\n const initialDelayMs =\n response?.status === 410\n ? Math.max(MIN_DELAY_FOR_410_MS, msiRetryConfig.startDelayInMs)\n : msiRetryConfig.startDelayInMs;\n\n return calculateRetryDelay(retryCount, {\n retryDelayInMs: initialDelayMs,\n maxRetryDelayInMs: DEFAULT_CLIENT_MAX_RETRY_INTERVAL,\n });\n },\n },\n ],\n {\n maxRetries: msiRetryConfig.maxRetries,\n },\n );\n}\n"]}
|
@@ -1,12 +1,13 @@
|
|
1
1
|
import type { PipelinePolicy } from "@azure/core-rest-pipeline";
|
2
2
|
import type { MSIConfiguration } from "./models.js";
|
3
3
|
/**
|
4
|
-
* An additional policy that retries on 404 errors. The default retry policy does not retry on
|
5
|
-
* 404s, but the IMDS endpoint can return
|
6
|
-
* will retry on 404s with an exponential backoff.
|
4
|
+
* An additional policy that retries on 404 and 410 errors. The default retry policy does not retry on
|
5
|
+
* 404s or 410s, but the IMDS endpoint can return these when the token is not yet available or when
|
6
|
+
* the identity is still being set up. This policy will retry on 404s and 410s with an exponential backoff.
|
7
|
+
* For 410 responses, it uses a minimum 3-second initial delay to ensure at least 70 seconds total duration.
|
7
8
|
*
|
8
9
|
* @param msiRetryConfig - The retry configuration for the MSI credential.
|
9
|
-
* @returns - The policy that will retry on 404s.
|
10
|
+
* @returns - The policy that will retry on 404s and 410s.
|
10
11
|
*/
|
11
12
|
export declare function imdsRetryPolicy(msiRetryConfig: MSIConfiguration["retryConfig"]): PipelinePolicy;
|
12
13
|
//# sourceMappingURL=imdsRetryPolicy.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"imdsRetryPolicy.d.ts","sourceRoot":"","sources":["../../../../src/credentials/managedIdentityCredential/imdsRetryPolicy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
1
|
+
{"version":3,"file":"imdsRetryPolicy.d.ts","sourceRoot":"","sources":["../../../../src/credentials/managedIdentityCredential/imdsRetryPolicy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAYpD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,cAAc,EAAE,gBAAgB,CAAC,aAAa,CAAC,GAAG,cAAc,CA2B/F"}
|
@@ -4,24 +4,34 @@ import { retryPolicy } from "@azure/core-rest-pipeline";
|
|
4
4
|
import { calculateRetryDelay } from "@azure/core-util";
|
5
5
|
// Matches the default retry configuration in expontentialRetryStrategy.ts
|
6
6
|
const DEFAULT_CLIENT_MAX_RETRY_INTERVAL = 1000 * 64;
|
7
|
+
// For 410 responses, we need at least 70 seconds total retry duration
|
8
|
+
// With 5 retries using exponential backoff: delays of d, 2d, 4d, 8d, 16d sum to 31d
|
9
|
+
// Accounting for jitter (which can reduce delays by 20%), we need 31d * 0.8 >= 70
|
10
|
+
// So we need d >= 70/24.8 = 2.82 seconds. Using 3 seconds to be safe.
|
11
|
+
const MIN_DELAY_FOR_410_MS = 3000;
|
7
12
|
/**
|
8
|
-
* An additional policy that retries on 404 errors. The default retry policy does not retry on
|
9
|
-
* 404s, but the IMDS endpoint can return
|
10
|
-
* will retry on 404s with an exponential backoff.
|
13
|
+
* An additional policy that retries on 404 and 410 errors. The default retry policy does not retry on
|
14
|
+
* 404s or 410s, but the IMDS endpoint can return these when the token is not yet available or when
|
15
|
+
* the identity is still being set up. This policy will retry on 404s and 410s with an exponential backoff.
|
16
|
+
* For 410 responses, it uses a minimum 3-second initial delay to ensure at least 70 seconds total duration.
|
11
17
|
*
|
12
18
|
* @param msiRetryConfig - The retry configuration for the MSI credential.
|
13
|
-
* @returns - The policy that will retry on 404s.
|
19
|
+
* @returns - The policy that will retry on 404s and 410s.
|
14
20
|
*/
|
15
21
|
export function imdsRetryPolicy(msiRetryConfig) {
|
16
22
|
return retryPolicy([
|
17
23
|
{
|
18
24
|
name: "imdsRetryPolicy",
|
19
25
|
retry: ({ retryCount, response }) => {
|
20
|
-
if ((response === null || response === void 0 ? void 0 : response.status) !== 404) {
|
26
|
+
if ((response === null || response === void 0 ? void 0 : response.status) !== 404 && (response === null || response === void 0 ? void 0 : response.status) !== 410) {
|
21
27
|
return { skipStrategy: true };
|
22
28
|
}
|
29
|
+
// For 410 responses, use a minimum 3-second delay to ensure at least 70 seconds total retry duration
|
30
|
+
const initialDelayMs = (response === null || response === void 0 ? void 0 : response.status) === 410
|
31
|
+
? Math.max(MIN_DELAY_FOR_410_MS, msiRetryConfig.startDelayInMs)
|
32
|
+
: msiRetryConfig.startDelayInMs;
|
23
33
|
return calculateRetryDelay(retryCount, {
|
24
|
-
retryDelayInMs:
|
34
|
+
retryDelayInMs: initialDelayMs,
|
25
35
|
maxRetryDelayInMs: DEFAULT_CLIENT_MAX_RETRY_INTERVAL,
|
26
36
|
});
|
27
37
|
},
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"imdsRetryPolicy.js","sourceRoot":"","sources":["../../../../src/credentials/managedIdentityCredential/imdsRetryPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,0EAA0E;AAC1E,MAAM,iCAAiC,GAAG,IAAI,GAAG,EAAE,CAAC;AAEpD
|
1
|
+
{"version":3,"file":"imdsRetryPolicy.js","sourceRoot":"","sources":["../../../../src/credentials/managedIdentityCredential/imdsRetryPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,0EAA0E;AAC1E,MAAM,iCAAiC,GAAG,IAAI,GAAG,EAAE,CAAC;AAEpD,sEAAsE;AACtE,oFAAoF;AACpF,kFAAkF;AAClF,sEAAsE;AACtE,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAElC;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,cAA+C;IAC7E,OAAO,WAAW,CAChB;QACE;YACE,IAAI,EAAE,iBAAiB;YACvB,KAAK,EAAE,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE;gBAClC,IAAI,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,MAAK,GAAG,IAAI,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,MAAK,GAAG,EAAE,CAAC;oBACzD,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;gBAChC,CAAC;gBAED,qGAAqG;gBACrG,MAAM,cAAc,GAClB,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,MAAK,GAAG;oBACtB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,oBAAoB,EAAE,cAAc,CAAC,cAAc,CAAC;oBAC/D,CAAC,CAAC,cAAc,CAAC,cAAc,CAAC;gBAEpC,OAAO,mBAAmB,CAAC,UAAU,EAAE;oBACrC,cAAc,EAAE,cAAc;oBAC9B,iBAAiB,EAAE,iCAAiC;iBACrD,CAAC,CAAC;YACL,CAAC;SACF;KACF,EACD;QACE,UAAU,EAAE,cAAc,CAAC,UAAU;KACtC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelinePolicy } from \"@azure/core-rest-pipeline\";\nimport { retryPolicy } from \"@azure/core-rest-pipeline\";\n\nimport type { MSIConfiguration } from \"./models.js\";\nimport { calculateRetryDelay } from \"@azure/core-util\";\n\n// Matches the default retry configuration in expontentialRetryStrategy.ts\nconst DEFAULT_CLIENT_MAX_RETRY_INTERVAL = 1000 * 64;\n\n// For 410 responses, we need at least 70 seconds total retry duration\n// With 5 retries using exponential backoff: delays of d, 2d, 4d, 8d, 16d sum to 31d\n// Accounting for jitter (which can reduce delays by 20%), we need 31d * 0.8 >= 70\n// So we need d >= 70/24.8 = 2.82 seconds. Using 3 seconds to be safe.\nconst MIN_DELAY_FOR_410_MS = 3000;\n\n/**\n * An additional policy that retries on 404 and 410 errors. The default retry policy does not retry on\n * 404s or 410s, but the IMDS endpoint can return these when the token is not yet available or when\n * the identity is still being set up. This policy will retry on 404s and 410s with an exponential backoff.\n * For 410 responses, it uses a minimum 3-second initial delay to ensure at least 70 seconds total duration.\n *\n * @param msiRetryConfig - The retry configuration for the MSI credential.\n * @returns - The policy that will retry on 404s and 410s.\n */\nexport function imdsRetryPolicy(msiRetryConfig: MSIConfiguration[\"retryConfig\"]): PipelinePolicy {\n return retryPolicy(\n [\n {\n name: \"imdsRetryPolicy\",\n retry: ({ retryCount, response }) => {\n if (response?.status !== 404 && response?.status !== 410) {\n return { skipStrategy: true };\n }\n\n // For 410 responses, use a minimum 3-second delay to ensure at least 70 seconds total retry duration\n const initialDelayMs =\n response?.status === 410\n ? Math.max(MIN_DELAY_FOR_410_MS, msiRetryConfig.startDelayInMs)\n : msiRetryConfig.startDelayInMs;\n\n return calculateRetryDelay(retryCount, {\n retryDelayInMs: initialDelayMs,\n maxRetryDelayInMs: DEFAULT_CLIENT_MAX_RETRY_INTERVAL,\n });\n },\n },\n ],\n {\n maxRetries: msiRetryConfig.maxRetries,\n },\n );\n}\n"]}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@azure/identity",
|
3
3
|
"sdk-type": "client",
|
4
|
-
"version": "4.10.3-alpha.
|
4
|
+
"version": "4.10.3-alpha.20250714.3",
|
5
5
|
"description": "Provides credential implementations for Azure SDK libraries that can authenticate with Microsoft Entra ID",
|
6
6
|
"main": "./dist/commonjs/index.js",
|
7
7
|
"module": "./dist/esm/index.js",
|