Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Identity fix SharedTokenCache account filter to be case-insensitive #11859

Merged
merged 3 commits into from
May 6, 2020

Conversation

schaabs
Copy link
Member

@schaabs schaabs commented May 6, 2020

Fixes #10816

@schaabs schaabs requested a review from pakrym May 6, 2020 18:11
@@ -133,7 +133,7 @@ private async Task<IAccount> GetAccountAsync()
{
List<IAccount> accounts = (await _client.GetAccountsAsync().ConfigureAwait(false)).ToList();

List<IAccount> filteredAccounts = accounts.Where(a => (string.IsNullOrEmpty(_username) || a.Username == _username) && (string.IsNullOrEmpty(_tenantId) || a.HomeAccountId?.TenantId == _tenantId)).ToList();
List<IAccount> filteredAccounts = accounts.Where(a => (string.IsNullOrEmpty(_username) || string.Compare(a.Username, _username, StringComparison.OrdinalIgnoreCase) == 0 && (string.IsNullOrEmpty(_tenantId) || string.Compare(a.HomeAccountId?.TenantId, _tenantId, StringComparison.OrdinalIgnoreCase) == 0))).ToList();
Copy link
Contributor

@pakrym pakrym May 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you reformat this a bit so it's a bit easier to read?

@schaabs schaabs merged commit c6fd8ac into Azure:master May 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG]AZURE_USERNAME is case sensitive for use with DefaultAzureCredential().
2 participants