Custom authorisation with self hosted OWIN and WindowsAuthentication
up vote
0
down vote
favorite
I have self-hosted WebApi that uses Windows Authentication to authenticate users – I would like to add some custom authorisation basing on roles of authenticated user. Ideally I could read role name using reflection (from controller method) and inside readied attribute (AppRole) we will have app roles (not AD roles). My custom logic (middleware) should compare this app roles with user AD roles we read from user context and decide do he have a permission to access resource. How can I do this in ASP.NET WebAPI? (standard not Core) [HttpGet] [Route("enable")] [AppRole(“Admin”] public async Task<IHttpActionResult> EnableJobs() { }
asp.net-web-api2 authorization
share | improve ...