ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1683139 - in /webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom: message/token/BinarySecurity.java processor/BinarySecurityTokenProcessor.java
Date Tue, 02 Jun 2015 16:58:09 GMT
Author: coheigea
Date: Tue Jun  2 16:58:09 2015
New Revision: 1683139

URL: http://svn.apache.org/r1683139
Log:
[WSS-539] - Avoid Base-64 (re)coding for BinarySecurityTokens


Conflicts:
	ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/BinarySecurity.java

Modified:
    webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/BinarySecurity.java
    webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/BinarySecurityTokenProcessor.java

Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/BinarySecurity.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/BinarySecurity.java?rev=1683139&r1=1683138&r2=1683139&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/BinarySecurity.java
(original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/BinarySecurity.java
Tue Jun  2 16:58:09 2015
@@ -49,6 +49,7 @@ public class BinarySecurity {
         org.slf4j.LoggerFactory.getLogger(BinarySecurity.class);
     
     private Element element;
+    private byte[] data;
 
     /**
      * Constructor.
@@ -182,6 +183,10 @@ public class BinarySecurity {
      * @return the byte array containing token information
      */
     public byte[] getToken() {
+        if (data != null) {
+            return data;
+        }
+
         Node node = element.getFirstChild();
         StringBuilder builder = new StringBuilder();
         while (node != null) {
@@ -212,6 +217,14 @@ public class BinarySecurity {
         }
         Text node = getFirstNode();
         node.setData(Base64.encode(data));
+        setRawToken(data);
+    }
+    
+    /**
+     * Set the raw token data, without Base-64 encoding it into the Element.
+     */
+    public void setRawToken(byte[] data) {
+        this.data = Arrays.copyOf(data, data.length);
     }
 
     /**

Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/BinarySecurityTokenProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/BinarySecurityTokenProcessor.java?rev=1683139&r1=1683138&r2=1683139&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/BinarySecurityTokenProcessor.java
(original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/BinarySecurityTokenProcessor.java
Tue Jun  2 16:58:09 2015
@@ -175,7 +175,7 @@ public class BinarySecurityTokenProcesso
             String xopUri = elementChild.getAttributeNS(null, "href");
             if (xopUri != null && xopUri.startsWith("cid:")) {
                 byte[] content = WSSecurityUtil.getBytesFromAttachment(xopUri, data);
-                token.setToken(content);
+                token.setRawToken(content);
             }
         }
         



Mime
View raw message