public async Task <IActionResult> Post([FromForm] LoginModel model) { // User profile Profile = new UserProfile(); // Security Security = new AdvancedSecurity(); // As an example, AuthService.CreateToken can return Jose.JWT.Encode(claims, YourTokenSecretKey, Jose.JwsAlgorithm.HS256); if (await Security.ValidateUser(model, false)) { return(Ok(new { JWT = Security.JwtToken })); } return(BadRequest("Invalid username or password!")); }
public async Task <IActionResult> Post([FromForm] LoginModel model) { // User profile Profile = new UserProfile(); // Security Security = new AdvancedSecurity(); bool validPwd = await Security.ValidateUser(model, false); // As an example, AuthService.CreateToken can return Jose.JWT.Encode(claims, YourTokenSecretKey, Jose.JwsAlgorithm.HS256); if (validPwd) { return(Ok(new { JWT = BuildToken(model.Username, Security.CurrentUserID, Security.CurrentParentUserID, Security.CurrentUserLevelID) })); } else { return(BadRequest("Invalid username or password!")); } }