ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1197531 - in /webservices/wss4j/trunk: ./ lib/ src/main/java/org/apache/ws/security/ src/main/java/org/apache/ws/security/message/ src/main/java/org/apache/ws/security/processor/ src/main/java/org/apache/ws/security/saml/ src/test/resources/
Date Fri, 04 Nov 2011 12:25:27 GMT
Author: coheigea
Date: Fri Nov  4 12:25:27 2011
New Revision: 1197531

URL: http://svn.apache.org/viewvc?rev=1197531&view=rev
Log:
Upgrading to Santuario 1.5.0-SNAPSHOT
 - Explicitly using Santuario provider now for JSR-105.
 - Also fixed a failing test with the IBM JDK.

Added:
    webservices/wss4j/trunk/lib/xmlsec-1.5.0-SNAPSHOT.jar
Removed:
    webservices/wss4j/trunk/lib/xmlsec-1.4.5.jar
Modified:
    webservices/wss4j/trunk/pom.xml
    webservices/wss4j/trunk/src/main/java/org/apache/ws/security/WSSConfig.java
    webservices/wss4j/trunk/src/main/java/org/apache/ws/security/message/WSSecDKSign.java
    webservices/wss4j/trunk/src/main/java/org/apache/ws/security/message/WSSecSignature.java
    webservices/wss4j/trunk/src/main/java/org/apache/ws/security/processor/SignatureProcessor.java
    webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/SAMLUtil.java
    webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/WSSecSignatureSAML.java
    webservices/wss4j/trunk/src/test/resources/alice.properties

Added: webservices/wss4j/trunk/lib/xmlsec-1.5.0-SNAPSHOT.jar
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/lib/xmlsec-1.5.0-SNAPSHOT.jar?rev=1197531&view=auto
==============================================================================
Files webservices/wss4j/trunk/lib/xmlsec-1.5.0-SNAPSHOT.jar (added) and webservices/wss4j/trunk/lib/xmlsec-1.5.0-SNAPSHOT.jar
Fri Nov  4 12:25:27 2011 differ

Modified: webservices/wss4j/trunk/pom.xml
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/pom.xml?rev=1197531&r1=1197530&r2=1197531&view=diff
==============================================================================
--- webservices/wss4j/trunk/pom.xml (original)
+++ webservices/wss4j/trunk/pom.xml Fri Nov  4 12:25:27 2011
@@ -160,7 +160,7 @@
                               javax.xml.crypto.*,
                               org.apache.xml.security.*,
                               org.bouncycastle.*;resolution:=optional,
-                              org.jcp.xml.dsig.internal.dom.*,
+                              org.apache.jcp.xml.dsig.internal.dom.*,
                               org.opensaml.*;resolution:=optional,
                               *;resolution:=optional
                         </Import-Package>
@@ -353,7 +353,7 @@
     </profiles>
 
     <properties>
-        <xmlsec.version>1.4.6</xmlsec.version>
+        <xmlsec.version>1.5.0-SNAPSHOT</xmlsec.version>
         <opensaml.version>2.5.1-1</opensaml.version>
         <xml.apis.version>1.3.04</xml.apis.version>
         <bcprov.version>1.46</bcprov.version>
@@ -551,4 +551,20 @@
             </url>
         </site>
     </distributionManagement>
+
+    <!-- Temporarily adding in to get Santuario SNAPSHOT -->
+    <repositories>
+          <repository>
+              <id>apache.snapshots</id>
+              <url>http://repository.apache.org/snapshots/</url>
+              <name>Apache Snapshot Repo</name>
+             <snapshots>
+                 <enabled>true</enabled>
+             </snapshots>
+             <releases>
+                 <enabled>false</enabled>
+             </releases>
+         </repository>
+     </repositories>
+
 </project>

Modified: webservices/wss4j/trunk/src/main/java/org/apache/ws/security/WSSConfig.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/WSSConfig.java?rev=1197531&r1=1197530&r2=1197531&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/main/java/org/apache/ws/security/WSSConfig.java (original)
+++ webservices/wss4j/trunk/src/main/java/org/apache/ws/security/WSSConfig.java Fri Nov  4
12:25:27 2011
@@ -30,13 +30,13 @@ import java.util.Map;
 
 import javax.xml.namespace.QName;
 
+import org.apache.jcp.xml.dsig.internal.dom.XMLDSigRI;
 import org.apache.ws.security.action.Action;
 import org.apache.ws.security.processor.Processor;
 import org.apache.ws.security.util.Loader;
 import org.apache.ws.security.util.UUIDGenerator;
 import org.apache.ws.security.validate.Validator;
 import org.apache.xml.security.utils.XMLUtils;
-import org.jcp.xml.dsig.internal.dom.XMLDSigRI;
 
 /**
  * WSSConfig <p/> Carries configuration data so the WSS4J spec compliance can be
@@ -401,7 +401,7 @@ public class WSSConfig {
             if (addJceProviders) {
                 AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
                     public Boolean run() {
-                        addXMLDSigRI();
+                        addJceProvider("ApacheXMLDSig", new XMLDSigRI());
                         addJceProvider("BC", "org.bouncycastle.jce.provider.BouncyCastleProvider");
                         Security.removeProvider("STRTransform");
                         appendJceProvider(
@@ -416,18 +416,6 @@ public class WSSConfig {
         }
     }
     
-    private static void addXMLDSigRI() {
-        try {
-            addXMLDSigRIInternal();
-        } catch (Throwable t) {
-            //ignore - may be a NoClassDefFound if XMLDSigRI isn't avail
-            return;
-        }
-    }
-    public static void addXMLDSigRIInternal() {
-        addJceProvider("XMLDSig", new XMLDSigRI());
-    }
-    
     /**
      * @return a new WSSConfig instance configured with the default values
      */

Modified: webservices/wss4j/trunk/src/main/java/org/apache/ws/security/message/WSSecDKSign.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/message/WSSecDKSign.java?rev=1197531&r1=1197530&r2=1197531&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/main/java/org/apache/ws/security/message/WSSecDKSign.java
(original)
+++ webservices/wss4j/trunk/src/main/java/org/apache/ws/security/message/WSSecDKSign.java
Fri Nov  4 12:25:27 2011
@@ -33,6 +33,7 @@ import org.apache.ws.security.util.WSSec
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
+import java.security.NoSuchProviderException;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -72,19 +73,36 @@ public class WSSecDKSign extends WSSecDe
     private String strUri = null;
     private WSDocInfo wsDocInfo;
     
-    private KeyInfoFactory keyInfoFactory = KeyInfoFactory.getInstance("DOM");
-    private XMLSignatureFactory signatureFactory = XMLSignatureFactory.getInstance("DOM");
+    private KeyInfoFactory keyInfoFactory;
+    private XMLSignatureFactory signatureFactory;
     private XMLSignature sig;
     private KeyInfo keyInfo;
     private CanonicalizationMethod c14nMethod;
     private Element securityHeader = null;
 
-
     public WSSecDKSign() {
         super();
+        init();
     }
+    
     public WSSecDKSign(WSSConfig config) {
         super(config);
+        init();
+    }
+    
+    private void init() {
+        // Try to install the Santuario Provider - fall back to the JDK provider if this
does
+        // not work
+        try {
+            signatureFactory = XMLSignatureFactory.getInstance("DOM", "ApacheXMLDSig");
+        } catch (NoSuchProviderException ex) {
+            signatureFactory = XMLSignatureFactory.getInstance("DOM");
+        }
+        try {
+            keyInfoFactory = KeyInfoFactory.getInstance("DOM", "ApacheXMLDSig");
+        } catch (NoSuchProviderException ex) {
+            keyInfoFactory = KeyInfoFactory.getInstance("DOM");
+        }
     }
     
     public Document build(Document doc, WSSecHeader secHeader)

Modified: webservices/wss4j/trunk/src/main/java/org/apache/ws/security/message/WSSecSignature.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/message/WSSecSignature.java?rev=1197531&r1=1197530&r2=1197531&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/main/java/org/apache/ws/security/message/WSSecSignature.java
(original)
+++ webservices/wss4j/trunk/src/main/java/org/apache/ws/security/message/WSSecSignature.java
Fri Nov  4 12:25:27 2011
@@ -42,6 +42,7 @@ import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
+import java.security.NoSuchProviderException;
 import java.security.cert.X509Certificate;
 import java.util.ArrayList;
 import java.util.List;
@@ -92,8 +93,8 @@ public class WSSecSignature extends WSSe
     protected String strUri = null;
     protected BinarySecurity bstToken = null;
     
-    protected KeyInfoFactory keyInfoFactory = KeyInfoFactory.getInstance("DOM");
-    protected XMLSignatureFactory signatureFactory = XMLSignatureFactory.getInstance("DOM");
+    protected KeyInfoFactory keyInfoFactory;
+    protected XMLSignatureFactory signatureFactory;
     protected KeyInfo keyInfo;
     protected CanonicalizationMethod c14nMethod;
     protected XMLSignature sig;
@@ -110,9 +111,27 @@ public class WSSecSignature extends WSSe
 
     public WSSecSignature() {
         super();
+        init();
     }
+    
     public WSSecSignature(WSSConfig config) {
         super(config);
+        init();
+    }
+    
+    private void init() {
+        // Try to install the Santuario Provider - fall back to the JDK provider if this
does
+        // not work
+        try {
+            signatureFactory = XMLSignatureFactory.getInstance("DOM", "ApacheXMLDSig");
+        } catch (NoSuchProviderException ex) {
+            signatureFactory = XMLSignatureFactory.getInstance("DOM");
+        }
+        try {
+            keyInfoFactory = KeyInfoFactory.getInstance("DOM", "ApacheXMLDSig");
+        } catch (NoSuchProviderException ex) {
+            keyInfoFactory = KeyInfoFactory.getInstance("DOM");
+        }
     }
    
     /**

Modified: webservices/wss4j/trunk/src/main/java/org/apache/ws/security/processor/SignatureProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/processor/SignatureProcessor.java?rev=1197531&r1=1197530&r2=1197531&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/main/java/org/apache/ws/security/processor/SignatureProcessor.java
(original)
+++ webservices/wss4j/trunk/src/main/java/org/apache/ws/security/processor/SignatureProcessor.java
Fri Nov  4 12:25:27 2011
@@ -63,6 +63,7 @@ import javax.xml.crypto.dsig.keyinfo.Key
 import javax.xml.crypto.dsig.keyinfo.KeyValue;
 
 import java.security.Key;
+import java.security.NoSuchProviderException;
 import java.security.PublicKey;
 import java.security.Principal;
 import java.security.cert.X509Certificate;
@@ -75,9 +76,23 @@ public class SignatureProcessor implemen
     private static org.apache.commons.logging.Log LOG = 
         org.apache.commons.logging.LogFactory.getLog(SignatureProcessor.class);
     
-    private XMLSignatureFactory signatureFactory = XMLSignatureFactory.getInstance("DOM");
+    private XMLSignatureFactory signatureFactory;
+    private KeyInfoFactory keyInfoFactory;
     
-    private KeyInfoFactory keyInfoFactory = KeyInfoFactory.getInstance("DOM");
+    public SignatureProcessor() {
+        // Try to install the Santuario Provider - fall back to the JDK provider if this
does
+        // not work
+        try {
+            signatureFactory = XMLSignatureFactory.getInstance("DOM", "ApacheXMLDSig");
+        } catch (NoSuchProviderException ex) {
+            signatureFactory = XMLSignatureFactory.getInstance("DOM");
+        }
+        try {
+            keyInfoFactory = KeyInfoFactory.getInstance("DOM", "ApacheXMLDSig");
+        } catch (NoSuchProviderException ex) {
+            keyInfoFactory = KeyInfoFactory.getInstance("DOM");
+        }
+    }
     
     public List<WSSecurityEngineResult> handleToken(
         Element elem,

Modified: webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/SAMLUtil.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/SAMLUtil.java?rev=1197531&r1=1197530&r2=1197531&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/SAMLUtil.java (original)
+++ webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/SAMLUtil.java Fri Nov
 4 12:25:27 2011
@@ -49,6 +49,7 @@ import javax.xml.crypto.dsig.keyinfo.X50
 import javax.xml.crypto.dsig.keyinfo.X509IssuerSerial;
 import javax.xml.namespace.QName;
 
+import java.security.NoSuchProviderException;
 import java.security.PublicKey;
 import java.security.cert.X509Certificate;
 import java.util.List;
@@ -310,7 +311,12 @@ public class SAMLUtil {
         // (public key) credential
         //
         X509Certificate[] certs = null;
-        KeyInfoFactory keyInfoFactory = KeyInfoFactory.getInstance("DOM");
+        KeyInfoFactory keyInfoFactory = null;
+        try {
+            keyInfoFactory = KeyInfoFactory.getInstance("DOM", "ApacheXMLDSig");
+        } catch (NoSuchProviderException ex) {
+            keyInfoFactory = KeyInfoFactory.getInstance("DOM");
+        }
         XMLStructure keyInfoStructure = new DOMStructure(keyInfoElement);
 
         try {

Modified: webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/WSSecSignatureSAML.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/WSSecSignatureSAML.java?rev=1197531&r1=1197530&r2=1197531&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/WSSecSignatureSAML.java
(original)
+++ webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/WSSecSignatureSAML.java
Fri Nov  4 12:25:27 2011
@@ -19,6 +19,20 @@
 
 package org.apache.ws.security.saml;
 
+import java.security.PublicKey;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.crypto.XMLStructure;
+import javax.xml.crypto.dom.DOMStructure;
+import javax.xml.crypto.dsig.SignatureMethod;
+import javax.xml.crypto.dsig.SignedInfo;
+import javax.xml.crypto.dsig.XMLSignContext;
+import javax.xml.crypto.dsig.dom.DOMSignContext;
+import javax.xml.crypto.dsig.spec.C14NMethodParameterSpec;
+import javax.xml.crypto.dsig.spec.ExcC14NParameterSpec;
+
 import org.apache.ws.security.WSConstants;
 import org.apache.ws.security.WSDocInfo;
 import org.apache.ws.security.WSEncryptionPart;
@@ -38,26 +52,9 @@ import org.apache.ws.security.saml.ext.A
 import org.apache.ws.security.saml.ext.OpenSAMLUtil;
 import org.apache.ws.security.transform.STRTransform;
 import org.apache.ws.security.util.WSSecurityUtil;
-
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
-import java.security.PublicKey;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.crypto.XMLStructure;
-import javax.xml.crypto.dom.DOMStructure;
-import javax.xml.crypto.dsig.SignatureMethod;
-import javax.xml.crypto.dsig.SignedInfo;
-import javax.xml.crypto.dsig.XMLSignContext;
-import javax.xml.crypto.dsig.XMLSignatureFactory;
-import javax.xml.crypto.dsig.dom.DOMSignContext;
-import javax.xml.crypto.dsig.keyinfo.KeyInfoFactory;
-import javax.xml.crypto.dsig.spec.C14NMethodParameterSpec;
-import javax.xml.crypto.dsig.spec.ExcC14NParameterSpec;
-
 public class WSSecSignatureSAML extends WSSecSignature {
 
     private static org.apache.commons.logging.Log log = 
@@ -72,8 +69,6 @@ public class WSSecSignatureSAML extends 
     private String issuerKeyPW = null;
     private boolean useDirectReferenceToAssertion = false;
     
-    private KeyInfoFactory keyInfoFactory = KeyInfoFactory.getInstance("DOM");
-
     /**
      * Constructor.
      */
@@ -211,9 +206,6 @@ public class WSSecSignatureSAML extends 
         issuerKeyName = iKeyName;
         issuerKeyPW = iKeyPW;
         
-        keyInfoFactory = KeyInfoFactory.getInstance("DOM");
-        signatureFactory = XMLSignatureFactory.getInstance("DOM");
-        
         samlToken = (Element) assertion.toDOM(doc);
 
         //

Modified: webservices/wss4j/trunk/src/test/resources/alice.properties
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/test/resources/alice.properties?rev=1197531&r1=1197530&r2=1197531&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/test/resources/alice.properties (original)
+++ webservices/wss4j/trunk/src/test/resources/alice.properties Fri Nov  4 12:25:27 2011
@@ -3,3 +3,4 @@ org.apache.ws.security.crypto.merlin.key
 org.apache.ws.security.crypto.merlin.keystore.password=password
 org.apache.ws.security.crypto.merlin.keystore.alias=alice
 org.apache.ws.security.crypto.merlin.keystore.file=keys/alice.p12
+org.apache.ws.security.crypto.merlin.keystore.private.password=password
\ No newline at end of file



Mime
View raw message