I applied my own Authorize attribute.
The attribute is applied both at the controller level and at the action level.
Here is an example of what I need to do:
[ClaimsAuthorize(Roles = "AdvancedUsers")] public class SecurityController : Controller { [ClaimsAuthorize(Roles = "Administrators")] public ActionResult AdministrativeTask() { return View(); } public ActionResult SomeOtherAction() { return View(); } }
Currently, if a user has an administrator role but not the AdvancedUsers role, he cannot complete the "Administrative task".
How can I change this behavior to perform a security check at the action level, even if the user is not authorized at the controller level?
At the moment, the only solution I can think of is to implement 2 attributes: one to protect the controllers, the other to provide security. Then I will play with the Order property to complete the first at the action level.
However, I would prefer a solution with a single attribute, if possible.
source share