예제 #1
0
        public async Task <IActionResult> Login([FromBody] LoginViewModel loginViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            var user = await _userServices.GetUser(loginViewModel);

            if (user != null)
            {
                string result = $"Beaner {jwtHelper.CreateJwt(user.UserName)}";
                return(Ok(result));
            }
            return(NotFound());
        }
예제 #2
0
 public string CreateJwt(IWebSession session)
 {
     return(JwtHelper.CreateJwt(session, _jwtSecret, 1));
 }