/// <summary> /// Gets the actual type of the ISecurityPolicy. Takes care of checking for lazy policies. /// </summary> public static Type GetPolicyType(this ISecurityPolicy securityPolicy) { var lazySecurityPolicy = securityPolicy as ILazySecurityPolicy; return(lazySecurityPolicy != null ? lazySecurityPolicy.PolicyType : securityPolicy.GetType()); }
public static PolicyResult CreateSuccessResult(ISecurityPolicy policy) { return new PolicyResult { PolicyType = policy.GetType(), ViolationOccured = false, Message = null }; }
public static PolicyResult CreateSuccessResult(ISecurityPolicy policy) { return(new PolicyResult { PolicyType = policy.GetType(), ViolationOccured = false, Message = null }); }
public virtual ISecurityPolicy Merge(ISecurityPolicy next) { if (next == null) { throw new ArgumentNullException("next"); } if (next.GetType() != this.GetType()) { throw new ArgumentException("Merging of policies of different types not allowed"); } return(next); }
public static PolicyResult CreateFailureResult(ISecurityPolicy policy, string message) { if (policy == null) throw new ArgumentNullException("policy", "A policy must be provided."); if (String.IsNullOrEmpty(message)) throw new ArgumentNullException("message", "A failure message must be provided."); return new PolicyResult { PolicyType = policy.GetType(), ViolationOccured = true, Message = message }; }
public static PolicyResult CreateFailureResult(ISecurityPolicy policy, string message) { if (policy == null) { throw new ArgumentNullException("policy", "A policy must be provided."); } if (String.IsNullOrEmpty(message)) { throw new ArgumentNullException("message", "A failure message must be provided."); } return(new PolicyResult { PolicyType = policy.GetType(), ViolationOccured = true, Message = message }); }
private PolicyResultCacheStrategy GetExecutionCacheStrategyForPolicy(ISecurityPolicy securityPolicy, Cache defaultResultsCacheLifecycle) { var existingStrategy = GetExistingCacheStrategyForPolicy(securityPolicy.GetType()); return(existingStrategy ?? new PolicyResultCacheStrategy(ControllerName, ActionName, securityPolicy.GetType(), defaultResultsCacheLifecycle)); }
protected PolicyResult(string message, bool violationOccured, ISecurityPolicy policy) : this(message, violationOccured, policy.GetType()) { }