コード例 #1
0
        /// <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);
        }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
ファイル: AdalAuthenticator.cs プロジェクト: DDEfromOR/se
 public async Task <AuthenticationResult> GetTokenAsync(bool forceRefresh = false)
 {
     return(await Retry.Run(
                task : () => AcquireTokenAsync(forceRefresh),
                retryExceptionHandler : (ex, ct) => HandleAdalException(ex, ct)).ConfigureAwait(false));
 }