Guest User

Untitled

a guest
Feb 9th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. [AcceptVerbs("POST")]
  2. [HttpPost]
  3. public string Post([FromBody]User user)
  4. {
  5. if(user.Username == "hello" && user.Password == "123")
  6. {
  7. var accessTokenResponse = GenerateLocalAccessTokenResponse(user.Username);
  8.  
  9. return accessTokenResponse.ToString();
  10. }
  11. else
  12. {
  13. return "User invalid";
  14. }
  15. }
  16.  
  17. [Authorize]
  18. [HttpGet]
  19. // GET api/orders/5
  20. public string Get()
  21. {
  22. return "This is a secure resource";
  23. }
Add Comment
Please, Sign In to add comment