@azure/msal-node 5.5.0 → 5.6.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/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 +16 -6
- package/dist/client/ClientApplication.mjs.map +1 -1
- package/dist/client/ClientAssertion.mjs +1 -1
- package/dist/client/ClientCredentialClient.mjs +5 -3
- package/dist/client/ClientCredentialClient.mjs.map +1 -1
- package/dist/client/ConfidentialClientApplication.mjs +1 -1
- package/dist/client/DeviceCodeClient.mjs +2 -2
- 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 +93 -16
- package/dist/client/ManagedIdentitySources/AzureArc.mjs.map +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 +6 -3
- package/dist/client/OnBehalfOfClient.mjs.map +1 -1
- package/dist/client/PublicClientApplication.mjs +1 -1
- package/dist/client/UserFederatedIdentityCredentialClient.mjs +2 -2
- package/dist/client/UserFederatedIdentityCredentialClient.mjs.map +1 -1
- package/dist/client/UsernamePasswordClient.mjs +2 -2
- package/dist/client/UsernamePasswordClient.mjs.map +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 +13 -13
- package/dist/crypto/CryptoProvider.mjs.map +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 +5 -4
- package/dist/error/ManagedIdentityError.mjs.map +1 -1
- package/dist/error/ManagedIdentityErrorCodes.mjs +3 -2
- package/dist/error/ManagedIdentityErrorCodes.mjs.map +1 -1
- package/dist/error/NodeAuthError.mjs +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 +450 -142
- package/lib/msal-node.cjs.map +1 -1
- package/package.json +2 -2
- package/src/client/ClientApplication.ts +15 -5
- package/src/client/ClientCredentialClient.ts +6 -2
- package/src/client/DeviceCodeClient.ts +2 -1
- package/src/client/ManagedIdentitySources/AzureArc.ts +139 -19
- package/src/client/OnBehalfOfClient.ts +6 -2
- package/src/client/UserFederatedIdentityCredentialClient.ts +2 -1
- package/src/client/UsernamePasswordClient.ts +2 -1
- package/src/crypto/CryptoProvider.ts +31 -13
- package/src/error/ManagedIdentityError.ts +4 -2
- package/src/error/ManagedIdentityErrorCodes.ts +2 -0
- package/src/packageMetadata.ts +1 -1
- package/src/request/AuthorizationCodeRequest.ts +4 -0
- package/src/response/ManagedIdentityTokenResponse.ts +3 -0
- package/types/client/ClientApplication.d.ts.map +1 -1
- package/types/client/ClientCredentialClient.d.ts.map +1 -1
- package/types/client/DeviceCodeClient.d.ts.map +1 -1
- package/types/client/ManagedIdentitySources/AzureArc.d.ts +22 -8
- package/types/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
- package/types/client/OnBehalfOfClient.d.ts.map +1 -1
- package/types/client/UserFederatedIdentityCredentialClient.d.ts.map +1 -1
- package/types/client/UsernamePasswordClient.d.ts.map +1 -1
- package/types/crypto/CryptoProvider.d.ts +11 -9
- package/types/crypto/CryptoProvider.d.ts.map +1 -1
- package/types/error/ManagedIdentityError.d.ts +1 -0
- package/types/error/ManagedIdentityError.d.ts.map +1 -1
- package/types/error/ManagedIdentityErrorCodes.d.ts +1 -0
- package/types/error/ManagedIdentityErrorCodes.d.ts.map +1 -1
- package/types/packageMetadata.d.ts +1 -1
- package/types/request/AuthorizationCodeRequest.d.ts +4 -0
- package/types/request/AuthorizationCodeRequest.d.ts.map +1 -1
- package/types/response/ManagedIdentityTokenResponse.d.ts +3 -0
- package/types/response/ManagedIdentityTokenResponse.d.ts.map +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": "5.
|
|
4
|
+
"version": "5.6.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Microsoft",
|
|
7
7
|
"email": "nugetaad@microsoft.com",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"yargs": "^17.3.1"
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@azure/msal-common": "16.
|
|
87
|
+
"@azure/msal-common": "16.13.0",
|
|
88
88
|
"jsonwebtoken": "^9.0.0"
|
|
89
89
|
},
|
|
90
90
|
"engines": {
|
|
@@ -161,18 +161,28 @@ export abstract class ClientApplication {
|
|
|
161
161
|
"acquireTokenByCode called",
|
|
162
162
|
request.correlationId || ""
|
|
163
163
|
);
|
|
164
|
-
|
|
164
|
+
let validatedAuthCodePayload = authCodePayLoad;
|
|
165
|
+
if (request.state && validatedAuthCodePayload) {
|
|
165
166
|
this.logger.info(
|
|
166
167
|
"acquireTokenByCode - validating state",
|
|
167
168
|
request.correlationId || ""
|
|
168
169
|
);
|
|
169
170
|
this.validateState(
|
|
170
171
|
request.state,
|
|
171
|
-
|
|
172
|
+
validatedAuthCodePayload.state || "",
|
|
172
173
|
request.correlationId || ""
|
|
173
174
|
);
|
|
174
|
-
|
|
175
|
-
|
|
175
|
+
validatedAuthCodePayload = {
|
|
176
|
+
...validatedAuthCodePayload,
|
|
177
|
+
state: "",
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
if (request.nonce) {
|
|
181
|
+
validatedAuthCodePayload = {
|
|
182
|
+
...validatedAuthCodePayload,
|
|
183
|
+
code: request.code,
|
|
184
|
+
nonce: request.nonce,
|
|
185
|
+
};
|
|
176
186
|
}
|
|
177
187
|
const validRequest: CommonAuthorizationCodeRequest = {
|
|
178
188
|
...request,
|
|
@@ -208,7 +218,7 @@ export abstract class ClientApplication {
|
|
|
208
218
|
return await authorizationCodeClient.acquireToken(
|
|
209
219
|
validRequest,
|
|
210
220
|
ApiId.acquireTokenByCode,
|
|
211
|
-
|
|
221
|
+
validatedAuthCodePayload
|
|
212
222
|
);
|
|
213
223
|
} catch (e) {
|
|
214
224
|
if (e instanceof AuthError) {
|
|
@@ -238,7 +238,10 @@ export class ClientCredentialClient extends BaseClient {
|
|
|
238
238
|
},
|
|
239
239
|
true,
|
|
240
240
|
request,
|
|
241
|
-
this.performanceClient
|
|
241
|
+
this.performanceClient,
|
|
242
|
+
{
|
|
243
|
+
tokenBindingKeyManager: this.config.tokenBindingKeyManager,
|
|
244
|
+
}
|
|
242
245
|
),
|
|
243
246
|
lastCacheOutcome,
|
|
244
247
|
];
|
|
@@ -370,7 +373,8 @@ export class ClientCredentialClient extends BaseClient {
|
|
|
370
373
|
this.logger,
|
|
371
374
|
this.performanceClient,
|
|
372
375
|
this.config.serializableCache,
|
|
373
|
-
this.config.persistencePlugin
|
|
376
|
+
this.config.persistencePlugin,
|
|
377
|
+
this.config.tokenBindingKeyManager
|
|
374
378
|
);
|
|
375
379
|
|
|
376
380
|
responseHandler.validateTokenResponse(
|
|
@@ -58,7 +58,8 @@ export class DeviceCodeClient extends BaseClient {
|
|
|
58
58
|
this.logger,
|
|
59
59
|
this.performanceClient,
|
|
60
60
|
this.config.serializableCache,
|
|
61
|
-
this.config.persistencePlugin
|
|
61
|
+
this.config.persistencePlugin,
|
|
62
|
+
this.config.tokenBindingKeyManager
|
|
62
63
|
);
|
|
63
64
|
|
|
64
65
|
// Validate response. This function throws a server error if an error is returned by the server.
|
|
@@ -15,7 +15,10 @@ import {
|
|
|
15
15
|
Constants,
|
|
16
16
|
} from "@azure/msal-common/node";
|
|
17
17
|
import { ManagedIdentityRequestParameters } from "../../config/ManagedIdentityRequestParameters.js";
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
BaseManagedIdentitySource,
|
|
20
|
+
ManagedIdentityUserAssignedIdQueryParameterNames,
|
|
21
|
+
} from "./BaseManagedIdentitySource.js";
|
|
19
22
|
import { CryptoProvider } from "../../crypto/CryptoProvider.js";
|
|
20
23
|
import {
|
|
21
24
|
ManagedIdentityErrorCodes,
|
|
@@ -153,20 +156,20 @@ export class AzureArc extends BaseManagedIdentitySource {
|
|
|
153
156
|
* Attempts to create an AzureArc managed identity source instance.
|
|
154
157
|
*
|
|
155
158
|
* Validates the Azure Arc environment by checking environment variables
|
|
156
|
-
* and performing file-based detection.
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
+
* and performing file-based detection. Azure Arc supports both system-assigned and user-assigned
|
|
160
|
+
* managed identities; when a user-assigned identity is requested, its selector is forwarded on the
|
|
161
|
+
* request and validated against the token response echo (fail closed). The method performs
|
|
162
|
+
* comprehensive validation of endpoint URLs and logs detailed information about the detection process.
|
|
159
163
|
*
|
|
160
164
|
* @param logger - Logger instance for capturing creation and validation steps
|
|
161
165
|
* @param nodeStorage - Storage implementation for the managed identity source
|
|
162
166
|
* @param networkClient - Network client for HTTP communication
|
|
163
167
|
* @param cryptoProvider - Cryptographic operations provider
|
|
164
168
|
* @param disableInternalRetries - Whether to disable automatic retry mechanisms
|
|
165
|
-
* @param
|
|
169
|
+
* @param _managedIdentityId - Unused; Azure Arc now supports user-assigned identities, which are
|
|
170
|
+
* forwarded on the request and validated against the token response echo (fail closed).
|
|
166
171
|
*
|
|
167
172
|
* @returns AzureArc instance if the environment supports Azure Arc managed identity, null otherwise
|
|
168
|
-
*
|
|
169
|
-
* @throws {ManagedIdentityError} When a user-assigned managed identity is specified (not supported for Azure Arc)
|
|
170
173
|
*/
|
|
171
174
|
public static tryCreate(
|
|
172
175
|
logger: Logger,
|
|
@@ -174,7 +177,8 @@ export class AzureArc extends BaseManagedIdentitySource {
|
|
|
174
177
|
networkClient: INetworkModule,
|
|
175
178
|
cryptoProvider: CryptoProvider,
|
|
176
179
|
disableInternalRetries: boolean,
|
|
177
|
-
|
|
180
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
181
|
+
_managedIdentityId: ManagedIdentityId
|
|
178
182
|
): AzureArc | null {
|
|
179
183
|
const [identityEndpoint, imdsEndpoint] =
|
|
180
184
|
AzureArc.getEnvironmentVariables();
|
|
@@ -223,15 +227,6 @@ export class AzureArc extends BaseManagedIdentitySource {
|
|
|
223
227
|
);
|
|
224
228
|
}
|
|
225
229
|
|
|
226
|
-
if (
|
|
227
|
-
managedIdentityId.idType !== ManagedIdentityIdType.SYSTEM_ASSIGNED
|
|
228
|
-
) {
|
|
229
|
-
throw createManagedIdentityError(
|
|
230
|
-
ManagedIdentityErrorCodes.unableToCreateAzureArc,
|
|
231
|
-
""
|
|
232
|
-
);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
230
|
return new AzureArc(
|
|
236
231
|
logger,
|
|
237
232
|
nodeStorage,
|
|
@@ -253,7 +248,10 @@ export class AzureArc extends BaseManagedIdentitySource {
|
|
|
253
248
|
*
|
|
254
249
|
* @returns A configured ManagedIdentityRequestParameters object ready for network execution
|
|
255
250
|
*/
|
|
256
|
-
public createRequest(
|
|
251
|
+
public createRequest(
|
|
252
|
+
resource: string,
|
|
253
|
+
managedIdentityId: ManagedIdentityId
|
|
254
|
+
): ManagedIdentityRequestParameters {
|
|
257
255
|
const request: ManagedIdentityRequestParameters =
|
|
258
256
|
new ManagedIdentityRequestParameters(
|
|
259
257
|
HttpMethod.GET,
|
|
@@ -267,11 +265,118 @@ export class AzureArc extends BaseManagedIdentitySource {
|
|
|
267
265
|
request.queryParameters[ManagedIdentityQueryParameters.RESOURCE] =
|
|
268
266
|
resource;
|
|
269
267
|
|
|
268
|
+
if (
|
|
269
|
+
managedIdentityId.idType !== ManagedIdentityIdType.SYSTEM_ASSIGNED
|
|
270
|
+
) {
|
|
271
|
+
/*
|
|
272
|
+
* Forward the user-assigned selector. Azure Arc honors the IMDS "msi_res_id" spelling for
|
|
273
|
+
* the resource-id selector (isImds = true); "mi_res_id" is silently ignored and returns
|
|
274
|
+
* the system-assigned identity.
|
|
275
|
+
*/
|
|
276
|
+
request.queryParameters[
|
|
277
|
+
this.getManagedIdentityUserAssignedIdQueryParameterKey(
|
|
278
|
+
managedIdentityId.idType,
|
|
279
|
+
true // isImds -> msi_res_id for the resource-id selector
|
|
280
|
+
)
|
|
281
|
+
] = managedIdentityId.id;
|
|
282
|
+
}
|
|
283
|
+
|
|
270
284
|
// bodyParameters calculated in BaseManagedIdentity.acquireTokenWithManagedIdentity
|
|
271
285
|
|
|
272
286
|
return request;
|
|
273
287
|
}
|
|
274
288
|
|
|
289
|
+
/**
|
|
290
|
+
* Fails closed when a user-assigned identity was requested but the Azure Arc token response does
|
|
291
|
+
* not confirm it. A legacy Azure Arc agent ignores the client_id / object_id / msi_res_id selector
|
|
292
|
+
* and silently returns the machine's system-assigned identity; an agent that supports user-assigned
|
|
293
|
+
* managed identity echoes the identity it used. When the echoed identity is missing or does not
|
|
294
|
+
* match the requested selector, MSAL must not return a token for a different identity than requested.
|
|
295
|
+
*
|
|
296
|
+
* @param networkRequest - The request that produced this response; its query parameters carry the
|
|
297
|
+
* requested user-assigned selector (client_id / object_id / msi_res_id)
|
|
298
|
+
* @param responseBody - The deserialized Azure Arc token response
|
|
299
|
+
*
|
|
300
|
+
* @throws {ManagedIdentityError} When a user-assigned identity was requested but not confirmed
|
|
301
|
+
*/
|
|
302
|
+
private validateUserAssignedIdentityWasHonored(
|
|
303
|
+
networkRequest: ManagedIdentityRequestParameters,
|
|
304
|
+
responseBody: ManagedIdentityTokenResponse
|
|
305
|
+
): void {
|
|
306
|
+
/*
|
|
307
|
+
* Derive the requested selector from the request that produced this response rather than from
|
|
308
|
+
* instance state. The managed identity source instance is cached and reused across acquireToken
|
|
309
|
+
* calls, so relying on a stored field could compare against a different identity than the one
|
|
310
|
+
* this request actually asked for. The network request is scoped to this call and carries exactly
|
|
311
|
+
* one user-assigned selector (client_id, object_id, or msi_res_id) when a UAMI was requested.
|
|
312
|
+
*/
|
|
313
|
+
const queryParameters: Record<string, string> =
|
|
314
|
+
networkRequest.queryParameters;
|
|
315
|
+
|
|
316
|
+
let requestedIdentity: string | undefined;
|
|
317
|
+
let echoedIdentity: string | undefined;
|
|
318
|
+
|
|
319
|
+
if (
|
|
320
|
+
queryParameters[
|
|
321
|
+
ManagedIdentityUserAssignedIdQueryParameterNames
|
|
322
|
+
.MANAGED_IDENTITY_CLIENT_ID
|
|
323
|
+
]
|
|
324
|
+
) {
|
|
325
|
+
requestedIdentity =
|
|
326
|
+
queryParameters[
|
|
327
|
+
ManagedIdentityUserAssignedIdQueryParameterNames
|
|
328
|
+
.MANAGED_IDENTITY_CLIENT_ID
|
|
329
|
+
];
|
|
330
|
+
echoedIdentity = responseBody.client_id;
|
|
331
|
+
} else if (
|
|
332
|
+
queryParameters[
|
|
333
|
+
ManagedIdentityUserAssignedIdQueryParameterNames
|
|
334
|
+
.MANAGED_IDENTITY_OBJECT_ID
|
|
335
|
+
]
|
|
336
|
+
) {
|
|
337
|
+
requestedIdentity =
|
|
338
|
+
queryParameters[
|
|
339
|
+
ManagedIdentityUserAssignedIdQueryParameterNames
|
|
340
|
+
.MANAGED_IDENTITY_OBJECT_ID
|
|
341
|
+
];
|
|
342
|
+
echoedIdentity = responseBody.object_id;
|
|
343
|
+
} else if (
|
|
344
|
+
queryParameters[
|
|
345
|
+
ManagedIdentityUserAssignedIdQueryParameterNames
|
|
346
|
+
.MANAGED_IDENTITY_RESOURCE_ID_IMDS
|
|
347
|
+
]
|
|
348
|
+
) {
|
|
349
|
+
requestedIdentity =
|
|
350
|
+
queryParameters[
|
|
351
|
+
ManagedIdentityUserAssignedIdQueryParameterNames
|
|
352
|
+
.MANAGED_IDENTITY_RESOURCE_ID_IMDS
|
|
353
|
+
];
|
|
354
|
+
// Accept either spelling on the echo as a safety net; Azure Arc returns msi_res_id.
|
|
355
|
+
echoedIdentity = responseBody.msi_res_id || responseBody.mi_res_id;
|
|
356
|
+
} else {
|
|
357
|
+
// System-assigned (no user-assigned selector forwarded): nothing to confirm.
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/*
|
|
362
|
+
* Compare case-insensitively: client_id / object_id are GUIDs, and an ARM resource id can
|
|
363
|
+
* legitimately differ in segment casing.
|
|
364
|
+
*/
|
|
365
|
+
if (
|
|
366
|
+
!echoedIdentity ||
|
|
367
|
+
echoedIdentity.toLowerCase() !== requestedIdentity.toLowerCase()
|
|
368
|
+
) {
|
|
369
|
+
this.logger.error(
|
|
370
|
+
"[Managed Identity] Azure Arc did not confirm the requested user-assigned identity in the token response. The agent likely does not support user-assigned managed identity and returned the system-assigned identity.",
|
|
371
|
+
""
|
|
372
|
+
);
|
|
373
|
+
throw createManagedIdentityError(
|
|
374
|
+
ManagedIdentityErrorCodes.userAssignedManagedIdentityNotConfirmed,
|
|
375
|
+
""
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
275
380
|
/**
|
|
276
381
|
* Processes the server response and handles Azure Arc-specific authentication challenges.
|
|
277
382
|
*
|
|
@@ -420,6 +525,21 @@ export class AzureArc extends BaseManagedIdentitySource {
|
|
|
420
525
|
}
|
|
421
526
|
}
|
|
422
527
|
|
|
423
|
-
|
|
528
|
+
const finalResponse: NetworkResponse<ManagedIdentityTokenResponse> =
|
|
529
|
+
retryResponse || originalResponse;
|
|
530
|
+
|
|
531
|
+
/*
|
|
532
|
+
* Fail closed: when a user-assigned identity was requested and the agent returned a token,
|
|
533
|
+
* ensure the echoed identity matches. A genuine service error (no access_token, e.g. a 404
|
|
534
|
+
* for a non-existent identity) is surfaced normally by the response handler.
|
|
535
|
+
*/
|
|
536
|
+
if (finalResponse.body.access_token) {
|
|
537
|
+
this.validateUserAssignedIdentityWasHonored(
|
|
538
|
+
networkRequest,
|
|
539
|
+
finalResponse.body
|
|
540
|
+
);
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
return this.getServerTokenResponse(finalResponse);
|
|
424
544
|
}
|
|
425
545
|
}
|
|
@@ -202,7 +202,10 @@ export class OnBehalfOfClient extends BaseClient {
|
|
|
202
202
|
true,
|
|
203
203
|
request,
|
|
204
204
|
this.performanceClient,
|
|
205
|
-
|
|
205
|
+
{
|
|
206
|
+
idTokenClaims,
|
|
207
|
+
tokenBindingKeyManager: this.config.tokenBindingKeyManager,
|
|
208
|
+
}
|
|
206
209
|
);
|
|
207
210
|
}
|
|
208
211
|
|
|
@@ -336,7 +339,8 @@ export class OnBehalfOfClient extends BaseClient {
|
|
|
336
339
|
this.logger,
|
|
337
340
|
this.performanceClient,
|
|
338
341
|
this.config.serializableCache,
|
|
339
|
-
this.config.persistencePlugin
|
|
342
|
+
this.config.persistencePlugin,
|
|
343
|
+
this.config.tokenBindingKeyManager
|
|
340
344
|
);
|
|
341
345
|
|
|
342
346
|
responseHandler.validateTokenResponse(
|
|
@@ -99,7 +99,8 @@ export class UserFederatedIdentityCredentialClient extends BaseClient {
|
|
|
99
99
|
this.logger,
|
|
100
100
|
this.performanceClient,
|
|
101
101
|
this.config.serializableCache,
|
|
102
|
-
this.config.persistencePlugin
|
|
102
|
+
this.config.persistencePlugin,
|
|
103
|
+
this.config.tokenBindingKeyManager
|
|
103
104
|
);
|
|
104
105
|
|
|
105
106
|
responseHandler.validateTokenResponse(
|
|
@@ -62,7 +62,8 @@ export class UsernamePasswordClient extends BaseClient {
|
|
|
62
62
|
this.logger,
|
|
63
63
|
this.performanceClient,
|
|
64
64
|
this.config.serializableCache,
|
|
65
|
-
this.config.persistencePlugin
|
|
65
|
+
this.config.persistencePlugin,
|
|
66
|
+
this.config.tokenBindingKeyManager
|
|
66
67
|
);
|
|
67
68
|
|
|
68
69
|
// Validate response. This function throws a server error if an error is returned by the server.
|
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
ClientAuthErrorCodes,
|
|
8
|
+
Constants,
|
|
9
|
+
createClientAuthError,
|
|
10
|
+
} from "@azure/msal-common/node";
|
|
11
|
+
import type { ICrypto, PkceCodes } from "@azure/msal-common/node";
|
|
7
12
|
import { GuidGenerator } from "./GuidGenerator.js";
|
|
8
13
|
import { EncodingUtils } from "../utils/EncodingUtils.js";
|
|
9
14
|
import { PkceGenerator } from "./PkceGenerator.js";
|
|
@@ -72,33 +77,46 @@ export class CryptoProvider implements ICrypto {
|
|
|
72
77
|
return this.pkceGenerator.generatePkceCodes();
|
|
73
78
|
}
|
|
74
79
|
|
|
75
|
-
/**
|
|
76
|
-
* Generates a keypair, stores it and returns a thumbprint - not yet implemented for node
|
|
77
|
-
*/
|
|
78
|
-
getPublicKeyThumbprint(): Promise<string> {
|
|
79
|
-
throw new Error("Method not implemented.");
|
|
80
|
-
}
|
|
81
|
-
|
|
82
80
|
/**
|
|
83
81
|
* Removes cryptographic keypair from key store matching the keyId passed in
|
|
84
82
|
* @param kid - public key id
|
|
83
|
+
* @param correlationId - correlation id
|
|
85
84
|
*/
|
|
86
|
-
removeTokenBindingKey(): Promise<void> {
|
|
85
|
+
removeTokenBindingKey(kid: string, correlationId: string): Promise<void> {
|
|
86
|
+
void kid;
|
|
87
|
+
void correlationId;
|
|
87
88
|
throw new Error("Method not implemented.");
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
/**
|
|
91
92
|
* Removes all cryptographic keys from Keystore
|
|
93
|
+
* @param correlationId - correlation id
|
|
92
94
|
*/
|
|
93
|
-
clearKeystore(): Promise<boolean> {
|
|
95
|
+
clearKeystore(correlationId: string): Promise<boolean> {
|
|
96
|
+
void correlationId;
|
|
94
97
|
throw new Error("Method not implemented.");
|
|
95
98
|
}
|
|
96
99
|
|
|
97
100
|
/**
|
|
98
|
-
* Signs
|
|
101
|
+
* Signs a compact JWT with a token-binding key - not yet implemented for node
|
|
102
|
+
* @param header - JOSE header
|
|
103
|
+
* @param payload - JWT payload
|
|
104
|
+
* @param kid - public key id
|
|
105
|
+
* @param correlationId - correlation id
|
|
99
106
|
*/
|
|
100
|
-
|
|
101
|
-
|
|
107
|
+
signTokenBindingJwt(
|
|
108
|
+
header: object,
|
|
109
|
+
payload: object,
|
|
110
|
+
kid: string,
|
|
111
|
+
correlationId: string
|
|
112
|
+
): Promise<string> {
|
|
113
|
+
void header;
|
|
114
|
+
void payload;
|
|
115
|
+
void kid;
|
|
116
|
+
throw createClientAuthError(
|
|
117
|
+
ClientAuthErrorCodes.methodNotImplemented,
|
|
118
|
+
correlationId
|
|
119
|
+
);
|
|
102
120
|
}
|
|
103
121
|
|
|
104
122
|
/**
|
|
@@ -44,10 +44,12 @@ export const ManagedIdentityErrorMessages = {
|
|
|
44
44
|
"Unable to read the secret file.",
|
|
45
45
|
[ManagedIdentityErrorCodes.userAssignedNotAvailableAtRuntime]:
|
|
46
46
|
"Service Fabric user assigned managed identity ClientId or ResourceId is not configurable at runtime.",
|
|
47
|
+
[ManagedIdentityErrorCodes.userAssignedManagedIdentityNotConfirmed]:
|
|
48
|
+
"Azure Arc did not confirm the requested user-assigned managed identity in the token response. The agent likely does not support user-assigned managed identity and returned the system-assigned identity.",
|
|
47
49
|
[ManagedIdentityErrorCodes.wwwAuthenticateHeaderMissing]:
|
|
48
|
-
"A 401 response was received
|
|
50
|
+
"A 401 response was received from the Azure Arc Managed Identity, but the www-authenticate header is missing.",
|
|
49
51
|
[ManagedIdentityErrorCodes.wwwAuthenticateHeaderUnsupportedFormat]:
|
|
50
|
-
"A 401 response was received
|
|
52
|
+
"A 401 response was received from the Azure Arc Managed Identity, but the www-authenticate header is in an unsupported format.",
|
|
51
53
|
};
|
|
52
54
|
|
|
53
55
|
export class ManagedIdentityError extends AuthError {
|
|
@@ -19,6 +19,8 @@ export const unableToReadSecretFile = "unable_to_read_secret_file";
|
|
|
19
19
|
export const urlParseError = "url_parse_error";
|
|
20
20
|
export const userAssignedNotAvailableAtRuntime =
|
|
21
21
|
"user_assigned_not_available_at_runtime";
|
|
22
|
+
export const userAssignedManagedIdentityNotConfirmed =
|
|
23
|
+
"user_assigned_managed_identity_not_confirmed";
|
|
22
24
|
export const wwwAuthenticateHeaderMissing = "www_authenticate_header_missing";
|
|
23
25
|
export const wwwAuthenticateHeaderUnsupportedFormat =
|
|
24
26
|
"www_authenticate_header_unsupported_format";
|
package/src/packageMetadata.ts
CHANGED
|
@@ -33,6 +33,10 @@ export type AuthorizationCodeRequest = Partial<
|
|
|
33
33
|
* The authorization_code that the user acquired in the first leg of the flow.
|
|
34
34
|
*/
|
|
35
35
|
code: string;
|
|
36
|
+
/**
|
|
37
|
+
* The nonce sent in the original authorization request. When provided, the ID Token nonce claim must be present and match this value.
|
|
38
|
+
*/
|
|
39
|
+
nonce?: string;
|
|
36
40
|
/**
|
|
37
41
|
* Unique GUID generated by the user that is cached by the user and sent to the server during the first leg of the flow. This string is sent back by the server with the authorization code. The user cached state is then compared with the state received from the server to mitigate the risk of CSRF attacks. See https://datatracker.ietf.org/doc/html/rfc6819#section-3.6.
|
|
38
42
|
*/
|
|
@@ -23,6 +23,9 @@ export type ManagedIdentityTokenResponse = {
|
|
|
23
23
|
// success
|
|
24
24
|
access_token?: string;
|
|
25
25
|
client_id?: string;
|
|
26
|
+
object_id?: string; // echoed by Azure Arc when a user-assigned object id is honored
|
|
27
|
+
mi_res_id?: string; // resource-id echo (non-IMDS spelling), accepted as a safety net
|
|
28
|
+
msi_res_id?: string; // resource-id echo (IMDS spelling) that Azure Arc returns
|
|
26
29
|
expires_on?: number; // will be converted to expires_in
|
|
27
30
|
resource?: string; // equivalent to ServerAuthorizationTokenResponse's "scope" field
|
|
28
31
|
token_type?: Constants.AuthenticationScheme;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientApplication.d.ts","sourceRoot":"","sources":["../../src/client/ClientApplication.ts"],"names":[],"mappings":"AAKA,OAAO,EAEH,mBAAmB,EAEnB,oBAAoB,EACpB,SAAS,EAET,eAAe,EAEf,MAAM,EACN,sBAAsB,EAOtB,wBAAwB,EAExB,iBAAiB,EACjB,wBAAwB,EAMxB,uBAAuB,EAI1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACH,aAAa,EAEb,iBAAiB,EACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;A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OAAO,CAAC,SAAS,CAAC;IA4BrB;;OAEG;IACH,UAAU,IAAI,IAAI;CAGrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientCredentialClient.d.ts","sourceRoot":"","sources":["../../src/client/ClientCredentialClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAGH,oBAAoB,EACpB,SAAS,EACT,YAAY,EAEZ,mBAAmB,EACnB,SAAS,EAET,iBAAiB,EACjB,OAAO,EAMP,sBAAsB,EASzB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACH,4BAA4B,EAE/B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAC;AAC5F,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,UAAU;IAClD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAoB;gBAGlD,aAAa,EAAE,mBAAmB,EAClC,gBAAgB,CAAC,EAAE,iBAAiB;IAMxC;;;OAGG;IACU,YAAY,CACrB,OAAO,EAAE,6BAA6B,GACvC,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IA+EvC;;OAEG;IACU,6BAA6B,CACtC,OAAO,EAAE,6BAA6B,EACtC,MAAM,EAAE,mBAAmB,GAAG,4BAA4B,EAC1D,WAAW,EAAE,OAAO,EACpB,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,YAAY,EAC1B,sBAAsB,CAAC,EAAE,sBAAsB,GAAG,IAAI,EACtD,4BAA4B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACtD,OAAO,CAAC,CAAC,oBAAoB,GAAG,IAAI,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"ClientCredentialClient.d.ts","sourceRoot":"","sources":["../../src/client/ClientCredentialClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAGH,oB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E,MAAM,uCAAuC,CAAC;AAEhF,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;gBAChC,aAAa,EAAE,mBAAmB;IAI9C;;;;OAIG;IACU,YAAY,CACrB,OAAO,EAAE,uBAAuB,GACjC,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"DeviceCodeClient.d.ts","sourceRoot":"","sources":["../../src/client/DeviceCodeClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAEH,oBAAoB,EACpB,mBAAmB,EActB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAEhF,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;gBAChC,aAAa,EAAE,mBAAmB;IAI9C;;;;OAIG;IACU,YAAY,CACrB,OAAO,EAAE,uBAAuB,GACjC,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IA+BvC;;;OAGG;YACW,aAAa;IA+B3B;;;OAGG;IACI,0BAA0B,CAC7B,OAAO,EAAE,uBAAuB,GACjC,MAAM;IAaT;;;;;;;OAOG;YACW,sCAAsC;IAoCpD;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAoCzB;;;;;;OAMG;IACH,OAAO,CAAC,eAAe;IA+CvB;;;;OAIG;YACW,0BAA0B;IAiGxC;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;CA0DjC"}
|
|
@@ -51,22 +51,22 @@ export declare class AzureArc extends BaseManagedIdentitySource {
|
|
|
51
51
|
* Attempts to create an AzureArc managed identity source instance.
|
|
52
52
|
*
|
|
53
53
|
* Validates the Azure Arc environment by checking environment variables
|
|
54
|
-
* and performing file-based detection.
|
|
55
|
-
*
|
|
56
|
-
*
|
|
54
|
+
* and performing file-based detection. Azure Arc supports both system-assigned and user-assigned
|
|
55
|
+
* managed identities; when a user-assigned identity is requested, its selector is forwarded on the
|
|
56
|
+
* request and validated against the token response echo (fail closed). The method performs
|
|
57
|
+
* comprehensive validation of endpoint URLs and logs detailed information about the detection process.
|
|
57
58
|
*
|
|
58
59
|
* @param logger - Logger instance for capturing creation and validation steps
|
|
59
60
|
* @param nodeStorage - Storage implementation for the managed identity source
|
|
60
61
|
* @param networkClient - Network client for HTTP communication
|
|
61
62
|
* @param cryptoProvider - Cryptographic operations provider
|
|
62
63
|
* @param disableInternalRetries - Whether to disable automatic retry mechanisms
|
|
63
|
-
* @param
|
|
64
|
+
* @param _managedIdentityId - Unused; Azure Arc now supports user-assigned identities, which are
|
|
65
|
+
* forwarded on the request and validated against the token response echo (fail closed).
|
|
64
66
|
*
|
|
65
67
|
* @returns AzureArc instance if the environment supports Azure Arc managed identity, null otherwise
|
|
66
|
-
*
|
|
67
|
-
* @throws {ManagedIdentityError} When a user-assigned managed identity is specified (not supported for Azure Arc)
|
|
68
68
|
*/
|
|
69
|
-
static tryCreate(logger: Logger, nodeStorage: NodeStorage, networkClient: INetworkModule, cryptoProvider: CryptoProvider, disableInternalRetries: boolean,
|
|
69
|
+
static tryCreate(logger: Logger, nodeStorage: NodeStorage, networkClient: INetworkModule, cryptoProvider: CryptoProvider, disableInternalRetries: boolean, _managedIdentityId: ManagedIdentityId): AzureArc | null;
|
|
70
70
|
/**
|
|
71
71
|
* Creates a properly formatted HTTP request for acquiring tokens from the Azure Arc identity endpoint.
|
|
72
72
|
*
|
|
@@ -78,7 +78,21 @@ export declare class AzureArc extends BaseManagedIdentitySource {
|
|
|
78
78
|
*
|
|
79
79
|
* @returns A configured ManagedIdentityRequestParameters object ready for network execution
|
|
80
80
|
*/
|
|
81
|
-
createRequest(resource: string): ManagedIdentityRequestParameters;
|
|
81
|
+
createRequest(resource: string, managedIdentityId: ManagedIdentityId): ManagedIdentityRequestParameters;
|
|
82
|
+
/**
|
|
83
|
+
* Fails closed when a user-assigned identity was requested but the Azure Arc token response does
|
|
84
|
+
* not confirm it. A legacy Azure Arc agent ignores the client_id / object_id / msi_res_id selector
|
|
85
|
+
* and silently returns the machine's system-assigned identity; an agent that supports user-assigned
|
|
86
|
+
* managed identity echoes the identity it used. When the echoed identity is missing or does not
|
|
87
|
+
* match the requested selector, MSAL must not return a token for a different identity than requested.
|
|
88
|
+
*
|
|
89
|
+
* @param networkRequest - The request that produced this response; its query parameters carry the
|
|
90
|
+
* requested user-assigned selector (client_id / object_id / msi_res_id)
|
|
91
|
+
* @param responseBody - The deserialized Azure Arc token response
|
|
92
|
+
*
|
|
93
|
+
* @throws {ManagedIdentityError} When a user-assigned identity was requested but not confirmed
|
|
94
|
+
*/
|
|
95
|
+
private validateUserAssignedIdentityWasHonored;
|
|
82
96
|
/**
|
|
83
97
|
* Processes the server response and handles Azure Arc-specific authentication challenges.
|
|
84
98
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureArc.d.ts","sourceRoot":"","sources":["../../../src/client/ManagedIdentitySources/AzureArc.ts"],"names":[],"mappings":"AAKA,OAAO,EAIH,cAAc,EACd,eAAe,EACf,qBAAqB,EACrB,MAAM,EACN,gCAAgC,EAEnC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,gCAAgC,EAAE,MAAM,kDAAkD,CAAC;AACpG,OAAO,
|
|
1
|
+
{"version":3,"file":"AzureArc.d.ts","sourceRoot":"","sources":["../../../src/client/ManagedIdentitySources/AzureArc.ts"],"names":[],"mappings":"AAKA,OAAO,EAIH,cAAc,EACd,eAAe,EACf,qBAAqB,EACrB,MAAM,EACN,gCAAgC,EAEnC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,gCAAgC,EAAE,MAAM,kDAAkD,CAAC;AACpG,OAAO,EACH,yBAAyB,EAE5B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAchE,OAAO,EAAE,WAAW,EAAE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C/D,aAAa,EAAE,cAAc,EAC7B,cAAc,EAAE,gCAAgC,EAChD,qBAAqB,EAAE,qBAAqB,GAC7C,OAAO,CAAC,gCAAgC,CAAC;CAwI/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OnBehalfOfClient.d.ts","sourceRoot":"","sources":["../../src/client/OnBehalfOfClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAKH,oBAAoB,EAIpB,mBAAmB,EAgBtB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;IAC5C,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,iBAAiB,CAAS;gBAEtB,aAAa,EAAE,mBAAmB;IAI9C;;;OAGG;IACU,YAAY,CACrB,OAAO,EAAE,uBAAuB,GACjC,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAqDvC;;;;;;;OAOG;YACW,6BAA6B;
|
|
1
|
+
{"version":3,"file":"OnBehalfOfClient.d.ts","sourceRoot":"","sources":["../../src/client/OnBehalfOfClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAKH,oBAAoB,EAIpB,mBAAmB,EAgBtB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;IAC5C,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,iBAAiB,CAAS;gBAEtB,aAAa,EAAE,mBAAmB;IAI9C;;;OAGG;IACU,YAAY,CACrB,OAAO,EAAE,uBAAuB,GACjC,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAqDvC;;;;;;;OAOG;YACW,6BAA6B;IAgG3C;;;;OAIG;IACH,OAAO,CAAC,0BAA0B;IAuBlC;;;;OAIG;IACH,OAAO,CAAC,8BAA8B;IAkDtC;;;;OAIG;YACW,mBAAmB;IAmEjC;;;OAGG;YACW,sBAAsB;CAuGvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserFederatedIdentityCredentialClient.d.ts","sourceRoot":"","sources":["../../src/client/UserFederatedIdentityCredentialClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAEH,oBAAoB,EAEpB,mBAAmB,EAYtB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,4CAA4C,EAAE,MAAM,4DAA4D,CAAC;AAE1H;;;;GAIG;AACH,qBAAa,qCAAsC,SAAQ,UAAU;gBACrD,aAAa,EAAE,mBAAmB;IAI9C;;;;OAIG;IACU,YAAY,CACrB,OAAO,EAAE,4CAA4C,GACtD,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAIvC;;OAEG;YACW,mBAAmB;
|
|
1
|
+
{"version":3,"file":"UserFederatedIdentityCredentialClient.d.ts","sourceRoot":"","sources":["../../src/client/UserFederatedIdentityCredentialClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAEH,oBAAoB,EAEpB,mBAAmB,EAYtB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,4CAA4C,EAAE,MAAM,4DAA4D,CAAC;AAE1H;;;;GAIG;AACH,qBAAa,qCAAsC,SAAQ,UAAU;gBACrD,aAAa,EAAE,mBAAmB;IAI9C;;;;OAIG;IACU,YAAY,CACrB,OAAO,EAAE,4CAA4C,GACtD,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAIvC;;OAEG;YACW,mBAAmB;IAuEjC;;OAEG;YACW,sBAAsB;CA+GvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UsernamePasswordClient.d.ts","sourceRoot":"","sources":["../../src/client/UsernamePasswordClient.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,oBAAoB,EAIpB,mBAAmB,EAYtB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAC;AAC5F,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;;GAKG;AACH,qBAAa,sBAAuB,SAAQ,UAAU;gBACtC,aAAa,EAAE,mBAAmB;IAI9C;;;;OAIG;IACG,YAAY,CACd,OAAO,EAAE,6BAA6B,GACvC,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"UsernamePasswordClient.d.ts","sourceRoot":"","sources":["../../src/client/UsernamePasswordClient.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,oBAAoB,EAIpB,mBAAmB,EAYtB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAC;AAC5F,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;;GAKG;AACH,qBAAa,sBAAuB,SAAQ,UAAU;gBACtC,aAAa,EAAE,mBAAmB;IAI9C;;;;OAIG;IACG,YAAY,CACd,OAAO,EAAE,6BAA6B,GACvC,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAuCvC;;;;OAIG;YACW,mBAAmB;IAmCjC;;;OAGG;YACW,sBAAsB;CAkGvC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICrypto, PkceCodes } from "@azure/msal-common/node";
|
|
1
|
+
import type { ICrypto, PkceCodes } from "@azure/msal-common/node";
|
|
2
2
|
/**
|
|
3
3
|
* This class implements MSAL node's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
|
|
4
4
|
* implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
|
|
@@ -38,23 +38,25 @@ export declare class CryptoProvider implements ICrypto {
|
|
|
38
38
|
* Generates PKCE codes used in Authorization Code Flow.
|
|
39
39
|
*/
|
|
40
40
|
generatePkceCodes(): Promise<PkceCodes>;
|
|
41
|
-
/**
|
|
42
|
-
* Generates a keypair, stores it and returns a thumbprint - not yet implemented for node
|
|
43
|
-
*/
|
|
44
|
-
getPublicKeyThumbprint(): Promise<string>;
|
|
45
41
|
/**
|
|
46
42
|
* Removes cryptographic keypair from key store matching the keyId passed in
|
|
47
43
|
* @param kid - public key id
|
|
44
|
+
* @param correlationId - correlation id
|
|
48
45
|
*/
|
|
49
|
-
removeTokenBindingKey(): Promise<void>;
|
|
46
|
+
removeTokenBindingKey(kid: string, correlationId: string): Promise<void>;
|
|
50
47
|
/**
|
|
51
48
|
* Removes all cryptographic keys from Keystore
|
|
49
|
+
* @param correlationId - correlation id
|
|
52
50
|
*/
|
|
53
|
-
clearKeystore(): Promise<boolean>;
|
|
51
|
+
clearKeystore(correlationId: string): Promise<boolean>;
|
|
54
52
|
/**
|
|
55
|
-
* Signs
|
|
53
|
+
* Signs a compact JWT with a token-binding key - not yet implemented for node
|
|
54
|
+
* @param header - JOSE header
|
|
55
|
+
* @param payload - JWT payload
|
|
56
|
+
* @param kid - public key id
|
|
57
|
+
* @param correlationId - correlation id
|
|
56
58
|
*/
|
|
57
|
-
|
|
59
|
+
signTokenBindingJwt(header: object, payload: object, kid: string, correlationId: string): Promise<string>;
|
|
58
60
|
/**
|
|
59
61
|
* Returns the SHA-256 hash of an input string
|
|
60
62
|
*/
|