// [HttpGet] public IActionResult Login(User user) { _log4net.Info("Authentication Started"); IActionResult response = Unauthorized(); var tempuser = _auth.AuthenticateUser(user); if (tempuser != null) { var tokenString = _auth.GenerateJSONWebToken(); response = Ok(new { token = tokenString }); } return(response); }
public string GenerateJSONWebTokenFromRepo() { string tokenFromRepo = ""; try { tokenFromRepo = objRepository.GenerateJSONWebToken(config); return(tokenFromRepo); } catch (Exception e) { return(null); } }
public IActionResult Login(Authenticate user) { _log4net.Info("post method invoked"); IActionResult response = Unauthorized(); if (user != null) { var tokenString = _authrepo.GenerateJSONWebToken(); response = Ok(new { token = tokenString }); } return(response); // return NotFound(); }
// [HttpGet] public IActionResult Login(UserDetail userdetail) { /*user.Id = 1; * user.UserName = "******"; * user.Password = "******";*/ _log4net.Info("Authentication initiated"); IActionResult response = Unauthorized(); var user = _auth.AuthenticateUser(userdetail); if (user != null) { var tokenString = _auth.GenerateJSONWebToken(); response = Ok(new { token = tokenString }); } // return response; /* var tokenString = GenerateJSONWebToken(); * response = Ok(new { token = tokenString }); * // return Ok(GenerateJSONWebToken());*/ return(response); }