From 884edf111454fcfd3f4eaf261990c41b0c1847ea Mon Sep 17 00:00:00 2001 From: David Parks <DavidParks8@outlook.com> Date: Thu, 12 Sep 2019 16:39:14 -0700 Subject: [PATCH] Speed up azure service token provider (#7527) --- .../AzureServiceTokenProvider.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sdk/mgmtcommon/AppAuthentication/Azure.Services.AppAuthentication/AzureServiceTokenProvider.cs b/sdk/mgmtcommon/AppAuthentication/Azure.Services.AppAuthentication/AzureServiceTokenProvider.cs index fdfd285d3c70..7731aaa4a5f4 100644 --- a/sdk/mgmtcommon/AppAuthentication/Azure.Services.AppAuthentication/AzureServiceTokenProvider.cs +++ b/sdk/mgmtcommon/AppAuthentication/Azure.Services.AppAuthentication/AzureServiceTokenProvider.cs @@ -248,9 +248,9 @@ private List<NonInteractiveAzureServiceTokenProviderBase> GetTokenProviders() return authResult.AccessToken; } - public async Task<string> GetAccessTokenAsync(string resource, string tenantId) + public Task<string> GetAccessTokenAsync(string resource, string tenantId) { - return await GetAccessTokenAsync(resource, tenantId, default(CancellationToken)).ConfigureAwait(false); + return GetAccessTokenAsync(resource, tenantId, default(CancellationToken)); } /// <summary> @@ -267,7 +267,7 @@ public async Task<string> GetAccessTokenAsync(string resource, string tenantId) /// <returns>Access token</returns> /// <exception cref="ArgumentNullException">Thrown if resource is null or empty.</exception> /// <exception cref="AzureServiceTokenProviderException">Thrown if access token cannot be acquired.</exception> - public async Task<AppAuthenticationResult> GetAuthenticationResultAsync(string resource, string tenantId = default(string), + public Task<AppAuthenticationResult> GetAuthenticationResultAsync(string resource, string tenantId = default(string), CancellationToken cancellationToken = default(CancellationToken)) { if (string.IsNullOrWhiteSpace(resource)) @@ -277,12 +277,12 @@ public async Task<string> GetAccessTokenAsync(string resource, string tenantId) string authority = string.IsNullOrEmpty(tenantId) ? string.Empty : $"{_azureAdInstance}{tenantId}"; - return await GetAuthResultAsyncImpl(resource, authority, cancellationToken).ConfigureAwait(false); + return GetAuthResultAsyncImpl(resource, authority, cancellationToken); } - public async Task<AppAuthenticationResult> GetAuthenticationResultAsync(string resource, string tenantId) + public Task<AppAuthenticationResult> GetAuthenticationResultAsync(string resource, string tenantId) { - return await GetAuthenticationResultAsync(resource, tenantId, default(CancellationToken)).ConfigureAwait(false); + return GetAuthenticationResultAsync(resource, tenantId, default(CancellationToken)); } } }