コード例 #1
0
        public AuthenticationResponse Authenticate(AuthenticateRequest request)
        {
            _singleUserAuthentication.TryAuthenticate(request.Password, out var jwtTokenOrNull);

            if (jwtTokenOrNull != null)
            {
                return(new AuthenticationResponse
                {
                    Authenticated = true,
                    JwtToken = jwtTokenOrNull
                });
            }

            return(new AuthenticationResponse
            {
                Authenticated = false,
                JwtToken = null
            });
        }
コード例 #2
0
        public void returns_jwt_token_when_password_is_correct()
        {
            _singleUserAuthentication.TryAuthenticate("test-password", out var jwtTokenOrNull);

            jwtTokenOrNull.Should().NotBeNull();
        }