예제 #1
0
        public async Task <IActionResult> SignIn([FromBody] SignInRequest request)
        {
            Guid id = _identityService.GenerateIdentityHash(request.Email);

            Identity identity = await _identityDataSource.Read(id);

            if (identity == null ||
                !_identityService.IsPasswordValid(request.Password, identity.Hash, identity.Salt))
            {
                return(BadRequest("Password incorrect or email not found."));
            }

            TokenResponse tokenResponse = _jwtAuthenticationService.CreateTokenResponse(identity);

            return(Ok(tokenResponse));
        }