using System; using System.Collections.Generic; using System.Web.Http; using Authentication_test.DBO; using iiie.Authentication.Business; using iiie.Authentication.Business.JWT; namespace Authentication_test.Controllers { public class ValuesController : ApiController { [AuthFilter] public IEnumerable Post() { return new[] { "value1", "value2" }; } [AuthFilter((int)UserRoles.Root)] public IEnumerable Get() { return new [] { "value1", "value2" }; } [AuthFilter((int)UserRoles.NotRoot)] public string Get(int id) { return UserStorage.BasicUserDbo.Username + " " + UserStorage.BasicUserDbo.TokenData; } [Route("api/login")] [HttpGet] public string Login(string username) { return TokenManager.GetToken(username, "", new { Date = DateTime.Now }); } } }