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 AndMatchFunctor extends AbstractMatchFunctor {
29
30
31 private List<MatchFunctor> targetRules;
32
33
34
35
36
37
38 public AndMatchFunctor(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 targetRules.isEmpty()) {
57
58
59
60
61
62 return false;
63 }
64
65 for (MatchFunctor child : targetRules) {
66 if (!child.evaluatePolicyRequirement(filterContext)) {
67 return false;
68 }
69 }
70
71 return true;
72 }
73
74
75 protected boolean doEvaluateValue(ShibbolethFilteringContext filterContext, String attributeId,
76 Object attributeValue) throws FilterProcessingException {
77 if (targetRules == null ||
78 targetRules.isEmpty()) {
79
80
81
82 return false;
83 }
84
85 for (MatchFunctor child : targetRules) {
86 if (!child.evaluatePermitValue(filterContext, attributeId, attributeValue)) {
87 return false;
88 }
89 }
90
91 return true;
92 }
93 }