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