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