ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1039467 - in /webservices/wss4j/trunk/src/org/apache/ws/security: message/WSSecSignature.java transform/STRTransform.java
Date Fri, 26 Nov 2010 17:06:53 GMT
Author: coheigea
Date: Fri Nov 26 17:06:53 2010
New Revision: 1039467

URL: http://svn.apache.org/viewvc?rev=1039467&view=rev
Log:
Added some accessor methods for the SecurityTokenReference in WSSecSignature
 - Some cleanup of STRTransform.

Modified:
    webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignature.java
    webservices/wss4j/trunk/src/org/apache/ws/security/transform/STRTransform.java

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignature.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignature.java?rev=1039467&r1=1039466&r2=1039467&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignature.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignature.java Fri Nov
26 17:06:53 2010
@@ -664,6 +664,22 @@ public class WSSecSignature extends WSSe
         }
         return null;
     }
+    
+    /**
+     * @return the URI associated with the SecurityTokenReference
+     * (must be called after {@link #prepare(Document, Crypto, WSSecHeader)}
+     */
+    public String getSecurityTokenReferenceURI() {
+        return strUri;
+    }
+    
+    /**
+     * @return the SecurityTokenReference (must be called after 
+     * {@link #prepare(Document, Crypto, WSSecHeader)}
+     */
+    public SecurityTokenReference getSecurityTokenReference() {
+        return secRef;
+    }
 
     private String getSHA1(byte[] input) throws WSSecurityException {
         try {

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/transform/STRTransform.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/transform/STRTransform.java?rev=1039467&r1=1039466&r2=1039467&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/transform/STRTransform.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/transform/STRTransform.java Fri Nov
26 17:06:53 2010
@@ -31,7 +31,6 @@ import org.apache.ws.security.util.WSSec
 
 import org.apache.xml.security.c14n.Canonicalizer;
 import org.apache.xml.security.signature.XMLSignatureInput;
-//import org.apache.xml.security.utils.XMLUtils;
 
 import org.jcp.xml.dsig.internal.dom.ApacheData;
 import org.jcp.xml.dsig.internal.dom.DOMSubTreeData;
@@ -47,15 +46,12 @@ import java.security.spec.AlgorithmParam
 
 import javax.xml.crypto.Data;
 import javax.xml.crypto.MarshalException;
-//import javax.xml.crypto.NodeSetData;
 import javax.xml.crypto.OctetStreamData;
 import javax.xml.crypto.XMLCryptoContext;
 import javax.xml.crypto.XMLStructure;
 import javax.xml.crypto.dom.DOMCryptoContext;
-//import javax.xml.crypto.dsig.Transform;
 import javax.xml.crypto.dsig.TransformException;
 import javax.xml.crypto.dsig.TransformService;
-//import javax.xml.crypto.dsig.XMLSignatureFactory;
 import javax.xml.crypto.dsig.spec.TransformParameterSpec;
 
 
@@ -71,8 +67,6 @@ public class STRTransform extends Transf
     
     private Element transformElement;
     
-    // private XMLSignatureFactory signatureFactory = XMLSignatureFactory.getInstance("DOM");
-    
     private static Log log = LogFactory.getLog(STRTransform.class.getName());
 
     private static boolean doDebug = false;
@@ -147,14 +141,8 @@ public class STRTransform extends Transf
                 );
             canonAlgo = canonElem.getAttribute("Algorithm");
         }
+        xc.getDefaultNamespacePrefix();
         try {
-            /*
-            Transform c14nTransform =
-                signatureFactory.newTransform(
-                    canonAlgo, (TransformParameterSpec)null
-                );
-                */
-            
             //
             // Get the input (node) to transform. Currently we support only an
             // Element as input format. If other formats are required we must
@@ -194,7 +182,6 @@ public class STRTransform extends Transf
             ByteArrayOutputStream bos = null;
             byte[] buf = null;
             
-            xc.getBaseURI();
             //
             // Third and fourth step are performed by dereferenceSTR()
             //
@@ -246,7 +233,7 @@ public class STRTransform extends Transf
             // return new XMLSignatureInput(buf);
             
             // start of HACK
-            StringBuffer bf = new StringBuffer(new String(buf));
+            StringBuilder bf = new StringBuilder(new String(buf));
             String bf1 = bf.toString();
 
             //
@@ -277,43 +264,6 @@ public class STRTransform extends Transf
                 return null;
             }
             return new OctetStreamData(output.getOctetStream());
-            
-            /*
-            //
-            // According to WSS spec an Apex node must contain a default namespace.
-            // 
-            boolean changedNamespace = false;
-            if (!dereferencedToken.hasAttribute("xmlns")) {
-                dereferencedToken.setAttribute("xmlns", "");
-                changedNamespace = true;
-            }
-            
-            //
-            // C14n with specified algorithm. According to WSS Specification.
-            //
-            boolean excludeComments = false;
-            if (WSConstants.C14N_EXCL_OMIT_COMMENTS.equals(canonAlgo)
-                || WSConstants.C14N_OMIT_COMMENTS.equals(canonAlgo)) {
-                excludeComments = true;
-            }
-            NodeSetData transformData = new DOMSubTreeData(dereferencedToken, excludeComments);
-            OctetStreamData transformedData = 
-                (OctetStreamData)c14nTransform.transform(transformData, xc);
-            
-            //
-            // If a default namespace has been added, then remove it from the element
-            //
-            if (changedNamespace) {
-                dereferencedToken.removeAttribute("xmlns");
-            }
-            
-            XMLSignatureInput output = new XMLSignatureInput(transformedData.getOctetStream());
-            if (os != null) {
-                output.updateOutputStream(os);
-                return null;
-            }
-            return new OctetStreamData(output.getOctetStream());
-            */
         } catch (Exception ex) {
             throw new TransformException(ex);
         }



Mime
View raw message