cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject git commit: Allow the message initiator to see security exceptions
Date Wed, 26 Mar 2014 16:59:34 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes 2dd2ededf -> 9d7e7e459


Allow the message initiator to see security exceptions


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

Branch: refs/heads/2.7.x-fixes
Commit: 9d7e7e4590555a751f1f332c4c91d514c1fbb6bb
Parents: 2dd2ede
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Wed Mar 26 16:59:08 2014 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Wed Mar 26 16:59:08 2014 +0000

----------------------------------------------------------------------
 .../cxf/ws/security/wss4j/WSS4JInInterceptor.java     | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/9d7e7e45/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
index 084419b..0011ef1 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
@@ -324,7 +324,7 @@ public class WSS4JInInterceptor extends AbstractWSS4JInterceptor {
 
         } catch (WSSecurityException e) {
             LOG.log(Level.WARNING, "", e);
-            SoapFault fault = createSoapFault(version, e);
+            SoapFault fault = createSoapFault(msg, version, e);
             throw fault;
         } catch (XMLStreamException e) {
             throw new SoapFault(new Message("STAX_EX", LOG), e, version.getSender());
@@ -833,12 +833,18 @@ public class WSS4JInInterceptor extends AbstractWSS4JInterceptor {
      * as the fault code from the WSSecurityException.
      */
     private SoapFault 
-    createSoapFault(SoapVersion version, WSSecurityException e) {
+    createSoapFault(org.apache.cxf.message.Message message, SoapVersion version, WSSecurityException
e) {
         SoapFault fault;
-        String errorMessage = WSS4JUtils.getSafeExceptionMessage(e);
-        if (errorMessage == null) {
+        String errorMessage = null;
+        if (MessageUtils.isRequestor(message)) {
             errorMessage = e.getMessage();
+        } else {
+            errorMessage = WSS4JUtils.getSafeExceptionMessage(e);
+            if (errorMessage == null) {
+                errorMessage = e.getMessage();
+            }
         }
+        
         javax.xml.namespace.QName faultCode = e.getFaultCode();
         if (version.getVersion() == 1.1 && faultCode != null) {
             fault = new SoapFault(errorMessage, e, faultCode);


Mime
View raw message