@azure/msal-node 2.15.0 → 2.16.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 (158) hide show
  1. package/dist/cache/NodeStorage.d.ts +3 -3
  2. package/dist/cache/NodeStorage.d.ts.map +1 -1
  3. package/dist/cache/NodeStorage.mjs +4 -4
  4. package/dist/cache/NodeStorage.mjs.map +1 -1
  5. package/dist/cache/TokenCache.mjs +1 -1
  6. package/dist/cache/distributed/DistributedCachePlugin.d.ts +12 -0
  7. package/dist/cache/distributed/DistributedCachePlugin.d.ts.map +1 -1
  8. package/dist/cache/distributed/DistributedCachePlugin.mjs +13 -1
  9. package/dist/cache/distributed/DistributedCachePlugin.mjs.map +1 -1
  10. package/dist/cache/distributed/ICacheClient.d.ts +7 -3
  11. package/dist/cache/distributed/ICacheClient.d.ts.map +1 -1
  12. package/dist/cache/distributed/IPartitionManager.d.ts +5 -1
  13. package/dist/cache/distributed/IPartitionManager.d.ts.map +1 -1
  14. package/dist/cache/serializer/Deserializer.d.ts +9 -8
  15. package/dist/cache/serializer/Deserializer.d.ts.map +1 -1
  16. package/dist/cache/serializer/Deserializer.mjs +10 -9
  17. package/dist/cache/serializer/Deserializer.mjs.map +1 -1
  18. package/dist/cache/serializer/Serializer.d.ts +11 -7
  19. package/dist/cache/serializer/Serializer.d.ts.map +1 -1
  20. package/dist/cache/serializer/Serializer.mjs +12 -8
  21. package/dist/cache/serializer/Serializer.mjs.map +1 -1
  22. package/dist/client/ClientApplication.d.ts +3 -3
  23. package/dist/client/ClientApplication.d.ts.map +1 -1
  24. package/dist/client/ClientApplication.mjs +11 -10
  25. package/dist/client/ClientApplication.mjs.map +1 -1
  26. package/dist/client/ClientAssertion.mjs +1 -1
  27. package/dist/client/ClientCredentialClient.d.ts +5 -4
  28. package/dist/client/ClientCredentialClient.d.ts.map +1 -1
  29. package/dist/client/ClientCredentialClient.mjs +6 -5
  30. package/dist/client/ClientCredentialClient.mjs.map +1 -1
  31. package/dist/client/ConfidentialClientApplication.d.ts.map +1 -1
  32. package/dist/client/ConfidentialClientApplication.mjs +19 -5
  33. package/dist/client/ConfidentialClientApplication.mjs.map +1 -1
  34. package/dist/client/DeviceCodeClient.d.ts +19 -15
  35. package/dist/client/DeviceCodeClient.d.ts.map +1 -1
  36. package/dist/client/DeviceCodeClient.mjs +24 -20
  37. package/dist/client/DeviceCodeClient.mjs.map +1 -1
  38. package/dist/client/ManagedIdentityApplication.mjs +1 -1
  39. package/dist/client/ManagedIdentityClient.mjs +1 -1
  40. package/dist/client/ManagedIdentitySources/AppService.mjs +1 -1
  41. package/dist/client/ManagedIdentitySources/AzureArc.mjs +1 -1
  42. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +1 -1
  43. package/dist/client/ManagedIdentitySources/CloudShell.mjs +1 -1
  44. package/dist/client/ManagedIdentitySources/Imds.mjs +1 -1
  45. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +1 -1
  46. package/dist/client/OnBehalfOfClient.d.ts +9 -9
  47. package/dist/client/OnBehalfOfClient.d.ts.map +1 -1
  48. package/dist/client/OnBehalfOfClient.mjs +10 -10
  49. package/dist/client/OnBehalfOfClient.mjs.map +1 -1
  50. package/dist/client/PublicClientApplication.d.ts +3 -3
  51. package/dist/client/PublicClientApplication.d.ts.map +1 -1
  52. package/dist/client/PublicClientApplication.mjs +5 -5
  53. package/dist/client/PublicClientApplication.mjs.map +1 -1
  54. package/dist/client/UsernamePasswordClient.d.ts +5 -4
  55. package/dist/client/UsernamePasswordClient.d.ts.map +1 -1
  56. package/dist/client/UsernamePasswordClient.mjs +6 -5
  57. package/dist/client/UsernamePasswordClient.mjs.map +1 -1
  58. package/dist/config/Configuration.d.ts +4 -0
  59. package/dist/config/Configuration.d.ts.map +1 -1
  60. package/dist/config/Configuration.mjs +1 -1
  61. package/dist/config/Configuration.mjs.map +1 -1
  62. package/dist/config/ManagedIdentityId.mjs +1 -1
  63. package/dist/config/ManagedIdentityRequestParameters.mjs +1 -1
  64. package/dist/crypto/CryptoProvider.d.ts +2 -2
  65. package/dist/crypto/CryptoProvider.mjs +3 -3
  66. package/dist/crypto/GuidGenerator.mjs +1 -1
  67. package/dist/crypto/HashUtils.mjs +1 -1
  68. package/dist/crypto/PkceGenerator.mjs +1 -1
  69. package/dist/error/ManagedIdentityError.mjs +1 -1
  70. package/dist/error/ManagedIdentityErrorCodes.mjs +1 -1
  71. package/dist/error/NodeAuthError.mjs +1 -1
  72. package/dist/index.d.ts +1 -1
  73. package/dist/index.d.ts.map +1 -1
  74. package/dist/index.mjs +1 -2
  75. package/dist/index.mjs.map +1 -1
  76. package/dist/internals.mjs +1 -1
  77. package/dist/network/HttpClient.mjs +1 -1
  78. package/dist/network/HttpClientWithRetries.mjs +1 -1
  79. package/dist/network/LoopbackClient.mjs +1 -1
  80. package/dist/packageMetadata.d.ts +1 -1
  81. package/dist/packageMetadata.mjs +2 -2
  82. package/dist/request/ManagedIdentityRequestParams.d.ts +2 -1
  83. package/dist/request/ManagedIdentityRequestParams.d.ts.map +1 -1
  84. package/dist/request/SignOutRequest.d.ts +1 -0
  85. package/dist/request/SignOutRequest.d.ts.map +1 -1
  86. package/dist/retry/LinearRetryPolicy.mjs +1 -1
  87. package/dist/utils/Constants.d.ts +1 -0
  88. package/dist/utils/Constants.d.ts.map +1 -1
  89. package/dist/utils/Constants.mjs +3 -2
  90. package/dist/utils/Constants.mjs.map +1 -1
  91. package/dist/utils/EncodingUtils.mjs +1 -1
  92. package/dist/utils/NetworkUtils.d.ts +12 -1
  93. package/dist/utils/NetworkUtils.d.ts.map +1 -1
  94. package/dist/utils/NetworkUtils.mjs +1 -1
  95. package/dist/utils/NetworkUtils.mjs.map +1 -1
  96. package/lib/msal-node.cjs +421 -312
  97. package/lib/msal-node.cjs.map +1 -1
  98. package/lib/types/cache/NodeStorage.d.ts +3 -3
  99. package/lib/types/cache/NodeStorage.d.ts.map +1 -1
  100. package/lib/types/cache/distributed/DistributedCachePlugin.d.ts +12 -0
  101. package/lib/types/cache/distributed/DistributedCachePlugin.d.ts.map +1 -1
  102. package/lib/types/cache/distributed/ICacheClient.d.ts +7 -3
  103. package/lib/types/cache/distributed/ICacheClient.d.ts.map +1 -1
  104. package/lib/types/cache/distributed/IPartitionManager.d.ts +5 -1
  105. package/lib/types/cache/distributed/IPartitionManager.d.ts.map +1 -1
  106. package/lib/types/cache/serializer/Deserializer.d.ts +9 -8
  107. package/lib/types/cache/serializer/Deserializer.d.ts.map +1 -1
  108. package/lib/types/cache/serializer/Serializer.d.ts +11 -7
  109. package/lib/types/cache/serializer/Serializer.d.ts.map +1 -1
  110. package/lib/types/client/ClientApplication.d.ts +3 -3
  111. package/lib/types/client/ClientApplication.d.ts.map +1 -1
  112. package/lib/types/client/ClientCredentialClient.d.ts +5 -4
  113. package/lib/types/client/ClientCredentialClient.d.ts.map +1 -1
  114. package/lib/types/client/ConfidentialClientApplication.d.ts.map +1 -1
  115. package/lib/types/client/DeviceCodeClient.d.ts +19 -15
  116. package/lib/types/client/DeviceCodeClient.d.ts.map +1 -1
  117. package/lib/types/client/OnBehalfOfClient.d.ts +9 -9
  118. package/lib/types/client/OnBehalfOfClient.d.ts.map +1 -1
  119. package/lib/types/client/PublicClientApplication.d.ts +3 -3
  120. package/lib/types/client/PublicClientApplication.d.ts.map +1 -1
  121. package/lib/types/client/UsernamePasswordClient.d.ts +5 -4
  122. package/lib/types/client/UsernamePasswordClient.d.ts.map +1 -1
  123. package/lib/types/config/Configuration.d.ts +4 -0
  124. package/lib/types/config/Configuration.d.ts.map +1 -1
  125. package/lib/types/crypto/CryptoProvider.d.ts +2 -2
  126. package/lib/types/index.d.ts +1 -1
  127. package/lib/types/index.d.ts.map +1 -1
  128. package/lib/types/packageMetadata.d.ts +1 -1
  129. package/lib/types/request/ManagedIdentityRequestParams.d.ts +2 -1
  130. package/lib/types/request/ManagedIdentityRequestParams.d.ts.map +1 -1
  131. package/lib/types/request/SignOutRequest.d.ts +1 -0
  132. package/lib/types/request/SignOutRequest.d.ts.map +1 -1
  133. package/lib/types/utils/Constants.d.ts +1 -0
  134. package/lib/types/utils/Constants.d.ts.map +1 -1
  135. package/lib/types/utils/NetworkUtils.d.ts +12 -1
  136. package/lib/types/utils/NetworkUtils.d.ts.map +1 -1
  137. package/package.json +3 -3
  138. package/src/cache/NodeStorage.ts +3 -3
  139. package/src/cache/distributed/DistributedCachePlugin.ts +12 -0
  140. package/src/cache/distributed/ICacheClient.ts +7 -3
  141. package/src/cache/distributed/IPartitionManager.ts +5 -1
  142. package/src/cache/serializer/Deserializer.ts +9 -8
  143. package/src/cache/serializer/Serializer.ts +11 -7
  144. package/src/client/ClientApplication.ts +10 -3
  145. package/src/client/ClientCredentialClient.ts +5 -4
  146. package/src/client/ConfidentialClientApplication.ts +21 -1
  147. package/src/client/DeviceCodeClient.ts +29 -20
  148. package/src/client/OnBehalfOfClient.ts +9 -9
  149. package/src/client/PublicClientApplication.ts +4 -3
  150. package/src/client/UsernamePasswordClient.ts +5 -4
  151. package/src/config/Configuration.ts +4 -0
  152. package/src/crypto/CryptoProvider.ts +2 -2
  153. package/src/index.ts +0 -1
  154. package/src/packageMetadata.ts +1 -1
  155. package/src/request/ManagedIdentityRequestParams.ts +2 -1
  156. package/src/request/SignOutRequest.ts +1 -0
  157. package/src/utils/Constants.ts +1 -0
  158. package/src/utils/NetworkUtils.ts +13 -4
@@ -37,6 +37,7 @@ import { EncodingUtils } from "../utils/EncodingUtils.js";
37
37
 
38
38
  /**
39
39
  * On-Behalf-Of client
40
+ * @public
40
41
  */
41
42
  export class OnBehalfOfClient extends BaseClient {
42
43
  private scopeSet: ScopeSet;
@@ -48,7 +49,7 @@ export class OnBehalfOfClient extends BaseClient {
48
49
 
49
50
  /**
50
51
  * Public API to acquire tokens with on behalf of flow
51
- * @param request
52
+ * @param request - developer provided CommonOnBehalfOfRequest
52
53
  */
53
54
  public async acquireToken(
54
55
  request: CommonOnBehalfOfRequest
@@ -86,7 +87,7 @@ export class OnBehalfOfClient extends BaseClient {
86
87
  * Find accessToken based on user assertion and account info in the cache
87
88
  * Please note we are not yet supported OBO tokens refreshed with long lived RT. User will have to send a new assertion if the current access token expires
88
89
  * This is to prevent security issues when the assertion changes over time, however, longlived RT helps retaining the session
89
- * @param request
90
+ * @param request - developer provided CommonOnBehalfOfRequest
90
91
  */
91
92
  private async getCachedAuthenticationResult(
92
93
  request: CommonOnBehalfOfRequest
@@ -172,7 +173,7 @@ export class OnBehalfOfClient extends BaseClient {
172
173
  /**
173
174
  * read idtoken from cache, this is a specific implementation for OBO as the requirements differ from a generic lookup in the cacheManager
174
175
  * Certain use cases of OBO flow do not expect an idToken in the cache/or from the service
175
- * @param atHomeAccountId {string}
176
+ * @param atHomeAccountId - account id
176
177
  */
177
178
  private readIdTokenFromCacheForOBO(
178
179
  atHomeAccountId: string
@@ -198,9 +199,8 @@ export class OnBehalfOfClient extends BaseClient {
198
199
 
199
200
  /**
200
201
  * Fetches the cached access token based on incoming assertion
201
- * @param clientId
202
- * @param request
203
- * @param userAssertionHash
202
+ * @param clientId - client id
203
+ * @param request - developer provided CommonOnBehalfOfRequest
204
204
  */
205
205
  private readAccessTokenFromCacheForOBO(
206
206
  clientId: string,
@@ -246,8 +246,8 @@ export class OnBehalfOfClient extends BaseClient {
246
246
 
247
247
  /**
248
248
  * Make a network call to the server requesting credentials
249
- * @param request
250
- * @param authority
249
+ * @param request - developer provided CommonOnBehalfOfRequest
250
+ * @param authority - authority object
251
251
  */
252
252
  private async executeTokenRequest(
253
253
  request: CommonOnBehalfOfRequest,
@@ -307,7 +307,7 @@ export class OnBehalfOfClient extends BaseClient {
307
307
 
308
308
  /**
309
309
  * generate a server request in accepable format
310
- * @param request
310
+ * @param request - developer provided CommonOnBehalfOfRequest
311
311
  */
312
312
  private async createTokenRequestBody(
313
313
  request: CommonOnBehalfOfRequest
@@ -116,6 +116,7 @@ export class PublicClientApplication
116
116
  const deviceCodeConfig = await this.buildOauthClientConfiguration(
117
117
  validRequest.authority,
118
118
  validRequest.correlationId,
119
+ "",
119
120
  serverTelemetryManager,
120
121
  undefined,
121
122
  request.azureCloudOptions
@@ -238,7 +239,7 @@ export class PublicClientApplication
238
239
 
239
240
  /**
240
241
  * Returns a token retrieved either from the cache or by exchanging the refresh token for a fresh access token. If brokering is enabled the token request will be serviced by the broker.
241
- * @param request
242
+ * @param request - developer provided SilentFlowRequest
242
243
  * @returns
243
244
  */
244
245
  async acquireTokenSilent(
@@ -271,7 +272,7 @@ export class PublicClientApplication
271
272
 
272
273
  /**
273
274
  * Removes cache artifacts associated with the given account
274
- * @param request
275
+ * @param request - developer provided SignOutRequest
275
276
  * @returns
276
277
  */
277
278
  async signOut(request: SignOutRequest): Promise<void> {
@@ -307,7 +308,7 @@ export class PublicClientApplication
307
308
 
308
309
  /**
309
310
  * Attempts to retrieve the redirectUri from the loopback server. If the loopback server does not start listening for requests within the timeout this will throw.
310
- * @param loopbackClient
311
+ * @param loopbackClient - developer provided custom loopback server implementation
311
312
  * @returns
312
313
  */
313
314
  private async waitForRedirectUri(
@@ -26,6 +26,7 @@ import {
26
26
  /**
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
+ * @public
29
30
  */
30
31
  export class UsernamePasswordClient extends BaseClient {
31
32
  constructor(configuration: ClientConfiguration) {
@@ -35,7 +36,7 @@ export class UsernamePasswordClient extends BaseClient {
35
36
  /**
36
37
  * API to acquire a token by passing the username and password to the service in exchage of credentials
37
38
  * password_grant
38
- * @param request
39
+ * @param request - CommonUsernamePasswordRequest
39
40
  */
40
41
  async acquireToken(
41
42
  request: CommonUsernamePasswordRequest
@@ -71,8 +72,8 @@ export class UsernamePasswordClient extends BaseClient {
71
72
 
72
73
  /**
73
74
  * Executes POST request to token endpoint
74
- * @param authority
75
- * @param request
75
+ * @param authority - authority object
76
+ * @param request - CommonUsernamePasswordRequest provided by the developer
76
77
  */
77
78
  private async executeTokenRequest(
78
79
  authority: Authority,
@@ -111,7 +112,7 @@ export class UsernamePasswordClient extends BaseClient {
111
112
 
112
113
  /**
113
114
  * Generates a map for all the params to be sent to the service
114
- * @param request
115
+ * @param request - CommonUsernamePasswordRequest provided by the developer
115
116
  */
116
117
  private async createTokenRequestBody(
117
118
  request: CommonUsernamePasswordRequest
@@ -104,6 +104,7 @@ export type NodeSystemOptions = {
104
104
  disableInternalRetries?: boolean;
105
105
  };
106
106
 
107
+ /** @public */
107
108
  export type NodeTelemetryOptions = {
108
109
  application?: ApplicationTelemetry;
109
110
  };
@@ -126,12 +127,14 @@ export type Configuration = {
126
127
  telemetry?: NodeTelemetryOptions;
127
128
  };
128
129
 
130
+ /** @public */
129
131
  export type ManagedIdentityIdParams = {
130
132
  userAssignedClientId?: string;
131
133
  userAssignedResourceId?: string;
132
134
  userAssignedObjectId?: string;
133
135
  };
134
136
 
137
+ /** @public */
135
138
  export type ManagedIdentityConfiguration = {
136
139
  managedIdentityIdParams?: ManagedIdentityIdParams;
137
140
  system?: NodeSystemOptions;
@@ -242,6 +245,7 @@ export function buildAppConfiguration({
242
245
  };
243
246
  }
244
247
 
248
+ /** @internal */
245
249
  export type ManagedIdentityNodeConfiguration = {
246
250
  managedIdentityId: ManagedIdentityId;
247
251
  system: Required<
@@ -34,7 +34,7 @@ export class CryptoProvider implements ICrypto {
34
34
  }
35
35
  /**
36
36
  * Stringifies and base64Url encodes input public key
37
- * @param inputKid
37
+ * @param inputKid - public key id
38
38
  * @returns Base64Url encoded public key
39
39
  */
40
40
  encodeKid(): string {
@@ -81,7 +81,7 @@ export class CryptoProvider implements ICrypto {
81
81
 
82
82
  /**
83
83
  * Removes cryptographic keypair from key store matching the keyId passed in
84
- * @param kid
84
+ * @param kid - public key id
85
85
  */
86
86
  removeTokenBindingKey(): Promise<boolean> {
87
87
  throw new Error("Method not implemented.");
package/src/index.ts CHANGED
@@ -38,7 +38,6 @@ export {
38
38
  Configuration,
39
39
  ManagedIdentityConfiguration,
40
40
  ManagedIdentityIdParams,
41
- buildAppConfiguration,
42
41
  NodeAuthOptions,
43
42
  NodeSystemOptions,
44
43
  BrokerOptions,
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable header/header */
2
2
  export const name = "@azure/msal-node";
3
- export const version = "2.15.0";
3
+ export const version = "2.16.0";
@@ -7,7 +7,8 @@
7
7
  * ManagedIdentityRequest
8
8
  * - claims - a stringified claims request which will be used to determine whether or not the cache should be skipped
9
9
  * - forceRefresh - forces managed identity requests to skip the cache and make network calls if true
10
- * - resource - resource requested to access the protected API. It should be of the form "{ResourceIdUri}" or {ResourceIdUri/.default}. For instance https://management.azure.net or, for Microsoft Graph, https://graph.microsoft.com/.default
10
+ * - resource - resource requested to access the protected API. It should be of the form "ResourceIdUri" or "ResourceIdUri/.default". For instance https://management.azure.net or, for Microsoft Graph, https://graph.microsoft.com/.default
11
+ * @public
11
12
  */
12
13
  export type ManagedIdentityRequestParams = {
13
14
  claims?: string;
@@ -5,6 +5,7 @@
5
5
 
6
6
  import { AccountInfo } from "@azure/msal-common/node";
7
7
 
8
+ /** @public */
8
9
  export type SignOutRequest = {
9
10
  account: AccountInfo;
10
11
  correlationId?: string;
@@ -82,6 +82,7 @@ export type ProxyStatus = (typeof ProxyStatus)[keyof typeof ProxyStatus];
82
82
  * Constants used for region discovery
83
83
  */
84
84
  export const REGION_ENVIRONMENT_VARIABLE = "REGION_NAME";
85
+ export const MSAL_FORCE_REGION = "MSAL_FORCE_REGION";
85
86
 
86
87
  /**
87
88
  * Constant used for PKCE
@@ -3,10 +3,19 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import {
7
- NetworkResponse,
8
- UrlToHttpRequestOptions,
9
- } from "@azure/msal-common/node";
6
+ import { NetworkResponse } from "@azure/msal-common/node";
7
+
8
+ export type UrlToHttpRequestOptions = {
9
+ protocol: string;
10
+ hostname: string;
11
+ hash: string;
12
+ search: string;
13
+ pathname: string;
14
+ path: string;
15
+ href: string;
16
+ port?: number;
17
+ auth?: string;
18
+ };
10
19
 
11
20
  export class NetworkUtils {
12
21
  static getNetworkResponse<T>(