1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package edu.internet2.middleware.shibboleth.common.config.security;
19
20 import javax.xml.namespace.QName;
21
22 import org.opensaml.xml.security.x509.PKIXValidationOptions;
23 import org.opensaml.xml.util.DatatypeHelper;
24 import org.opensaml.xml.util.XMLHelper;
25 import org.springframework.beans.factory.support.BeanDefinitionBuilder;
26 import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
27 import org.w3c.dom.Attr;
28 import org.w3c.dom.Element;
29
30
31 public class PKIXValidationOptionsBeanDefinitionParser extends AbstractSingleBeanDefinitionParser {
32
33
34 public static final QName ELEMENT_NAME = new QName(SecurityNamespaceHandler.NAMESPACE, "ValidationOptions");
35
36
37 public static final QName SCHEMA_TYPE = new QName(SecurityNamespaceHandler.NAMESPACE, "ValidationOptionsType");
38
39
40 protected Class getBeanClass(Element element) {
41 return PKIXValidationOptions.class;
42 }
43
44
45 protected boolean shouldGenerateId() {
46 return true;
47 }
48
49
50 protected void doParse(Element element, BeanDefinitionBuilder builder) {
51 if (element.hasAttributeNS(null, "processEmptyCRLs")) {
52 Attr attr = element.getAttributeNodeNS(null, "processEmptyCRLs");
53 builder.addPropertyValue("processEmptyCRLs", XMLHelper.getAttributeValueAsBoolean(attr));
54 }
55
56 if (element.hasAttributeNS(null, "processExpiredCRLs")) {
57 Attr attr = element.getAttributeNodeNS(null, "processExpiredCRLs");
58 builder.addPropertyValue("processExpiredCRLs", XMLHelper.getAttributeValueAsBoolean(attr));
59 }
60
61 if (element.hasAttributeNS(null, "processCredentialCRLs")) {
62 Attr attr = element.getAttributeNodeNS(null, "processCredentialCRLs");
63 builder.addPropertyValue("processCredentialCRLs", XMLHelper.getAttributeValueAsBoolean(attr));
64 }
65
66 if (element.hasAttributeNS(null, "defaultVerificationDepth")) {
67 Integer depth = new Integer(DatatypeHelper.safeTrim(element.getAttributeNS(null, "defaultVerificationDepth")));
68 builder.addPropertyValue("defaultVerificationDepth", depth);
69 }
70
71 }
72
73 }