예제 #1
0
        public async Task <Uri> ExecuteAsync(
            AcquireTokenCommonParameters commonParameters,
            GetAuthorizationRequestUrlParameters authorizationRequestUrlParameters,
            CancellationToken cancellationToken)
        {
            var requestContext = CreateRequestContextAndLogVersionInfo(commonParameters.CorrelationId, cancellationToken);

            var requestParameters = _confidentialClientApplication.CreateRequestParameters(
                commonParameters,
                requestContext,
                _confidentialClientApplication.UserTokenCacheInternal);

            requestParameters.Account   = authorizationRequestUrlParameters.Account;
            requestParameters.LoginHint = authorizationRequestUrlParameters.LoginHint;

            if (!string.IsNullOrWhiteSpace(authorizationRequestUrlParameters.RedirectUri))
            {
                requestParameters.RedirectUri = new Uri(authorizationRequestUrlParameters.RedirectUri);
            }

            await AuthorityEndpoints.UpdateAuthorityEndpointsAsync(requestParameters).ConfigureAwait(false);

            var handler = new AuthCodeRequestComponent(
                requestParameters,
                authorizationRequestUrlParameters.ToInteractiveParameters());

            return(handler.GetAuthorizationUriWithoutPkce());
        }
예제 #2
0
        public async Task <Uri> ExecuteAsync(
            AcquireTokenCommonParameters commonParameters,
            GetAuthorizationRequestUrlParameters authorizationRequestUrlParameters,
            CancellationToken cancellationToken)
        {
            var requestContext = CreateRequestContextAndLogVersionInfo(commonParameters.CorrelationId, cancellationToken);

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

            requestParameters.Account        = authorizationRequestUrlParameters.Account;
            requestParameters.LoginHint      = authorizationRequestUrlParameters.LoginHint;
            requestParameters.CcsRoutingHint = authorizationRequestUrlParameters.CcsRoutingHint;

            if (!string.IsNullOrWhiteSpace(authorizationRequestUrlParameters.RedirectUri))
            {
                requestParameters.RedirectUri = new Uri(authorizationRequestUrlParameters.RedirectUri);
            }

            await requestParameters.AuthorityManager.RunInstanceDiscoveryAndValidationAsync().ConfigureAwait(false);

            var handler = new AuthCodeRequestComponent(
                requestParameters,
                authorizationRequestUrlParameters.ToInteractiveParameters());

            if (authorizationRequestUrlParameters.CodeVerifier != null)
            {
                return(handler.GetAuthorizationUriWithPkce(authorizationRequestUrlParameters.CodeVerifier));
            }
            else
            {
                return(handler.GetAuthorizationUriWithoutPkce());
            }
        }