public Task <AuthenticationResult> ExecuteAsync(
     AcquireTokenCommonParameters commonParameters,
     AcquireTokenByUsernamePasswordParameters usernamePasswordParameters,
     CancellationToken cancellationToken)
 {
     return(ExecuteMatsAsync(
                commonParameters,
                async() => await _executor.ExecuteAsync(commonParameters, usernamePasswordParameters, cancellationToken).ConfigureAwait(false)));
 }
Example #2
0
 public UsernamePasswordRequest(
     IServiceBundle serviceBundle,
     AuthenticationRequestParameters authenticationRequestParameters,
     AcquireTokenByUsernamePasswordParameters usernamePasswordParameters)
     : base(serviceBundle, authenticationRequestParameters, usernamePasswordParameters)
 {
     _usernamePasswordParameters  = usernamePasswordParameters;
     _commonNonInteractiveHandler = new CommonNonInteractiveHandler(
         authenticationRequestParameters.RequestContext,
         serviceBundle);
 }
Example #3
0
        public async Task <AuthenticationResult> ExecuteAsync(
            AcquireTokenCommonParameters commonParameters,
            AcquireTokenByUsernamePasswordParameters usernamePasswordParameters,
            CancellationToken cancellationToken)
        {
            var requestContext = CreateRequestContextAndLogVersionInfo(commonParameters.CorrelationId);

            var requestParams = _publicClientApplication.CreateRequestParameters(
                commonParameters,
                requestContext,
                _publicClientApplication.UserTokenCacheInternal);

            var handler = new UsernamePasswordRequest(
                ServiceBundle,
                requestParams,
                usernamePasswordParameters);

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