Esempio n. 1
0
 public MatchResult Evaluate(AuthorizationContext authorizationContext)
 {
     foreach (var allOf in AllOf)
         if (allOf.Evaluate(authorizationContext) == MatchResult.True)
             return MatchResult.True;
     return MatchResult.False;
 }
Esempio n. 2
0
 public MatchResult Evaluate(AuthorizationContext authorizationContext)
 {
     foreach (var match in Matches)
         if (match.Evaluate(authorizationContext) == MatchResult.False)
             return MatchResult.False;
     return MatchResult.True;
 }
Esempio n. 3
0
 public MatchResult Evaluate(AuthorizationContext authorizationContext)
 {
     foreach (var attributeCategory in authorizationContext.AttributeCategories)
         if (Evaluate(attributeCategory) == MatchResult.True)
             return MatchResult.True;
     return MatchResult.False;
 }
Esempio n. 4
0
        /// <summary>
        /// <see cref="http://docs.oasis-open.org/xacml/3.0/xacml-3.0-core-spec-os-en.html#_Toc325047188">Rule evaluation</see>
        /// </summary>
        /// <param name="authorizationContext"></param>
        /// <returns></returns>
        public Decision Evaluate(AuthorizationContext authorizationContext)
        {
            // not using conditions right now, so the rule table will always be
            // true for the condition column
            var matchResult = Target != null
                ? Target.Evaluate(authorizationContext)
                : MatchResult.True;

            switch (matchResult)
            {
                case MatchResult.True:
                    if (Effect == RuleEffect.Permit)
                        return Decision.Permit;
                    return Decision.Deny;

                case MatchResult.False:
                    return Decision.NotApplicable;

                case MatchResult.Indeterminate:
                    if (Effect == RuleEffect.Permit)
                        return Decision.Indeterminate | Decision.Permit;
                    return Decision.Indeterminate | Decision.Deny;
            }
            throw new Exception("Invalid match result detected.");
        }
Esempio n. 5
0
 public ICollection<PolicySet> GetApplicablePolicySets(AuthorizationContext authorizationContext)
 {
     var applicablePolicySets = new List<PolicySet>();
     foreach (var policySet in PolicySets)
         if (policySet.Target.Evaluate(authorizationContext) == MatchResult.True)
             applicablePolicySets.Add(policySet);
     return applicablePolicySets;
 }
Esempio n. 6
0
 public abstract Decision Evaluate(IEnumerable<IDecisionEvaluator> evaluators, AuthorizationContext context);
Esempio n. 7
0
 public AuthorizationRequest(AuthorizationContext authorizationContext)
 {
     AuthorizationContext = authorizationContext;
 }
Esempio n. 8
0
 public Decision Evaluate(AuthorizationContext authorizationContext)
 {
     return CombiningAlgorithm.Evaluate(Rules, authorizationContext);
 }