Exemple #1
0
 /// <summary>
 /// This module requires claims to be validated
 /// </summary>
 /// <param name="module">Module to enable</param>
 /// <param name="isValid">Claims validator</param>
 public static void RequiresValidatedClaims(this INancyModule module, Func <IEnumerable <string>, bool> isValid)
 {
     module.AddBeforeHookOrExecute(SecurityHooks.RequiresAuthentication(), "Requires Authentication");
     module.AddBeforeHookOrExecute(SecurityHooks.RequiresValidatedClaims(isValid), "Requires Validated Claim");
 }
Exemple #2
0
 /// <summary>
 /// This module requires authentication
 /// </summary>
 /// <param name="module">Module to enable</param>
 public static void RequiresAuthentication(this INancyModule module)
 {
     module.AddBeforeHookOrExecute(SecurityHooks.RequiresAuthentication(), "Requires Authentication");
 }
Exemple #3
0
 /// <summary>
 /// This module requires authentication and any one of certain claims to be present.
 /// </summary>
 /// <param name="module">Module to enable</param>
 /// <param name="requiredClaims">Claim(s) required</param>
 public static void RequiresAnyClaim(this INancyModule module, IEnumerable <string> requiredClaims)
 {
     module.AddBeforeHookOrExecute(SecurityHooks.RequiresAuthentication(), "Requires Authentication");
     module.AddBeforeHookOrExecute(SecurityHooks.RequiresAnyClaim(requiredClaims), "Requires Any Claim");
 }
 /// <summary>
 /// This module requires authentication and any one of certain claims to be present.
 /// </summary>
 /// <param name="module">Module to enable</param>
 /// <param name="requiredClaims">Claim(s) required</param>
 public static void RequiresAnyClaim(this INancyModule module, params Predicate <Claim>[] requiredClaims)
 {
     module.AddBeforeHookOrExecute(SecurityHooks.RequiresAuthentication(), "Requires Authentication");
     module.AddBeforeHookOrExecute(SecurityHooks.RequiresAnyClaim(requiredClaims), "Requires Any Claim");
 }
Exemple #5
0
 /// <summary>
 /// This module requires claims to be validated
 /// </summary>
 /// <param name="module">Module to enable</param>
 /// <param name="isValid">Claims validator</param>
 public static void RequiresValidatedClaims(this INancyModule module, Func <IEnumerable <string>, bool> isValid)
 {
     module.Before.AddItemToStartOfPipeline(SecurityHooks.RequiresValidatedClaims(isValid));
     module.Before.AddItemToStartOfPipeline(SecurityHooks.RequiresAuthentication());
 }
Exemple #6
0
 /// <summary>
 /// This module requires authentication and any one of certain claims to be present.
 /// </summary>
 /// <param name="module">Module to enable</param>
 /// <param name="requiredClaims">Claim(s) required</param>
 public static void RequiresAnyClaim(this INancyModule module, IEnumerable <string> requiredClaims)
 {
     module.Before.AddItemToEndOfPipeline(SecurityHooks.RequiresAuthentication());
     module.Before.AddItemToEndOfPipeline(SecurityHooks.RequiresAnyClaim(requiredClaims));
 }
Exemple #7
0
 /// <summary>
 /// This module requires authentication
 /// </summary>
 /// <param name="module">Module to enable</param>
 public static void RequiresAuthentication(this INancyModule module)
 {
     module.Before.AddItemToEndOfPipeline(SecurityHooks.RequiresAuthentication());
 }
 /// <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");
 }