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 2012/07/16 13:16:56 UTC

svn commit: r1361972 - in /webservices/wss4j/branches/swssf: ./ cxf-integration/ streaming-ws-policy/ streaming-ws-policy/src/test/resources/ streaming-ws-security/ streaming-ws-security/src/main/java/org/swssf/wss/ streaming-ws-security/src/main/java/...

Author: coheigea
Date: Mon Jul 16 11:16:56 2012
New Revision: 1361972

URL: http://svn.apache.org/viewvc?rev=1361972&view=rev
Log:
Made BouncyCastle optional + some other minor changes

Modified:
    webservices/wss4j/branches/swssf/cxf-integration/pom.xml
    webservices/wss4j/branches/swssf/pom.xml
    webservices/wss4j/branches/swssf/streaming-ws-policy/pom.xml
    webservices/wss4j/branches/swssf/streaming-ws-policy/src/test/resources/log4j-wsp.xml
    webservices/wss4j/branches/swssf/streaming-ws-security/pom.xml
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/WSSec.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/SecurityHeaderInputProcessor.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/AbstractTestBase.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/SignatureTest.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/test/resources/log4j-wss.xml
    webservices/wss4j/branches/swssf/streaming-ws-security/src/test/resources/log4j-xmlsec.xml

Modified: webservices/wss4j/branches/swssf/cxf-integration/pom.xml
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/cxf-integration/pom.xml?rev=1361972&r1=1361971&r2=1361972&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/cxf-integration/pom.xml (original)
+++ webservices/wss4j/branches/swssf/cxf-integration/pom.xml Mon Jul 16 11:16:56 2012
@@ -73,7 +73,7 @@
         <dependency>
             <groupId>log4j</groupId>
             <artifactId>log4j</artifactId>
-            <version>1.2.17</version>
+            <version>${log4j.version}</version>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -97,13 +97,13 @@
         <dependency>
             <groupId>xalan</groupId>
             <artifactId>xalan</artifactId>
-            <version>2.7.1</version>
+            <version>${xalan.version}</version>
             <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>xalan</groupId>
             <artifactId>serializer</artifactId>
-            <version>2.7.1</version>
+            <version>${xalan.version}</version>
             <scope>test</scope>
         </dependency>
     </dependencies>

Modified: webservices/wss4j/branches/swssf/pom.xml
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/pom.xml?rev=1361972&r1=1361971&r2=1361972&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/pom.xml (original)
+++ webservices/wss4j/branches/swssf/pom.xml Mon Jul 16 11:16:56 2012
@@ -44,11 +44,17 @@
 
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <xmlsec.version>2.0.0-SNAPSHOT</xmlsec.version>
-        <wss4j.version>1.6.6</wss4j.version>
-        <neethi.version>3.0.2</neethi.version>
         <targetJdk>1.6</targetJdk>
+
         <bcprov.version>1.46</bcprov.version>
+        <log4j.version>1.2.16</log4j.version>
+        <neethi.version>3.0.2</neethi.version>
+        <slf4j.version>1.6.1</slf4j.version>
+        <woodstox.core.asl.version>4.1.3</woodstox.core.asl.version>
+        <wss4j.version>1.6.6</wss4j.version>
+        <xalan.version>2.7.1</xalan.version>
+        <xerces.version>2.9.1</xerces.version>
+        <xmlsec.version>2.0.0-SNAPSHOT</xmlsec.version>
     </properties>
 
     <dependencyManagement>
@@ -56,7 +62,7 @@
             <dependency>
                 <groupId>xerces</groupId>
                 <artifactId>xercesImpl</artifactId>
-                <version>2.9.1</version>
+                <version>${xerces.version}</version>
             </dependency>
             <dependency>
                 <groupId>org.apache.santuario</groupId>
@@ -76,7 +82,7 @@
             <dependency>
                 <groupId>org.codehaus.woodstox</groupId>
                 <artifactId>woodstox-core-asl</artifactId>
-                <version>4.1.3</version>
+                <version>${woodstox.core.asl.version}</version>
             </dependency>
         </dependencies>
     </dependencyManagement>

Modified: webservices/wss4j/branches/swssf/streaming-ws-policy/pom.xml
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-policy/pom.xml?rev=1361972&r1=1361971&r2=1361972&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-policy/pom.xml (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-policy/pom.xml Mon Jul 16 11:16:56 2012
@@ -64,7 +64,13 @@
         <dependency>
             <groupId>log4j</groupId>
             <artifactId>log4j</artifactId>
-            <version>1.2.17</version>
+            <version>${log4j.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <version>${slf4j.version}</version>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -81,13 +87,13 @@
         <dependency>
             <groupId>xalan</groupId>
             <artifactId>xalan</artifactId>
-            <version>2.7.1</version>
+            <version>${xalan.version}</version>
             <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>xalan</groupId>
             <artifactId>serializer</artifactId>
-            <version>2.7.1</version>
+            <version>${xalan.version}</version>
             <scope>test</scope>
         </dependency>
     </dependencies>

Modified: webservices/wss4j/branches/swssf/streaming-ws-policy/src/test/resources/log4j-wsp.xml
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-policy/src/test/resources/log4j-wsp.xml?rev=1361972&r1=1361971&r2=1361972&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-policy/src/test/resources/log4j-wsp.xml (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-policy/src/test/resources/log4j-wsp.xml Mon Jul 16 11:16:56 2012
@@ -18,6 +18,6 @@
     <root>
         <level value="INFO"/>
         <appender-ref ref="FILE"/>
-        <appender-ref ref="STDOUT"/>
+        <!--<appender-ref ref="STDOUT"/>-->
     </root>
 </log4j:configuration>

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/pom.xml
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/pom.xml?rev=1361972&r1=1361971&r2=1361972&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/pom.xml (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/pom.xml Mon Jul 16 11:16:56 2012
@@ -199,7 +199,13 @@
         <dependency>
             <groupId>log4j</groupId>
             <artifactId>log4j</artifactId>
-            <version>1.2.17</version>
+            <version>${log4j.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <version>${slf4j.version}</version>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -216,13 +222,13 @@
         <dependency>
             <groupId>xalan</groupId>
             <artifactId>xalan</artifactId>
-            <version>2.7.1</version>
+            <version>${xalan.version}</version>
             <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>xalan</groupId>
             <artifactId>serializer</artifactId>
-            <version>2.7.1</version>
+            <version>${xalan.version}</version>
             <scope>test</scope>
         </dependency>
     </dependencies>

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/WSSec.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/WSSec.java?rev=1361972&r1=1361971&r2=1361972&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/WSSec.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/WSSec.java Mon Jul 16 11:16:56 2012
@@ -19,6 +19,8 @@
 package org.swssf.wss;
 
 import org.swssf.wss.ext.*;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.xml.security.stax.config.Init;
 import org.apache.xml.security.stax.ext.SecurePart;
 import org.apache.xml.security.stax.ext.XMLSecurityConstants;
@@ -40,18 +42,22 @@ import java.util.List;
  * @version $Revision$ $Date$
  */
 public class WSSec {
+    
+    private static final transient Log logger = LogFactory.getLog(WSSec.class);
 
     //todo crl check
     //todo outgoing client setup per policy
 
     static {
         try {
-            Class<?> c = WSSec.class.getClassLoader().loadClass("org.bouncycastle.jce.provider.BouncyCastleProvider");
+            Class<?> c = 
+                WSSec.class.getClassLoader().loadClass("org.bouncycastle.jce.provider.BouncyCastleProvider");
             if (null == Security.getProvider("BC")) {
                 Security.addProvider((Provider) c.newInstance());
             }
         } catch (Throwable e) {
-            throw new RuntimeException("Adding BouncyCastle provider failed", e);
+            logger.debug("Adding BouncyCastle provider failed", e);
+            // throw new RuntimeException("Adding BouncyCastle provider failed", e);
         }
 
         try {

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/SecurityHeaderInputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/SecurityHeaderInputProcessor.java?rev=1361972&r1=1361971&r2=1361972&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/SecurityHeaderInputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/SecurityHeaderInputProcessor.java Mon Jul 16 11:16:56 2012
@@ -154,7 +154,8 @@ public class SecurityHeaderInputProcesso
                                              QName elementName)
             throws WSSecurityException, XMLStreamException {
 
-        Class<XMLSecurityHeaderHandler> clazz = SecurityHeaderHandlerMapper.getSecurityHeaderHandler(elementName);
+        Class<XMLSecurityHeaderHandler> clazz = 
+            (Class<XMLSecurityHeaderHandler>)SecurityHeaderHandlerMapper.getSecurityHeaderHandler(elementName);
         if (clazz == null) {
             logger.warn("No matching handler found for " + elementName);
             return;

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/AbstractTestBase.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/AbstractTestBase.java?rev=1361972&r1=1361971&r2=1361972&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/AbstractTestBase.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/AbstractTestBase.java Mon Jul 16 11:16:56 2012
@@ -30,6 +30,7 @@ import org.apache.ws.security.handler.WS
 import org.apache.ws.security.handler.WSHandlerResult;
 import org.apache.ws.security.util.UUIDGenerator;
 import org.apache.ws.security.util.WSSecurityUtil;
+import org.apache.xml.security.stax.ext.XMLSec;
 import org.apache.xml.security.stax.ext.XMLSecurityException;
 import org.apache.xml.security.stax.securityEvent.SecurityEvent;
 import org.apache.xml.security.stax.securityEvent.SecurityEventConstants;
@@ -61,6 +62,7 @@ import javax.xml.xpath.XPathFactory;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
 import java.lang.reflect.Field;
+import java.security.Provider;
 import java.security.Security;
 import java.util.*;
 import java.util.logging.Level;
@@ -105,7 +107,17 @@ public abstract class AbstractTestBase {
         //we need an JCE provider which understands elliptic curve cryptography.
         //the sun default provider also supports ec but returns a sun.security.x509.X509Key
         //instead of the java.security.interfaces.ECPublicKey. Bug?
-        Security.insertProviderAt(new org.bouncycastle.jce.provider.BouncyCastleProvider(), 2);
+        // Security.insertProviderAt(new org.bouncycastle.jce.provider.BouncyCastleProvider(), 2);
+        try {
+            Class<?> c = 
+                XMLSec.class.getClassLoader().loadClass("org.bouncycastle.jce.provider.BouncyCastleProvider");
+            if (null == Security.getProvider("BC")) {
+                Security.addProvider((Provider) c.newInstance());
+            }
+        } catch (Throwable e) {
+            // throw new RuntimeException("Adding BouncyCastle provider failed", e);
+        }
+
     }
 
     @AfterClass

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/SignatureTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/SignatureTest.java?rev=1361972&r1=1361971&r2=1361972&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/SignatureTest.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/SignatureTest.java Mon Jul 16 11:16:56 2012
@@ -44,6 +44,7 @@ import javax.xml.xpath.XPathExpression;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
+import java.security.Security;
 import java.util.ArrayList;
 import java.util.Properties;
 
@@ -814,6 +815,11 @@ public class SignatureTest extends Abstr
 
     @Test
     public void testSignatureUsePKIPathOutbound() throws Exception {
+        
+        // Needs BouncyCastle to work properly...
+        if (Security.getProvider("BC") == null) {
+            return;
+        }
 
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         {
@@ -1010,6 +1016,10 @@ public class SignatureTest extends Abstr
 
     @Test
     public void testSignatureECKeyValue() throws Exception {
+        
+        if (Security.getProvider("BC") == null) {
+            return;
+        }
 
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         {

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/test/resources/log4j-wss.xml
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/test/resources/log4j-wss.xml?rev=1361972&r1=1361971&r2=1361972&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/test/resources/log4j-wss.xml (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/test/resources/log4j-wss.xml Mon Jul 16 11:16:56 2012
@@ -45,6 +45,6 @@
     <root>
         <level value="INFO"/>
         <appender-ref ref="FILE"/>
-        <appender-ref ref="STDOUT"/>
+        <!--<appender-ref ref="STDOUT"/>-->
     </root>
 </log4j:configuration>

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/test/resources/log4j-xmlsec.xml
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/test/resources/log4j-xmlsec.xml?rev=1361972&r1=1361971&r2=1361972&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/test/resources/log4j-xmlsec.xml (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/test/resources/log4j-xmlsec.xml Mon Jul 16 11:16:56 2012
@@ -39,6 +39,6 @@
     <root>
         <level value="INFO"/>
         <appender-ref ref="FILE"/>
-        <appender-ref ref="STDOUT"/>
+        <!--<appender-ref ref="STDOUT"/>-->
     </root>
 </log4j:configuration>