@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.
- package/dist/cache/NodeStorage.d.ts +3 -3
- package/dist/cache/NodeStorage.d.ts.map +1 -1
- package/dist/cache/NodeStorage.mjs +4 -4
- package/dist/cache/NodeStorage.mjs.map +1 -1
- package/dist/cache/TokenCache.mjs +1 -1
- package/dist/cache/distributed/DistributedCachePlugin.d.ts +12 -0
- package/dist/cache/distributed/DistributedCachePlugin.d.ts.map +1 -1
- package/dist/cache/distributed/DistributedCachePlugin.mjs +13 -1
- package/dist/cache/distributed/DistributedCachePlugin.mjs.map +1 -1
- package/dist/cache/distributed/ICacheClient.d.ts +7 -3
- package/dist/cache/distributed/ICacheClient.d.ts.map +1 -1
- package/dist/cache/distributed/IPartitionManager.d.ts +5 -1
- package/dist/cache/distributed/IPartitionManager.d.ts.map +1 -1
- package/dist/cache/serializer/Deserializer.d.ts +9 -8
- package/dist/cache/serializer/Deserializer.d.ts.map +1 -1
- package/dist/cache/serializer/Deserializer.mjs +10 -9
- package/dist/cache/serializer/Deserializer.mjs.map +1 -1
- package/dist/cache/serializer/Serializer.d.ts +11 -7
- package/dist/cache/serializer/Serializer.d.ts.map +1 -1
- package/dist/cache/serializer/Serializer.mjs +12 -8
- package/dist/cache/serializer/Serializer.mjs.map +1 -1
- package/dist/client/ClientApplication.d.ts +3 -3
- package/dist/client/ClientApplication.d.ts.map +1 -1
- package/dist/client/ClientApplication.mjs +11 -10
- package/dist/client/ClientApplication.mjs.map +1 -1
- package/dist/client/ClientAssertion.mjs +1 -1
- package/dist/client/ClientCredentialClient.d.ts +5 -4
- package/dist/client/ClientCredentialClient.d.ts.map +1 -1
- package/dist/client/ClientCredentialClient.mjs +6 -5
- package/dist/client/ClientCredentialClient.mjs.map +1 -1
- package/dist/client/ConfidentialClientApplication.d.ts.map +1 -1
- package/dist/client/ConfidentialClientApplication.mjs +19 -5
- package/dist/client/ConfidentialClientApplication.mjs.map +1 -1
- package/dist/client/DeviceCodeClient.d.ts +19 -15
- package/dist/client/DeviceCodeClient.d.ts.map +1 -1
- package/dist/client/DeviceCodeClient.mjs +24 -20
- package/dist/client/DeviceCodeClient.mjs.map +1 -1
- package/dist/client/ManagedIdentityApplication.mjs +1 -1
- package/dist/client/ManagedIdentityClient.mjs +1 -1
- package/dist/client/ManagedIdentitySources/AppService.mjs +1 -1
- package/dist/client/ManagedIdentitySources/AzureArc.mjs +1 -1
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +1 -1
- package/dist/client/ManagedIdentitySources/CloudShell.mjs +1 -1
- package/dist/client/ManagedIdentitySources/Imds.mjs +1 -1
- package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +1 -1
- package/dist/client/OnBehalfOfClient.d.ts +9 -9
- package/dist/client/OnBehalfOfClient.d.ts.map +1 -1
- package/dist/client/OnBehalfOfClient.mjs +10 -10
- package/dist/client/OnBehalfOfClient.mjs.map +1 -1
- package/dist/client/PublicClientApplication.d.ts +3 -3
- package/dist/client/PublicClientApplication.d.ts.map +1 -1
- package/dist/client/PublicClientApplication.mjs +5 -5
- package/dist/client/PublicClientApplication.mjs.map +1 -1
- package/dist/client/UsernamePasswordClient.d.ts +5 -4
- package/dist/client/UsernamePasswordClient.d.ts.map +1 -1
- package/dist/client/UsernamePasswordClient.mjs +6 -5
- package/dist/client/UsernamePasswordClient.mjs.map +1 -1
- package/dist/config/Configuration.d.ts +4 -0
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.mjs +1 -1
- package/dist/config/Configuration.mjs.map +1 -1
- package/dist/config/ManagedIdentityId.mjs +1 -1
- package/dist/config/ManagedIdentityRequestParameters.mjs +1 -1
- package/dist/crypto/CryptoProvider.d.ts +2 -2
- package/dist/crypto/CryptoProvider.mjs +3 -3
- 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.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +1 -2
- package/dist/index.mjs.map +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/request/ManagedIdentityRequestParams.d.ts +2 -1
- package/dist/request/ManagedIdentityRequestParams.d.ts.map +1 -1
- package/dist/request/SignOutRequest.d.ts +1 -0
- package/dist/request/SignOutRequest.d.ts.map +1 -1
- package/dist/retry/LinearRetryPolicy.mjs +1 -1
- package/dist/utils/Constants.d.ts +1 -0
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.mjs +3 -2
- package/dist/utils/Constants.mjs.map +1 -1
- package/dist/utils/EncodingUtils.mjs +1 -1
- package/dist/utils/NetworkUtils.d.ts +12 -1
- package/dist/utils/NetworkUtils.d.ts.map +1 -1
- package/dist/utils/NetworkUtils.mjs +1 -1
- package/dist/utils/NetworkUtils.mjs.map +1 -1
- package/lib/msal-node.cjs +421 -312
- package/lib/msal-node.cjs.map +1 -1
- package/lib/types/cache/NodeStorage.d.ts +3 -3
- package/lib/types/cache/NodeStorage.d.ts.map +1 -1
- package/lib/types/cache/distributed/DistributedCachePlugin.d.ts +12 -0
- package/lib/types/cache/distributed/DistributedCachePlugin.d.ts.map +1 -1
- package/lib/types/cache/distributed/ICacheClient.d.ts +7 -3
- package/lib/types/cache/distributed/ICacheClient.d.ts.map +1 -1
- package/lib/types/cache/distributed/IPartitionManager.d.ts +5 -1
- package/lib/types/cache/distributed/IPartitionManager.d.ts.map +1 -1
- package/lib/types/cache/serializer/Deserializer.d.ts +9 -8
- package/lib/types/cache/serializer/Deserializer.d.ts.map +1 -1
- package/lib/types/cache/serializer/Serializer.d.ts +11 -7
- package/lib/types/cache/serializer/Serializer.d.ts.map +1 -1
- package/lib/types/client/ClientApplication.d.ts +3 -3
- package/lib/types/client/ClientApplication.d.ts.map +1 -1
- package/lib/types/client/ClientCredentialClient.d.ts +5 -4
- package/lib/types/client/ClientCredentialClient.d.ts.map +1 -1
- package/lib/types/client/ConfidentialClientApplication.d.ts.map +1 -1
- package/lib/types/client/DeviceCodeClient.d.ts +19 -15
- package/lib/types/client/DeviceCodeClient.d.ts.map +1 -1
- package/lib/types/client/OnBehalfOfClient.d.ts +9 -9
- package/lib/types/client/OnBehalfOfClient.d.ts.map +1 -1
- package/lib/types/client/PublicClientApplication.d.ts +3 -3
- package/lib/types/client/PublicClientApplication.d.ts.map +1 -1
- package/lib/types/client/UsernamePasswordClient.d.ts +5 -4
- package/lib/types/client/UsernamePasswordClient.d.ts.map +1 -1
- package/lib/types/config/Configuration.d.ts +4 -0
- package/lib/types/config/Configuration.d.ts.map +1 -1
- package/lib/types/crypto/CryptoProvider.d.ts +2 -2
- package/lib/types/index.d.ts +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/packageMetadata.d.ts +1 -1
- package/lib/types/request/ManagedIdentityRequestParams.d.ts +2 -1
- package/lib/types/request/ManagedIdentityRequestParams.d.ts.map +1 -1
- package/lib/types/request/SignOutRequest.d.ts +1 -0
- package/lib/types/request/SignOutRequest.d.ts.map +1 -1
- package/lib/types/utils/Constants.d.ts +1 -0
- package/lib/types/utils/Constants.d.ts.map +1 -1
- package/lib/types/utils/NetworkUtils.d.ts +12 -1
- package/lib/types/utils/NetworkUtils.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/cache/NodeStorage.ts +3 -3
- package/src/cache/distributed/DistributedCachePlugin.ts +12 -0
- package/src/cache/distributed/ICacheClient.ts +7 -3
- package/src/cache/distributed/IPartitionManager.ts +5 -1
- package/src/cache/serializer/Deserializer.ts +9 -8
- package/src/cache/serializer/Serializer.ts +11 -7
- package/src/client/ClientApplication.ts +10 -3
- package/src/client/ClientCredentialClient.ts +5 -4
- package/src/client/ConfidentialClientApplication.ts +21 -1
- package/src/client/DeviceCodeClient.ts +29 -20
- package/src/client/OnBehalfOfClient.ts +9 -9
- package/src/client/PublicClientApplication.ts +4 -3
- package/src/client/UsernamePasswordClient.ts +5 -4
- package/src/config/Configuration.ts +4 -0
- package/src/crypto/CryptoProvider.ts +2 -2
- package/src/index.ts +0 -1
- package/src/packageMetadata.ts +1 -1
- package/src/request/ManagedIdentityRequestParams.ts +2 -1
- package/src/request/SignOutRequest.ts +1 -0
- package/src/utils/Constants.ts +1 -0
- 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
|
|
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
package/src/packageMetadata.ts
CHANGED
|
@@ -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 "
|
|
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;
|
package/src/utils/Constants.ts
CHANGED
|
@@ -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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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>(
|