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 2013/09/13 12:09:17 UTC

svn commit: r1522843 - in /cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers: AsymmetricBindingHandler.java SymmetricBindingHandler.java

Author: coheigea
Date: Fri Sep 13 10:09:17 2013
New Revision: 1522843

URL: http://svn.apache.org/r1522843
Log:
Improved logging in WS-Security handling


Conflicts:
	rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java

Modified:
    cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AsymmetricBindingHandler.java
    cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java

Modified: cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AsymmetricBindingHandler.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AsymmetricBindingHandler.java?rev=1522843&r1=1522842&r2=1522843&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AsymmetricBindingHandler.java (original)
+++ cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AsymmetricBindingHandler.java Fri Sep 13 10:09:17 2013
@@ -192,6 +192,7 @@ public class AsymmetricBindingHandler ex
         } catch (Exception e) {
             String reason = e.getMessage();
             LOG.log(Level.WARNING, "Sign before encryption failed due to : " + reason);
+            LOG.log(Level.FINE, e.getMessage(), e);
             throw new Fault(e);
         }
     }
@@ -246,6 +247,7 @@ public class AsymmetricBindingHandler ex
                 } catch (Exception e) {
                     String reason = e.getMessage();
                     LOG.log(Level.WARNING, "Encrypt before sign failed due to : " + reason);
+                    LOG.log(Level.FINE, e.getMessage(), e);
                     throw new Fault(e);
                 }
             }
@@ -259,6 +261,7 @@ public class AsymmetricBindingHandler ex
             //will not be included otherwise
             sigParts = getSignedParts();
         } catch (SOAPException ex) {
+            LOG.log(Level.FINE, ex.getMessage(), ex);
             throw new Fault(ex);
         }
         
@@ -278,6 +281,7 @@ public class AsymmetricBindingHandler ex
             try {
                 addSupportingTokens(sigParts);
             } catch (WSSecurityException ex) {
+                LOG.log(Level.FINE, ex.getMessage(), ex);
                 policyNotAsserted(encryptionToken, ex);
             }
         } else {
@@ -299,8 +303,10 @@ public class AsymmetricBindingHandler ex
                 }
             }
         } catch (WSSecurityException ex) {
+            LOG.log(Level.FINE, ex.getMessage(), ex);
             throw new Fault(ex);
         } catch (SOAPException ex) {
+            LOG.log(Level.FINE, ex.getMessage(), ex);
             throw new Fault(ex);
         }
 
@@ -348,6 +354,7 @@ public class AsymmetricBindingHandler ex
                     ((WSSecDKEncrypt)encrBase).encryptForExternalRef(null, secondEncrParts);
                 ((WSSecDKEncrypt)encrBase).addExternalRefElement(secondRefList, secHeader);
             } catch (WSSecurityException ex) {
+                LOG.log(Level.FINE, ex.getMessage(), ex);
                 throw new Fault(ex);
             }
         } else if (encrBase instanceof WSSecEncrypt) {
@@ -364,6 +371,7 @@ public class AsymmetricBindingHandler ex
                 ((WSSecEncrypt)encrBase).encryptForRef(secondRefList, secondEncrParts);
 
             } catch (WSSecurityException ex) {
+                LOG.log(Level.FINE, ex.getMessage(), ex);
                 throw new Fault(ex);
             }
         }
@@ -399,6 +407,7 @@ public class AsymmetricBindingHandler ex
                     insertBeforeBottomUp(refList);
                     return dkEncr;
                 } catch (Exception e) {
+                    LOG.log(Level.FINE, e.getMessage(), e);
                     policyNotAsserted(recToken, e);
                 }
             } else {
@@ -448,6 +457,7 @@ public class AsymmetricBindingHandler ex
                     this.addEncryptedKeyElement(encryptedKeyElement);
                     return encr;
                 } catch (WSSecurityException e) {
+                    LOG.log(Level.FINE, e.getMessage(), e);
                     policyNotAsserted(recToken, e);
                 }    
             }
@@ -550,6 +560,7 @@ public class AsymmetricBindingHandler ex
                 
                 mainSigId = dkSign.getSignatureId();
             } catch (Exception ex) {
+                LOG.log(Level.FINE, ex.getMessage(), ex);
                 throw new Fault(ex);
             }
         } else {

Modified: cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java?rev=1522843&r1=1522842&r2=1522843&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java (original)
+++ cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java Fri Sep 13 10:09:17 2013
@@ -23,13 +23,13 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Date;
 import java.util.List;
+import java.util.logging.Level;
 
 import javax.xml.crypto.dsig.Reference;
 import javax.xml.soap.SOAPMessage;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
-
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.helpers.CastUtils;
@@ -268,8 +268,10 @@ public class SymmetricBindingHandler ext
                 }
             }
         } catch (RuntimeException ex) {
+            LOG.log(Level.FINE, ex.getMessage(), ex);
             throw ex;
         } catch (Exception ex) {
+            LOG.log(Level.FINE, ex.getMessage(), ex);
             throw new Fault(ex);
         }
     }
@@ -392,6 +394,7 @@ public class SymmetricBindingHandler ext
                          enc,
                          false);
         } catch (Exception e) {
+            LOG.log(Level.FINE, e.getMessage(), e);
             throw new Fault(e);
         }
     }
@@ -494,6 +497,7 @@ public class SymmetricBindingHandler ext
             }
             return dkEncr;
         } catch (Exception e) {
+            LOG.log(Level.FINE, e.getMessage(), e);
             policyNotAsserted(recToken, e);
         }
         return null;
@@ -603,6 +607,7 @@ public class SymmetricBindingHandler ext
                     }
                     return encr;
                 } catch (WSSecurityException e) {
+                    LOG.log(Level.FINE, e.getMessage(), e);
                     policyNotAsserted(recToken, e);
                 }    
             }
@@ -696,6 +701,7 @@ public class SymmetricBindingHandler ext
         try {
             dkSign.prepare(doc, secHeader);
         } catch (ConversationException e) {
+            LOG.log(Level.FINE, e.getMessage(), e);
             throw new WSSecurityException(e.getMessage(), e);
         }
         
@@ -962,6 +968,7 @@ public class SymmetricBindingHandler ext
             byte[] digestBytes = WSSecurityUtil.generateDigest(input);
             return Base64.encode(digestBytes);
         } catch (WSSecurityException e) {
+            LOG.log(Level.FINE, e.getMessage(), e);
             //REVISIT
         }
         return null;