Пример #1
0
        public async Task ExecuteAsync_Should_Throw_Authentication_Result_Exception()
        {
            var exception  = new Exception("Invalid scheme.");
            var authResult = new AuthenticateResult(false, exception, null, null);

            _authenticationServiceMock.Setup(x => x.AuthenticateAsync(It.IsAny <string>())).ReturnsAsync(authResult);

            Func <Task <ExternalLoginResultOutput> > result = async() => await _externalLoginInteractor.ExecuteAsync("Scheme");

            var exceptionResult = await result.Should().ThrowExactlyAsync <Exception>();

            exceptionResult.WithMessage(exception.Message);
        }
Пример #2
0
        public async Task <IActionResult> Callback()
        {
            var output =
                await _externalLoginInteractor.ExecuteAsync(IdentityServer4.IdentityServerConstants
                                                            .ExternalCookieAuthenticationScheme);

            return(output.IsNativeClient.HasValue && output.IsNativeClient.Value
                ? this.LoadingPage("Redirect", output.ReturnUrl)
                : Redirect(output.ReturnUrl));
        }