You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ValuesController.cs 726B

123456789101112131415161718192021222324252627282930
  1. using System.Collections.Generic;
  2. using System.Web.Http;
  3. using Authentication_test.DBO;
  4. using iiie.Authentication.Business;
  5. using iiie.Authentication.Business.JWT;
  6. namespace Authentication_test.Controllers
  7. {
  8. public class ValuesController : ApiController
  9. {
  10. [AuthFilter((int)UserRoles.Root)]
  11. public IEnumerable<string> Get()
  12. {
  13. return new [] { "value1", "value2" };
  14. }
  15. [AuthFilter((int)UserRoles.NotRoot)]
  16. public string Get(int id)
  17. {
  18. return "value";
  19. }
  20. [Route("api/login")]
  21. [HttpGet]
  22. public string Login(string username)
  23. {
  24. return TokenManager.GetToken(username, "");
  25. }
  26. }
  27. }