@azure/identity 4.5.0-alpha.20240823.1 → 4.5.0-alpha.20240827.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +79 -42
- package/dist/index.js.map +1 -1
- package/dist-esm/src/client/identityClient.js +3 -2
- package/dist-esm/src/client/identityClient.js.map +1 -1
- package/dist-esm/src/constants.js +1 -1
- package/dist-esm/src/constants.js.map +1 -1
- package/dist-esm/src/credentials/authorityValidationOptions.js +1 -1
- package/dist-esm/src/credentials/authorityValidationOptions.js.map +1 -1
- package/dist-esm/src/credentials/authorizationCodeCredential.browser.js +1 -1
- package/dist-esm/src/credentials/authorizationCodeCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/authorizationCodeCredential.js +1 -1
- package/dist-esm/src/credentials/authorizationCodeCredential.js.map +1 -1
- package/dist-esm/src/credentials/authorizationCodeCredentialOptions.js +1 -1
- package/dist-esm/src/credentials/authorizationCodeCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/azureApplicationCredential.browser.js +1 -1
- package/dist-esm/src/credentials/azureApplicationCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/azureApplicationCredential.js +1 -1
- package/dist-esm/src/credentials/azureApplicationCredential.js.map +1 -1
- package/dist-esm/src/credentials/azureApplicationCredentialOptions.js +1 -1
- package/dist-esm/src/credentials/azureApplicationCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/azureCliCredential.browser.js +1 -1
- package/dist-esm/src/credentials/azureCliCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/azureCliCredential.js +1 -1
- package/dist-esm/src/credentials/azureCliCredential.js.map +1 -1
- package/dist-esm/src/credentials/azureCliCredentialOptions.js +1 -1
- package/dist-esm/src/credentials/azureCliCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/azureDeveloperCliCredential.browser.js +1 -1
- package/dist-esm/src/credentials/azureDeveloperCliCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/azureDeveloperCliCredential.js +1 -1
- package/dist-esm/src/credentials/azureDeveloperCliCredential.js.map +1 -1
- package/dist-esm/src/credentials/azureDeveloperCliCredentialOptions.js +1 -1
- package/dist-esm/src/credentials/azureDeveloperCliCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/azurePipelinesCredential.browser.js +1 -1
- package/dist-esm/src/credentials/azurePipelinesCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/azurePipelinesCredential.js +1 -1
- package/dist-esm/src/credentials/azurePipelinesCredential.js.map +1 -1
- package/dist-esm/src/credentials/azurePipelinesCredentialOptions.js +1 -1
- package/dist-esm/src/credentials/azurePipelinesCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/azurePowerShellCredential.browser.js +1 -1
- package/dist-esm/src/credentials/azurePowerShellCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/azurePowerShellCredential.js +1 -1
- package/dist-esm/src/credentials/azurePowerShellCredential.js.map +1 -1
- package/dist-esm/src/credentials/azurePowerShellCredentialOptions.js +1 -1
- package/dist-esm/src/credentials/azurePowerShellCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/brokerAuthOptions.js.map +1 -1
- package/dist-esm/src/credentials/browserCustomizationOptions.js +1 -1
- package/dist-esm/src/credentials/browserCustomizationOptions.js.map +1 -1
- package/dist-esm/src/credentials/chainedTokenCredential.js +1 -1
- package/dist-esm/src/credentials/chainedTokenCredential.js.map +1 -1
- package/dist-esm/src/credentials/clientAssertionCredential.browser.js +1 -1
- package/dist-esm/src/credentials/clientAssertionCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/clientAssertionCredential.js +1 -1
- package/dist-esm/src/credentials/clientAssertionCredential.js.map +1 -1
- package/dist-esm/src/credentials/clientAssertionCredentialOptions.js +1 -1
- package/dist-esm/src/credentials/clientAssertionCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/clientCertificateCredential.browser.js +1 -1
- package/dist-esm/src/credentials/clientCertificateCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/clientCertificateCredential.js +1 -1
- package/dist-esm/src/credentials/clientCertificateCredential.js.map +1 -1
- package/dist-esm/src/credentials/clientCertificateCredentialOptions.js +1 -1
- package/dist-esm/src/credentials/clientCertificateCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/clientSecretCredential.browser.js +1 -1
- package/dist-esm/src/credentials/clientSecretCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/clientSecretCredential.js +1 -1
- package/dist-esm/src/credentials/clientSecretCredential.js.map +1 -1
- package/dist-esm/src/credentials/clientSecretCredentialOptions.js +1 -1
- package/dist-esm/src/credentials/clientSecretCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/credentialPersistenceOptions.js +1 -1
- package/dist-esm/src/credentials/credentialPersistenceOptions.js.map +1 -1
- package/dist-esm/src/credentials/defaultAzureCredential.browser.js +1 -1
- package/dist-esm/src/credentials/defaultAzureCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/defaultAzureCredential.js +1 -1
- package/dist-esm/src/credentials/defaultAzureCredential.js.map +1 -1
- package/dist-esm/src/credentials/defaultAzureCredentialOptions.js +1 -1
- package/dist-esm/src/credentials/defaultAzureCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/deviceCodeCredential.browser.js +1 -1
- package/dist-esm/src/credentials/deviceCodeCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/deviceCodeCredential.js +1 -1
- package/dist-esm/src/credentials/deviceCodeCredential.js.map +1 -1
- package/dist-esm/src/credentials/deviceCodeCredentialOptions.js +1 -1
- package/dist-esm/src/credentials/deviceCodeCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/environmentCredential.browser.js +1 -1
- package/dist-esm/src/credentials/environmentCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/environmentCredential.js +1 -1
- package/dist-esm/src/credentials/environmentCredential.js.map +1 -1
- package/dist-esm/src/credentials/environmentCredentialOptions.js +1 -1
- package/dist-esm/src/credentials/environmentCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js +1 -1
- package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/interactiveBrowserCredential.js +1 -1
- package/dist-esm/src/credentials/interactiveBrowserCredential.js.map +1 -1
- package/dist-esm/src/credentials/interactiveBrowserCredentialOptions.js +1 -1
- package/dist-esm/src/credentials/interactiveBrowserCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/interactiveCredentialOptions.js +1 -1
- package/dist-esm/src/credentials/interactiveCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2017.js +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2017.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2019.js +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2019.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/arcMsi.js +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/arcMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/cloudShellMsi.js +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/cloudShellMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/constants.js +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/constants.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/fabricMsi.js +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/fabricMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/imdsRetryPolicy.js +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/imdsRetryPolicy.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/index.browser.js +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/index.browser.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/index.js +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/index.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/legacyMsiProvider.js +7 -1
- package/dist-esm/src/credentials/managedIdentityCredential/legacyMsiProvider.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/models.js +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/models.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/msalMsiProvider.js +3 -1
- package/dist-esm/src/credentials/managedIdentityCredential/msalMsiProvider.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/tokenExchangeMsi.js +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/utils.js +26 -1
- package/dist-esm/src/credentials/managedIdentityCredential/utils.js.map +1 -1
- package/dist-esm/src/credentials/multiTenantTokenCredentialOptions.js +1 -1
- package/dist-esm/src/credentials/multiTenantTokenCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/onBehalfOfCredential.browser.js +1 -1
- package/dist-esm/src/credentials/onBehalfOfCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/onBehalfOfCredential.js +1 -1
- package/dist-esm/src/credentials/onBehalfOfCredential.js.map +1 -1
- package/dist-esm/src/credentials/onBehalfOfCredentialOptions.js +1 -1
- package/dist-esm/src/credentials/onBehalfOfCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/usernamePasswordCredential.browser.js +1 -1
- package/dist-esm/src/credentials/usernamePasswordCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/usernamePasswordCredential.js +1 -1
- package/dist-esm/src/credentials/usernamePasswordCredential.js.map +1 -1
- package/dist-esm/src/credentials/usernamePasswordCredentialOptions.js +1 -1
- package/dist-esm/src/credentials/usernamePasswordCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/visualStudioCodeCredential.browser.js +1 -1
- package/dist-esm/src/credentials/visualStudioCodeCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/visualStudioCodeCredential.js +1 -1
- package/dist-esm/src/credentials/visualStudioCodeCredential.js.map +1 -1
- package/dist-esm/src/credentials/visualStudioCodeCredentialOptions.js +1 -1
- package/dist-esm/src/credentials/visualStudioCodeCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/visualStudioCodeCredentialPlugin.js +1 -1
- package/dist-esm/src/credentials/visualStudioCodeCredentialPlugin.js.map +1 -1
- package/dist-esm/src/credentials/workloadIdentityCredential.browser.js +1 -1
- package/dist-esm/src/credentials/workloadIdentityCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/workloadIdentityCredential.js +1 -1
- package/dist-esm/src/credentials/workloadIdentityCredential.js.map +1 -1
- package/dist-esm/src/credentials/workloadIdentityCredentialOptions.js +1 -1
- package/dist-esm/src/credentials/workloadIdentityCredentialOptions.js.map +1 -1
- package/dist-esm/src/errors.js +1 -1
- package/dist-esm/src/errors.js.map +1 -1
- package/dist-esm/src/index.js +1 -1
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/msal/browserFlows/flows.js +1 -1
- package/dist-esm/src/msal/browserFlows/flows.js.map +1 -1
- package/dist-esm/src/msal/browserFlows/msalAuthCode.js +1 -1
- package/dist-esm/src/msal/browserFlows/msalAuthCode.js.map +1 -1
- package/dist-esm/src/msal/browserFlows/msalBrowserCommon.js +3 -1
- package/dist-esm/src/msal/browserFlows/msalBrowserCommon.js.map +1 -1
- package/dist-esm/src/msal/credentials.js +1 -1
- package/dist-esm/src/msal/credentials.js.map +1 -1
- package/dist-esm/src/msal/msal.browser.js +1 -1
- package/dist-esm/src/msal/msal.browser.js.map +1 -1
- package/dist-esm/src/msal/msal.js +1 -1
- package/dist-esm/src/msal/msal.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/brokerOptions.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/msalClient.js +11 -2
- package/dist-esm/src/msal/nodeFlows/msalClient.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/msalPlugins.js +1 -1
- package/dist-esm/src/msal/nodeFlows/msalPlugins.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/tokenCachePersistenceOptions.js +1 -1
- package/dist-esm/src/msal/nodeFlows/tokenCachePersistenceOptions.js.map +1 -1
- package/dist-esm/src/msal/types.js +1 -1
- package/dist-esm/src/msal/types.js.map +1 -1
- package/dist-esm/src/msal/utils.js +1 -1
- package/dist-esm/src/msal/utils.js.map +1 -1
- package/dist-esm/src/plugins/consumer.browser.js +1 -1
- package/dist-esm/src/plugins/consumer.browser.js.map +1 -1
- package/dist-esm/src/plugins/consumer.js +1 -1
- package/dist-esm/src/plugins/consumer.js.map +1 -1
- package/dist-esm/src/plugins/provider.js +1 -1
- package/dist-esm/src/plugins/provider.js.map +1 -1
- package/dist-esm/src/regionalAuthority.js +1 -1
- package/dist-esm/src/regionalAuthority.js.map +1 -1
- package/dist-esm/src/tokenCredentialOptions.js +1 -1
- package/dist-esm/src/tokenCredentialOptions.js.map +1 -1
- package/dist-esm/src/tokenProvider.js +1 -1
- package/dist-esm/src/tokenProvider.js.map +1 -1
- package/dist-esm/src/util/authHostEnv.browser.js +1 -1
- package/dist-esm/src/util/authHostEnv.browser.js.map +1 -1
- package/dist-esm/src/util/identityTokenEndpoint.js +1 -1
- package/dist-esm/src/util/identityTokenEndpoint.js.map +1 -1
- package/dist-esm/src/util/logging.js +1 -1
- package/dist-esm/src/util/logging.js.map +1 -1
- package/dist-esm/src/util/processMultiTenantRequest.browser.js +1 -1
- package/dist-esm/src/util/processMultiTenantRequest.browser.js.map +1 -1
- package/dist-esm/src/util/processMultiTenantRequest.js +1 -1
- package/dist-esm/src/util/processMultiTenantRequest.js.map +1 -1
- package/dist-esm/src/util/processUtils.js +1 -1
- package/dist-esm/src/util/processUtils.js.map +1 -1
- package/dist-esm/src/util/scopeUtils.js +1 -1
- package/dist-esm/src/util/scopeUtils.js.map +1 -1
- package/dist-esm/src/util/tenantIdUtils.js +1 -1
- package/dist-esm/src/util/tenantIdUtils.js.map +1 -1
- package/dist-esm/src/util/tracing.js +1 -1
- package/dist-esm/src/util/tracing.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
@@ -40,7 +40,7 @@ var msalCommon__namespace = /*#__PURE__*/_interopNamespaceDefault(msalCommon);
|
|
40
40
|
var child_process__namespace = /*#__PURE__*/_interopNamespaceDefault(child_process);
|
41
41
|
|
42
42
|
// Copyright (c) Microsoft Corporation.
|
43
|
-
// Licensed under the MIT
|
43
|
+
// Licensed under the MIT License.
|
44
44
|
/**
|
45
45
|
* Current version of the `@azure/identity` package.
|
46
46
|
*/
|
@@ -107,7 +107,7 @@ const CACHE_NON_CAE_SUFFIX = "nocae";
|
|
107
107
|
const DEFAULT_TOKEN_CACHE_NAME = "msal.cache";
|
108
108
|
|
109
109
|
// Copyright (c) Microsoft Corporation.
|
110
|
-
// Licensed under the MIT
|
110
|
+
// Licensed under the MIT License.
|
111
111
|
/**
|
112
112
|
* The current persistence provider, undefined by default.
|
113
113
|
* @internal
|
@@ -190,7 +190,7 @@ const msalPlugins = {
|
|
190
190
|
};
|
191
191
|
|
192
192
|
// Copyright (c) Microsoft Corporation.
|
193
|
-
// Licensed under the MIT
|
193
|
+
// Licensed under the MIT License.
|
194
194
|
/**
|
195
195
|
* The AzureLogger used for all clients within the identity package
|
196
196
|
*/
|
@@ -273,7 +273,7 @@ function credentialLogger(title, log = logger$l) {
|
|
273
273
|
}
|
274
274
|
|
275
275
|
// Copyright (c) Microsoft Corporation.
|
276
|
-
// Licensed under the MIT
|
276
|
+
// Licensed under the MIT License.
|
277
277
|
function isErrorResponse(errorResponse) {
|
278
278
|
return (errorResponse &&
|
279
279
|
typeof errorResponse.error === "string" &&
|
@@ -396,7 +396,7 @@ class AuthenticationRequiredError extends Error {
|
|
396
396
|
}
|
397
397
|
|
398
398
|
// Copyright (c) Microsoft Corporation.
|
399
|
-
// Licensed under the MIT
|
399
|
+
// Licensed under the MIT License.
|
400
400
|
function createConfigurationErrorMessage(tenantId) {
|
401
401
|
return `The current credential is not configured to acquire tokens for tenant ${tenantId}. To enable acquiring tokens for this tenant add it to the AdditionallyAllowedTenants on the credential options, or add "*" to AdditionallyAllowedTenants to allow acquiring tokens for any tenant.`;
|
402
402
|
}
|
@@ -430,7 +430,7 @@ function processMultiTenantRequest(tenantId, getTokenOptions, additionallyAllowe
|
|
430
430
|
}
|
431
431
|
|
432
432
|
// Copyright (c) Microsoft Corporation.
|
433
|
-
// Licensed under the MIT
|
433
|
+
// Licensed under the MIT License.
|
434
434
|
/**
|
435
435
|
* @internal
|
436
436
|
*/
|
@@ -471,7 +471,7 @@ function resolveAdditionallyAllowedTenantIds(additionallyAllowedTenants) {
|
|
471
471
|
}
|
472
472
|
|
473
473
|
// Copyright (c) Microsoft Corporation.
|
474
|
-
// Licensed under the MIT
|
474
|
+
// Licensed under the MIT License.
|
475
475
|
function getIdentityTokenEndpointSuffix(tenantId) {
|
476
476
|
if (tenantId === "adfs") {
|
477
477
|
return "oauth2/token";
|
@@ -482,7 +482,7 @@ function getIdentityTokenEndpointSuffix(tenantId) {
|
|
482
482
|
}
|
483
483
|
|
484
484
|
// Copyright (c) Microsoft Corporation.
|
485
|
-
// Licensed under the MIT
|
485
|
+
// Licensed under the MIT License.
|
486
486
|
/**
|
487
487
|
* Creates a span using the global tracer.
|
488
488
|
* @internal
|
@@ -494,14 +494,14 @@ const tracingClient = coreTracing.createTracingClient({
|
|
494
494
|
});
|
495
495
|
|
496
496
|
// Copyright (c) Microsoft Corporation.
|
497
|
-
// Licensed under the MIT
|
497
|
+
// Licensed under the MIT License.
|
498
498
|
const DefaultScopeSuffix = "/.default";
|
499
499
|
const imdsHost = "http://169.254.169.254";
|
500
500
|
const imdsEndpointPath = "/metadata/identity/oauth2/token";
|
501
501
|
const imdsApiVersion = "2018-02-01";
|
502
502
|
|
503
503
|
// Copyright (c) Microsoft Corporation.
|
504
|
-
// Licensed under the MIT
|
504
|
+
// Licensed under the MIT License.
|
505
505
|
/**
|
506
506
|
* Most MSIs send requests to the IMDS endpoint, or a similar endpoint.
|
507
507
|
* These are GET requests that require sending a `resource` parameter on the query.
|
@@ -550,9 +550,34 @@ function parseExpirationTimestamp(body) {
|
|
550
550
|
}
|
551
551
|
throw new Error(`Failed to parse token expiration from body. expires_in="${body.expires_in}", expires_on="${body.expires_on}"`);
|
552
552
|
}
|
553
|
+
/**
|
554
|
+
* Given a token response, return the expiration timestamp as the number of milliseconds from the Unix epoch.
|
555
|
+
* @param body - A parsed response body from the authentication endpoint.
|
556
|
+
*/
|
557
|
+
function parseRefreshTimestamp(body) {
|
558
|
+
if (body.refresh_on) {
|
559
|
+
if (typeof body.refresh_on === "number") {
|
560
|
+
return body.refresh_on * 1000;
|
561
|
+
}
|
562
|
+
if (typeof body.refresh_on === "string") {
|
563
|
+
const asNumber = +body.refresh_on;
|
564
|
+
if (!isNaN(asNumber)) {
|
565
|
+
return asNumber * 1000;
|
566
|
+
}
|
567
|
+
const asDate = Date.parse(body.refresh_on);
|
568
|
+
if (!isNaN(asDate)) {
|
569
|
+
return asDate;
|
570
|
+
}
|
571
|
+
}
|
572
|
+
throw new Error(`Failed to parse refresh_on from body. refresh_on="${body.refresh_on}"`);
|
573
|
+
}
|
574
|
+
else {
|
575
|
+
return undefined;
|
576
|
+
}
|
577
|
+
}
|
553
578
|
|
554
579
|
// Copyright (c) Microsoft Corporation.
|
555
|
-
// Licensed under the MIT
|
580
|
+
// Licensed under the MIT License.
|
556
581
|
const noCorrelationId = "noCorrelationId";
|
557
582
|
/**
|
558
583
|
* @internal
|
@@ -614,6 +639,7 @@ class IdentityClient extends coreClient.ServiceClient {
|
|
614
639
|
accessToken: {
|
615
640
|
token: parsedBody.access_token,
|
616
641
|
expiresOnTimestamp: parseExpirationTimestamp(parsedBody),
|
642
|
+
refreshAfterTimestamp: parseRefreshTimestamp(parsedBody),
|
617
643
|
},
|
618
644
|
refreshToken: parsedBody.refresh_token,
|
619
645
|
};
|
@@ -789,7 +815,7 @@ class IdentityClient extends coreClient.ServiceClient {
|
|
789
815
|
}
|
790
816
|
|
791
817
|
// Copyright (c) Microsoft Corporation.
|
792
|
-
// Licensed under the MIT
|
818
|
+
// Licensed under the MIT License.
|
793
819
|
const CommonTenantId = "common";
|
794
820
|
const AzureAccountClientId = "aebc6443-996d-45c2-90f0-388ff96faa56"; // VSC: 'aebc6443-996d-45c2-90f0-388ff96faa56'
|
795
821
|
const logger$k = credentialLogger("VisualStudioCodeCredential");
|
@@ -970,7 +996,7 @@ class VisualStudioCodeCredential {
|
|
970
996
|
}
|
971
997
|
|
972
998
|
// Copyright (c) Microsoft Corporation.
|
973
|
-
// Licensed under the MIT
|
999
|
+
// Licensed under the MIT License.
|
974
1000
|
/**
|
975
1001
|
* The context passed to an Identity plugin. This contains objects that
|
976
1002
|
* plugins can use to set backend implementations.
|
@@ -1013,7 +1039,7 @@ function useIdentityPlugin(plugin) {
|
|
1013
1039
|
}
|
1014
1040
|
|
1015
1041
|
// Copyright (c) Microsoft Corporation.
|
1016
|
-
// Licensed under the MIT
|
1042
|
+
// Licensed under the MIT License.
|
1017
1043
|
/**
|
1018
1044
|
* @internal
|
1019
1045
|
*/
|
@@ -1215,7 +1241,7 @@ function deserializeAuthenticationRecord(serializedRecord) {
|
|
1215
1241
|
}
|
1216
1242
|
|
1217
1243
|
// Copyright (c) Microsoft Corporation.
|
1218
|
-
// Licensed under the MIT
|
1244
|
+
// Licensed under the MIT License.
|
1219
1245
|
const msiName$1 = "ManagedIdentityCredential - IMDS";
|
1220
1246
|
const logger$i = credentialLogger(msiName$1);
|
1221
1247
|
/**
|
@@ -1352,7 +1378,7 @@ const imdsMsi = {
|
|
1352
1378
|
};
|
1353
1379
|
|
1354
1380
|
// Copyright (c) Microsoft Corporation.
|
1355
|
-
// Licensed under the MIT
|
1381
|
+
// Licensed under the MIT License.
|
1356
1382
|
// Matches the default retry configuration in expontentialRetryStrategy.ts
|
1357
1383
|
const DEFAULT_CLIENT_MAX_RETRY_INTERVAL = 1000 * 64;
|
1358
1384
|
/**
|
@@ -1387,7 +1413,7 @@ function imdsRetryPolicy(msiRetryConfig) {
|
|
1387
1413
|
}
|
1388
1414
|
|
1389
1415
|
// Copyright (c) Microsoft Corporation.
|
1390
|
-
// Licensed under the MIT
|
1416
|
+
// Licensed under the MIT License.
|
1391
1417
|
/**
|
1392
1418
|
* Helps specify a regional authority, or "AutoDiscoverRegion" to auto-detect the region.
|
1393
1419
|
*/
|
@@ -1527,7 +1553,7 @@ function calculateRegionalAuthority(regionalAuthority) {
|
|
1527
1553
|
}
|
1528
1554
|
|
1529
1555
|
// Copyright (c) Microsoft Corporation.
|
1530
|
-
// Licensed under the MIT
|
1556
|
+
// Licensed under the MIT License.
|
1531
1557
|
/**
|
1532
1558
|
* The default logger used if no logger was passed in by the credential.
|
1533
1559
|
*/
|
@@ -1684,7 +1710,7 @@ To work with multiple accounts for the same Client ID and Tenant ID, please prov
|
|
1684
1710
|
* @returns A promise that resolves to an AccessToken object containing the access token and its expiration timestamp.
|
1685
1711
|
*/
|
1686
1712
|
async function withSilentAuthentication(msalApp, scopes, options, onAuthenticationRequired) {
|
1687
|
-
var _a;
|
1713
|
+
var _a, _b;
|
1688
1714
|
let response = null;
|
1689
1715
|
try {
|
1690
1716
|
response = await getTokenSilent(msalApp, scopes, options);
|
@@ -1717,9 +1743,11 @@ To work with multiple accounts for the same Client ID and Tenant ID, please prov
|
|
1717
1743
|
return {
|
1718
1744
|
token: response.accessToken,
|
1719
1745
|
expiresOnTimestamp: response.expiresOn.getTime(),
|
1746
|
+
refreshAfterTimestamp: (_b = response.refreshOn) === null || _b === void 0 ? void 0 : _b.getTime(),
|
1720
1747
|
};
|
1721
1748
|
}
|
1722
1749
|
async function getTokenByClientSecret(scopes, clientSecret, options = {}) {
|
1750
|
+
var _a;
|
1723
1751
|
state.logger.getToken.info(`Attempting to acquire token using client secret`);
|
1724
1752
|
state.msalConfig.auth.clientSecret = clientSecret;
|
1725
1753
|
const msalApp = await getConfidentialApp(options);
|
@@ -1735,6 +1763,7 @@ To work with multiple accounts for the same Client ID and Tenant ID, please prov
|
|
1735
1763
|
return {
|
1736
1764
|
token: response.accessToken,
|
1737
1765
|
expiresOnTimestamp: response.expiresOn.getTime(),
|
1766
|
+
refreshAfterTimestamp: (_a = response.refreshOn) === null || _a === void 0 ? void 0 : _a.getTime(),
|
1738
1767
|
};
|
1739
1768
|
}
|
1740
1769
|
catch (err) {
|
@@ -1742,6 +1771,7 @@ To work with multiple accounts for the same Client ID and Tenant ID, please prov
|
|
1742
1771
|
}
|
1743
1772
|
}
|
1744
1773
|
async function getTokenByClientAssertion(scopes, clientAssertion, options = {}) {
|
1774
|
+
var _a;
|
1745
1775
|
state.logger.getToken.info(`Attempting to acquire token using client assertion`);
|
1746
1776
|
state.msalConfig.auth.clientAssertion = clientAssertion;
|
1747
1777
|
const msalApp = await getConfidentialApp(options);
|
@@ -1758,6 +1788,7 @@ To work with multiple accounts for the same Client ID and Tenant ID, please prov
|
|
1758
1788
|
return {
|
1759
1789
|
token: response.accessToken,
|
1760
1790
|
expiresOnTimestamp: response.expiresOn.getTime(),
|
1791
|
+
refreshAfterTimestamp: (_a = response.refreshOn) === null || _a === void 0 ? void 0 : _a.getTime(),
|
1761
1792
|
};
|
1762
1793
|
}
|
1763
1794
|
catch (err) {
|
@@ -1765,6 +1796,7 @@ To work with multiple accounts for the same Client ID and Tenant ID, please prov
|
|
1765
1796
|
}
|
1766
1797
|
}
|
1767
1798
|
async function getTokenByClientCertificate(scopes, certificate, options = {}) {
|
1799
|
+
var _a;
|
1768
1800
|
state.logger.getToken.info(`Attempting to acquire token using client certificate`);
|
1769
1801
|
state.msalConfig.auth.clientCertificate = certificate;
|
1770
1802
|
const msalApp = await getConfidentialApp(options);
|
@@ -1780,6 +1812,7 @@ To work with multiple accounts for the same Client ID and Tenant ID, please prov
|
|
1780
1812
|
return {
|
1781
1813
|
token: response.accessToken,
|
1782
1814
|
expiresOnTimestamp: response.expiresOn.getTime(),
|
1815
|
+
refreshAfterTimestamp: (_a = response.refreshOn) === null || _a === void 0 ? void 0 : _a.getTime(),
|
1783
1816
|
};
|
1784
1817
|
}
|
1785
1818
|
catch (err) {
|
@@ -1850,6 +1883,7 @@ To work with multiple accounts for the same Client ID and Tenant ID, please prov
|
|
1850
1883
|
});
|
1851
1884
|
}
|
1852
1885
|
async function getTokenOnBehalfOf(scopes, userAssertionToken, clientCredentials, options = {}) {
|
1886
|
+
var _a;
|
1853
1887
|
msalLogger.getToken.info(`Attempting to acquire token on behalf of another user`);
|
1854
1888
|
if (typeof clientCredentials === "string") {
|
1855
1889
|
// Client secret
|
@@ -1879,6 +1913,7 @@ To work with multiple accounts for the same Client ID and Tenant ID, please prov
|
|
1879
1913
|
return {
|
1880
1914
|
token: response.accessToken,
|
1881
1915
|
expiresOnTimestamp: response.expiresOn.getTime(),
|
1916
|
+
refreshAfterTimestamp: (_a = response.refreshOn) === null || _a === void 0 ? void 0 : _a.getTime(),
|
1882
1917
|
};
|
1883
1918
|
}
|
1884
1919
|
catch (err) {
|
@@ -1967,7 +2002,7 @@ To work with multiple accounts for the same Client ID and Tenant ID, please prov
|
|
1967
2002
|
}
|
1968
2003
|
|
1969
2004
|
// Copyright (c) Microsoft Corporation.
|
1970
|
-
// Licensed under the MIT
|
2005
|
+
// Licensed under the MIT License.
|
1971
2006
|
const logger$h = credentialLogger("ClientAssertionCredential");
|
1972
2007
|
/**
|
1973
2008
|
* Authenticates a service principal with a JWT assertion.
|
@@ -2017,7 +2052,7 @@ class ClientAssertionCredential {
|
|
2017
2052
|
}
|
2018
2053
|
|
2019
2054
|
// Copyright (c) Microsoft Corporation.
|
2020
|
-
// Licensed under the MIT
|
2055
|
+
// Licensed under the MIT License.
|
2021
2056
|
const credentialName$4 = "WorkloadIdentityCredential";
|
2022
2057
|
/**
|
2023
2058
|
* Contains the list of all supported environment variable names so that an
|
@@ -2126,7 +2161,7 @@ class WorkloadIdentityCredential {
|
|
2126
2161
|
}
|
2127
2162
|
|
2128
2163
|
// Copyright (c) Microsoft Corporation.
|
2129
|
-
// Licensed under the MIT
|
2164
|
+
// Licensed under the MIT License.
|
2130
2165
|
const msiName = "ManagedIdentityCredential - Token Exchange";
|
2131
2166
|
const logger$f = credentialLogger(msiName);
|
2132
2167
|
/**
|
@@ -2153,7 +2188,7 @@ const tokenExchangeMsi = {
|
|
2153
2188
|
};
|
2154
2189
|
|
2155
2190
|
// Copyright (c) Microsoft Corporation.
|
2156
|
-
// Licensed under the MIT
|
2191
|
+
// Licensed under the MIT License.
|
2157
2192
|
const logger$e = credentialLogger("ManagedIdentityCredential(MSAL)");
|
2158
2193
|
class MsalMsiProvider {
|
2159
2194
|
constructor(clientIdOrOptions, options = {}) {
|
@@ -2222,6 +2257,7 @@ class MsalMsiProvider {
|
|
2222
2257
|
throw new CredentialUnavailableError(`ManagedIdentityCredential: Multiple scopes are not supported. Scopes: ${JSON.stringify(scopes)}`);
|
2223
2258
|
}
|
2224
2259
|
return tracingClient.withSpan("ManagedIdentityCredential.getToken", options, async () => {
|
2260
|
+
var _a;
|
2225
2261
|
try {
|
2226
2262
|
const isTokenExchangeMsi = await tokenExchangeMsi.isAvailable({
|
2227
2263
|
scopes,
|
@@ -2281,6 +2317,7 @@ class MsalMsiProvider {
|
|
2281
2317
|
return {
|
2282
2318
|
expiresOnTimestamp: token.expiresOn.getTime(),
|
2283
2319
|
token: token.accessToken,
|
2320
|
+
refreshAfterTimestamp: (_a = token.refreshOn) === null || _a === void 0 ? void 0 : _a.getTime(),
|
2284
2321
|
};
|
2285
2322
|
}
|
2286
2323
|
catch (err) {
|
@@ -2340,7 +2377,7 @@ function isNetworkError(err) {
|
|
2340
2377
|
}
|
2341
2378
|
|
2342
2379
|
// Copyright (c) Microsoft Corporation.
|
2343
|
-
// Licensed under the MIT
|
2380
|
+
// Licensed under the MIT License.
|
2344
2381
|
/**
|
2345
2382
|
* Attempts authentication using a managed identity available at the deployment environment.
|
2346
2383
|
* This authentication type works in Azure VMs, App Service instances, Azure Functions applications,
|
@@ -2376,7 +2413,7 @@ class ManagedIdentityCredential {
|
|
2376
2413
|
}
|
2377
2414
|
|
2378
2415
|
// Copyright (c) Microsoft Corporation.
|
2379
|
-
// Licensed under the MIT
|
2416
|
+
// Licensed under the MIT License.
|
2380
2417
|
/**
|
2381
2418
|
* Ensures the scopes value is an array.
|
2382
2419
|
* @internal
|
@@ -2404,7 +2441,7 @@ function getScopeResource(scope) {
|
|
2404
2441
|
}
|
2405
2442
|
|
2406
2443
|
// Copyright (c) Microsoft Corporation.
|
2407
|
-
// Licensed under the MIT
|
2444
|
+
// Licensed under the MIT License.
|
2408
2445
|
/**
|
2409
2446
|
* Mockable reference to the CLI credential cliCredentialFunctions
|
2410
2447
|
* @internal
|
@@ -2571,7 +2608,7 @@ class AzureCliCredential {
|
|
2571
2608
|
}
|
2572
2609
|
|
2573
2610
|
// Copyright (c) Microsoft Corporation.
|
2574
|
-
// Licensed under the MIT
|
2611
|
+
// Licensed under the MIT License.
|
2575
2612
|
/**
|
2576
2613
|
* Mockable reference to the Developer CLI credential cliCredentialFunctions
|
2577
2614
|
* @internal
|
@@ -2735,7 +2772,7 @@ class AzureDeveloperCliCredential {
|
|
2735
2772
|
}
|
2736
2773
|
|
2737
2774
|
// Copyright (c) Microsoft Corporation.
|
2738
|
-
// Licensed under the MIT
|
2775
|
+
// Licensed under the MIT License.
|
2739
2776
|
/**
|
2740
2777
|
* Easy to mock childProcess utils.
|
2741
2778
|
* @internal
|
@@ -2766,7 +2803,7 @@ const processUtils = {
|
|
2766
2803
|
};
|
2767
2804
|
|
2768
2805
|
// Copyright (c) Microsoft Corporation.
|
2769
|
-
// Licensed under the MIT
|
2806
|
+
// Licensed under the MIT License.
|
2770
2807
|
const logger$b = credentialLogger("AzurePowerShellCredential");
|
2771
2808
|
const isWindows = process.platform === "win32";
|
2772
2809
|
/**
|
@@ -2988,7 +3025,7 @@ async function parseJsonToken(result) {
|
|
2988
3025
|
}
|
2989
3026
|
|
2990
3027
|
// Copyright (c) Microsoft Corporation.
|
2991
|
-
// Licensed under the MIT
|
3028
|
+
// Licensed under the MIT License.
|
2992
3029
|
/**
|
2993
3030
|
* @internal
|
2994
3031
|
*/
|
@@ -3067,7 +3104,7 @@ class ChainedTokenCredential {
|
|
3067
3104
|
}
|
3068
3105
|
|
3069
3106
|
// Copyright (c) Microsoft Corporation.
|
3070
|
-
// Licensed under the MIT
|
3107
|
+
// Licensed under the MIT License.
|
3071
3108
|
const credentialName$3 = "ClientCertificateCredential";
|
3072
3109
|
const logger$9 = credentialLogger(credentialName$3);
|
3073
3110
|
/**
|
@@ -3180,7 +3217,7 @@ async function parseCertificate(certificateConfiguration, sendCertificateChain)
|
|
3180
3217
|
}
|
3181
3218
|
|
3182
3219
|
// Copyright (c) Microsoft Corporation.
|
3183
|
-
// Licensed under the MIT
|
3220
|
+
// Licensed under the MIT License.
|
3184
3221
|
const logger$8 = credentialLogger("ClientSecretCredential");
|
3185
3222
|
/**
|
3186
3223
|
* Enables authentication to Microsoft Entra ID using a client secret
|
@@ -3234,7 +3271,7 @@ class ClientSecretCredential {
|
|
3234
3271
|
}
|
3235
3272
|
|
3236
3273
|
// Copyright (c) Microsoft Corporation.
|
3237
|
-
// Licensed under the MIT
|
3274
|
+
// Licensed under the MIT License.
|
3238
3275
|
const logger$7 = credentialLogger("UsernamePasswordCredential");
|
3239
3276
|
/**
|
3240
3277
|
* Enables authentication to Microsoft Entra ID with a user's
|
@@ -3295,7 +3332,7 @@ class UsernamePasswordCredential {
|
|
3295
3332
|
}
|
3296
3333
|
|
3297
3334
|
// Copyright (c) Microsoft Corporation.
|
3298
|
-
// Licensed under the MIT
|
3335
|
+
// Licensed under the MIT License.
|
3299
3336
|
/**
|
3300
3337
|
* Contains the list of all supported environment variable names so that an
|
3301
3338
|
* appropriate error message can be generated when no credentials can be
|
@@ -3418,7 +3455,7 @@ class EnvironmentCredential {
|
|
3418
3455
|
}
|
3419
3456
|
|
3420
3457
|
// Copyright (c) Microsoft Corporation.
|
3421
|
-
// Licensed under the MIT
|
3458
|
+
// Licensed under the MIT License.
|
3422
3459
|
const logger$5 = credentialLogger("DefaultAzureCredential");
|
3423
3460
|
/**
|
3424
3461
|
* Creates a {@link ManagedIdentityCredential} from the provided options.
|
@@ -3561,7 +3598,7 @@ class DefaultAzureCredential extends ChainedTokenCredential {
|
|
3561
3598
|
}
|
3562
3599
|
|
3563
3600
|
// Copyright (c) Microsoft Corporation.
|
3564
|
-
// Licensed under the MIT
|
3601
|
+
// Licensed under the MIT License.
|
3565
3602
|
const logger$4 = credentialLogger("InteractiveBrowserCredential");
|
3566
3603
|
/**
|
3567
3604
|
* Enables authentication to Microsoft Entra ID inside of the web browser
|
@@ -3646,7 +3683,7 @@ class InteractiveBrowserCredential {
|
|
3646
3683
|
}
|
3647
3684
|
|
3648
3685
|
// Copyright (c) Microsoft Corporation.
|
3649
|
-
// Licensed under the MIT
|
3686
|
+
// Licensed under the MIT License.
|
3650
3687
|
const logger$3 = credentialLogger("DeviceCodeCredential");
|
3651
3688
|
/**
|
3652
3689
|
* Method that logs the user code from the DeviceCodeCredential.
|
@@ -3729,7 +3766,7 @@ class DeviceCodeCredential {
|
|
3729
3766
|
}
|
3730
3767
|
|
3731
3768
|
// Copyright (c) Microsoft Corporation.
|
3732
|
-
// Licensed under the MIT
|
3769
|
+
// Licensed under the MIT License.
|
3733
3770
|
const credentialName$1 = "AzurePipelinesCredential";
|
3734
3771
|
const logger$2 = credentialLogger(credentialName$1);
|
3735
3772
|
const OIDC_API_VERSION = "7.1";
|
@@ -3853,7 +3890,7 @@ function handleOidcResponse(response) {
|
|
3853
3890
|
}
|
3854
3891
|
|
3855
3892
|
// Copyright (c) Microsoft Corporation.
|
3856
|
-
// Licensed under the MIT
|
3893
|
+
// Licensed under the MIT License.
|
3857
3894
|
const logger$1 = credentialLogger("AuthorizationCodeCredential");
|
3858
3895
|
/**
|
3859
3896
|
* Enables authentication to Microsoft Entra ID using an authorization code
|
@@ -3907,7 +3944,7 @@ class AuthorizationCodeCredential {
|
|
3907
3944
|
}
|
3908
3945
|
|
3909
3946
|
// Copyright (c) Microsoft Corporation.
|
3910
|
-
// Licensed under the MIT
|
3947
|
+
// Licensed under the MIT License.
|
3911
3948
|
const credentialName = "OnBehalfOfCredential";
|
3912
3949
|
const logger = credentialLogger(credentialName);
|
3913
3950
|
/**
|
@@ -4011,7 +4048,7 @@ class OnBehalfOfCredential {
|
|
4011
4048
|
}
|
4012
4049
|
|
4013
4050
|
// Copyright (c) Microsoft Corporation.
|
4014
|
-
// Licensed under the MIT
|
4051
|
+
// Licensed under the MIT License.
|
4015
4052
|
/**
|
4016
4053
|
* Returns a callback that provides a bearer token.
|
4017
4054
|
* For example, the bearer token can be used to authenticate a request as follows:
|
@@ -4062,7 +4099,7 @@ function getBearerTokenProvider(credential, scopes, options) {
|
|
4062
4099
|
}
|
4063
4100
|
|
4064
4101
|
// Copyright (c) Microsoft Corporation.
|
4065
|
-
// Licensed under the MIT
|
4102
|
+
// Licensed under the MIT License.
|
4066
4103
|
/**
|
4067
4104
|
* Returns a new instance of the {@link DefaultAzureCredential}.
|
4068
4105
|
*/
|