You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by co...@apache.org on 2017/03/15 17:40:12 UTC

svn commit: r1787085 - in /webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml: OpenSAMLBootstrap.java OpenSAMLUtil.java

Author: coheigea
Date: Wed Mar 15 17:40:12 2017
New Revision: 1787085

URL: http://svn.apache.org/viewvc?rev=1787085&view=rev
Log:
WSS-601 - Optionally skip XACML initialization for OpenSAML
 - Thanks to Francesco for the patch

Modified:
    webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLBootstrap.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLUtil.java

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLBootstrap.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLBootstrap.java?rev=1787085&r1=1787084&r2=1787085&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLBootstrap.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLBootstrap.java Wed Mar 15 17:40:12 2017
@@ -69,9 +69,13 @@ public class OpenSAMLBootstrap {
     /**
      * Initializes the OpenSAML library, loading default configurations.
      *
-     * @throws ConfigurationException thrown if there is a problem initializing the OpenSAML library
+     * @throws XMLConfigurationException thrown if there is a problem initializing the OpenSAML library
      */
     public static synchronized void bootstrap() throws XMLConfigurationException {
+        bootstrap(true);
+    }
+
+    public static synchronized void bootstrap(boolean includeXacml) throws XMLConfigurationException {
         ClassLoader loader = Thread.currentThread().getContextClassLoader();
         try {
             XMLConfigurator configurator = new XMLConfigurator();
@@ -79,18 +83,20 @@ public class OpenSAMLBootstrap {
             Thread.currentThread().setContextClassLoader(XMLObjectProviderRegistrySupport.class.getClassLoader());
 
             for (String config : XML_CONFIGS) {
-                //most are found in the Configuration.class classloader
-                InputStream ins = Configuration.class.getResourceAsStream(config);
-                if (ins == null) {
-                    //some are from us
-                    ins = OpenSAMLBootstrap.class.getResourceAsStream(config);
-                }
-                if (ins != null) {
-                    configurator.load(ins);
-                    try {
-                        ins.close();
-                    } catch (IOException ex) { //NOPMD
-                        // Do nothing
+                if (includeXacml || !config.contains("xacml")) {
+                    //most are found in the Configuration.class classloader
+                    InputStream ins = Configuration.class.getResourceAsStream(config);
+                    if (ins == null) {
+                        //some are from us
+                        ins = OpenSAMLBootstrap.class.getResourceAsStream(config);
+                    }
+                    if (ins != null) {
+                        configurator.load(ins);
+                        try {
+                            ins.close();
+                        } catch (IOException ex) { //NOPMD
+                            // Do nothing
+                        }
                     }
                 }
             }

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLUtil.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLUtil.java?rev=1787085&r1=1787084&r2=1787085&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLUtil.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLUtil.java Wed Mar 15 17:40:12 2017
@@ -71,6 +71,10 @@ public final class OpenSAMLUtil {
      * Initialise the SAML library
      */
     public static synchronized void initSamlEngine() {
+        initSamlEngine(true);
+    }
+
+    public static synchronized void initSamlEngine(boolean includeXacml) {
         if (!samlEngineInitialized) {
             if (LOG.isDebugEnabled()) {
                 LOG.debug("Initializing the opensaml2 library...");
@@ -85,7 +89,7 @@ public final class OpenSAMLUtil {
                                    ConfigurationService.DEFAULT_PARTITION_NAME);
 
             try {
-                OpenSAMLBootstrap.bootstrap();
+                OpenSAMLBootstrap.bootstrap(includeXacml);
 
                 SAMLConfiguration samlConfiguration = new SAMLConfiguration();