4

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 parameter?

Joel
  • 7,401
  • 4
  • 52
  • 58

1 Answers1

2

I was asking the same question. Currently, you can pass in default values for the parameters.

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

where HomeController is:

public ActionResult Index(string id)
{
    return View();
}
Utensil
  • 450
  • 4
  • 11
  • I recommend using the simplest thing possible. As the value is completely ignored you can pass it values like "", 0 or false. Whatever feels best in your case. – Kristoffer Ahl Nov 11 '12 at 07:47