Exemplo n.º 1
0
 /// <summary>
 /// This module requires authentication and certain roles to be present.
 /// </summary>
 /// <param name="module">Module to enable</param>
 /// <param name="requiredRoles">Role(s) required</param>
 public static void RequiresRoles(this INancyModule module, params string[] requiredRoles)
 {
     module.AddBeforeHookOrExecute(SecurityHooks.RequiresAuthentication(), "Requires Authentication");
     module.AddBeforeHookOrExecute(SecurityHooks.RequiresRoles(requiredRoles), "Requires Roles");
 }