예제 #1
0
        public async Task <IdentityRightWayResponseBase <AcceptConsentDto> > Handle(AcceptConsentCommand request, CancellationToken cancellationToken)
        {
            var result = await ProcessConsent(request);

            if (result.IsRedirect)
            {
                if (await _clientStore.IsPkceClientAsync(result.ClientId))
                {
                    // if the client is PKCE then we assume it's native, so this change in how to
                    // return the response is for better UX for the end user.
                    //return View("Redirect", new RedirectViewModel { RedirectUrl = result.RedirectUri });
                    return(new IdentityRightWayResponseBase <AcceptConsentDto> {
                        Errors = null, IsValid = true, Payload = new AcceptConsentDto {
                            RedirectUri = result.RedirectUri
                        }
                    });
                }

                return(new IdentityRightWayResponseBase <AcceptConsentDto> {
                    Errors = null, IsValid = false
                });
            }
            return(new IdentityRightWayResponseBase <AcceptConsentDto> {
                Errors = null, IsValid = false
            });
        }
        public async Task <IActionResult> Accept([FromBody] AcceptConsentCommand value)
        {
            var response = await queryBus.Send(value);

            return(Ok(response));
        }