Ejemplo n.º 1
0
        public IActionResult CreateToken([FromBody] LogInModel login)
        {
            IActionResult response = Unauthorized();
            User          user     = logInService.Authenticate(login.Username, login.Password);

            if (user != null)
            {
                var tokenString = BuildToken(user);
                response = Ok(new { token = tokenString });
            }

            return(response);
        }