Esempio n. 1
0
        public async Task <AuthenticationResult> ExecuteAsync(
            AcquireTokenCommonParameters commonParameters,
            AcquireTokenForClientParameters clientParameters,
            CancellationToken cancellationToken)
        {
            var requestContext = CreateRequestContextAndLogVersionInfo(commonParameters.CorrelationId, cancellationToken);

            var requestParams = _confidentialClientApplication.CreateRequestParameters(
                commonParameters,
                requestContext,
                _confidentialClientApplication.AppTokenCacheInternal);

            if (clientParameters.AutoDetectRegion && requestContext.ServiceBundle.Config.AuthorityInfo.AuthorityType == AuthorityType.Adfs)
            {
                throw new MsalClientException(MsalError.RegionDiscoveryNotEnabled, MsalErrorMessage.RegionDiscoveryNotAvailable);
            }

            requestParams.SendX5C = clientParameters.SendX5C;
            requestContext.ServiceBundle.Config.AuthorityInfo.AutoDetectRegion = clientParameters.AutoDetectRegion;
            requestContext.ServiceBundle.Config.AuthorityInfo.RegionToUse      = clientParameters.RegionToUse;

            var handler = new ClientCredentialRequest(
                ServiceBundle,
                requestParams,
                clientParameters);

            return(await handler.RunAsync(cancellationToken).ConfigureAwait(false));
        }
 public ClientCredentialRequest(
     IServiceBundle serviceBundle,
     AuthenticationRequestParameters authenticationRequestParameters,
     AcquireTokenForClientParameters clientParameters)
     : base(serviceBundle, authenticationRequestParameters, clientParameters)
 {
     _clientParameters = clientParameters;
 }
 public Task <AuthenticationResult> ExecuteAsync(
     AcquireTokenCommonParameters commonParameters,
     AcquireTokenForClientParameters clientParameters,
     CancellationToken cancellationToken)
 {
     return(ExecuteMatsAsync(
                commonParameters,
                async() => await _executor.ExecuteAsync(commonParameters, clientParameters, cancellationToken).ConfigureAwait(false)));
 }
Esempio n. 4
0
        public async Task <AuthenticationResult> ExecuteAsync(
            AcquireTokenCommonParameters commonParameters,
            AcquireTokenForClientParameters clientParameters,
            CancellationToken cancellationToken)
        {
            var requestContext = CreateRequestContextAndLogVersionInfo(commonParameters.CorrelationId, cancellationToken);

            var requestParams = await _confidentialClientApplication.CreateRequestParametersAsync(
                commonParameters,
                requestContext,
                _confidentialClientApplication.AppTokenCacheInternal).ConfigureAwait(false);

            requestParams.SendX5C = clientParameters.SendX5C ?? false;

            var handler = new ClientCredentialRequest(
                ServiceBundle,
                requestParams,
                clientParameters);

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