@azure/msal-node 7.0.0 → 7.0.2
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/CacheHelpers.mjs +1 -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/BaseClient.mjs +1 -1
- package/dist/client/ClientApplication.mjs +1 -1
- package/dist/client/ClientAssertion.mjs +1 -1
- package/dist/client/ClientCredentialClient.mjs +1 -1
- package/dist/client/ConfidentialClientApplication.mjs +29 -1
- package/dist/client/ConfidentialClientApplication.mjs.map +1 -1
- package/dist/client/DeviceCodeClient.mjs +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/MachineLearning.mjs +1 -1
- package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +1 -1
- package/dist/client/OnBehalfOfClient.mjs +1 -1
- package/dist/client/PublicClientApplication.mjs +1 -1
- package/dist/client/SilentRequestCoalescer.mjs +1 -1
- package/dist/client/UserFederatedIdentityCredentialClient.mjs +1 -1
- package/dist/client/UsernamePasswordClient.mjs +1 -1
- package/dist/config/Configuration.mjs +1 -1
- package/dist/config/ManagedIdentityId.mjs +1 -1
- package/dist/config/ManagedIdentityRequestParameters.mjs +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/ClientAuthErrorCodes.mjs +1 -1
- package/dist/error/ManagedIdentityError.mjs +1 -1
- package/dist/error/ManagedIdentityErrorCodes.mjs +1 -1
- package/dist/error/NodeAuthError.mjs +11 -1
- package/dist/error/NodeAuthError.mjs.map +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.mjs +2 -2
- package/dist/protocol/Authorize.mjs +1 -1
- package/dist/retry/DefaultManagedIdentityRetryPolicy.mjs +1 -1
- package/dist/retry/ExponentialRetryStrategy.mjs +1 -1
- package/dist/retry/ImdsRetryPolicy.mjs +1 -1
- package/dist/retry/LinearRetryStrategy.mjs +1 -1
- package/dist/utils/Constants.mjs +1 -1
- package/dist/utils/EncodingUtils.mjs +1 -1
- package/dist/utils/TimeUtils.mjs +1 -1
- package/lib/msal-node.cjs +107 -69
- package/lib/msal-node.cjs.map +1 -1
- package/package.json +3 -3
- package/src/client/ConfidentialClientApplication.ts +50 -0
- package/src/error/NodeAuthError.ts +17 -0
- package/src/packageMetadata.ts +1 -1
- package/types/client/ConfidentialClientApplication.d.ts +11 -1
- package/types/client/ConfidentialClientApplication.d.ts.map +1 -1
- package/types/error/NodeAuthError.d.ts +8 -0
- package/types/error/NodeAuthError.d.ts.map +1 -1
- package/types/packageMetadata.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@azure/msal-node",
|
|
4
|
-
"version": "7.0.
|
|
4
|
+
"version": "7.0.2",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Microsoft",
|
|
7
7
|
"email": "nugetaad@microsoft.com",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"@types/node": "^20.3.1",
|
|
71
71
|
"eslint-config-msal": "file:../../shared-configs/eslint-config-msal",
|
|
72
72
|
"jest": "^29.5.0",
|
|
73
|
-
"jest-junit": "^16.0.0",
|
|
73
|
+
"jest-junit": "^16.0.0 || ^17.0.0",
|
|
74
74
|
"prettier": "2.8.7",
|
|
75
75
|
"rollup": "^4.22.4",
|
|
76
76
|
"rollup-msal": "file:../../shared-configs/rollup-msal",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"yargs": "^17.3.1"
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
|
-
"@azure/msal-common": "16.14.
|
|
83
|
+
"@azure/msal-common": "16.14.2",
|
|
84
84
|
"jsonwebtoken": "^9.0.0"
|
|
85
85
|
},
|
|
86
86
|
"engines": {
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
ClientAssertion as ClientAssertionType,
|
|
26
26
|
getClientAssertion,
|
|
27
27
|
AzureRegion,
|
|
28
|
+
AuthorizationCodePayload,
|
|
28
29
|
} from "@azure/msal-common/node";
|
|
29
30
|
import { IConfidentialClientApplication } from "./IConfidentialClientApplication.js";
|
|
30
31
|
import { OnBehalfOfRequest } from "../request/OnBehalfOfRequest.js";
|
|
@@ -37,6 +38,9 @@ import { UserFederatedIdentityCredentialClient } from "./UserFederatedIdentityCr
|
|
|
37
38
|
import { UserFederatedIdentityCredentialRequest } from "../request/UserFederatedIdentityCredentialRequest.js";
|
|
38
39
|
import { CommonUserFederatedIdentityCredentialRequest } from "../request/CommonUserFederatedIdentityCredentialRequest.js";
|
|
39
40
|
import * as NodeClientAuthErrorCodes from "../error/ClientAuthErrorCodes.js";
|
|
41
|
+
import { AuthorizationCodeRequest } from "../request/AuthorizationCodeRequest.js";
|
|
42
|
+
import { AuthorizationUrlRequest } from "../request/AuthorizationUrlRequest.js";
|
|
43
|
+
import { NodeAuthError } from "../error/NodeAuthError.js";
|
|
40
44
|
|
|
41
45
|
/**
|
|
42
46
|
* This class is to be used to acquire tokens for confidential client applications (webApp, webAPI). Confidential client applications
|
|
@@ -69,6 +73,13 @@ export class ConfidentialClientApplication
|
|
|
69
73
|
* @param Configuration - configuration object for the MSAL ConfidentialClientApplication instance
|
|
70
74
|
*/
|
|
71
75
|
constructor(configuration: Configuration) {
|
|
76
|
+
if (
|
|
77
|
+
"instanceAware" in configuration.auth &&
|
|
78
|
+
configuration.auth.instanceAware === true
|
|
79
|
+
) {
|
|
80
|
+
throw NodeAuthError.createUnsupportedCcaInstanceAwareError();
|
|
81
|
+
}
|
|
82
|
+
|
|
72
83
|
super(configuration);
|
|
73
84
|
|
|
74
85
|
const clientSecretNotEmpty = !!this.config.auth.clientSecret;
|
|
@@ -132,6 +143,45 @@ export class ConfidentialClientApplication
|
|
|
132
143
|
this.appTokenProvider = undefined;
|
|
133
144
|
}
|
|
134
145
|
|
|
146
|
+
/**
|
|
147
|
+
* Creates the URL of the authorization request.
|
|
148
|
+
*/
|
|
149
|
+
public async getAuthCodeUrl(
|
|
150
|
+
request: AuthorizationUrlRequest
|
|
151
|
+
): Promise<string> {
|
|
152
|
+
if (
|
|
153
|
+
request.extraQueryParameters &&
|
|
154
|
+
Object.prototype.hasOwnProperty.call(
|
|
155
|
+
request.extraQueryParameters,
|
|
156
|
+
"instance_aware"
|
|
157
|
+
)
|
|
158
|
+
) {
|
|
159
|
+
throw NodeAuthError.createUnsupportedCcaInstanceAwareError(
|
|
160
|
+
request.correlationId
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return super.getAuthCodeUrl(request);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Acquires a token by exchanging an authorization code.
|
|
169
|
+
*/
|
|
170
|
+
public async acquireTokenByCode(
|
|
171
|
+
request: AuthorizationCodeRequest,
|
|
172
|
+
authCodePayload?: AuthorizationCodePayload
|
|
173
|
+
): Promise<AuthenticationResult> {
|
|
174
|
+
const sanitizedAuthCodePayload = authCodePayload
|
|
175
|
+
? {
|
|
176
|
+
code: request.code,
|
|
177
|
+
state: authCodePayload.state,
|
|
178
|
+
nonce: request.nonce,
|
|
179
|
+
}
|
|
180
|
+
: undefined;
|
|
181
|
+
|
|
182
|
+
return super.acquireTokenByCode(request, sanitizedAuthCodePayload);
|
|
183
|
+
}
|
|
184
|
+
|
|
135
185
|
/**
|
|
136
186
|
* This extensibility point only works for the client_credential flow, i.e. acquireTokenByClientCredential and
|
|
137
187
|
* is meant for Azure SDK to enhance Managed Identity support.
|
|
@@ -49,6 +49,10 @@ export const NodeAuthErrorMessage = {
|
|
|
49
49
|
code: "redirect_uri_not_supported",
|
|
50
50
|
desc: "RedirectUri is not supported in this scenario. Please remove redirectUri from the request.",
|
|
51
51
|
},
|
|
52
|
+
unsupportedCcaInstanceAware: {
|
|
53
|
+
code: "unsupported_cca_instance_aware",
|
|
54
|
+
desc: "Instance-aware configuration is not supported by ConfidentialClientApplication.",
|
|
55
|
+
},
|
|
52
56
|
};
|
|
53
57
|
|
|
54
58
|
export class NodeAuthError extends AuthError {
|
|
@@ -176,4 +180,17 @@ export class NodeAuthError extends AuthError {
|
|
|
176
180
|
NodeAuthErrorMessage.redirectUriNotSupported.desc
|
|
177
181
|
);
|
|
178
182
|
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Creates an error thrown when instance-aware behavior is requested for a confidential client.
|
|
186
|
+
*/
|
|
187
|
+
static createUnsupportedCcaInstanceAwareError(
|
|
188
|
+
correlationId: string = ""
|
|
189
|
+
): NodeAuthError {
|
|
190
|
+
return new NodeAuthError(
|
|
191
|
+
NodeAuthErrorMessage.unsupportedCcaInstanceAware.code,
|
|
192
|
+
correlationId,
|
|
193
|
+
NodeAuthErrorMessage.unsupportedCcaInstanceAware.desc
|
|
194
|
+
);
|
|
195
|
+
}
|
|
179
196
|
}
|
package/src/packageMetadata.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { ClientApplication } from "./ClientApplication.js";
|
|
2
2
|
import { Configuration } from "../config/Configuration.js";
|
|
3
|
-
import { AuthenticationResult, IAppTokenProvider } from "@azure/msal-common/node";
|
|
3
|
+
import { AuthenticationResult, IAppTokenProvider, AuthorizationCodePayload } from "@azure/msal-common/node";
|
|
4
4
|
import { IConfidentialClientApplication } from "./IConfidentialClientApplication.js";
|
|
5
5
|
import { OnBehalfOfRequest } from "../request/OnBehalfOfRequest.js";
|
|
6
6
|
import { ClientCredentialRequest } from "../request/ClientCredentialRequest.js";
|
|
7
7
|
import { UserFederatedIdentityCredentialRequest } from "../request/UserFederatedIdentityCredentialRequest.js";
|
|
8
|
+
import { AuthorizationCodeRequest } from "../request/AuthorizationCodeRequest.js";
|
|
9
|
+
import { AuthorizationUrlRequest } from "../request/AuthorizationUrlRequest.js";
|
|
8
10
|
/**
|
|
9
11
|
* This class is to be used to acquire tokens for confidential client applications (webApp, webAPI). Confidential client applications
|
|
10
12
|
* will configure application secrets, client certificates/assertions as applicable
|
|
@@ -32,6 +34,14 @@ export declare class ConfidentialClientApplication extends ClientApplication imp
|
|
|
32
34
|
* @param Configuration - configuration object for the MSAL ConfidentialClientApplication instance
|
|
33
35
|
*/
|
|
34
36
|
constructor(configuration: Configuration);
|
|
37
|
+
/**
|
|
38
|
+
* Creates the URL of the authorization request.
|
|
39
|
+
*/
|
|
40
|
+
getAuthCodeUrl(request: AuthorizationUrlRequest): Promise<string>;
|
|
41
|
+
/**
|
|
42
|
+
* Acquires a token by exchanging an authorization code.
|
|
43
|
+
*/
|
|
44
|
+
acquireTokenByCode(request: AuthorizationCodeRequest, authCodePayload?: AuthorizationCodePayload): Promise<AuthenticationResult>;
|
|
35
45
|
/**
|
|
36
46
|
* This extensibility point only works for the client_credential flow, i.e. acquireTokenByClientCredential and
|
|
37
47
|
* is meant for Azure SDK to enhance Managed Identity support.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfidentialClientApplication.d.ts","sourceRoot":"","sources":["../../src/client/ConfidentialClientApplication.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAQ3D,OAAO,EACH,oBAAoB,EAGpB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"ConfidentialClientApplication.d.ts","sourceRoot":"","sources":["../../src/client/ConfidentialClientApplication.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAQ3D,OAAO,EACH,oBAAoB,EAGpB,iBAAiB,EAOjB,wBAAwB,EAC3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAGpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAIhF,OAAO,EAAE,sCAAsC,EAAE,MAAM,sDAAsD,CAAC;AAG9G,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAGhF;;;;GAIG;AACH,qBAAa,6BACT,SAAQ,iBACR,YAAW,8BAA8B;IAEzC,OAAO,CAAC,gBAAgB,CAAC,CAAoB;IAE7C;;;;;;;;;;;;;;;;;;OAkBG;gBACS,aAAa,EAAE,aAAa;IAuExC;;OAEG;IACU,cAAc,CACvB,OAAO,EAAE,uBAAuB,GACjC,OAAO,CAAC,MAAM,CAAC;IAgBlB;;OAEG;IACU,kBAAkB,CAC3B,OAAO,EAAE,wBAAwB,EACjC,eAAe,CAAC,EAAE,wBAAwB,GAC3C,OAAO,CAAC,oBAAoB,CAAC;IAYhC;;;;;OAKG;IACH,mBAAmB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI;IAItD;;OAEG;IACU,8BAA8B,CACvC,OAAO,EAAE,uBAAuB,GACjC,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAkHvC;;;;;;;;;;OAUG;IACU,sBAAsB,CAC/B,OAAO,EAAE,iBAAiB,GAC3B,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAoCvC;;;;;;;OAOG;IACU,6CAA6C,CACtD,OAAO,EAAE,sCAAsC,GAChD,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;CAkF1C"}
|
|
@@ -43,6 +43,10 @@ export declare const NodeAuthErrorMessage: {
|
|
|
43
43
|
code: string;
|
|
44
44
|
desc: string;
|
|
45
45
|
};
|
|
46
|
+
unsupportedCcaInstanceAware: {
|
|
47
|
+
code: string;
|
|
48
|
+
desc: string;
|
|
49
|
+
};
|
|
46
50
|
};
|
|
47
51
|
export declare class NodeAuthError extends AuthError {
|
|
48
52
|
constructor(errorCode: string, correlationId: string, errorMessage?: string);
|
|
@@ -86,5 +90,9 @@ export declare class NodeAuthError extends AuthError {
|
|
|
86
90
|
* Creates an error thrown when redirectUri is provided in an unsupported scenario
|
|
87
91
|
*/
|
|
88
92
|
static createRedirectUriNotSupportedError(correlationId?: string): NodeAuthError;
|
|
93
|
+
/**
|
|
94
|
+
* Creates an error thrown when instance-aware behavior is requested for a confidential client.
|
|
95
|
+
*/
|
|
96
|
+
static createUnsupportedCcaInstanceAwareError(correlationId?: string): NodeAuthError;
|
|
89
97
|
}
|
|
90
98
|
//# sourceMappingURL=NodeAuthError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeAuthError.d.ts","sourceRoot":"","sources":["../../src/error/NodeAuthError.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD;;GAEG;AACH,eAAO,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"NodeAuthError.d.ts","sourceRoot":"","sources":["../../src/error/NodeAuthError.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6ChC,CAAC;AAEF,qBAAa,aAAc,SAAQ,SAAS;gBAEpC,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,YAAY,CAAC,EAAE,MAAM;IAMzB;;OAEG;IACH,MAAM,CAAC,qCAAqC,IAAI,aAAa;IAQ7D;;OAEG;IACH,MAAM,CAAC,kCAAkC,IAAI,aAAa;IAQ1D;;OAEG;IACH,MAAM,CAAC,+BAA+B,CAClC,aAAa,GAAE,MAAW,GAC3B,aAAa;IAQhB;;OAEG;IACH,MAAM,CAAC,iCAAiC,IAAI,aAAa;IAQzD;;OAEG;IACH,MAAM,CAAC,sCAAsC,IAAI,aAAa;IAQ9D;;OAEG;IACH,MAAM,CAAC,gCAAgC,CACnC,aAAa,GAAE,MAAW,GAC3B,aAAa;IAQhB;;OAEG;IACH,MAAM,CAAC,kDAAkD,IAAI,aAAa;IAQ1E;;OAEG;IACH,MAAM,CAAC,wBAAwB,CAAC,aAAa,GAAE,MAAW,GAAG,aAAa;IAQ1E;;OAEG;IACH,MAAM,CAAC,4BAA4B,IAAI,aAAa;IAQpD;;OAEG;IACH,MAAM,CAAC,kCAAkC,CACrC,aAAa,GAAE,MAAW,GAC3B,aAAa;IAQhB;;OAEG;IACH,MAAM,CAAC,sCAAsC,CACzC,aAAa,GAAE,MAAW,GAC3B,aAAa;CAOnB"}
|