/// <summary> /// Performs the call to acquire a security token. /// </summary> /// <param name="forceRefresh">Forces a token refresh by clearing the token cache and acquiring it again.</param> /// <returns>A <see cref="Task{AuthenticationResult}" /> object.</returns> public async Task <AuthenticationResult> GetTokenAsync(bool forceRefresh = false) { var watch = Stopwatch.StartNew(); var result = await Retry.Run( task : () => AcquireTokenAsync(forceRefresh), retryExceptionHandler : (ex, ct) => HandleAdalException(ex, ct)).ConfigureAwait(false); watch.Stop(); logger?.LogInformation($"GetTokenAsync: Acquired token using ADAL in {watch.ElapsedMilliseconds}."); return(result); }
/// <inheritdoc/> public async Task <AuthenticatorResult> GetTokenAsync(bool forceRefresh = false) { var watch = Stopwatch.StartNew(); var result = await Retry .Run(() => AcquireTokenAsync(forceRefresh), HandleTokenProviderException) .ConfigureAwait(false); watch.Stop(); _logger.LogInformation($"GetTokenAsync: Acquired token using MSI in {watch.ElapsedMilliseconds}."); return(result); }
public async Task <AuthenticationResult> GetTokenAsync(bool forceRefresh = false) { return(await Retry.Run( task : () => AcquireTokenAsync(forceRefresh), retryExceptionHandler : (ex, ct) => HandleAdalException(ex, ct)).ConfigureAwait(false)); }