1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.opensaml.saml1.core.validator;
18
19 import org.opensaml.saml1.core.AuthenticationStatement;
20 import org.opensaml.xml.util.DatatypeHelper;
21 import org.opensaml.xml.validation.ValidationException;
22
23
24
25
26 public class AuthenticationStatementSchemaValidator extends SubjectStatementSchemaValidator<AuthenticationStatement> {
27
28
29 public void validate(AuthenticationStatement authenticationStatement) throws ValidationException {
30 super.validate(authenticationStatement);
31
32 validateAuthenticationMethod(authenticationStatement);
33
34 validateAuthenticationInstant(authenticationStatement);
35 }
36
37
38
39
40
41
42
43
44 protected void validateAuthenticationMethod(AuthenticationStatement authenticationStatement)
45 throws ValidationException {
46 if (DatatypeHelper.isEmpty(authenticationStatement.getAuthenticationMethod())) {
47 throw new ValidationException("No authenticationStatement URI is null");
48 }
49 }
50
51
52
53
54
55
56
57
58 protected void validateAuthenticationInstant(AuthenticationStatement authenticationStatement)
59 throws ValidationException {
60 if (authenticationStatement.getAuthenticationInstant() == null) {
61 throw new ValidationException("No authenticationInstant present");
62 }
63 }
64 }