Exemple #1
0
        public IActionResult Authenticate([FromBody] AccountLoginModel account)
        {
            var jwtInfo = new JWTInfoModel
            {
                Username   = account.Username,
                Password   = account.Password,
                ExpireTime = DateTime.Now.AddMinutes(long.Parse(_iConfiguration["Jwt:ExpiresInMinutes"])),
                PrivateKey = _iConfiguration["Jwt:PrivateKey"]
            };

            var result = _iCoreService.Authenticate(jwtInfo);

            return(Ok(result));
        }
 public IActionResult Authenticate([FromBody]User param) {
     var user = iservice.Authenticate(param.Username, param.Password);
     if (user == null)
         return BadRequest(new { message = "Username or password is incorrect" });
     return Ok(user);
 }