1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.opensaml.saml2.metadata.validator;
22
23 import org.opensaml.saml2.metadata.Endpoint;
24 import org.opensaml.xml.util.DatatypeHelper;
25 import org.opensaml.xml.validation.ValidationException;
26 import org.opensaml.xml.validation.Validator;
27
28
29
30
31 public class EndpointSchemaValidator<EndpointType extends Endpoint> implements Validator<EndpointType> {
32
33
34 public EndpointSchemaValidator() {
35
36 }
37
38
39 public void validate(EndpointType endpoint) throws ValidationException {
40 validateBinding(endpoint);
41 validateLocation(endpoint);
42 }
43
44
45
46
47
48
49
50 protected void validateBinding(Endpoint endpoint) throws ValidationException {
51 if (DatatypeHelper.isEmpty(endpoint.getBinding())) {
52 throw new ValidationException("Binding required");
53 }
54 }
55
56
57
58
59
60
61
62 protected void validateLocation(Endpoint endpoint) throws ValidationException {
63 if (DatatypeHelper.isEmpty(endpoint.getLocation())) {
64 throw new ValidationException("Location required");
65 }
66 }
67 }