fluent-security

Catch exceptions from RequiredRole and other policies to redirect using Fluent Security

≯℡__Kan透↙ 提交于 2020-01-04 08:15:07
问题 Using Fluent Security, I have configured website access using DenyAnonymousAccess, DenyAuthenticationAccess and RequireRole. SecurityConfigurator.Configure(configuration => { configuration.ResolveServicesUsing(new FluentSecurityServiceLocator()); configuration.GetAuthenticationStatusFrom(CurrentUser.IsAuthenticated); configuration.GetRolesFrom(CurrentUser.Roles); configuration.For<HomeController>().DenyAnonymousAccess(); configuration.For<ReportsController>().RequireRole(UserRole

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"); 来源:

FluentSecurity: How to assign multiple roles

非 Y 不嫁゛ 提交于 2019-12-06 14:02:11
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? Jen 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

Fluent Security - configuring parameterized controller actions

馋奶兔 提交于 2019-12-01 20:21:29
问题 I have done quite a bit of research and have tested both the 1.4 and 2.0 versions of the FluentSecurity libraries and I don't seem to be able to use the configuration pattern: configuration.For<MyController>(x => x.GetCustomer()) .RequireRole(appRoles); when my controller action requires a parameter such as: public ActionResult GetCustomer(int customerID) Is this type of configuration currently supported? If so, how do I implement a role requirement against an action that has a required