cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject cxf git commit: Add a warning for MTOM for the policy case as well
Date Wed, 08 Jul 2015 15:44:16 GMT
Repository: cxf
Updated Branches:
  refs/heads/master b71933f09 -> 419478ede


Add a warning for MTOM for the policy case as well


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/419478ed
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/419478ed
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/419478ed

Branch: refs/heads/master
Commit: 419478ede89bdedd5a6ac4f0c233005e7b62fc05
Parents: b71933f
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Wed Jul 8 16:43:53 2015 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Wed Jul 8 16:44:09 2015 +0100

----------------------------------------------------------------------
 .../security/wss4j/PolicyBasedWSS4JOutInterceptor.java  | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/419478ed/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JOutInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JOutInterceptor.java
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JOutInterceptor.java
index 342ba5a..d406ae8 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JOutInterceptor.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JOutInterceptor.java
@@ -28,6 +28,7 @@ import javax.xml.soap.SOAPException;
 import javax.xml.soap.SOAPMessage;
 
 import org.w3c.dom.Element;
+import org.apache.cxf.attachment.AttachmentUtil;
 import org.apache.cxf.binding.soap.SoapFault;
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor;
@@ -127,6 +128,12 @@ public class PolicyBasedWSS4JOutInterceptor extends AbstractPhaseInterceptor<Soa
                 );
             String actor = (String)message.getContextualProperty(SecurityConstants.ACTOR);
             
+            if (AttachmentUtil.isMtomEnabled(message) && hasAttachments(message))
{
+                LOG.warning("MTOM is enabled with WS-Security. Please note that if an attachment
is"
+                    + "referenced in the SOAP Body, only the reference will be signed and
not the"
+                    + "SOAP Body!");
+            }
+            
             // extract Assertion information
             AbstractBinding binding = PolicyUtils.getSecurityBinding(aim);
 
@@ -190,6 +197,11 @@ public class PolicyBasedWSS4JOutInterceptor extends AbstractPhaseInterceptor<Soa
             
         }
         
+        private boolean hasAttachments(SoapMessage mc) {
+            final Collection<org.apache.cxf.message.Attachment> attachments = mc.getAttachments();
+            return attachments != null && attachments.size() > 0;
+        }
+        
         public Set<String> getAfter() {
             return Collections.emptySet();
         }


Mime
View raw message