@azure/identity 3.3.1-alpha.20230927.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 CHANGED
@@ -2652,7 +2652,10 @@ class AzureCliCredential {
2652
2652
  * @param options - Options, to optionally allow multi-tenant requests.
2653
2653
  */
2654
2654
  constructor(options) {
2655
- this.tenantId = options === null || options === void 0 ? void 0 : options.tenantId;
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
+ }
2656
2659
  this.additionallyAllowedTenantIds = resolveAddionallyAllowedTenantIds(options === null || options === void 0 ? void 0 : options.additionallyAllowedTenants);
2657
2660
  this.timeout = options === null || options === void 0 ? void 0 : options.processTimeoutInMs;
2658
2661
  }
@@ -2666,6 +2669,9 @@ class AzureCliCredential {
2666
2669
  */
2667
2670
  async getToken(scopes, options = {}) {
2668
2671
  const tenantId = processMultiTenantRequest(this.tenantId, options, this.additionallyAllowedTenantIds);
2672
+ if (tenantId) {
2673
+ checkTenantId(logger$b, tenantId);
2674
+ }
2669
2675
  const scope = typeof scopes === "string" ? scopes : scopes[0];
2670
2676
  logger$b.getToken.info(`Using the scope ${scope}`);
2671
2677
  return tracingClient.withSpan(`${this.constructor.name}.getToken`, options, async () => {
@@ -2826,7 +2832,10 @@ class AzurePowerShellCredential {
2826
2832
  * @param options - Options, to optionally allow multi-tenant requests.
2827
2833
  */
2828
2834
  constructor(options) {
2829
- this.tenantId = options === null || options === void 0 ? void 0 : options.tenantId;
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
+ }
2830
2839
  this.additionallyAllowedTenantIds = resolveAddionallyAllowedTenantIds(options === null || options === void 0 ? void 0 : options.additionallyAllowedTenants);
2831
2840
  this.timeout = options === null || options === void 0 ? void 0 : options.processTimeoutInMs;
2832
2841
  }
@@ -2852,15 +2861,11 @@ class AzurePowerShellCredential {
2852
2861
  const results = await runCommands([
2853
2862
  [
2854
2863
  powerShellCommand,
2855
- "-NoProfile",
2856
- "-NonInteractive",
2857
2864
  "-Command",
2858
2865
  "Import-Module Az.Accounts -MinimumVersion 2.2.0 -PassThru",
2859
2866
  ],
2860
2867
  [
2861
2868
  powerShellCommand,
2862
- "-NoProfile",
2863
- "-NonInteractive",
2864
2869
  "-Command",
2865
2870
  `Get-AzAccessToken ${tenantSection} -ResourceUrl "${resource}" | ConvertTo-Json`,
2866
2871
  ],
@@ -2886,6 +2891,9 @@ class AzurePowerShellCredential {
2886
2891
  return tracingClient.withSpan(`${this.constructor.name}.getToken`, options, async () => {
2887
2892
  const tenantId = processMultiTenantRequest(this.tenantId, options, this.additionallyAllowedTenantIds);
2888
2893
  const scope = typeof scopes === "string" ? scopes : scopes[0];
2894
+ if (tenantId) {
2895
+ checkTenantId(logger$a, tenantId);
2896
+ }
2889
2897
  try {
2890
2898
  ensureValidScopeForDevTimeCreds(scope, logger$a);
2891
2899
  logger$a.getToken.info(`Using the scope ${scope}`);
@@ -3468,7 +3476,6 @@ const developerCliCredentialInternals = {
3468
3476
  ...tenantSection,
3469
3477
  ], {
3470
3478
  cwd: developerCliCredentialInternals.getSafeWorkingDir(),
3471
- shell: true,
3472
3479
  timeout,
3473
3480
  }, (error, stdout, stderr) => {
3474
3481
  resolve({ stdout, stderr, error });
@@ -3516,7 +3523,10 @@ class AzureDeveloperCliCredential {
3516
3523
  * @param options - Options, to optionally allow multi-tenant requests.
3517
3524
  */
3518
3525
  constructor(options) {
3519
- this.tenantId = options === null || options === void 0 ? void 0 : options.tenantId;
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
+ }
3520
3530
  this.additionallyAllowedTenantIds = resolveAddionallyAllowedTenantIds(options === null || options === void 0 ? void 0 : options.additionallyAllowedTenants);
3521
3531
  this.timeout = options === null || options === void 0 ? void 0 : options.processTimeoutInMs;
3522
3532
  }
@@ -3530,6 +3540,9 @@ class AzureDeveloperCliCredential {
3530
3540
  */
3531
3541
  async getToken(scopes, options = {}) {
3532
3542
  const tenantId = processMultiTenantRequest(this.tenantId, options, this.additionallyAllowedTenantIds);
3543
+ if (tenantId) {
3544
+ checkTenantId(logger$4, tenantId);
3545
+ }
3533
3546
  let scopeList;
3534
3547
  if (typeof scopes === "string") {
3535
3548
  scopeList = [scopes];
@@ -3541,6 +3554,9 @@ class AzureDeveloperCliCredential {
3541
3554
  return tracingClient.withSpan(`${this.constructor.name}.getToken`, options, async () => {
3542
3555
  var _a, _b, _c, _d;
3543
3556
  try {
3557
+ scopeList.forEach((scope) => {
3558
+ ensureValidScopeForDevTimeCreds(scope, logger$4);
3559
+ });
3544
3560
  const obj = await developerCliCredentialInternals.getAzdAccessToken(scopeList, tenantId, this.timeout);
3545
3561
  const isNotLoggedInError = ((_a = obj.stderr) === null || _a === void 0 ? void 0 : _a.match("not logged in, run `azd login` to login")) ||
3546
3562
  ((_b = obj.stderr) === null || _b === void 0 ? void 0 : _b.match("not logged in, run `azd auth login` to login"));