Hi,
I am developing Authorization function for a Web API project in ASP.NET 5.
Currently I have configured Roles for Controller statically using [Authorize(Roles = "Admin")] as below:
[Authorize(Roles = "Admin")] [Route("api/[controller]")] public class ValuesController : Controller { // GET: api/values [HttpGet] public IEnumerable<string> Get() { return new string[] { "value1", "value2" }; } }
"Admin" role is hard code for Controller.
But in fact, all roles will be stored in DB and I want to load and set them for Controllers/Methods in Controller when App start at runtime
If anybody know how to do this ? Please help.
Thanks in advance.