public async Task <AuthenticationResult> ExecuteAsync(CancellationToken cancellationToken)
        {
            MsalTokenResponse response = await SendTokenRequestToBrokerAsync().ConfigureAwait(false);

            Metrics.IncrementTotalAccessTokensFromBroker();
            return(await _silentRequest.CacheTokenResponseAndCreateAuthenticationResultAsync(response).ConfigureAwait(false));
        }
Ejemplo n.º 2
0
        public async Task <AuthenticationResult> ExecuteAsync(CancellationToken cancellationToken)
        {
            if (!Broker.IsBrokerInstalledAndInvokable(_authenticationRequestParameters.AuthorityInfo.AuthorityType))
            {
                _logger.Warning("Broker is not installed. Cannot respond to silent request.");
                return(null);
            }

            MsalTokenResponse response = await SendTokenRequestToBrokerAsync().ConfigureAwait(false);

            if (response != null)
            {
                ValidateResponseFromBroker(response);
                Metrics.IncrementTotalAccessTokensFromBroker();
                return(await _silentRequest.CacheTokenResponseAndCreateAuthenticationResultAsync(response).ConfigureAwait(false));
            }

            return(null);
        }