I have an ApiController class with 10 public methods.
Of these 10 methods, nine require [Authorize(Roles="Admin")] . One that does not do this does not require authorization.
If it were not for this single method that does not require authorization, I would decorate the ApiController [Authorize(Roles="Admin")] class.
Instead of class level, I decorate all nine methods with the same [Authorize(Roles="Admin")] and do not decorate this single method with [Authorize(...)] .
What I don't like about this is that I have to repeat the same [Authorize(Roles="Admin")] nine times.
Is there a way that I can, however, decorate the [Authorize(Roles="Admin")] class and only decorate the only method that [Authorize(Roles="Admin")] should not have with an attribute that means that something like "don't apply class-level action filter for this particular method"?
core
source share