@azure/msal-node 3.2.3 → 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.
Files changed (119) hide show
  1. package/dist/cache/NodeStorage.mjs +1 -1
  2. package/dist/cache/TokenCache.mjs +1 -1
  3. package/dist/cache/distributed/DistributedCachePlugin.mjs +1 -1
  4. package/dist/cache/serializer/Deserializer.mjs +1 -1
  5. package/dist/cache/serializer/Serializer.mjs +1 -1
  6. package/dist/client/ClientApplication.mjs +1 -1
  7. package/dist/client/ClientAssertion.mjs +1 -1
  8. package/dist/client/ClientCredentialClient.mjs +1 -1
  9. package/dist/client/ConfidentialClientApplication.mjs +1 -1
  10. package/dist/client/DeviceCodeClient.mjs +1 -1
  11. package/dist/client/ManagedIdentityApplication.d.ts.map +1 -1
  12. package/dist/client/ManagedIdentityApplication.mjs +2 -2
  13. package/dist/client/ManagedIdentityApplication.mjs.map +1 -1
  14. package/dist/client/ManagedIdentityClient.d.ts +2 -1
  15. package/dist/client/ManagedIdentityClient.d.ts.map +1 -1
  16. package/dist/client/ManagedIdentityClient.mjs +11 -10
  17. package/dist/client/ManagedIdentityClient.mjs.map +1 -1
  18. package/dist/client/ManagedIdentitySources/AppService.d.ts +2 -2
  19. package/dist/client/ManagedIdentitySources/AppService.d.ts.map +1 -1
  20. package/dist/client/ManagedIdentitySources/AppService.mjs +5 -5
  21. package/dist/client/ManagedIdentitySources/AppService.mjs.map +1 -1
  22. package/dist/client/ManagedIdentitySources/AzureArc.d.ts +2 -2
  23. package/dist/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
  24. package/dist/client/ManagedIdentitySources/AzureArc.mjs +5 -5
  25. package/dist/client/ManagedIdentitySources/AzureArc.mjs.map +1 -1
  26. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts +2 -1
  27. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -1
  28. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +15 -5
  29. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs.map +1 -1
  30. package/dist/client/ManagedIdentitySources/CloudShell.d.ts +2 -2
  31. package/dist/client/ManagedIdentitySources/CloudShell.d.ts.map +1 -1
  32. package/dist/client/ManagedIdentitySources/CloudShell.mjs +5 -5
  33. package/dist/client/ManagedIdentitySources/CloudShell.mjs.map +1 -1
  34. package/dist/client/ManagedIdentitySources/Imds.d.ts +2 -2
  35. package/dist/client/ManagedIdentitySources/Imds.d.ts.map +1 -1
  36. package/dist/client/ManagedIdentitySources/Imds.mjs +5 -5
  37. package/dist/client/ManagedIdentitySources/Imds.mjs.map +1 -1
  38. package/dist/client/ManagedIdentitySources/MachineLearning.d.ts +2 -2
  39. package/dist/client/ManagedIdentitySources/MachineLearning.d.ts.map +1 -1
  40. package/dist/client/ManagedIdentitySources/MachineLearning.mjs +5 -5
  41. package/dist/client/ManagedIdentitySources/MachineLearning.mjs.map +1 -1
  42. package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts +2 -2
  43. package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts.map +1 -1
  44. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +5 -5
  45. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs.map +1 -1
  46. package/dist/client/OnBehalfOfClient.mjs +1 -1
  47. package/dist/client/PublicClientApplication.mjs +1 -1
  48. package/dist/client/UsernamePasswordClient.mjs +1 -1
  49. package/dist/config/Configuration.d.ts +1 -0
  50. package/dist/config/Configuration.d.ts.map +1 -1
  51. package/dist/config/Configuration.mjs +2 -9
  52. package/dist/config/Configuration.mjs.map +1 -1
  53. package/dist/config/ManagedIdentityId.mjs +1 -1
  54. package/dist/config/ManagedIdentityRequestParameters.d.ts +3 -2
  55. package/dist/config/ManagedIdentityRequestParameters.d.ts.map +1 -1
  56. package/dist/config/ManagedIdentityRequestParameters.mjs +6 -2
  57. package/dist/config/ManagedIdentityRequestParameters.mjs.map +1 -1
  58. package/dist/crypto/CryptoProvider.mjs +1 -1
  59. package/dist/crypto/GuidGenerator.mjs +1 -1
  60. package/dist/crypto/HashUtils.mjs +1 -1
  61. package/dist/crypto/PkceGenerator.mjs +1 -1
  62. package/dist/error/ManagedIdentityError.mjs +1 -1
  63. package/dist/error/ManagedIdentityErrorCodes.mjs +1 -1
  64. package/dist/error/NodeAuthError.mjs +1 -1
  65. package/dist/index.mjs +1 -1
  66. package/dist/internals.mjs +1 -1
  67. package/dist/network/HttpClient.mjs +1 -1
  68. package/dist/network/HttpClientWithRetries.mjs +1 -1
  69. package/dist/network/LoopbackClient.mjs +1 -1
  70. package/dist/packageMetadata.d.ts +1 -1
  71. package/dist/packageMetadata.mjs +2 -2
  72. package/dist/retry/LinearRetryPolicy.mjs +1 -1
  73. package/dist/utils/Constants.d.ts +5 -0
  74. package/dist/utils/Constants.d.ts.map +1 -1
  75. package/dist/utils/Constants.mjs +1 -1
  76. package/dist/utils/Constants.mjs.map +1 -1
  77. package/dist/utils/EncodingUtils.mjs +1 -1
  78. package/dist/utils/NetworkUtils.mjs +1 -1
  79. package/dist/utils/TimeUtils.mjs +1 -1
  80. package/lib/msal-node.cjs +225 -218
  81. package/lib/msal-node.cjs.map +1 -1
  82. package/lib/types/client/ManagedIdentityApplication.d.ts.map +1 -1
  83. package/lib/types/client/ManagedIdentityClient.d.ts +2 -1
  84. package/lib/types/client/ManagedIdentityClient.d.ts.map +1 -1
  85. package/lib/types/client/ManagedIdentitySources/AppService.d.ts +2 -2
  86. package/lib/types/client/ManagedIdentitySources/AppService.d.ts.map +1 -1
  87. package/lib/types/client/ManagedIdentitySources/AzureArc.d.ts +2 -2
  88. package/lib/types/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
  89. package/lib/types/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts +2 -1
  90. package/lib/types/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -1
  91. package/lib/types/client/ManagedIdentitySources/CloudShell.d.ts +2 -2
  92. package/lib/types/client/ManagedIdentitySources/CloudShell.d.ts.map +1 -1
  93. package/lib/types/client/ManagedIdentitySources/Imds.d.ts +2 -2
  94. package/lib/types/client/ManagedIdentitySources/Imds.d.ts.map +1 -1
  95. package/lib/types/client/ManagedIdentitySources/MachineLearning.d.ts +2 -2
  96. package/lib/types/client/ManagedIdentitySources/MachineLearning.d.ts.map +1 -1
  97. package/lib/types/client/ManagedIdentitySources/ServiceFabric.d.ts +2 -2
  98. package/lib/types/client/ManagedIdentitySources/ServiceFabric.d.ts.map +1 -1
  99. package/lib/types/config/Configuration.d.ts +1 -0
  100. package/lib/types/config/Configuration.d.ts.map +1 -1
  101. package/lib/types/config/ManagedIdentityRequestParameters.d.ts +3 -2
  102. package/lib/types/config/ManagedIdentityRequestParameters.d.ts.map +1 -1
  103. package/lib/types/packageMetadata.d.ts +1 -1
  104. package/lib/types/utils/Constants.d.ts +5 -0
  105. package/lib/types/utils/Constants.d.ts.map +1 -1
  106. package/package.json +2 -2
  107. package/src/client/ManagedIdentityApplication.ts +2 -1
  108. package/src/client/ManagedIdentityClient.ts +20 -4
  109. package/src/client/ManagedIdentitySources/AppService.ts +11 -2
  110. package/src/client/ManagedIdentitySources/AzureArc.ts +10 -1
  111. package/src/client/ManagedIdentitySources/BaseManagedIdentitySource.ts +20 -4
  112. package/src/client/ManagedIdentitySources/CloudShell.ts +10 -1
  113. package/src/client/ManagedIdentitySources/Imds.ts +11 -2
  114. package/src/client/ManagedIdentitySources/MachineLearning.ts +11 -2
  115. package/src/client/ManagedIdentitySources/ServiceFabric.ts +10 -1
  116. package/src/config/Configuration.ts +2 -20
  117. package/src/config/ManagedIdentityRequestParameters.ts +21 -2
  118. package/src/packageMetadata.ts +1 -1
  119. package/src/utils/Constants.ts +6 -0
@@ -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(logger, nodeStorage, networkClient, cryptoProvider);
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(logger, nodeStorage, networkClient, cryptoProvider);
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
  );
@@ -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 { HttpMethod } from "../utils/Constants.js";
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(httpMethod: HttpMethod, endpoint: string) {
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 {
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable header/header */
2
2
  export const name = "@azure/msal-node";
3
- export const version = "3.2.3";
3
+ export const version = "3.3.0";
@@ -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;