Search code examples
fluent-security

ForActionsMatching an area and controller name?


Is there a way to build a predicate down to a list of actions with a specific name, in a specific controller, in a specific area?


Solution

  • If you're area controllers are in a namespace specific to that area, you should be able to use the following:

    configuration.ForActionsMatching(info =>
       info.ControllerType.Namespace.StartsWith("Some.Namespace")
    )
    

    https://github.com/kristofferahl/FluentSecurity/wiki/Securing-controllers

    If you're areas are in an assembly not reference by the application running FluentSecurity, you should have a look at Profiles in FluentSecurity 2.0.

    https://github.com/kristofferahl/FluentSecurity/wiki/Profiles