1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.opensaml.saml1.core.validator;
21
22 import org.opensaml.saml1.core.Assertion;
23 import org.opensaml.saml1.core.Condition;
24 import org.opensaml.saml1.core.Conditions;
25 import org.opensaml.saml1.core.DoNotCacheCondition;
26 import org.opensaml.xml.validation.ValidationException;
27 import org.opensaml.xml.validation.Validator;
28
29
30
31
32 public class AssertionSpecValidator implements Validator<Assertion> {
33
34 public void validate(Assertion assertion) throws ValidationException {
35 validateDoNotCache(assertion);
36 }
37
38 protected void validateDoNotCache(Assertion assertion) throws ValidationException {
39
40 if (assertion.getMinorVersion() == 0) {
41 Conditions conditions = assertion.getConditions();
42 if (conditions != null) {
43 for (Condition condition : conditions.getConditions()) {
44 if (condition instanceof DoNotCacheCondition) {
45 throw new ValidationException("DoNotCacheCondition not valid in SAML1.0");
46 }
47 }
48 }
49 }
50 }
51 }