Authorize all controllers in a given namespace?

155 Views Asked by At

Is it possible to apply an AuthorizeAttribute to all controllers within a given namespace using FluentSecurity?

1

There are 1 best solutions below

0
Kristoffer Ahl On BEST ANSWER

Yes, you can do that using ForAllControllersInNamespaceContainingType<TType>() or ForActionsMatching(info => *predicate*) in FluentSecurity 2.0 (currently in beta).

You can read more about it in the documentation here: https://github.com/kristofferahl/FluentSecurity/wiki/Securing-controllers