コード例 #1
0
 /// <summary>
 /// This module requires authentication and any one of certain roles to be present.
 /// </summary>
 /// <param name="module">Module to enable</param>
 /// <param name="requiredRoles">Role(s) at least one of which is required</param>
 public static void RequiresAnyRole(this INancyModule module, params string[] requiredRoles)
 {
     module.AddBeforeHookOrExecute(SecurityHooks.RequiresAuthentication(), "Requires Authentication");
     module.AddBeforeHookOrExecute(SecurityHooks.RequiresAnyRole(requiredRoles), "Requires Any Role");
 }