public async Task <AuthenticationResult> ExecuteAsync(
            AcquireTokenCommonParameters commonParameters,
            AcquireTokenSilentParameters silentParameters,
            CancellationToken cancellationToken)
        {
            //Since the AcquireTokenSilentParameterBuilder api is shared between public and confidential clients,
            //We need some way to validate that MSAL is not performing AcquireTokenSilent with POP on public clients without Broker
            if (commonParameters.PopAuthenticationConfiguration != null &&
                ServiceBundle?.Config.IsBrokerEnabled == false &&
                //Validates that we are not on CCA
                //TODO: Find a better way to determine this
                ServiceBundle?.Config.ClientCredential == null &&
                commonParameters.OnBeforeTokenRequestHandler == null &&
                ServiceBundle?.Config.AppTokenProvider == null
                )
            {
                throw new MsalClientException(MsalError.BrokerRequiredForPop, MsalErrorMessage.BrokerRequiredForPop);
            }

            var requestContext = CreateRequestContextAndLogVersionInfo(commonParameters.CorrelationId, cancellationToken);

            var requestParameters = await _clientApplicationBase.CreateRequestParametersAsync(
                commonParameters,
                requestContext,
                _clientApplicationBase.UserTokenCacheInternal).ConfigureAwait(false);

            requestParameters.SendX5C = silentParameters.SendX5C ?? false;

            var handler = new SilentRequest(ServiceBundle, requestParameters, silentParameters);

            return(await handler.RunAsync(cancellationToken).ConfigureAwait(false));
        }
Exemple #2
0
        public async Task <AuthenticationResult> ExecuteAsync(
            AcquireTokenCommonParameters commonParameters,
            AcquireTokenSilentParameters silentParameters,
            CancellationToken cancellationToken)
        {
            var requestContext = CreateRequestContextAndLogVersionInfo(commonParameters.CorrelationId, cancellationToken);

            var requestParameters = await _clientApplicationBase.CreateRequestParametersAsync(
                commonParameters,
                requestContext,
                _clientApplicationBase.UserTokenCacheInternal).ConfigureAwait(false);

            requestParameters.SendX5C = silentParameters.SendX5C;

            var handler = new SilentRequest(ServiceBundle, requestParameters, silentParameters);

            return(await handler.RunAsync(cancellationToken).ConfigureAwait(false));
        }