Beispiel #1
0
        public IActionResult Authenticate(RequestLogin user)
        {
            var userAthenticated = _userservices.AuthUser(user.User, user.Password);

            if (userAthenticated == null)
            {
                return(Unauthorized("Usuario o Contraseña Incorrectas"));
            }

            var           token = _authenticationService.GenerateSecurityToken(userAthenticated);
            ResponseLogin res   = new ResponseLogin();

            res.Token  = token;
            res.Expire = DateTime.Now.AddDays(30);
            return(Ok(res));
        }
 public ActionResult <Nullable <Int32> > AuthUser([FromBody] User user)
 {
     return(_service.AuthUser(user));
 }