예제 #1
0
 public IActionResult GetAccessToken(string userName, string password)
 {
     try
     {
         var user = _systemUserService.Get(f => f.UserName == userName && f.Password == password);
         if (user != null)
         {
             JwtToken jwtToken = new JwtToken
             {
                 ID   = user.Id,
                 Name = user.UserName
             };
             string Token = JwtTokenHelp.GetJWT(jwtToken);
             return(Ok(Token));
         }
         else
         {
             return(Ok("未能找到此用户"));
         }
     }
     catch (Exception ex)
     {
         return(Ok(ex.Message));
     }
 }
예제 #2
0
        public IActionResult GetJwtToken([FromBody] JwtToken jwtToken)
        {
            string Token = JwtTokenHelp.GetJWT(jwtToken);

            return(Content(Token));
        }