1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.opensaml.saml1.core.validator;
22
23 import javax.xml.namespace.QName;
24
25 import org.opensaml.saml1.core.AuthorityBinding;
26 import org.opensaml.xml.util.DatatypeHelper;
27 import org.opensaml.xml.validation.ValidationException;
28 import org.opensaml.xml.validation.Validator;
29
30
31
32
33 public class AuthorityBindingSchemaValidator implements Validator<AuthorityBinding> {
34
35
36 public void validate(AuthorityBinding authorityBinding) throws ValidationException {
37 validateAuthorityKind(authorityBinding);
38 validateBinding(authorityBinding);
39 validateLocation(authorityBinding);
40 }
41
42
43
44
45
46
47 protected void validateAuthorityKind(AuthorityBinding authorityBinding) throws ValidationException {
48
49
50
51
52
53
54 QName authorityKind = authorityBinding.getAuthorityKind();
55 if (authorityKind == null) {
56 throw new ValidationException("No AuthorityKind attribute present");
57 }
58 }
59
60
61
62
63
64
65 protected void validateLocation(AuthorityBinding authorityBinding) throws ValidationException {
66 if (DatatypeHelper.isEmpty(authorityBinding.getLocation())) {
67 throw new ValidationException("Location attribute not present or invalid ");
68 }
69 }
70
71
72
73
74
75
76 protected void validateBinding(AuthorityBinding authorityBinding) throws ValidationException {
77 if (DatatypeHelper.isEmpty(authorityBinding.getBinding())) {
78 throw new ValidationException("Binding attribute not present or invalid ");
79 }
80 }
81 }