1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package edu.internet2.middleware.shibboleth.common.attribute.filtering.provider.match.basic;
18
19 import java.util.List;
20
21 import edu.internet2.middleware.shibboleth.common.attribute.filtering.provider.FilterProcessingException;
22 import edu.internet2.middleware.shibboleth.common.attribute.filtering.provider.MatchFunctor;
23 import edu.internet2.middleware.shibboleth.common.attribute.filtering.provider.ShibbolethFilteringContext;
24
25
26
27
28 public class OrMatchFunctor extends AbstractMatchFunctor {
29
30
31 private List<MatchFunctor> targetRules;
32
33
34
35
36
37
38 public OrMatchFunctor(List<MatchFunctor> rules){
39 targetRules = rules;
40 }
41
42
43
44
45
46
47 public List<MatchFunctor> getTargetRules() {
48 return targetRules;
49 }
50
51
52 protected boolean doEvaluatePolicyRequirement(ShibbolethFilteringContext filterContext)
53 throws FilterProcessingException {
54
55 if (targetRules == null) {
56
57
58
59 return false;
60 }
61
62 for (MatchFunctor child : targetRules) {
63 if (child.evaluatePolicyRequirement(filterContext)) {
64 return true;
65 }
66 }
67
68 return false;
69 }
70
71
72 protected boolean doEvaluateValue(ShibbolethFilteringContext filterContext, String attributeId,
73 Object attributeValue) throws FilterProcessingException {
74 if (targetRules == null) {
75 return false;
76 }
77
78 for (MatchFunctor child : targetRules) {
79 if (child.evaluatePermitValue(filterContext, attributeId, attributeValue)) {
80 return true;
81 }
82 }
83
84 return false;
85 }
86 }