Fluent Security - configuring parameterized controller actions

I did quite a bit of research and tested both versions 1.4 and 2.0 of the FluentSecurity libraries, and it seems I could not use the configuration template:

configuration.For<MyController>(x => x.GetCustomer()) .RequireRole(appRoles); 

when a parameter is required for my controller action, for example:

 public ActionResult GetCustomer(int customerID) 

Is this type of configuration supported? If so, how can I implement the role requirement for an action with the required parameter?

+4
source share
1 answer

I asked the same question. Currently, you can pass default values ​​for parameters.

 configuration .For<HomeController>(x => x.Index(default(string))) .DenyAnonymousAccess(); 

where is the HomeController :

 public ActionResult Index(string id) { return View(); } 
+2
source

Source: https://habr.com/ru/post/1443749/


All Articles