ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1552286 - /webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/saml/ext/OpenSAMLBootstrap.java
Date Thu, 19 Dec 2013 11:48:54 GMT
Author: coheigea
Date: Thu Dec 19 11:48:54 2013
New Revision: 1552286

URL: http://svn.apache.org/r1552286
Log:
Configure Opensaml ParserPool explicitly

Modified:
    webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/saml/ext/OpenSAMLBootstrap.java

Modified: webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/saml/ext/OpenSAMLBootstrap.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/saml/ext/OpenSAMLBootstrap.java?rev=1552286&r1=1552285&r2=1552286&view=diff
==============================================================================
--- webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/saml/ext/OpenSAMLBootstrap.java
(original)
+++ webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/saml/ext/OpenSAMLBootstrap.java
Thu Dec 19 11:48:54 2013
@@ -20,11 +20,17 @@
 package org.apache.ws.security.saml.ext;
 
 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);
+    }
 }



Mime
View raw message