Skip to content

Commit

Permalink
Bug fixes for development time credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
schaabs committed Oct 9, 2023
1 parent 01a82ba commit 65b2004
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
6 changes: 6 additions & 0 deletions sdk/identity/Azure.Identity/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release History

## 1.10.2 (2023-10-10)

### Bugs Fixed

- Bug fixes for development time credentials.

## 1.10.1 (2023-09-12)

### Bugs Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ internal AzureCliCredential(CredentialPipeline pipeline, IProcessService process
_pipeline = pipeline;
_path = !string.IsNullOrEmpty(EnvironmentVariables.Path) ? EnvironmentVariables.Path : DefaultPath;
_processService = processService ?? ProcessService.Default;
TenantId = options?.TenantId;
TenantId = Validations.ValidateTenantId(options?.TenantId, $"{nameof(options)}.{nameof(options.TenantId)}", true);
AdditionallyAllowedTenantIds = TenantIdResolver.ResolveAddionallyAllowedTenantIds((options as ISupportsAdditionallyAllowedTenants)?.AdditionallyAllowedTenants);
ProcessTimeout = options?.ProcessTimeout ?? TimeSpan.FromSeconds(13);
_isChainedCredential = options?.IsChainedCredential ?? false;
Expand Down Expand Up @@ -121,6 +121,7 @@ private async ValueTask<AccessToken> RequestCliAccessTokenAsync(bool async, Toke
string resource = ScopeUtilities.ScopesToResource(context.Scopes);
string tenantId = TenantIdResolver.Resolve(TenantId, context, AdditionallyAllowedTenantIds);

Validations.ValidateTenantId(tenantId, nameof(context.TenantId), true);
ScopeUtilities.ValidateScope(resource);

GetFileNameAndArguments(resource, tenantId, out string fileName, out string argument);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ internal AzureDeveloperCliCredential(CredentialPipeline pipeline, IProcessServic
_logAccountDetails = options?.Diagnostics?.IsAccountIdentifierLoggingEnabled ?? false;
_pipeline = pipeline;
_processService = processService ?? ProcessService.Default;
TenantId = options?.TenantId;
TenantId = Validations.ValidateTenantId(options?.TenantId, $"{nameof(options)}.{nameof(options.TenantId)}", true);
AdditionallyAllowedTenantIds = TenantIdResolver.ResolveAddionallyAllowedTenantIds((options as ISupportsAdditionallyAllowedTenants)?.AdditionallyAllowedTenants);
ProcessTimeout = options?.ProcessTimeout ?? TimeSpan.FromSeconds(13);
_isChainedCredential = options?.IsChainedCredential ?? false;
Expand Down Expand Up @@ -112,6 +112,13 @@ private async ValueTask<AccessToken> RequestCliAccessTokenAsync(bool async, Toke
{
string tenantId = TenantIdResolver.Resolve(TenantId, context, AdditionallyAllowedTenantIds);

Validations.ValidateTenantId(tenantId, nameof(context.TenantId), true);

foreach (var scope in context.Scopes)
{
ScopeUtilities.ValidateScope(scope);
}

GetFileNameAndArguments(context.Scopes, tenantId, out string fileName, out string argument);
ProcessStartInfo processStartInfo = GetAzureDeveloperCliProcessStartInfo(fileName, argument);
using var processRunner = new ProcessRunner(_processService.Create(processStartInfo), ProcessTimeout, _logPII, cancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ internal AzurePowerShellCredential(AzurePowerShellCredentialOptions options, Cre
UseLegacyPowerShell = false;
_logPII = options?.IsUnsafeSupportLoggingEnabled ?? false;
_logAccountDetails = options?.Diagnostics?.IsAccountIdentifierLoggingEnabled ?? false;
TenantId = options?.TenantId;
TenantId = Validations.ValidateTenantId(options?.TenantId, $"{nameof(options)}.{nameof(options.TenantId)}", true);
_pipeline = pipeline ?? CredentialPipeline.GetInstance(options);
_processService = processService ?? ProcessService.Default;
AdditionallyAllowedTenantIds = TenantIdResolver.ResolveAddionallyAllowedTenantIds((options as ISupportsAdditionallyAllowedTenants)?.AdditionallyAllowedTenants);
Expand Down Expand Up @@ -139,9 +139,12 @@ private async ValueTask<AccessToken> RequestAzurePowerShellAccessTokenAsync(bool
{
string resource = ScopeUtilities.ScopesToResource(context.Scopes);

ScopeUtilities.ValidateScope(resource);
var tenantId = TenantIdResolver.Resolve(TenantId, context, AdditionallyAllowedTenantIds);

Validations.ValidateTenantId(tenantId, nameof(context.TenantId), true);

ScopeUtilities.ValidateScope(resource);

GetFileNameAndArguments(resource, tenantId, out string fileName, out string argument);
ProcessStartInfo processStartInfo = GetAzurePowerShellProcessStartInfo(fileName, argument);
using var processRunner = new ProcessRunner(
Expand Down

0 comments on commit 65b2004

Please sign in to comment.