cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1080302 - in /cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j: AbstractWSS4JInterceptor.java policyhandlers/AbstractBindingBuilder.java policyhandlers/AsymmetricBindingHandler.java
Date Thu, 10 Mar 2011 18:13:38 GMT
Author: coheigea
Date: Thu Mar 10 18:13:38 2011
New Revision: 1080302

URL: http://svn.apache.org/viewvc?rev=1080302&view=rev
Log:
Some changes required after a recent update of WSS4J.

Modified:
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AbstractWSS4JInterceptor.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AsymmetricBindingHandler.java

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AbstractWSS4JInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AbstractWSS4JInterceptor.java?rev=1080302&r1=1080301&r2=1080302&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AbstractWSS4JInterceptor.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AbstractWSS4JInterceptor.java
Thu Mar 10 18:13:38 2011
@@ -39,6 +39,7 @@ import org.apache.cxf.message.MessageUti
 import org.apache.cxf.phase.PhaseInterceptor;
 import org.apache.cxf.resource.ResourceManager;
 import org.apache.ws.security.WSConstants;
+import org.apache.ws.security.WSSecurityException;
 import org.apache.ws.security.components.crypto.Crypto;
 import org.apache.ws.security.components.crypto.CryptoFactory;
 import org.apache.ws.security.handler.RequestData;
@@ -155,7 +156,10 @@ public abstract class AbstractWSS4JInter
     }  
 
     @Override
-    protected Crypto loadCryptoFromPropertiesFile(String propFilename, RequestData reqData)
{
+    protected Crypto loadCryptoFromPropertiesFile(
+        String propFilename, 
+        RequestData reqData
+    ) throws WSSecurityException {
         ClassLoader orig = Thread.currentThread().getContextClassLoader();
         try {
             try {

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java?rev=1080302&r1=1080301&r2=1080302&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
Thu Mar 10 18:13:38 2011
@@ -432,8 +432,10 @@ public abstract class AbstractBindingBui
         }
     }
     
-    protected Map<Token, WSSecBase> handleSupportingTokens(Collection<Assertion>
tokens, 
-                                                           boolean endorse) {
+    protected Map<Token, WSSecBase> handleSupportingTokens(
+        Collection<Assertion> tokens, 
+        boolean endorse
+    ) throws WSSecurityException {
         Map<Token, WSSecBase> ret = new HashMap<Token, WSSecBase>();
         if (tokens != null) {
             for (Assertion pa : tokens) {
@@ -445,13 +447,18 @@ public abstract class AbstractBindingBui
         return ret;
     }
     
-    protected Map<Token, WSSecBase> handleSupportingTokens(SupportingToken suppTokens,
boolean endorse) {
+    protected Map<Token, WSSecBase> handleSupportingTokens(
+        SupportingToken suppTokens,
+        boolean endorse
+    ) throws WSSecurityException {
         return handleSupportingTokens(suppTokens, endorse, new HashMap<Token, WSSecBase>());
     }
     
-    protected Map<Token, WSSecBase> handleSupportingTokens(SupportingToken suppTokens,

-                                                           boolean endorse,
-                                                           Map<Token, WSSecBase> ret)
{
+    protected Map<Token, WSSecBase> handleSupportingTokens(
+        SupportingToken suppTokens, 
+        boolean endorse,
+        Map<Token, WSSecBase> ret
+    ) throws WSSecurityException {
         if (suppTokens == null) {
             return ret;
         }
@@ -1054,19 +1061,23 @@ public abstract class AbstractBindingBui
         return encrKey;
     }
 
-    public Crypto getSignatureCrypto(TokenWrapper wrapper) {
+    public Crypto getSignatureCrypto(TokenWrapper wrapper) throws WSSecurityException {
         return getCrypto(wrapper, SecurityConstants.SIGNATURE_CRYPTO,
                          SecurityConstants.SIGNATURE_PROPERTIES);
     }
 
 
-    public Crypto getEncryptionCrypto(TokenWrapper wrapper) {
+    public Crypto getEncryptionCrypto(TokenWrapper wrapper) throws WSSecurityException {
         return getCrypto(wrapper, 
                          SecurityConstants.ENCRYPT_CRYPTO,
                          SecurityConstants.ENCRYPT_PROPERTIES);
     }
     
-    public Crypto getCrypto(TokenWrapper wrapper, String cryptoKey, String propKey) {
+    public Crypto getCrypto(
+        TokenWrapper wrapper, 
+        String cryptoKey, 
+        String propKey
+    ) throws WSSecurityException {
         Crypto crypto = (Crypto)message.getContextualProperty(cryptoKey);
         if (crypto != null) {
             return crypto;
@@ -1288,13 +1299,13 @@ public abstract class AbstractBindingBui
     
     protected WSSecSignature getSignatureBuilder(
         TokenWrapper wrapper, Token token, boolean endorse
-    ) {
+    ) throws WSSecurityException {
         return getSignatureBuilder(wrapper, token, false, endorse);
     }
     
     protected WSSecSignature getSignatureBuilder(
         TokenWrapper wrapper, Token token, boolean attached, boolean endorse
-    ) {
+    ) throws WSSecurityException {
         WSSecSignature sig = new WSSecSignature(wssConfig);
         checkForX509PkiPath(sig, token);
         if (token instanceof IssuedToken) {
@@ -1587,7 +1598,7 @@ public abstract class AbstractBindingBui
         assertSupportingTokens(findAndAssertPolicy(SP12Constants.ENCRYPTED_SUPPORTING_TOKENS));
     }
     
-    protected void addSupportingTokens(List<WSEncryptionPart> sigs) {
+    protected void addSupportingTokens(List<WSEncryptionPart> sigs) throws WSSecurityException
{
         
         Collection<Assertion> sgndSuppTokens = 
             findAndAssertPolicy(SP12Constants.SIGNED_SUPPORTING_TOKENS);

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AsymmetricBindingHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AsymmetricBindingHandler.java?rev=1080302&r1=1080301&r2=1080302&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AsymmetricBindingHandler.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AsymmetricBindingHandler.java
Thu Mar 10 18:13:38 2011
@@ -224,9 +224,8 @@ public class AsymmetricBindingHandler ex
             //Signed parts are determined before encryption because encrypted signed  headers
             //will not be included otherwise
             sigParts = getSignedParts();
-        } catch (SOAPException e1) {
-            //REVISIT - exception
-            e1.printStackTrace();
+        } catch (SOAPException ex) {
+            throw new Fault(ex);
         }
         
         if (encryptionToken == null && encrParts.size() > 0) {
@@ -244,7 +243,11 @@ public class AsymmetricBindingHandler ex
             }
             
             if (isRequestor()) {
-                addSupportingTokens(sigParts);
+                try {
+                    addSupportingTokens(sigParts);
+                } catch (WSSecurityException ex) {
+                    policyNotAsserted(encryptionToken, ex.getMessage());
+                }
             } else {
                 addSignatureConfirmation(sigParts);
             }
@@ -255,12 +258,10 @@ public class AsymmetricBindingHandler ex
                 || (!isRequestor() && abinding.getRecipientToken() != null)) {
                 try {
                     doSignature(sigParts, attached);
-                } catch (WSSecurityException e) {
-                    //REVISIT - exception
-                    e.printStackTrace();
-                } catch (SOAPException e) {
-                    //REVISIT - exception
-                    e.printStackTrace();
+                } catch (WSSecurityException ex) {
+                    throw new Fault(ex);
+                } catch (SOAPException ex) {
+                    throw new Fault(ex);
                 }
             }
 
@@ -289,9 +290,8 @@ public class AsymmetricBindingHandler ex
                             = ((WSSecDKEncrypt)encrBase).encryptForExternalRef(null, secondEncrParts);
                         ((WSSecDKEncrypt)encrBase).addExternalRefElement(secondRefList, secHeader);
 
-                    } catch (WSSecurityException e) {
-                        //REVISIT - exception
-                        e.printStackTrace();
+                    } catch (WSSecurityException ex) {
+                        throw new Fault(ex);
                     }
                 } else {
                     try {
@@ -302,9 +302,8 @@ public class AsymmetricBindingHandler ex
                         this.insertBeforeBottomUp(secondRefList);
                         ((WSSecEncrypt)encrBase).encryptForRef(secondRefList, secondEncrParts);
                         
-                    } catch (WSSecurityException e) {
-                        //REVISIT - exception
-                        e.printStackTrace();
+                    } catch (WSSecurityException ex) {
+                        throw new Fault(ex);
                     }
                 }
             }
@@ -464,9 +463,8 @@ public class AsymmetricBindingHandler ex
                 signatures.add(dkSign.getSignatureValue());
                 
                 mainSigId = dkSign.getSignatureId();
-            } catch (Exception e) {
-                //REVISIT
-                e.printStackTrace();
+            } catch (Exception ex) {
+                throw new Fault(ex);
             }
         } else {
             WSSecSignature sig = getSignatureBuilder(wrapper, sigToken, attached, false);



Mime
View raw message