Author: coheigea
Date: Thu Dec 19 11:43:42 2013
New Revision: 1552284
URL: http://svn.apache.org/r1552284
Log:
Configure Opensaml ParserPool explicitly
Modified:
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLBootstrap.java
Modified:
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLBootstrap.java
URL:
http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLBootstrap.java?rev=1552284&r1=1552283&r2=1552284&view=diff
==============================================================================
---
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLBootstrap.java
(original)
+++
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLBootstrap.java
Thu Dec 19 11:43:42 2013
@@ -20,11 +20,17 @@
package org.apache.wss4j.common.saml;
import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.XMLConstants;
import org.opensaml.Configuration;
import org.opensaml.DefaultBootstrap;
import org.opensaml.xml.ConfigurationException;
import org.opensaml.xml.XMLConfigurator;
+import org.opensaml.xml.parse.StaticBasicParserPool;
+import org.opensaml.xml.parse.XMLParserException;
/**
* This class intializes the Opensaml library. It is necessary to override
DefaultBootstrap
@@ -99,4 +105,22 @@ public class OpenSAMLBootstrap extends D
configurator.load(ins);
}
}
+
+ protected static void initializeParserPool() throws ConfigurationException
{
+ StaticBasicParserPool pp = new StaticBasicParserPool();
+ pp.setMaxPoolSize(50);
+
+ Map<String, Boolean> features = new HashMap<String, Boolean>();
+ features.put(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ features.put("http://apache.org/xml/features/disallow-doctype-decl",
true);
+ pp.setBuilderFeatures(features);
+ pp.setExpandEntityReferences(false);
+
+ try {
+ pp.initialize();
+ } catch (XMLParserException e) {
+ throw new ConfigurationException("Error initializing parser pool",
e);
+ }
+ Configuration.setParserPool(pp);
+ }
}