@azure/identity 3.3.1-alpha.20231009.1 → 3.3.1
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.
Potentially problematic release.
This version of @azure/identity might be problematic. Click here for more details.
- package/dist/index.js +51 -66
- package/dist/index.js.map +1 -1
- package/dist-esm/src/credentials/azureCliCredential.js +8 -2
- package/dist-esm/src/credentials/azureCliCredential.js.map +1 -1
- package/dist-esm/src/credentials/azureDeveloperCliCredential.js +12 -3
- package/dist-esm/src/credentials/azureDeveloperCliCredential.js.map +1 -1
- package/dist-esm/src/credentials/azurePowerShellCredential.js +8 -6
- package/dist-esm/src/credentials/azurePowerShellCredential.js.map +1 -1
- package/package.json +9 -11
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
3
5
|
var msalNode = require('@azure/msal-node');
|
|
4
6
|
var logger$o = require('@azure/logger');
|
|
5
7
|
var msalCommon = require('@azure/msal-common');
|
|
@@ -21,7 +23,10 @@ var http = require('http');
|
|
|
21
23
|
var open = require('open');
|
|
22
24
|
var stoppable = require('stoppable');
|
|
23
25
|
|
|
24
|
-
function
|
|
26
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
27
|
+
|
|
28
|
+
function _interopNamespace(e) {
|
|
29
|
+
if (e && e.__esModule) return e;
|
|
25
30
|
var n = Object.create(null);
|
|
26
31
|
if (e) {
|
|
27
32
|
Object.keys(e).forEach(function (k) {
|
|
@@ -34,13 +39,21 @@ function _interopNamespaceDefault(e) {
|
|
|
34
39
|
}
|
|
35
40
|
});
|
|
36
41
|
}
|
|
37
|
-
n
|
|
42
|
+
n["default"] = e;
|
|
38
43
|
return Object.freeze(n);
|
|
39
44
|
}
|
|
40
45
|
|
|
41
|
-
var msalNode__namespace = /*#__PURE__*/
|
|
42
|
-
var msalCommon__namespace = /*#__PURE__*/
|
|
43
|
-
var
|
|
46
|
+
var msalNode__namespace = /*#__PURE__*/_interopNamespace(msalNode);
|
|
47
|
+
var msalCommon__namespace = /*#__PURE__*/_interopNamespace(msalCommon);
|
|
48
|
+
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
|
|
49
|
+
var os__default = /*#__PURE__*/_interopDefaultLegacy(os);
|
|
50
|
+
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
|
|
51
|
+
var https__default = /*#__PURE__*/_interopDefaultLegacy(https);
|
|
52
|
+
var child_process__default = /*#__PURE__*/_interopDefaultLegacy(child_process);
|
|
53
|
+
var child_process__namespace = /*#__PURE__*/_interopNamespace(child_process);
|
|
54
|
+
var http__default = /*#__PURE__*/_interopDefaultLegacy(http);
|
|
55
|
+
var open__default = /*#__PURE__*/_interopDefaultLegacy(open);
|
|
56
|
+
var stoppable__default = /*#__PURE__*/_interopDefaultLegacy(stoppable);
|
|
44
57
|
|
|
45
58
|
// Copyright (c) Microsoft Corporation.
|
|
46
59
|
// Licensed under the MIT license.
|
|
@@ -162,7 +175,6 @@ class AuthenticationRequiredError extends Error {
|
|
|
162
175
|
}
|
|
163
176
|
|
|
164
177
|
// Copyright (c) Microsoft Corporation.
|
|
165
|
-
// Licensed under the MIT license.
|
|
166
178
|
/**
|
|
167
179
|
* The AzureLogger used for all clients within the identity package
|
|
168
180
|
*/
|
|
@@ -293,7 +305,6 @@ const CACHE_CAE_SUFFIX = ".cae";
|
|
|
293
305
|
const CACHE_NON_CAE_SUFFIX = ".nocae";
|
|
294
306
|
|
|
295
307
|
// Copyright (c) Microsoft Corporation.
|
|
296
|
-
// Licensed under the MIT license.
|
|
297
308
|
/**
|
|
298
309
|
* Latest AuthenticationRecord version
|
|
299
310
|
* @internal
|
|
@@ -523,7 +534,6 @@ function deserializeAuthenticationRecord(serializedRecord) {
|
|
|
523
534
|
}
|
|
524
535
|
|
|
525
536
|
// Copyright (c) Microsoft Corporation.
|
|
526
|
-
// Licensed under the MIT license.
|
|
527
537
|
function createConfigurationErrorMessage(tenantId) {
|
|
528
538
|
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.`;
|
|
529
539
|
}
|
|
@@ -557,7 +567,6 @@ function processMultiTenantRequest(tenantId, getTokenOptions, additionallyAllowe
|
|
|
557
567
|
}
|
|
558
568
|
|
|
559
569
|
// Copyright (c) Microsoft Corporation.
|
|
560
|
-
// Licensed under the MIT license.
|
|
561
570
|
/**
|
|
562
571
|
* @internal
|
|
563
572
|
*/
|
|
@@ -609,7 +618,6 @@ function getIdentityTokenEndpointSuffix(tenantId) {
|
|
|
609
618
|
}
|
|
610
619
|
|
|
611
620
|
// Copyright (c) Microsoft Corporation.
|
|
612
|
-
// Licensed under the MIT license.
|
|
613
621
|
/**
|
|
614
622
|
* Creates a span using the global tracer.
|
|
615
623
|
* @internal
|
|
@@ -630,7 +638,6 @@ const azureArcAPIVersion = "2019-11-01";
|
|
|
630
638
|
const azureFabricVersion = "2019-07-01-preview";
|
|
631
639
|
|
|
632
640
|
// Copyright (c) Microsoft Corporation.
|
|
633
|
-
// Licensed under the MIT license.
|
|
634
641
|
/**
|
|
635
642
|
* Most MSIs send requests to the IMDS endpoint, or a similar endpoint.
|
|
636
643
|
* These are GET requests that require sending a `resource` parameter on the query.
|
|
@@ -681,7 +688,6 @@ function parseExpirationTimestamp(body) {
|
|
|
681
688
|
}
|
|
682
689
|
|
|
683
690
|
// Copyright (c) Microsoft Corporation.
|
|
684
|
-
// Licensed under the MIT license.
|
|
685
691
|
const noCorrelationId = "noCorrelationId";
|
|
686
692
|
/**
|
|
687
693
|
* @internal
|
|
@@ -1026,7 +1032,6 @@ var RegionalAuthority;
|
|
|
1026
1032
|
})(RegionalAuthority || (RegionalAuthority = {}));
|
|
1027
1033
|
|
|
1028
1034
|
// Copyright (c) Microsoft Corporation.
|
|
1029
|
-
// Licensed under the MIT license.
|
|
1030
1035
|
/**
|
|
1031
1036
|
* The current persistence provider, undefined by default.
|
|
1032
1037
|
* @internal
|
|
@@ -1308,7 +1313,6 @@ To work with multiple accounts for the same Client ID and Tenant ID, please prov
|
|
|
1308
1313
|
}
|
|
1309
1314
|
|
|
1310
1315
|
// Copyright (c) Microsoft Corporation.
|
|
1311
|
-
// Licensed under the MIT license.
|
|
1312
1316
|
const CommonTenantId = "common";
|
|
1313
1317
|
const AzureAccountClientId = "aebc6443-996d-45c2-90f0-388ff96faa56"; // VSC: 'aebc6443-996d-45c2-90f0-388ff96faa56'
|
|
1314
1318
|
const logger$m = credentialLogger("VisualStudioCodeCredential");
|
|
@@ -1343,10 +1347,10 @@ function getPropertyFromVSCode(property) {
|
|
|
1343
1347
|
const settingsPath = ["User", "settings.json"];
|
|
1344
1348
|
// Eventually we can add more folders for more versions of VSCode.
|
|
1345
1349
|
const vsCodeFolder = "Code";
|
|
1346
|
-
const homedir =
|
|
1350
|
+
const homedir = os__default["default"].homedir();
|
|
1347
1351
|
function loadProperty(...pathSegments) {
|
|
1348
|
-
const fullPath =
|
|
1349
|
-
const settings = JSON.parse(
|
|
1352
|
+
const fullPath = path__default["default"].join(...pathSegments, vsCodeFolder, ...settingsPath);
|
|
1353
|
+
const settings = JSON.parse(fs__default["default"].readFileSync(fullPath, { encoding: "utf8" }));
|
|
1350
1354
|
return settings[property];
|
|
1351
1355
|
}
|
|
1352
1356
|
try {
|
|
@@ -1489,7 +1493,6 @@ class VisualStudioCodeCredential {
|
|
|
1489
1493
|
}
|
|
1490
1494
|
|
|
1491
1495
|
// Copyright (c) Microsoft Corporation.
|
|
1492
|
-
// Licensed under the MIT license.
|
|
1493
1496
|
/**
|
|
1494
1497
|
* The context passed to an Identity plugin. This contains objects that
|
|
1495
1498
|
* plugins can use to set backend implementations.
|
|
@@ -1531,7 +1534,6 @@ function useIdentityPlugin(plugin) {
|
|
|
1531
1534
|
}
|
|
1532
1535
|
|
|
1533
1536
|
// Copyright (c) Microsoft Corporation.
|
|
1534
|
-
// Licensed under the MIT license.
|
|
1535
1537
|
const msiName$6 = "ManagedIdentityCredential - AppServiceMSI 2017";
|
|
1536
1538
|
const logger$l = credentialLogger(msiName$6);
|
|
1537
1539
|
/**
|
|
@@ -1599,7 +1601,6 @@ const appServiceMsi2017 = {
|
|
|
1599
1601
|
};
|
|
1600
1602
|
|
|
1601
1603
|
// Copyright (c) Microsoft Corporation.
|
|
1602
|
-
// Licensed under the MIT license.
|
|
1603
1604
|
const msiName$5 = "ManagedIdentityCredential - CloudShellMSI";
|
|
1604
1605
|
const logger$k = credentialLogger(msiName$5);
|
|
1605
1606
|
/**
|
|
@@ -1671,7 +1672,6 @@ const cloudShellMsi = {
|
|
|
1671
1672
|
};
|
|
1672
1673
|
|
|
1673
1674
|
// Copyright (c) Microsoft Corporation.
|
|
1674
|
-
// Licensed under the MIT license.
|
|
1675
1675
|
const msiName$4 = "ManagedIdentityCredential - IMDS";
|
|
1676
1676
|
const logger$j = credentialLogger(msiName$4);
|
|
1677
1677
|
/**
|
|
@@ -1804,7 +1804,6 @@ const imdsMsi = {
|
|
|
1804
1804
|
};
|
|
1805
1805
|
|
|
1806
1806
|
// Copyright (c) Microsoft Corporation.
|
|
1807
|
-
// Licensed under the MIT license.
|
|
1808
1807
|
const msiName$3 = "ManagedIdentityCredential - Azure Arc MSI";
|
|
1809
1808
|
const logger$i = credentialLogger(msiName$3);
|
|
1810
1809
|
/**
|
|
@@ -1915,7 +1914,6 @@ const arcMsi = {
|
|
|
1915
1914
|
};
|
|
1916
1915
|
|
|
1917
1916
|
// Copyright (c) Microsoft Corporation.
|
|
1918
|
-
// Licensed under the MIT license.
|
|
1919
1917
|
/**
|
|
1920
1918
|
* MSAL client assertion client. Calls to MSAL's confidential application's `acquireTokenByClientCredential` during `doGetToken`.
|
|
1921
1919
|
* @internal
|
|
@@ -1955,7 +1953,6 @@ class MsalClientAssertion extends MsalNode {
|
|
|
1955
1953
|
}
|
|
1956
1954
|
|
|
1957
1955
|
// Copyright (c) Microsoft Corporation.
|
|
1958
|
-
// Licensed under the MIT license.
|
|
1959
1956
|
const logger$h = credentialLogger("ClientAssertionCredential");
|
|
1960
1957
|
/**
|
|
1961
1958
|
* Authenticates a service principal with a JWT assertion.
|
|
@@ -1999,7 +1996,6 @@ class ClientAssertionCredential {
|
|
|
1999
1996
|
}
|
|
2000
1997
|
|
|
2001
1998
|
// Copyright (c) Microsoft Corporation.
|
|
2002
|
-
// Licensed under the MIT license.
|
|
2003
1999
|
const credentialName$3 = "WorkloadIdentityCredential";
|
|
2004
2000
|
/**
|
|
2005
2001
|
* Contains the list of all supported environment variable names so that an
|
|
@@ -2098,7 +2094,6 @@ class WorkloadIdentityCredential {
|
|
|
2098
2094
|
}
|
|
2099
2095
|
|
|
2100
2096
|
// Copyright (c) Microsoft Corporation.
|
|
2101
|
-
// Licensed under the MIT license.
|
|
2102
2097
|
const msiName$2 = "ManagedIdentityCredential - Token Exchange";
|
|
2103
2098
|
const logger$f = credentialLogger(msiName$2);
|
|
2104
2099
|
/**
|
|
@@ -2128,7 +2123,6 @@ function tokenExchangeMsi() {
|
|
|
2128
2123
|
}
|
|
2129
2124
|
|
|
2130
2125
|
// Copyright (c) Microsoft Corporation.
|
|
2131
|
-
// Licensed under the MIT license.
|
|
2132
2126
|
// This MSI can be easily tested by deploying a container to Azure Service Fabric with the Dockerfile:
|
|
2133
2127
|
//
|
|
2134
2128
|
// FROM node:12
|
|
@@ -2207,7 +2201,7 @@ const fabricMsi = {
|
|
|
2207
2201
|
"IDENTITY_SERVER_THUMBPRINT=[REDACTED].",
|
|
2208
2202
|
].join(" "));
|
|
2209
2203
|
const request = coreRestPipeline.createPipelineRequest(Object.assign({ abortSignal: getTokenOptions.abortSignal }, prepareRequestOptions$1(scopes, clientId, resourceId)));
|
|
2210
|
-
request.agent = new
|
|
2204
|
+
request.agent = new https__default["default"].Agent({
|
|
2211
2205
|
// This is necessary because Service Fabric provides a self-signed certificate.
|
|
2212
2206
|
// The alternative path is to verify the certificate using the IDENTITY_SERVER_THUMBPRINT env variable.
|
|
2213
2207
|
rejectUnauthorized: false,
|
|
@@ -2218,7 +2212,6 @@ const fabricMsi = {
|
|
|
2218
2212
|
};
|
|
2219
2213
|
|
|
2220
2214
|
// Copyright (c) Microsoft Corporation.
|
|
2221
|
-
// Licensed under the MIT license.
|
|
2222
2215
|
const msiName = "ManagedIdentityCredential - AppServiceMSI 2019";
|
|
2223
2216
|
const logger$d = credentialLogger(msiName);
|
|
2224
2217
|
/**
|
|
@@ -2286,7 +2279,6 @@ const appServiceMsi2019 = {
|
|
|
2286
2279
|
};
|
|
2287
2280
|
|
|
2288
2281
|
// Copyright (c) Microsoft Corporation.
|
|
2289
|
-
// Licensed under the MIT license.
|
|
2290
2282
|
const logger$c = credentialLogger("ManagedIdentityCredential");
|
|
2291
2283
|
/**
|
|
2292
2284
|
* Attempts authentication using a managed identity available at the deployment environment.
|
|
@@ -2567,7 +2559,6 @@ class ManagedIdentityCredential {
|
|
|
2567
2559
|
}
|
|
2568
2560
|
|
|
2569
2561
|
// Copyright (c) Microsoft Corporation.
|
|
2570
|
-
// Licensed under the MIT license.
|
|
2571
2562
|
/**
|
|
2572
2563
|
* Ensures the scopes value is an array.
|
|
2573
2564
|
* @internal
|
|
@@ -2595,7 +2586,6 @@ function getScopeResource(scope) {
|
|
|
2595
2586
|
}
|
|
2596
2587
|
|
|
2597
2588
|
// Copyright (c) Microsoft Corporation.
|
|
2598
|
-
// Licensed under the MIT license.
|
|
2599
2589
|
/**
|
|
2600
2590
|
* Mockable reference to the CLI credential cliCredentialFunctions
|
|
2601
2591
|
* @internal
|
|
@@ -2627,7 +2617,7 @@ const cliCredentialInternals = {
|
|
|
2627
2617
|
}
|
|
2628
2618
|
return new Promise((resolve, reject) => {
|
|
2629
2619
|
try {
|
|
2630
|
-
|
|
2620
|
+
child_process__default["default"].execFile("az", [
|
|
2631
2621
|
"account",
|
|
2632
2622
|
"get-access-token",
|
|
2633
2623
|
"--output",
|
|
@@ -2662,7 +2652,10 @@ class AzureCliCredential {
|
|
|
2662
2652
|
* @param options - Options, to optionally allow multi-tenant requests.
|
|
2663
2653
|
*/
|
|
2664
2654
|
constructor(options) {
|
|
2665
|
-
|
|
2655
|
+
if (options === null || options === void 0 ? void 0 : options.tenantId) {
|
|
2656
|
+
checkTenantId(logger$b, options === null || options === void 0 ? void 0 : options.tenantId);
|
|
2657
|
+
this.tenantId = options === null || options === void 0 ? void 0 : options.tenantId;
|
|
2658
|
+
}
|
|
2666
2659
|
this.additionallyAllowedTenantIds = resolveAddionallyAllowedTenantIds(options === null || options === void 0 ? void 0 : options.additionallyAllowedTenants);
|
|
2667
2660
|
this.timeout = options === null || options === void 0 ? void 0 : options.processTimeoutInMs;
|
|
2668
2661
|
}
|
|
@@ -2676,6 +2669,9 @@ class AzureCliCredential {
|
|
|
2676
2669
|
*/
|
|
2677
2670
|
async getToken(scopes, options = {}) {
|
|
2678
2671
|
const tenantId = processMultiTenantRequest(this.tenantId, options, this.additionallyAllowedTenantIds);
|
|
2672
|
+
if (tenantId) {
|
|
2673
|
+
checkTenantId(logger$b, tenantId);
|
|
2674
|
+
}
|
|
2679
2675
|
const scope = typeof scopes === "string" ? scopes : scopes[0];
|
|
2680
2676
|
logger$b.getToken.info(`Using the scope ${scope}`);
|
|
2681
2677
|
return tracingClient.withSpan(`${this.constructor.name}.getToken`, options, async () => {
|
|
@@ -2726,7 +2722,6 @@ class AzureCliCredential {
|
|
|
2726
2722
|
}
|
|
2727
2723
|
|
|
2728
2724
|
// Copyright (c) Microsoft Corporation.
|
|
2729
|
-
// Licensed under the MIT license.
|
|
2730
2725
|
/**
|
|
2731
2726
|
* Easy to mock childProcess utils.
|
|
2732
2727
|
* @internal
|
|
@@ -2757,7 +2752,6 @@ const processUtils = {
|
|
|
2757
2752
|
};
|
|
2758
2753
|
|
|
2759
2754
|
// Copyright (c) Microsoft Corporation.
|
|
2760
|
-
// Licensed under the MIT license.
|
|
2761
2755
|
const logger$a = credentialLogger("AzurePowerShellCredential");
|
|
2762
2756
|
const isWindows = process.platform === "win32";
|
|
2763
2757
|
/**
|
|
@@ -2838,7 +2832,10 @@ class AzurePowerShellCredential {
|
|
|
2838
2832
|
* @param options - Options, to optionally allow multi-tenant requests.
|
|
2839
2833
|
*/
|
|
2840
2834
|
constructor(options) {
|
|
2841
|
-
|
|
2835
|
+
if (options === null || options === void 0 ? void 0 : options.tenantId) {
|
|
2836
|
+
checkTenantId(logger$a, options === null || options === void 0 ? void 0 : options.tenantId);
|
|
2837
|
+
this.tenantId = options === null || options === void 0 ? void 0 : options.tenantId;
|
|
2838
|
+
}
|
|
2842
2839
|
this.additionallyAllowedTenantIds = resolveAddionallyAllowedTenantIds(options === null || options === void 0 ? void 0 : options.additionallyAllowedTenants);
|
|
2843
2840
|
this.timeout = options === null || options === void 0 ? void 0 : options.processTimeoutInMs;
|
|
2844
2841
|
}
|
|
@@ -2864,15 +2861,11 @@ class AzurePowerShellCredential {
|
|
|
2864
2861
|
const results = await runCommands([
|
|
2865
2862
|
[
|
|
2866
2863
|
powerShellCommand,
|
|
2867
|
-
"-NoProfile",
|
|
2868
|
-
"-NonInteractive",
|
|
2869
2864
|
"-Command",
|
|
2870
2865
|
"Import-Module Az.Accounts -MinimumVersion 2.2.0 -PassThru",
|
|
2871
2866
|
],
|
|
2872
2867
|
[
|
|
2873
2868
|
powerShellCommand,
|
|
2874
|
-
"-NoProfile",
|
|
2875
|
-
"-NonInteractive",
|
|
2876
2869
|
"-Command",
|
|
2877
2870
|
`Get-AzAccessToken ${tenantSection} -ResourceUrl "${resource}" | ConvertTo-Json`,
|
|
2878
2871
|
],
|
|
@@ -2898,6 +2891,9 @@ class AzurePowerShellCredential {
|
|
|
2898
2891
|
return tracingClient.withSpan(`${this.constructor.name}.getToken`, options, async () => {
|
|
2899
2892
|
const tenantId = processMultiTenantRequest(this.tenantId, options, this.additionallyAllowedTenantIds);
|
|
2900
2893
|
const scope = typeof scopes === "string" ? scopes : scopes[0];
|
|
2894
|
+
if (tenantId) {
|
|
2895
|
+
checkTenantId(logger$a, tenantId);
|
|
2896
|
+
}
|
|
2901
2897
|
try {
|
|
2902
2898
|
ensureValidScopeForDevTimeCreds(scope, logger$a);
|
|
2903
2899
|
logger$a.getToken.info(`Using the scope ${scope}`);
|
|
@@ -2929,7 +2925,6 @@ class AzurePowerShellCredential {
|
|
|
2929
2925
|
}
|
|
2930
2926
|
|
|
2931
2927
|
// Copyright (c) Microsoft Corporation.
|
|
2932
|
-
// Licensed under the MIT license.
|
|
2933
2928
|
/**
|
|
2934
2929
|
* @internal
|
|
2935
2930
|
*/
|
|
@@ -3008,7 +3003,6 @@ class ChainedTokenCredential {
|
|
|
3008
3003
|
}
|
|
3009
3004
|
|
|
3010
3005
|
// Copyright (c) Microsoft Corporation.
|
|
3011
|
-
// Licensed under the MIT license.
|
|
3012
3006
|
const readFileAsync = util.promisify(fs.readFile);
|
|
3013
3007
|
/**
|
|
3014
3008
|
* Tries to asynchronously load a certificate from the given path.
|
|
@@ -3114,7 +3108,6 @@ class MsalClientCertificate extends MsalNode {
|
|
|
3114
3108
|
}
|
|
3115
3109
|
|
|
3116
3110
|
// Copyright (c) Microsoft Corporation.
|
|
3117
|
-
// Licensed under the MIT license.
|
|
3118
3111
|
const credentialName$2 = "ClientCertificateCredential";
|
|
3119
3112
|
const logger$8 = credentialLogger(credentialName$2);
|
|
3120
3113
|
/**
|
|
@@ -3169,7 +3162,6 @@ class ClientCertificateCredential {
|
|
|
3169
3162
|
}
|
|
3170
3163
|
|
|
3171
3164
|
// Copyright (c) Microsoft Corporation.
|
|
3172
|
-
// Licensed under the MIT license.
|
|
3173
3165
|
/**
|
|
3174
3166
|
* MSAL client secret client. Calls to MSAL's confidential application's `acquireTokenByClientCredential` during `doGetToken`.
|
|
3175
3167
|
* @internal
|
|
@@ -3200,7 +3192,6 @@ class MsalClientSecret extends MsalNode {
|
|
|
3200
3192
|
}
|
|
3201
3193
|
|
|
3202
3194
|
// Copyright (c) Microsoft Corporation.
|
|
3203
|
-
// Licensed under the MIT license.
|
|
3204
3195
|
const logger$7 = credentialLogger("ClientSecretCredential");
|
|
3205
3196
|
/**
|
|
3206
3197
|
* Enables authentication to Azure Active Directory using a client secret
|
|
@@ -3250,7 +3241,6 @@ class ClientSecretCredential {
|
|
|
3250
3241
|
}
|
|
3251
3242
|
|
|
3252
3243
|
// Copyright (c) Microsoft Corporation.
|
|
3253
|
-
// Licensed under the MIT license.
|
|
3254
3244
|
/**
|
|
3255
3245
|
* MSAL username and password client. Calls to the MSAL's public application's `acquireTokenByUsernamePassword` during `doGetToken`.
|
|
3256
3246
|
* @internal
|
|
@@ -3281,7 +3271,6 @@ class MsalUsernamePassword extends MsalNode {
|
|
|
3281
3271
|
}
|
|
3282
3272
|
|
|
3283
3273
|
// Copyright (c) Microsoft Corporation.
|
|
3284
|
-
// Licensed under the MIT license.
|
|
3285
3274
|
const logger$6 = credentialLogger("UsernamePasswordCredential");
|
|
3286
3275
|
/**
|
|
3287
3276
|
* Enables authentication to Azure Active Directory with a user's
|
|
@@ -3335,7 +3324,6 @@ class UsernamePasswordCredential {
|
|
|
3335
3324
|
}
|
|
3336
3325
|
|
|
3337
3326
|
// Copyright (c) Microsoft Corporation.
|
|
3338
|
-
// Licensed under the MIT license.
|
|
3339
3327
|
/**
|
|
3340
3328
|
* Contains the list of all supported environment variable names so that an
|
|
3341
3329
|
* appropriate error message can be generated when no credentials can be
|
|
@@ -3448,7 +3436,6 @@ class EnvironmentCredential {
|
|
|
3448
3436
|
}
|
|
3449
3437
|
|
|
3450
3438
|
// Copyright (c) Microsoft Corporation.
|
|
3451
|
-
// Licensed under the MIT license.
|
|
3452
3439
|
/**
|
|
3453
3440
|
* Mockable reference to the Developer CLI credential cliCredentialFunctions
|
|
3454
3441
|
* @internal
|
|
@@ -3480,7 +3467,7 @@ const developerCliCredentialInternals = {
|
|
|
3480
3467
|
}
|
|
3481
3468
|
return new Promise((resolve, reject) => {
|
|
3482
3469
|
try {
|
|
3483
|
-
|
|
3470
|
+
child_process__default["default"].execFile("azd", [
|
|
3484
3471
|
"auth",
|
|
3485
3472
|
"token",
|
|
3486
3473
|
"--output",
|
|
@@ -3489,7 +3476,6 @@ const developerCliCredentialInternals = {
|
|
|
3489
3476
|
...tenantSection,
|
|
3490
3477
|
], {
|
|
3491
3478
|
cwd: developerCliCredentialInternals.getSafeWorkingDir(),
|
|
3492
|
-
shell: true,
|
|
3493
3479
|
timeout,
|
|
3494
3480
|
}, (error, stdout, stderr) => {
|
|
3495
3481
|
resolve({ stdout, stderr, error });
|
|
@@ -3537,7 +3523,10 @@ class AzureDeveloperCliCredential {
|
|
|
3537
3523
|
* @param options - Options, to optionally allow multi-tenant requests.
|
|
3538
3524
|
*/
|
|
3539
3525
|
constructor(options) {
|
|
3540
|
-
|
|
3526
|
+
if (options === null || options === void 0 ? void 0 : options.tenantId) {
|
|
3527
|
+
checkTenantId(logger$4, options === null || options === void 0 ? void 0 : options.tenantId);
|
|
3528
|
+
this.tenantId = options === null || options === void 0 ? void 0 : options.tenantId;
|
|
3529
|
+
}
|
|
3541
3530
|
this.additionallyAllowedTenantIds = resolveAddionallyAllowedTenantIds(options === null || options === void 0 ? void 0 : options.additionallyAllowedTenants);
|
|
3542
3531
|
this.timeout = options === null || options === void 0 ? void 0 : options.processTimeoutInMs;
|
|
3543
3532
|
}
|
|
@@ -3551,6 +3540,9 @@ class AzureDeveloperCliCredential {
|
|
|
3551
3540
|
*/
|
|
3552
3541
|
async getToken(scopes, options = {}) {
|
|
3553
3542
|
const tenantId = processMultiTenantRequest(this.tenantId, options, this.additionallyAllowedTenantIds);
|
|
3543
|
+
if (tenantId) {
|
|
3544
|
+
checkTenantId(logger$4, tenantId);
|
|
3545
|
+
}
|
|
3554
3546
|
let scopeList;
|
|
3555
3547
|
if (typeof scopes === "string") {
|
|
3556
3548
|
scopeList = [scopes];
|
|
@@ -3562,6 +3554,9 @@ class AzureDeveloperCliCredential {
|
|
|
3562
3554
|
return tracingClient.withSpan(`${this.constructor.name}.getToken`, options, async () => {
|
|
3563
3555
|
var _a, _b, _c, _d;
|
|
3564
3556
|
try {
|
|
3557
|
+
scopeList.forEach((scope) => {
|
|
3558
|
+
ensureValidScopeForDevTimeCreds(scope, logger$4);
|
|
3559
|
+
});
|
|
3565
3560
|
const obj = await developerCliCredentialInternals.getAzdAccessToken(scopeList, tenantId, this.timeout);
|
|
3566
3561
|
const isNotLoggedInError = ((_a = obj.stderr) === null || _a === void 0 ? void 0 : _a.match("not logged in, run `azd login` to login")) ||
|
|
3567
3562
|
((_b = obj.stderr) === null || _b === void 0 ? void 0 : _b.match("not logged in, run `azd auth login` to login"));
|
|
@@ -3604,7 +3599,6 @@ class AzureDeveloperCliCredential {
|
|
|
3604
3599
|
}
|
|
3605
3600
|
|
|
3606
3601
|
// Copyright (c) Microsoft Corporation.
|
|
3607
|
-
// Licensed under the MIT license.
|
|
3608
3602
|
/**
|
|
3609
3603
|
* A shim around ManagedIdentityCredential that adapts it to accept
|
|
3610
3604
|
* `DefaultAzureCredentialOptions`.
|
|
@@ -3701,13 +3695,12 @@ class DefaultAzureCredential extends ChainedTokenCredential {
|
|
|
3701
3695
|
}
|
|
3702
3696
|
|
|
3703
3697
|
// Copyright (c) Microsoft Corporation.
|
|
3704
|
-
// Licensed under the MIT license.
|
|
3705
3698
|
/**
|
|
3706
3699
|
* A call to open(), but mockable
|
|
3707
3700
|
* @internal
|
|
3708
3701
|
*/
|
|
3709
3702
|
const interactiveBrowserMockable = {
|
|
3710
|
-
open,
|
|
3703
|
+
open: open__default["default"],
|
|
3711
3704
|
};
|
|
3712
3705
|
/**
|
|
3713
3706
|
* This MSAL client sets up a web server to listen for redirect callbacks, then calls to the MSAL's public application's `acquireTokenByDeviceCode` during `doGetToken`
|
|
@@ -3789,8 +3782,8 @@ class MsalOpenBrowser extends MsalNode {
|
|
|
3789
3782
|
cleanup();
|
|
3790
3783
|
});
|
|
3791
3784
|
};
|
|
3792
|
-
const app =
|
|
3793
|
-
const server =
|
|
3785
|
+
const app = http__default["default"].createServer(requestListener);
|
|
3786
|
+
const server = stoppable__default["default"](app);
|
|
3794
3787
|
const listen = app.listen(this.port, this.hostname, () => this.logger.info(`InteractiveBrowserCredential listening on port ${this.port}!`));
|
|
3795
3788
|
function cleanup() {
|
|
3796
3789
|
if (listen) {
|
|
@@ -3862,7 +3855,6 @@ class MsalOpenBrowser extends MsalNode {
|
|
|
3862
3855
|
}
|
|
3863
3856
|
|
|
3864
3857
|
// Copyright (c) Microsoft Corporation.
|
|
3865
|
-
// Licensed under the MIT license.
|
|
3866
3858
|
const logger$3 = credentialLogger("InteractiveBrowserCredential");
|
|
3867
3859
|
/**
|
|
3868
3860
|
* Enables authentication to Azure Active Directory inside of the web browser
|
|
@@ -3933,7 +3925,6 @@ class InteractiveBrowserCredential {
|
|
|
3933
3925
|
}
|
|
3934
3926
|
|
|
3935
3927
|
// Copyright (c) Microsoft Corporation.
|
|
3936
|
-
// Licensed under the MIT license.
|
|
3937
3928
|
/**
|
|
3938
3929
|
* MSAL device code client. Calls to the MSAL's public application's `acquireTokenByDeviceCode` during `doGetToken`.
|
|
3939
3930
|
* @internal
|
|
@@ -3966,7 +3957,6 @@ class MsalDeviceCode extends MsalNode {
|
|
|
3966
3957
|
}
|
|
3967
3958
|
|
|
3968
3959
|
// Copyright (c) Microsoft Corporation.
|
|
3969
|
-
// Licensed under the MIT license.
|
|
3970
3960
|
const logger$2 = credentialLogger("DeviceCodeCredential");
|
|
3971
3961
|
/**
|
|
3972
3962
|
* Method that logs the user code from the DeviceCodeCredential.
|
|
@@ -4045,7 +4035,6 @@ class DeviceCodeCredential {
|
|
|
4045
4035
|
}
|
|
4046
4036
|
|
|
4047
4037
|
// Copyright (c) Microsoft Corporation.
|
|
4048
|
-
// Licensed under the MIT license.
|
|
4049
4038
|
/**
|
|
4050
4039
|
* This MSAL client sets up a web server to listen for redirect callbacks, then calls to the MSAL's public application's `acquireTokenByDeviceCode` during `doGetToken`
|
|
4051
4040
|
* to trigger the authentication flow, and then respond based on the values obtained from the redirect callback
|
|
@@ -4089,7 +4078,6 @@ class MsalAuthorizationCode extends MsalNode {
|
|
|
4089
4078
|
}
|
|
4090
4079
|
|
|
4091
4080
|
// Copyright (c) Microsoft Corporation.
|
|
4092
|
-
// Licensed under the MIT license.
|
|
4093
4081
|
const logger$1 = credentialLogger("AuthorizationCodeCredential");
|
|
4094
4082
|
/**
|
|
4095
4083
|
* Enables authentication to Azure Active Directory using an authorization code
|
|
@@ -4145,7 +4133,6 @@ class AuthorizationCodeCredential {
|
|
|
4145
4133
|
}
|
|
4146
4134
|
|
|
4147
4135
|
// Copyright (c) Microsoft Corporation.
|
|
4148
|
-
// Licensed under the MIT license.
|
|
4149
4136
|
/**
|
|
4150
4137
|
* MSAL on behalf of flow. Calls to MSAL's confidential application's `acquireTokenOnBehalfOf` during `doGetToken`.
|
|
4151
4138
|
* @internal
|
|
@@ -4199,7 +4186,6 @@ class MsalOnBehalfOf extends MsalNode {
|
|
|
4199
4186
|
}
|
|
4200
4187
|
|
|
4201
4188
|
// Copyright (c) Microsoft Corporation.
|
|
4202
|
-
// Licensed under the MIT license.
|
|
4203
4189
|
const credentialName = "OnBehalfOfCredential";
|
|
4204
4190
|
const logger = credentialLogger(credentialName);
|
|
4205
4191
|
/**
|
|
@@ -4235,7 +4221,6 @@ class OnBehalfOfCredential {
|
|
|
4235
4221
|
}
|
|
4236
4222
|
|
|
4237
4223
|
// Copyright (c) Microsoft Corporation.
|
|
4238
|
-
// Licensed under the MIT license.
|
|
4239
4224
|
/**
|
|
4240
4225
|
* Returns a new instance of the {@link DefaultAzureCredential}.
|
|
4241
4226
|
*/
|