You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2011/02/07 12:16:57 UTC
svn commit: r1067915 -
/cxf/branches/wss4j-1.6-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JOutInterceptor.java
Author: coheigea
Date: Mon Feb 7 11:16:56 2011
New Revision: 1067915
URL: http://svn.apache.org/viewvc?rev=1067915&view=rev
Log:
Fixing bug following WSS4J trunk update.
Modified:
cxf/branches/wss4j-1.6-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JOutInterceptor.java
Modified: cxf/branches/wss4j-1.6-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/wss4j-1.6-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JOutInterceptor.java?rev=1067915&r1=1067914&r2=1067915&view=diff
==============================================================================
--- cxf/branches/wss4j-1.6-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JOutInterceptor.java (original)
+++ cxf/branches/wss4j-1.6-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JOutInterceptor.java Mon Feb 7 11:16:56 2011
@@ -21,14 +21,18 @@ package org.apache.cxf.ws.security.wss4j
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
+import java.util.logging.Logger;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
import org.w3c.dom.Element;
+import org.apache.cxf.binding.soap.SoapFault;
import org.apache.cxf.binding.soap.SoapMessage;
import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.phase.AbstractPhaseInterceptor;
import org.apache.cxf.phase.Phase;
@@ -43,12 +47,16 @@ import org.apache.cxf.ws.security.policy
import org.apache.cxf.ws.security.wss4j.policyhandlers.AsymmetricBindingHandler;
import org.apache.cxf.ws.security.wss4j.policyhandlers.SymmetricBindingHandler;
import org.apache.cxf.ws.security.wss4j.policyhandlers.TransportBindingHandler;
+import org.apache.ws.security.WSSecurityException;
import org.apache.ws.security.message.WSSecHeader;
public class PolicyBasedWSS4JOutInterceptor extends AbstractPhaseInterceptor<SoapMessage> {
public static final String SECURITY_PROCESSED = PolicyBasedWSS4JOutInterceptor.class.getName() + ".DONE";
public static final PolicyBasedWSS4JOutInterceptor INSTANCE = new PolicyBasedWSS4JOutInterceptor();
+ private static final Logger LOG = LogUtils.getL7dLogger(PolicyBasedWSS4JOutInterceptor.class);
+
+
private PolicyBasedWSS4JOutInterceptorInternal ending;
private SAAJOutInterceptor saajOut = new SAAJOutInterceptor();
@@ -119,7 +127,14 @@ public class PolicyBasedWSS4JOutIntercep
if (transport != null) {
WSSecHeader secHeader = new WSSecHeader(actor, mustUnderstand);
- Element el = secHeader.insertSecurityHeader(saaj.getSOAPPart());
+ Element el = null;
+ try {
+ el = secHeader.insertSecurityHeader(saaj.getSOAPPart());
+ } catch (WSSecurityException e) {
+ throw new SoapFault(
+ new Message("SECURITY_FAILED", LOG), e, message.getVersion().getSender()
+ );
+ }
try {
//move to end
saaj.getSOAPHeader().removeChild(el);