@azure/msal-node 3.2.3 → 3.4.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.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/ClientApplication.d.ts +3 -3
- package/dist/client/ClientApplication.d.ts.map +1 -1
- package/dist/client/ClientApplication.mjs +14 -17
- package/dist/client/ClientApplication.mjs.map +1 -1
- package/dist/client/ClientAssertion.mjs +1 -1
- package/dist/client/ClientCredentialClient.d.ts.map +1 -1
- package/dist/client/ClientCredentialClient.mjs +16 -16
- package/dist/client/ClientCredentialClient.mjs.map +1 -1
- package/dist/client/ConfidentialClientApplication.d.ts.map +1 -1
- package/dist/client/ConfidentialClientApplication.mjs +5 -3
- package/dist/client/ConfidentialClientApplication.mjs.map +1 -1
- package/dist/client/DeviceCodeClient.d.ts.map +1 -1
- package/dist/client/DeviceCodeClient.mjs +24 -24
- package/dist/client/DeviceCodeClient.mjs.map +1 -1
- package/dist/client/ManagedIdentityApplication.d.ts.map +1 -1
- package/dist/client/ManagedIdentityApplication.mjs +2 -2
- package/dist/client/ManagedIdentityApplication.mjs.map +1 -1
- package/dist/client/ManagedIdentityClient.d.ts +2 -1
- package/dist/client/ManagedIdentityClient.d.ts.map +1 -1
- package/dist/client/ManagedIdentityClient.mjs +11 -10
- package/dist/client/ManagedIdentityClient.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/AppService.d.ts +2 -2
- package/dist/client/ManagedIdentitySources/AppService.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/AppService.mjs +5 -5
- package/dist/client/ManagedIdentitySources/AppService.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/AzureArc.d.ts +2 -2
- package/dist/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/AzureArc.mjs +5 -5
- package/dist/client/ManagedIdentitySources/AzureArc.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts +2 -1
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +15 -5
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/CloudShell.d.ts +2 -2
- package/dist/client/ManagedIdentitySources/CloudShell.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/CloudShell.mjs +5 -5
- package/dist/client/ManagedIdentitySources/CloudShell.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/Imds.d.ts +2 -2
- package/dist/client/ManagedIdentitySources/Imds.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/Imds.mjs +5 -5
- package/dist/client/ManagedIdentitySources/Imds.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/MachineLearning.d.ts +2 -2
- package/dist/client/ManagedIdentitySources/MachineLearning.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/MachineLearning.mjs +5 -5
- package/dist/client/ManagedIdentitySources/MachineLearning.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts +2 -2
- package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +5 -5
- package/dist/client/ManagedIdentitySources/ServiceFabric.mjs.map +1 -1
- package/dist/client/OnBehalfOfClient.d.ts.map +1 -1
- package/dist/client/OnBehalfOfClient.mjs +19 -19
- package/dist/client/OnBehalfOfClient.mjs.map +1 -1
- package/dist/client/PublicClientApplication.d.ts.map +1 -1
- package/dist/client/PublicClientApplication.mjs +3 -2
- package/dist/client/PublicClientApplication.mjs.map +1 -1
- package/dist/client/UsernamePasswordClient.d.ts.map +1 -1
- package/dist/client/UsernamePasswordClient.mjs +21 -21
- package/dist/client/UsernamePasswordClient.mjs.map +1 -1
- package/dist/config/Configuration.d.ts +1 -0
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.mjs +2 -9
- package/dist/config/Configuration.mjs.map +1 -1
- package/dist/config/ManagedIdentityId.mjs +1 -1
- package/dist/config/ManagedIdentityRequestParameters.d.ts +3 -2
- package/dist/config/ManagedIdentityRequestParameters.d.ts.map +1 -1
- package/dist/config/ManagedIdentityRequestParameters.mjs +13 -9
- package/dist/config/ManagedIdentityRequestParameters.mjs.map +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/ManagedIdentityError.mjs +1 -1
- package/dist/error/ManagedIdentityErrorCodes.mjs +1 -1
- package/dist/error/NodeAuthError.mjs +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.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/ILoopbackClient.d.ts +2 -2
- package/dist/network/ILoopbackClient.d.ts.map +1 -1
- package/dist/network/LoopbackClient.d.ts +2 -2
- package/dist/network/LoopbackClient.d.ts.map +1 -1
- package/dist/network/LoopbackClient.mjs +3 -2
- package/dist/network/LoopbackClient.mjs.map +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/protocol/Authorize.d.ts +12 -0
- package/dist/protocol/Authorize.d.ts.map +1 -0
- package/dist/protocol/Authorize.mjs +42 -0
- package/dist/protocol/Authorize.mjs.map +1 -0
- package/dist/retry/LinearRetryPolicy.mjs +1 -1
- package/dist/utils/Constants.d.ts +5 -0
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.mjs +1 -1
- package/dist/utils/Constants.mjs.map +1 -1
- package/dist/utils/EncodingUtils.mjs +1 -1
- package/dist/utils/NetworkUtils.mjs +1 -1
- package/dist/utils/TimeUtils.mjs +1 -1
- package/lib/msal-node.cjs +1006 -1082
- package/lib/msal-node.cjs.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.map +1 -1
- package/lib/types/client/ConfidentialClientApplication.d.ts.map +1 -1
- package/lib/types/client/DeviceCodeClient.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentityApplication.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentityClient.d.ts +2 -1
- package/lib/types/client/ManagedIdentityClient.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/AppService.d.ts +2 -2
- package/lib/types/client/ManagedIdentitySources/AppService.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/AzureArc.d.ts +2 -2
- package/lib/types/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts +2 -1
- package/lib/types/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/CloudShell.d.ts +2 -2
- package/lib/types/client/ManagedIdentitySources/CloudShell.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/Imds.d.ts +2 -2
- package/lib/types/client/ManagedIdentitySources/Imds.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/MachineLearning.d.ts +2 -2
- package/lib/types/client/ManagedIdentitySources/MachineLearning.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/ServiceFabric.d.ts +2 -2
- package/lib/types/client/ManagedIdentitySources/ServiceFabric.d.ts.map +1 -1
- package/lib/types/client/OnBehalfOfClient.d.ts.map +1 -1
- package/lib/types/client/PublicClientApplication.d.ts.map +1 -1
- package/lib/types/client/UsernamePasswordClient.d.ts.map +1 -1
- package/lib/types/config/Configuration.d.ts +1 -0
- package/lib/types/config/Configuration.d.ts.map +1 -1
- package/lib/types/config/ManagedIdentityRequestParameters.d.ts +3 -2
- package/lib/types/config/ManagedIdentityRequestParameters.d.ts.map +1 -1
- package/lib/types/index.d.ts +5 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/network/ILoopbackClient.d.ts +2 -2
- package/lib/types/network/ILoopbackClient.d.ts.map +1 -1
- package/lib/types/network/LoopbackClient.d.ts +2 -2
- package/lib/types/network/LoopbackClient.d.ts.map +1 -1
- package/lib/types/packageMetadata.d.ts +1 -1
- package/lib/types/protocol/Authorize.d.ts +12 -0
- package/lib/types/protocol/Authorize.d.ts.map +1 -0
- package/lib/types/utils/Constants.d.ts +5 -0
- package/lib/types/utils/Constants.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/client/ClientApplication.ts +42 -44
- package/src/client/ClientCredentialClient.ts +32 -14
- package/src/client/ConfidentialClientApplication.ts +15 -7
- package/src/client/DeviceCodeClient.ts +46 -24
- package/src/client/ManagedIdentityApplication.ts +2 -1
- package/src/client/ManagedIdentityClient.ts +20 -4
- package/src/client/ManagedIdentitySources/AppService.ts +11 -2
- package/src/client/ManagedIdentitySources/AzureArc.ts +10 -1
- package/src/client/ManagedIdentitySources/BaseManagedIdentitySource.ts +20 -4
- package/src/client/ManagedIdentitySources/CloudShell.ts +10 -1
- package/src/client/ManagedIdentitySources/Imds.ts +11 -2
- package/src/client/ManagedIdentitySources/MachineLearning.ts +11 -2
- package/src/client/ManagedIdentitySources/ServiceFabric.ts +10 -1
- package/src/client/OnBehalfOfClient.ts +38 -17
- package/src/client/PublicClientApplication.ts +9 -5
- package/src/client/UsernamePasswordClient.ts +37 -19
- package/src/config/Configuration.ts +2 -20
- package/src/config/ManagedIdentityRequestParameters.ts +38 -9
- package/src/index.ts +5 -2
- package/src/network/ILoopbackClient.ts +2 -2
- package/src/network/LoopbackClient.ts +43 -46
- package/src/packageMetadata.ts +1 -1
- package/src/protocol/Authorize.ts +63 -0
- package/src/utils/Constants.ts +6 -0
|
@@ -57,6 +57,7 @@ import { version, name } from "../packageMetadata.js";
|
|
|
57
57
|
import { UsernamePasswordRequest } from "../request/UsernamePasswordRequest.js";
|
|
58
58
|
import { NodeAuthError } from "../error/NodeAuthError.js";
|
|
59
59
|
import { UsernamePasswordClient } from "./UsernamePasswordClient.js";
|
|
60
|
+
import { getAuthCodeRequestUrl } from "../protocol/Authorize.js";
|
|
60
61
|
|
|
61
62
|
/**
|
|
62
63
|
* Base abstract class for all ClientApplications - public and confidential
|
|
@@ -132,22 +133,18 @@ export abstract class ClientApplication {
|
|
|
132
133
|
authenticationScheme: AuthenticationScheme.BEARER,
|
|
133
134
|
};
|
|
134
135
|
|
|
135
|
-
const
|
|
136
|
+
const discoveredAuthority = await this.createAuthority(
|
|
136
137
|
validRequest.authority,
|
|
137
138
|
validRequest.correlationId,
|
|
138
|
-
validRequest.redirectUri,
|
|
139
|
-
undefined,
|
|
140
139
|
undefined,
|
|
141
140
|
request.azureCloudOptions
|
|
142
141
|
);
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
validRequest.correlationId
|
|
142
|
+
return getAuthCodeRequestUrl(
|
|
143
|
+
this.config,
|
|
144
|
+
discoveredAuthority,
|
|
145
|
+
validRequest,
|
|
146
|
+
this.logger
|
|
149
147
|
);
|
|
150
|
-
return authorizationCodeClient.getAuthCodeUrl(validRequest);
|
|
151
148
|
}
|
|
152
149
|
|
|
153
150
|
/**
|
|
@@ -180,14 +177,18 @@ export abstract class ClientApplication {
|
|
|
180
177
|
validRequest.correlationId
|
|
181
178
|
);
|
|
182
179
|
try {
|
|
183
|
-
const
|
|
180
|
+
const discoveredAuthority = await this.createAuthority(
|
|
184
181
|
validRequest.authority,
|
|
185
182
|
validRequest.correlationId,
|
|
186
|
-
validRequest.redirectUri,
|
|
187
|
-
serverTelemetryManager,
|
|
188
183
|
undefined,
|
|
189
184
|
request.azureCloudOptions
|
|
190
185
|
);
|
|
186
|
+
const authClientConfig = await this.buildOauthClientConfiguration(
|
|
187
|
+
discoveredAuthority,
|
|
188
|
+
validRequest.correlationId,
|
|
189
|
+
validRequest.redirectUri,
|
|
190
|
+
serverTelemetryManager
|
|
191
|
+
);
|
|
191
192
|
const authorizationCodeClient = new AuthorizationCodeClient(
|
|
192
193
|
authClientConfig
|
|
193
194
|
);
|
|
@@ -233,14 +234,18 @@ export abstract class ClientApplication {
|
|
|
233
234
|
validRequest.correlationId
|
|
234
235
|
);
|
|
235
236
|
try {
|
|
237
|
+
const discoveredAuthority = await this.createAuthority(
|
|
238
|
+
validRequest.authority,
|
|
239
|
+
validRequest.correlationId,
|
|
240
|
+
undefined,
|
|
241
|
+
request.azureCloudOptions
|
|
242
|
+
);
|
|
236
243
|
const refreshTokenClientConfig =
|
|
237
244
|
await this.buildOauthClientConfiguration(
|
|
238
|
-
|
|
245
|
+
discoveredAuthority,
|
|
239
246
|
validRequest.correlationId,
|
|
240
247
|
validRequest.redirectUri || "",
|
|
241
|
-
serverTelemetryManager
|
|
242
|
-
undefined,
|
|
243
|
-
request.azureCloudOptions
|
|
248
|
+
serverTelemetryManager
|
|
244
249
|
);
|
|
245
250
|
const refreshTokenClient = new RefreshTokenClient(
|
|
246
251
|
refreshTokenClientConfig
|
|
@@ -283,14 +288,18 @@ export abstract class ClientApplication {
|
|
|
283
288
|
);
|
|
284
289
|
|
|
285
290
|
try {
|
|
291
|
+
const discoveredAuthority = await this.createAuthority(
|
|
292
|
+
validRequest.authority,
|
|
293
|
+
validRequest.correlationId,
|
|
294
|
+
undefined,
|
|
295
|
+
request.azureCloudOptions
|
|
296
|
+
);
|
|
286
297
|
const clientConfiguration =
|
|
287
298
|
await this.buildOauthClientConfiguration(
|
|
288
|
-
|
|
299
|
+
discoveredAuthority,
|
|
289
300
|
validRequest.correlationId,
|
|
290
301
|
validRequest.redirectUri || "",
|
|
291
|
-
serverTelemetryManager
|
|
292
|
-
undefined,
|
|
293
|
-
validRequest.azureCloudOptions
|
|
302
|
+
serverTelemetryManager
|
|
294
303
|
);
|
|
295
304
|
const silentFlowClient = new SilentFlowClient(clientConfiguration);
|
|
296
305
|
this.logger.verbose(
|
|
@@ -391,14 +400,18 @@ export abstract class ClientApplication {
|
|
|
391
400
|
validRequest.correlationId
|
|
392
401
|
);
|
|
393
402
|
try {
|
|
403
|
+
const discoveredAuthority = await this.createAuthority(
|
|
404
|
+
validRequest.authority,
|
|
405
|
+
validRequest.correlationId,
|
|
406
|
+
undefined,
|
|
407
|
+
request.azureCloudOptions
|
|
408
|
+
);
|
|
394
409
|
const usernamePasswordClientConfig =
|
|
395
410
|
await this.buildOauthClientConfiguration(
|
|
396
|
-
|
|
411
|
+
discoveredAuthority,
|
|
397
412
|
validRequest.correlationId,
|
|
398
413
|
"",
|
|
399
|
-
serverTelemetryManager
|
|
400
|
-
undefined,
|
|
401
|
-
request.azureCloudOptions
|
|
414
|
+
serverTelemetryManager
|
|
402
415
|
);
|
|
403
416
|
const usernamePasswordClient = new UsernamePasswordClient(
|
|
404
417
|
usernamePasswordClientConfig
|
|
@@ -465,31 +478,16 @@ export abstract class ClientApplication {
|
|
|
465
478
|
* @param serverTelemetryManager - initializes servertelemetry if passed
|
|
466
479
|
*/
|
|
467
480
|
protected async buildOauthClientConfiguration(
|
|
468
|
-
|
|
481
|
+
discoveredAuthority: Authority,
|
|
469
482
|
requestCorrelationId: string,
|
|
470
483
|
redirectUri: string,
|
|
471
|
-
serverTelemetryManager?: ServerTelemetryManager
|
|
472
|
-
azureRegionConfiguration?: AzureRegionConfiguration,
|
|
473
|
-
azureCloudOptions?: AzureCloudOptions
|
|
484
|
+
serverTelemetryManager?: ServerTelemetryManager
|
|
474
485
|
): Promise<ClientConfiguration> {
|
|
475
486
|
this.logger.verbose(
|
|
476
487
|
"buildOauthClientConfiguration called",
|
|
477
488
|
requestCorrelationId
|
|
478
489
|
);
|
|
479
490
|
|
|
480
|
-
// precedence - azureCloudInstance + tenant >> authority and request >> config
|
|
481
|
-
const userAzureCloudOptions = azureCloudOptions
|
|
482
|
-
? azureCloudOptions
|
|
483
|
-
: this.config.auth.azureCloudOptions;
|
|
484
|
-
|
|
485
|
-
// using null assertion operator as we ensure that all config values have default values in buildConfiguration()
|
|
486
|
-
const discoveredAuthority = await this.createAuthority(
|
|
487
|
-
authority,
|
|
488
|
-
requestCorrelationId,
|
|
489
|
-
azureRegionConfiguration,
|
|
490
|
-
userAzureCloudOptions
|
|
491
|
-
);
|
|
492
|
-
|
|
493
491
|
this.logger.info(
|
|
494
492
|
`Building oauth client configuration with the following authority: ${discoveredAuthority.tokenEndpoint}.`,
|
|
495
493
|
requestCorrelationId
|
|
@@ -640,7 +638,7 @@ export abstract class ClientApplication {
|
|
|
640
638
|
* object. If no authority set in application object, then default to common authority.
|
|
641
639
|
* @param authorityString - authority from user configuration
|
|
642
640
|
*/
|
|
643
|
-
|
|
641
|
+
protected async createAuthority(
|
|
644
642
|
authorityString: string,
|
|
645
643
|
requestCorrelationId: string,
|
|
646
644
|
azureRegionConfiguration?: AzureRegionConfiguration,
|
|
@@ -651,7 +649,7 @@ export abstract class ClientApplication {
|
|
|
651
649
|
// build authority string based on auth params - azureCloudInstance is prioritized if provided
|
|
652
650
|
const authorityUrl = Authority.generateAuthority(
|
|
653
651
|
authorityString,
|
|
654
|
-
azureCloudOptions
|
|
652
|
+
azureCloudOptions || this.config.auth.azureCloudOptions
|
|
655
653
|
);
|
|
656
654
|
|
|
657
655
|
const authorityOptions: AuthorityOptions = {
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
createClientAuthError,
|
|
35
35
|
ClientAssertion,
|
|
36
36
|
getClientAssertion,
|
|
37
|
+
UrlUtils,
|
|
37
38
|
} from "@azure/msal-common/node";
|
|
38
39
|
import {
|
|
39
40
|
ManagedIdentityConfiguration,
|
|
@@ -336,32 +337,46 @@ export class ClientCredentialClient extends BaseClient {
|
|
|
336
337
|
private async createTokenRequestBody(
|
|
337
338
|
request: CommonClientCredentialRequest
|
|
338
339
|
): Promise<string> {
|
|
339
|
-
const
|
|
340
|
+
const parameters = new Map<string, string>();
|
|
340
341
|
|
|
341
|
-
|
|
342
|
+
RequestParameterBuilder.addClientId(
|
|
343
|
+
parameters,
|
|
344
|
+
this.config.authOptions.clientId
|
|
345
|
+
);
|
|
342
346
|
|
|
343
|
-
|
|
347
|
+
RequestParameterBuilder.addScopes(parameters, request.scopes, false);
|
|
344
348
|
|
|
345
|
-
|
|
349
|
+
RequestParameterBuilder.addGrantType(
|
|
350
|
+
parameters,
|
|
351
|
+
GrantType.CLIENT_CREDENTIALS_GRANT
|
|
352
|
+
);
|
|
346
353
|
|
|
347
|
-
|
|
348
|
-
|
|
354
|
+
RequestParameterBuilder.addLibraryInfo(
|
|
355
|
+
parameters,
|
|
356
|
+
this.config.libraryInfo
|
|
357
|
+
);
|
|
358
|
+
RequestParameterBuilder.addApplicationTelemetry(
|
|
359
|
+
parameters,
|
|
349
360
|
this.config.telemetry.application
|
|
350
361
|
);
|
|
351
362
|
|
|
352
|
-
|
|
363
|
+
RequestParameterBuilder.addThrottling(parameters);
|
|
353
364
|
|
|
354
365
|
if (this.serverTelemetryManager) {
|
|
355
|
-
|
|
366
|
+
RequestParameterBuilder.addServerTelemetry(
|
|
367
|
+
parameters,
|
|
368
|
+
this.serverTelemetryManager
|
|
369
|
+
);
|
|
356
370
|
}
|
|
357
371
|
|
|
358
372
|
const correlationId =
|
|
359
373
|
request.correlationId ||
|
|
360
374
|
this.config.cryptoInterface.createNewGuid();
|
|
361
|
-
|
|
375
|
+
RequestParameterBuilder.addCorrelationId(parameters, correlationId);
|
|
362
376
|
|
|
363
377
|
if (this.config.clientCredentials.clientSecret) {
|
|
364
|
-
|
|
378
|
+
RequestParameterBuilder.addClientSecret(
|
|
379
|
+
parameters,
|
|
365
380
|
this.config.clientCredentials.clientSecret
|
|
366
381
|
);
|
|
367
382
|
}
|
|
@@ -372,14 +387,16 @@ export class ClientCredentialClient extends BaseClient {
|
|
|
372
387
|
this.config.clientCredentials.clientAssertion;
|
|
373
388
|
|
|
374
389
|
if (clientAssertion) {
|
|
375
|
-
|
|
390
|
+
RequestParameterBuilder.addClientAssertion(
|
|
391
|
+
parameters,
|
|
376
392
|
await getClientAssertion(
|
|
377
393
|
clientAssertion.assertion,
|
|
378
394
|
this.config.authOptions.clientId,
|
|
379
395
|
request.resourceRequestUri
|
|
380
396
|
)
|
|
381
397
|
);
|
|
382
|
-
|
|
398
|
+
RequestParameterBuilder.addClientAssertionType(
|
|
399
|
+
parameters,
|
|
383
400
|
clientAssertion.assertionType
|
|
384
401
|
);
|
|
385
402
|
}
|
|
@@ -389,12 +406,13 @@ export class ClientCredentialClient extends BaseClient {
|
|
|
389
406
|
(this.config.authOptions.clientCapabilities &&
|
|
390
407
|
this.config.authOptions.clientCapabilities.length > 0)
|
|
391
408
|
) {
|
|
392
|
-
|
|
409
|
+
RequestParameterBuilder.addClaims(
|
|
410
|
+
parameters,
|
|
393
411
|
request.claims,
|
|
394
412
|
this.config.authOptions.clientCapabilities
|
|
395
413
|
);
|
|
396
414
|
}
|
|
397
415
|
|
|
398
|
-
return
|
|
416
|
+
return UrlUtils.mapToQueryString(parameters);
|
|
399
417
|
}
|
|
400
418
|
}
|
|
@@ -221,14 +221,18 @@ export class ConfidentialClientApplication
|
|
|
221
221
|
validRequest.skipCache
|
|
222
222
|
);
|
|
223
223
|
try {
|
|
224
|
+
const discoveredAuthority = await this.createAuthority(
|
|
225
|
+
validRequest.authority,
|
|
226
|
+
validRequest.correlationId,
|
|
227
|
+
azureRegionConfiguration,
|
|
228
|
+
request.azureCloudOptions
|
|
229
|
+
);
|
|
224
230
|
const clientCredentialConfig =
|
|
225
231
|
await this.buildOauthClientConfiguration(
|
|
226
|
-
|
|
232
|
+
discoveredAuthority,
|
|
227
233
|
validRequest.correlationId,
|
|
228
234
|
"",
|
|
229
|
-
serverTelemetryManager
|
|
230
|
-
azureRegionConfiguration,
|
|
231
|
-
request.azureCloudOptions
|
|
235
|
+
serverTelemetryManager
|
|
232
236
|
);
|
|
233
237
|
const clientCredentialClient = new ClientCredentialClient(
|
|
234
238
|
clientCredentialConfig,
|
|
@@ -271,14 +275,18 @@ export class ConfidentialClientApplication
|
|
|
271
275
|
...(await this.initializeBaseRequest(request)),
|
|
272
276
|
};
|
|
273
277
|
try {
|
|
274
|
-
const
|
|
278
|
+
const discoveredAuthority = await this.createAuthority(
|
|
275
279
|
validRequest.authority,
|
|
276
280
|
validRequest.correlationId,
|
|
277
|
-
"",
|
|
278
|
-
undefined,
|
|
279
281
|
undefined,
|
|
280
282
|
request.azureCloudOptions
|
|
281
283
|
);
|
|
284
|
+
const onBehalfOfConfig = await this.buildOauthClientConfiguration(
|
|
285
|
+
discoveredAuthority,
|
|
286
|
+
validRequest.correlationId,
|
|
287
|
+
"",
|
|
288
|
+
undefined
|
|
289
|
+
);
|
|
282
290
|
const oboClient = new OnBehalfOfClient(onBehalfOfConfig);
|
|
283
291
|
this.logger.verbose(
|
|
284
292
|
"On behalf of client created",
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
StringUtils,
|
|
22
22
|
TimeUtils,
|
|
23
23
|
UrlString,
|
|
24
|
+
UrlUtils,
|
|
24
25
|
createAuthError,
|
|
25
26
|
createClientAuthError,
|
|
26
27
|
} from "@azure/msal-common/node";
|
|
@@ -111,15 +112,16 @@ export class DeviceCodeClient extends BaseClient {
|
|
|
111
112
|
public createExtraQueryParameters(
|
|
112
113
|
request: CommonDeviceCodeRequest
|
|
113
114
|
): string {
|
|
114
|
-
const
|
|
115
|
+
const parameters = new Map<string, string>();
|
|
115
116
|
|
|
116
117
|
if (request.extraQueryParameters) {
|
|
117
|
-
|
|
118
|
+
RequestParameterBuilder.addExtraQueryParameters(
|
|
119
|
+
parameters,
|
|
118
120
|
request.extraQueryParameters
|
|
119
121
|
);
|
|
120
122
|
}
|
|
121
123
|
|
|
122
|
-
return
|
|
124
|
+
return UrlUtils.mapToQueryString(parameters);
|
|
123
125
|
}
|
|
124
126
|
|
|
125
127
|
/**
|
|
@@ -171,14 +173,17 @@ export class DeviceCodeClient extends BaseClient {
|
|
|
171
173
|
* @param request - developer provided CommonDeviceCodeRequest
|
|
172
174
|
*/
|
|
173
175
|
private createQueryString(request: CommonDeviceCodeRequest): string {
|
|
174
|
-
const
|
|
175
|
-
new RequestParameterBuilder();
|
|
176
|
+
const parameters = new Map<string, string>();
|
|
176
177
|
|
|
177
|
-
|
|
178
|
-
|
|
178
|
+
RequestParameterBuilder.addScopes(parameters, request.scopes);
|
|
179
|
+
RequestParameterBuilder.addClientId(
|
|
180
|
+
parameters,
|
|
181
|
+
this.config.authOptions.clientId
|
|
182
|
+
);
|
|
179
183
|
|
|
180
184
|
if (request.extraQueryParameters) {
|
|
181
|
-
|
|
185
|
+
RequestParameterBuilder.addExtraQueryParameters(
|
|
186
|
+
parameters,
|
|
182
187
|
request.extraQueryParameters
|
|
183
188
|
);
|
|
184
189
|
}
|
|
@@ -188,13 +193,14 @@ export class DeviceCodeClient extends BaseClient {
|
|
|
188
193
|
(this.config.authOptions.clientCapabilities &&
|
|
189
194
|
this.config.authOptions.clientCapabilities.length > 0)
|
|
190
195
|
) {
|
|
191
|
-
|
|
196
|
+
RequestParameterBuilder.addClaims(
|
|
197
|
+
parameters,
|
|
192
198
|
request.claims,
|
|
193
199
|
this.config.authOptions.clientCapabilities
|
|
194
200
|
);
|
|
195
201
|
}
|
|
196
202
|
|
|
197
|
-
return
|
|
203
|
+
return UrlUtils.mapToQueryString(parameters);
|
|
198
204
|
}
|
|
199
205
|
|
|
200
206
|
/**
|
|
@@ -342,25 +348,40 @@ export class DeviceCodeClient extends BaseClient {
|
|
|
342
348
|
request: CommonDeviceCodeRequest,
|
|
343
349
|
deviceCodeResponse: DeviceCodeResponse
|
|
344
350
|
): string {
|
|
345
|
-
const
|
|
346
|
-
new RequestParameterBuilder();
|
|
351
|
+
const parameters = new Map<string, string>();
|
|
347
352
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
353
|
+
RequestParameterBuilder.addScopes(parameters, request.scopes);
|
|
354
|
+
RequestParameterBuilder.addClientId(
|
|
355
|
+
parameters,
|
|
356
|
+
this.config.authOptions.clientId
|
|
357
|
+
);
|
|
358
|
+
RequestParameterBuilder.addGrantType(
|
|
359
|
+
parameters,
|
|
360
|
+
GrantType.DEVICE_CODE_GRANT
|
|
361
|
+
);
|
|
362
|
+
RequestParameterBuilder.addDeviceCode(
|
|
363
|
+
parameters,
|
|
364
|
+
deviceCodeResponse.deviceCode
|
|
365
|
+
);
|
|
352
366
|
const correlationId =
|
|
353
367
|
request.correlationId ||
|
|
354
368
|
this.config.cryptoInterface.createNewGuid();
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
369
|
+
RequestParameterBuilder.addCorrelationId(parameters, correlationId);
|
|
370
|
+
RequestParameterBuilder.addClientInfo(parameters);
|
|
371
|
+
RequestParameterBuilder.addLibraryInfo(
|
|
372
|
+
parameters,
|
|
373
|
+
this.config.libraryInfo
|
|
374
|
+
);
|
|
375
|
+
RequestParameterBuilder.addApplicationTelemetry(
|
|
376
|
+
parameters,
|
|
359
377
|
this.config.telemetry.application
|
|
360
378
|
);
|
|
361
|
-
|
|
379
|
+
RequestParameterBuilder.addThrottling(parameters);
|
|
362
380
|
if (this.serverTelemetryManager) {
|
|
363
|
-
|
|
381
|
+
RequestParameterBuilder.addServerTelemetry(
|
|
382
|
+
parameters,
|
|
383
|
+
this.serverTelemetryManager
|
|
384
|
+
);
|
|
364
385
|
}
|
|
365
386
|
|
|
366
387
|
if (
|
|
@@ -368,11 +389,12 @@ export class DeviceCodeClient extends BaseClient {
|
|
|
368
389
|
(this.config.authOptions.clientCapabilities &&
|
|
369
390
|
this.config.authOptions.clientCapabilities.length > 0)
|
|
370
391
|
) {
|
|
371
|
-
|
|
392
|
+
RequestParameterBuilder.addClaims(
|
|
393
|
+
parameters,
|
|
372
394
|
request.claims,
|
|
373
395
|
this.config.authOptions.clientCapabilities
|
|
374
396
|
);
|
|
375
397
|
}
|
|
376
|
-
return
|
|
398
|
+
return UrlUtils.mapToQueryString(parameters);
|
|
377
399
|
}
|
|
378
400
|
}
|
|
@@ -35,6 +35,7 @@ export class ManagedIdentityClient {
|
|
|
35
35
|
private nodeStorage: NodeStorage;
|
|
36
36
|
private networkClient: INetworkModule;
|
|
37
37
|
private cryptoProvider: CryptoProvider;
|
|
38
|
+
private disableInternalRetries: boolean;
|
|
38
39
|
|
|
39
40
|
private static identitySource?: BaseManagedIdentitySource;
|
|
40
41
|
public static sourceName?: ManagedIdentitySourceNames;
|
|
@@ -43,12 +44,14 @@ export class ManagedIdentityClient {
|
|
|
43
44
|
logger: Logger,
|
|
44
45
|
nodeStorage: NodeStorage,
|
|
45
46
|
networkClient: INetworkModule,
|
|
46
|
-
cryptoProvider: CryptoProvider
|
|
47
|
+
cryptoProvider: CryptoProvider,
|
|
48
|
+
disableInternalRetries: boolean
|
|
47
49
|
) {
|
|
48
50
|
this.logger = logger;
|
|
49
51
|
this.nodeStorage = nodeStorage;
|
|
50
52
|
this.networkClient = networkClient;
|
|
51
53
|
this.cryptoProvider = cryptoProvider;
|
|
54
|
+
this.disableInternalRetries = disableInternalRetries;
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
public async sendManagedIdentityTokenRequest(
|
|
@@ -64,6 +67,7 @@ export class ManagedIdentityClient {
|
|
|
64
67
|
this.nodeStorage,
|
|
65
68
|
this.networkClient,
|
|
66
69
|
this.cryptoProvider,
|
|
70
|
+
this.disableInternalRetries,
|
|
67
71
|
managedIdentityId
|
|
68
72
|
);
|
|
69
73
|
}
|
|
@@ -126,6 +130,7 @@ export class ManagedIdentityClient {
|
|
|
126
130
|
nodeStorage: NodeStorage,
|
|
127
131
|
networkClient: INetworkModule,
|
|
128
132
|
cryptoProvider: CryptoProvider,
|
|
133
|
+
disableInternalRetries: boolean,
|
|
129
134
|
managedIdentityId: ManagedIdentityId
|
|
130
135
|
): BaseManagedIdentitySource {
|
|
131
136
|
const source =
|
|
@@ -134,25 +139,29 @@ export class ManagedIdentityClient {
|
|
|
134
139
|
nodeStorage,
|
|
135
140
|
networkClient,
|
|
136
141
|
cryptoProvider,
|
|
142
|
+
disableInternalRetries,
|
|
137
143
|
managedIdentityId
|
|
138
144
|
) ||
|
|
139
145
|
AppService.tryCreate(
|
|
140
146
|
logger,
|
|
141
147
|
nodeStorage,
|
|
142
148
|
networkClient,
|
|
143
|
-
cryptoProvider
|
|
149
|
+
cryptoProvider,
|
|
150
|
+
disableInternalRetries
|
|
144
151
|
) ||
|
|
145
152
|
MachineLearning.tryCreate(
|
|
146
153
|
logger,
|
|
147
154
|
nodeStorage,
|
|
148
155
|
networkClient,
|
|
149
|
-
cryptoProvider
|
|
156
|
+
cryptoProvider,
|
|
157
|
+
disableInternalRetries
|
|
150
158
|
) ||
|
|
151
159
|
CloudShell.tryCreate(
|
|
152
160
|
logger,
|
|
153
161
|
nodeStorage,
|
|
154
162
|
networkClient,
|
|
155
163
|
cryptoProvider,
|
|
164
|
+
disableInternalRetries,
|
|
156
165
|
managedIdentityId
|
|
157
166
|
) ||
|
|
158
167
|
AzureArc.tryCreate(
|
|
@@ -160,9 +169,16 @@ export class ManagedIdentityClient {
|
|
|
160
169
|
nodeStorage,
|
|
161
170
|
networkClient,
|
|
162
171
|
cryptoProvider,
|
|
172
|
+
disableInternalRetries,
|
|
163
173
|
managedIdentityId
|
|
164
174
|
) ||
|
|
165
|
-
Imds.tryCreate(
|
|
175
|
+
Imds.tryCreate(
|
|
176
|
+
logger,
|
|
177
|
+
nodeStorage,
|
|
178
|
+
networkClient,
|
|
179
|
+
cryptoProvider,
|
|
180
|
+
disableInternalRetries
|
|
181
|
+
);
|
|
166
182
|
if (!source) {
|
|
167
183
|
throw createManagedIdentityError(
|
|
168
184
|
ManagedIdentityErrorCodes.unableToCreateSource
|
|
@@ -34,10 +34,17 @@ export class AppService extends BaseManagedIdentitySource {
|
|
|
34
34
|
nodeStorage: NodeStorage,
|
|
35
35
|
networkClient: INetworkModule,
|
|
36
36
|
cryptoProvider: CryptoProvider,
|
|
37
|
+
disableInternalRetries: boolean,
|
|
37
38
|
identityEndpoint: string,
|
|
38
39
|
identityHeader: string
|
|
39
40
|
) {
|
|
40
|
-
super(
|
|
41
|
+
super(
|
|
42
|
+
logger,
|
|
43
|
+
nodeStorage,
|
|
44
|
+
networkClient,
|
|
45
|
+
cryptoProvider,
|
|
46
|
+
disableInternalRetries
|
|
47
|
+
);
|
|
41
48
|
|
|
42
49
|
this.identityEndpoint = identityEndpoint;
|
|
43
50
|
this.identityHeader = identityHeader;
|
|
@@ -60,7 +67,8 @@ export class AppService extends BaseManagedIdentitySource {
|
|
|
60
67
|
logger: Logger,
|
|
61
68
|
nodeStorage: NodeStorage,
|
|
62
69
|
networkClient: INetworkModule,
|
|
63
|
-
cryptoProvider: CryptoProvider
|
|
70
|
+
cryptoProvider: CryptoProvider,
|
|
71
|
+
disableInternalRetries: boolean
|
|
64
72
|
): AppService | null {
|
|
65
73
|
const [identityEndpoint, identityHeader] =
|
|
66
74
|
AppService.getEnvironmentVariables();
|
|
@@ -90,6 +98,7 @@ export class AppService extends BaseManagedIdentitySource {
|
|
|
90
98
|
nodeStorage,
|
|
91
99
|
networkClient,
|
|
92
100
|
cryptoProvider,
|
|
101
|
+
disableInternalRetries,
|
|
93
102
|
identityEndpoint,
|
|
94
103
|
identityHeader
|
|
95
104
|
);
|
|
@@ -74,9 +74,16 @@ export class AzureArc extends BaseManagedIdentitySource {
|
|
|
74
74
|
nodeStorage: NodeStorage,
|
|
75
75
|
networkClient: INetworkModule,
|
|
76
76
|
cryptoProvider: CryptoProvider,
|
|
77
|
+
disableInternalRetries: boolean,
|
|
77
78
|
identityEndpoint: string
|
|
78
79
|
) {
|
|
79
|
-
super(
|
|
80
|
+
super(
|
|
81
|
+
logger,
|
|
82
|
+
nodeStorage,
|
|
83
|
+
networkClient,
|
|
84
|
+
cryptoProvider,
|
|
85
|
+
disableInternalRetries
|
|
86
|
+
);
|
|
80
87
|
|
|
81
88
|
this.identityEndpoint = identityEndpoint;
|
|
82
89
|
}
|
|
@@ -122,6 +129,7 @@ export class AzureArc extends BaseManagedIdentitySource {
|
|
|
122
129
|
nodeStorage: NodeStorage,
|
|
123
130
|
networkClient: INetworkModule,
|
|
124
131
|
cryptoProvider: CryptoProvider,
|
|
132
|
+
disableInternalRetries: boolean,
|
|
125
133
|
managedIdentityId: ManagedIdentityId
|
|
126
134
|
): AzureArc | null {
|
|
127
135
|
const [identityEndpoint, imdsEndpoint] =
|
|
@@ -181,6 +189,7 @@ export class AzureArc extends BaseManagedIdentitySource {
|
|
|
181
189
|
nodeStorage,
|
|
182
190
|
networkClient,
|
|
183
191
|
cryptoProvider,
|
|
192
|
+
disableInternalRetries,
|
|
184
193
|
identityEndpoint
|
|
185
194
|
);
|
|
186
195
|
}
|