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 2014/04/24 16:10:54 UTC

svn commit: r1589736 - in /webservices/wss4j/branches/1_6_x-fixes: pom.xml src/main/java/org/apache/ws/security/processor/EncryptedDataProcessor.java

Author: coheigea
Date: Thu Apr 24 14:10:54 2014
New Revision: 1589736

URL: http://svn.apache.org/r1589736
Log:
Backporting fix

Modified:
    webservices/wss4j/branches/1_6_x-fixes/pom.xml
    webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/processor/EncryptedDataProcessor.java

Modified: webservices/wss4j/branches/1_6_x-fixes/pom.xml
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/1_6_x-fixes/pom.xml?rev=1589736&r1=1589735&r2=1589736&view=diff
==============================================================================
--- webservices/wss4j/branches/1_6_x-fixes/pom.xml (original)
+++ webservices/wss4j/branches/1_6_x-fixes/pom.xml Thu Apr 24 14:10:54 2014
@@ -345,7 +345,7 @@
         <profile>
             <id>jdk16</id>
             <activation>
-                <jdk>1.6</jdk>
+                <jdk>[1.6,1.8]</jdk>
             </activation>
             <dependencies>
                 <dependency>

Modified: webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/processor/EncryptedDataProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/processor/EncryptedDataProcessor.java?rev=1589736&r1=1589735&r2=1589736&view=diff
==============================================================================
--- webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/processor/EncryptedDataProcessor.java (original)
+++ webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/processor/EncryptedDataProcessor.java Thu Apr 24 14:10:54 2014
@@ -175,6 +175,13 @@ public class EncryptedDataProcessor impl
         }
         dataRef.setXpath(ReferenceListProcessor.getXPath(decryptedNode));
         
+        if (decryptedNode != null
+            && decryptedNode.getParentNode().getLocalName().equals(WSConstants.ENCRYPED_ASSERTION_LN)
+            && decryptedNode.getParentNode().getNamespaceURI().equals(WSConstants.SAML2_NS)) {
+            Node soapHeader = decryptedNode.getParentNode().getParentNode();
+            soapHeader.replaceChild(decryptedNode, decryptedNode.getParentNode());
+        }
+        
         WSSecurityEngineResult result = 
                 new WSSecurityEngineResult(WSConstants.ENCR, Collections.singletonList(dataRef));
         result.put(WSSecurityEngineResult.TAG_ID, elem.getAttributeNS(null, "Id"));
@@ -191,12 +198,7 @@ public class EncryptedDataProcessor impl
         WSSConfig wssConfig = request.getWssConfig();
         if (wssConfig != null) {
             // Get hold of the plain text element
-            Element decryptedElem;
-            if (previousSibling == null) {
-                decryptedElem = (Element)parent.getFirstChild();
-            } else {
-                decryptedElem = (Element)previousSibling.getNextSibling();
-            }
+            Element decryptedElem = dataRef.getProtectedElement();
             QName el = new QName(decryptedElem.getNamespaceURI(), decryptedElem.getLocalName());
             Processor proc = request.getWssConfig().getProcessor(el);
             if (proc != null) {