FluentSecurity: How to assign multiple roles

早过忘川 提交于 2019-12-10 10:46:46

问题


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?


回答1:


Ok I got it now.

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


来源:https://stackoverflow.com/questions/19046111/fluentsecurity-how-to-assign-multiple-roles

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!