コード例 #1
0
        public async Task AuthenticateWithNoAuthorizationHeaderShouldFail()
        {
            _context.Request.Headers.Add("", new Microsoft.Extensions.Primitives.StringValues(""));

            var result = await _authenticationHandler.AuthenticateAsync();

            Assert.AreEqual(AuthenticateResult.Fail("").Succeeded, result.Succeeded);
        }
コード例 #2
0
        public async Task <ActionResult <AuthenticationResultDto> > AuthenticateAsync(
            [FromBody] AuthenticateUserCommand command,
            CancellationToken cancellationToken)
        {
            var result = await _authenticationHandler.AuthenticateAsync(
                command.Email,
                command.Password,
                cancellationToken);

            return(Ok(result));
        }
コード例 #3
0
 public void AuthenticateAsync_NullRequest_ShouldThrowArgumentNullException()
 {
     Assert.ThrowsAsync <ArgumentNullException>(() => authHandler.AuthenticateAsync(null));
 }