Last active
November 4, 2017 13:08
-
-
Save StephanyBatista/d1dde004224f0bf8ba1093a021e2b3d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Route("api/[controller]")] | |
public class TokenController : Controller | |
{ | |
[HttpPost] | |
public IActionResult Post([FromBody]LoginModel loginModel) | |
{ | |
if (loginModel.Username != "stephany" && loginModel.Password != "batista") | |
return Unauthorized(); | |
var token = new JwtTokenBuilder() | |
.AddSecurityKey(JwtSecurityKey.Create("a-password-very-big-to-be-good")) | |
.AddSubject("Stehany Batista") | |
.AddIssuer("stephanybatista.com") | |
.AddAudience("stephanybatista.com") | |
.AddNameId("salmeidabatista@gmail.com") | |
.AddClaim("employeer", "31") | |
.AddExpiry(1) | |
.Build(); | |
return Ok(token); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment