Search code examples
asp.net-mvcfluent-security

FluentSecurity: How to assign multiple roles


In ASP.NET MVC, we can assign multiple roles in AuthorizeAttribute. I'm currently using Fluent Security. The documentation says RequireRolePolicy can support one or more roles.

I want to do the code below:

 configuration.For<MyController>(x => x.Index()).RequireRole("Administrator, Editor");

but it seems that it only checks one role. How to assign multiple roles to it?


Solution

  • Ok I got it now.

     configuration.For<MyController>(x => x.Index()).RequireAllRolesPolicy("Administrator", "Editor");