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/11/15 15:27:47 UTC

svn commit: r1409806 - /webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/message/DOMCallbackLookup.java

Author: coheigea
Date: Thu Nov 15 14:27:46 2012
New Revision: 1409806

URL: http://svn.apache.org/viewvc?rev=1409806&view=rev
Log:
[WSS-411] - STRTransform does not work in certain circumstances

Modified:
    webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/message/DOMCallbackLookup.java

Modified: webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/message/DOMCallbackLookup.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/message/DOMCallbackLookup.java?rev=1409806&r1=1409805&r2=1409806&view=diff
==============================================================================
--- webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/message/DOMCallbackLookup.java (original)
+++ webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/message/DOMCallbackLookup.java Thu Nov 15 14:27:46 2012
@@ -54,17 +54,7 @@ public class DOMCallbackLookup implement
         String id, String valueType, boolean checkMultipleElements
     ) throws WSSecurityException {
         //
-        // Try to find a SAML Assertion Element if the ValueType corresponds to a SAML Assertion
-        //
-        if (WSConstants.WSS_SAML_KI_VALUE_TYPE.equals(valueType) 
-            || WSConstants.WSS_SAML2_KI_VALUE_TYPE.equals(valueType)) {
-            return 
-                WSSecurityUtil.findSAMLAssertionElementById(
-                    doc.getDocumentElement(), id
-                );
-        }
-        //
-        // Try the SOAP Body next
+        // Try the SOAP Body first
         //
         Element bodyElement = WSSecurityUtil.findBodyElement(doc);
         if (bodyElement != null) {
@@ -74,7 +64,27 @@ public class DOMCallbackLookup implement
             }
         }
         // Otherwise do a general search
-        return WSSecurityUtil.findElementById(doc.getDocumentElement(), id, checkMultipleElements);
+        Element foundElement = 
+            WSSecurityUtil.findElementById(doc.getDocumentElement(), id, checkMultipleElements);
+        if (foundElement != null) {
+            return foundElement;
+        }
+        
+        //
+        // Try to find a SAML Assertion Element if the ValueType corresponds to a SAML Assertion
+        // (or is empty)
+        //
+        if (WSConstants.WSS_SAML_KI_VALUE_TYPE.equals(valueType) 
+            || WSConstants.WSS_SAML2_KI_VALUE_TYPE.equals(valueType)
+            || "".equals(valueType)
+            || valueType == null) {
+            return 
+                WSSecurityUtil.findSAMLAssertionElementById(
+                    doc.getDocumentElement(), id
+                );
+        }
+        
+        return null;
     }
     
     /**