cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [1/2] git commit: Picking up WSS4J 2.0.0-SNAPSHOT again
Date Wed, 19 Feb 2014 14:47:57 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 4df368276 -> 994fd7060


Picking up WSS4J 2.0.0-SNAPSHOT again


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

Branch: refs/heads/master
Commit: ed8ac50116f225ad4a71b888b7e4f44c1f81991a
Parents: 5723211
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Wed Feb 19 14:47:04 2014 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Wed Feb 19 14:47:04 2014 +0000

----------------------------------------------------------------------
 parent/pom.xml                                   |  2 +-
 .../policy/interceptors/NegotiationUtils.java    |  7 ++++---
 .../security/policy/interceptors/STSInvoker.java |  3 +--
 .../cxf/ws/security/trust/AbstractSTSClient.java |  3 +--
 .../wss4j/PolicyBasedWSS4JStaxInInterceptor.java | 19 +++++++++++++------
 .../policyhandlers/AbstractBindingBuilder.java   |  5 ++---
 .../policyhandlers/SymmetricBindingHandler.java  |  8 +-------
 .../cxf/sts/token/provider/SCTProvider.java      |  9 ++++-----
 .../sts/token/provider/SymmetricKeyHandler.java  |  3 +--
 .../systest/sts/batch/SimpleBatchSTSClient.java  |  3 +--
 10 files changed, 29 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/ed8ac501/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index c98c78f..5f0113d 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -148,7 +148,7 @@
         <cxf.woodstox.core.version>4.2.0</cxf.woodstox.core.version>
         <cxf.woodstox.stax2-api.version>3.1.1</cxf.woodstox.stax2-api.version>
         <cxf.wsdl4j.version>1.6.3</cxf.wsdl4j.version>
-        <cxf.wss4j.version>2.0.0-rc1</cxf.wss4j.version>
+        <cxf.wss4j.version>2.0.0-SNAPSHOT</cxf.wss4j.version>
         <cxf.xerces.version>2.11.0</cxf.xerces.version>
         <cxf.xmlbeans.version>2.6.0</cxf.xmlbeans.version>
         <cxf.xmlschema.version>2.1.0</cxf.xmlschema.version>

http://git-wip-us.apache.org/repos/asf/cxf/blob/ed8ac501/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/NegotiationUtils.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/NegotiationUtils.java
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/NegotiationUtils.java
index f246591..597d8df 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/NegotiationUtils.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/NegotiationUtils.java
@@ -56,7 +56,7 @@ import org.apache.cxf.ws.security.wss4j.WSS4JUtils;
 import org.apache.neethi.Assertion;
 import org.apache.neethi.Policy;
 import org.apache.wss4j.common.derivedKey.ConversationConstants;
-import org.apache.wss4j.common.derivedKey.ConversationException;
+import org.apache.wss4j.common.ext.WSSecurityException;
 import org.apache.wss4j.dom.WSConstants;
 import org.apache.wss4j.dom.WSSecurityEngineResult;
 import org.apache.wss4j.dom.handler.WSHandlerConstants;
@@ -157,7 +157,7 @@ final class NegotiationUtils {
         return null;
     }
     
-    static int getWSCVersion(String tokenTypeValue) throws ConversationException {
+    static int getWSCVersion(String tokenTypeValue) throws WSSecurityException {
         if (tokenTypeValue == null) {
             return ConversationConstants.DEFAULT_VERSION;
         }
@@ -167,7 +167,8 @@ final class NegotiationUtils {
         } else if (tokenTypeValue.startsWith(ConversationConstants.WSC_NS_05_12)) {
             return ConversationConstants.getWSTVersion(ConversationConstants.WSC_NS_05_12);
         } else {
-            throw new ConversationException("unsupportedSecConvVersion");
+            throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, 
+                                          "unsupportedSecConvVersion");
         }
     }
     

http://git-wip-us.apache.org/repos/asf/cxf/blob/ed8ac501/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/STSInvoker.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/STSInvoker.java
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/STSInvoker.java
index b6fb8f4..c443b67 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/STSInvoker.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/STSInvoker.java
@@ -44,7 +44,6 @@ import org.apache.cxf.ws.security.SecurityConstants;
 import org.apache.cxf.ws.security.tokenstore.SecurityToken;
 import org.apache.cxf.ws.security.tokenstore.TokenStore;
 import org.apache.cxf.ws.security.trust.STSUtils;
-import org.apache.wss4j.common.derivedKey.ConversationException;
 import org.apache.wss4j.common.derivedKey.P_SHA1;
 import org.apache.wss4j.common.ext.WSSecurityException;
 import org.apache.wss4j.dom.WSConstants;
@@ -193,7 +192,7 @@ abstract class STSInvoker implements Invoker {
         W3CDOMStreamWriter writer,
         byte[] clientEntropy,
         int keySize
-    ) throws NoSuchAlgorithmException, WSSecurityException, ConversationException, XMLStreamException
{
+    ) throws NoSuchAlgorithmException, WSSecurityException, XMLStreamException {
         byte secret[] = null; 
         writer.writeStartElement(prefix, "RequestedProofToken", namespace);
         if (clientEntropy == null) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/ed8ac501/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java
index 64f3c6b..05d3cec 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java
@@ -108,7 +108,6 @@ import org.apache.neethi.PolicyRegistry;
 import org.apache.wss4j.common.crypto.Crypto;
 import org.apache.wss4j.common.crypto.CryptoFactory;
 import org.apache.wss4j.common.crypto.CryptoType;
-import org.apache.wss4j.common.derivedKey.ConversationException;
 import org.apache.wss4j.common.derivedKey.P_SHA1;
 import org.apache.wss4j.common.ext.WSSecurityException;
 import org.apache.wss4j.dom.WSConstants;
@@ -1378,7 +1377,7 @@ public abstract class AbstractSTSClient implements Configurable, InterceptorProv
                     }
                     try {
                         secret = psha1.createKey(requestorEntropy, serviceEntr, 0, length
/ 8);
-                    } catch (ConversationException e) {
+                    } catch (WSSecurityException e) {
                         throw new TrustException("DERIVED_KEY_ERROR", LOG, e);
                     }
                 } else {

http://git-wip-us.apache.org/repos/asf/cxf/blob/ed8ac501/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JStaxInInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JStaxInInterceptor.java
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JStaxInInterceptor.java
index 0568d79..6f13904 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JStaxInInterceptor.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JStaxInInterceptor.java
@@ -498,7 +498,6 @@ public class PolicyBasedWSS4JStaxInInterceptor extends WSS4JStaxInInterceptor
{
             EffectivePolicy policy = 
                 (EffectivePolicy)bindingOperationInfo.getProperty("policy-engine-info-serve-request");
             //PolicyEngineImpl.POLICY_INFO_REQUEST_SERVER);
-            String localName = operationName.getLocalPart();
             if (MessageUtils.isRequestor(msg)) {
                 policy = 
                     (EffectivePolicy)bindingOperationInfo.getProperty("policy-engine-info-client-response");
@@ -509,13 +508,23 @@ public class PolicyBasedWSS4JStaxInInterceptor extends WSS4JStaxInInterceptor
{
                 }
                 if (bindingOperationInfo.getOutput() != null) {
                     MessageInfo messageInfo = bindingOperationInfo.getOutput().getMessageInfo();
-                    localName = messageInfo.getName().getLocalPart();
+                    operationName = messageInfo.getName();
                     if (!messageInfo.getMessageParts().isEmpty()
                         && messageInfo.getMessagePart(0).getConcreteName() != null)
{
-                        localName = messageInfo.getMessagePart(0).getConcreteName().getLocalPart();
+                        operationName = messageInfo.getMessagePart(0).getConcreteName();
+                    }
+                }
+            } else {
+                if (bindingOperationInfo.getInput() != null) {
+                    MessageInfo messageInfo = bindingOperationInfo.getInput().getMessageInfo();
+                    operationName = messageInfo.getName();
+                    if (!messageInfo.getMessageParts().isEmpty()
+                        && messageInfo.getMessagePart(0).getConcreteName() != null)
{
+                        operationName = messageInfo.getMessagePart(0).getConcreteName();
                     }
                 }
             }
+            
             SoapOperationInfo soapOperationInfo = bindingOperationInfo.getExtensor(SoapOperationInfo.class);
             if (soapOperationInfo != null && policy == null && dispatchPolicy
!= null) {
                 policy = dispatchPolicy;
@@ -532,9 +541,7 @@ public class PolicyBasedWSS4JStaxInInterceptor extends WSS4JStaxInInterceptor
{
                     throw new IllegalArgumentException("BindingInfo is not an instance of
SoapBindingInfo");
                 }
                 
-                //todo: I think its a bug that we handover only the localPart of the operation.

-                // Needs to be fixed in ws-security-policy-stax
-                OperationPolicy operationPolicy = new OperationPolicy(localName);
+                OperationPolicy operationPolicy = new OperationPolicy(operationName);
                 operationPolicy.setPolicy(policy.getPolicy());
                 operationPolicy.setOperationAction(soapOperationInfo.getAction());
                 operationPolicy.setSoapMessageVersionNamespace(soapNS);

http://git-wip-us.apache.org/repos/asf/cxf/blob/ed8ac501/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
index b53a5a4..12e4732 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
@@ -83,7 +83,6 @@ import org.apache.wss4j.common.crypto.CryptoType;
 import org.apache.wss4j.common.crypto.JasyptPasswordEncryptor;
 import org.apache.wss4j.common.crypto.PasswordEncryptor;
 import org.apache.wss4j.common.derivedKey.ConversationConstants;
-import org.apache.wss4j.common.derivedKey.ConversationException;
 import org.apache.wss4j.common.ext.WSPasswordCallback;
 import org.apache.wss4j.common.ext.WSSecurityException;
 import org.apache.wss4j.common.principal.UsernameTokenPrincipal;
@@ -1851,7 +1850,7 @@ public abstract class AbstractBindingBuilder extends AbstractCommonBindingHandle
     
     private void doSymmSignatureDerived(AbstractToken policyToken, SecurityToken tok,
                                  List<WSEncryptionPart> sigParts, boolean isTokenProtection)
-        throws WSSecurityException, ConversationException {
+        throws WSSecurityException {
         
         Document doc = saaj.getSOAPPart();
         WSSecDKSign dkSign = new WSSecDKSign(wssConfig);  
@@ -1933,7 +1932,7 @@ public abstract class AbstractBindingBuilder extends AbstractCommonBindingHandle
     
     private void doSymmSignature(AbstractToken policyToken, SecurityToken tok,
                                          List<WSEncryptionPart> sigParts, boolean isTokenProtection)
-        throws WSSecurityException, ConversationException {
+        throws WSSecurityException {
         
         Document doc = saaj.getSOAPPart();
         WSSecSignature sig = new WSSecSignature(wssConfig);

http://git-wip-us.apache.org/repos/asf/cxf/blob/ed8ac501/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java
index ac8ede9..a036644 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java
@@ -44,7 +44,6 @@ import org.apache.cxf.ws.security.wss4j.AttachmentCallbackHandler;
 import org.apache.wss4j.common.WSEncryptionPart;
 import org.apache.wss4j.common.crypto.Crypto;
 import org.apache.wss4j.common.derivedKey.ConversationConstants;
-import org.apache.wss4j.common.derivedKey.ConversationException;
 import org.apache.wss4j.common.ext.WSSecurityException;
 import org.apache.wss4j.dom.WSConstants;
 import org.apache.wss4j.dom.WSSConfig;
@@ -700,12 +699,7 @@ public class SymmetricBindingHandler extends AbstractBindingBuilder {
             }
         }
         
-        try {
-            dkSign.prepare(doc, secHeader);
-        } catch (ConversationException e) {
-            LOG.log(Level.FINE, e.getMessage(), e);
-            throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e);
-        }
+        dkSign.prepare(doc, secHeader);
         
         if (sbinding.isProtectTokens()) {
             String sigTokId = tok.getId();

http://git-wip-us.apache.org/repos/asf/cxf/blob/ed8ac501/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SCTProvider.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SCTProvider.java
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SCTProvider.java
index bfaa696..7c5d1b4 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SCTProvider.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SCTProvider.java
@@ -25,7 +25,6 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.w3c.dom.Document;
-
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.sts.STSConstants;
@@ -34,9 +33,8 @@ import org.apache.cxf.sts.request.TokenRequirements;
 import org.apache.cxf.ws.security.sts.provider.STSException;
 import org.apache.cxf.ws.security.tokenstore.SecurityToken;
 import org.apache.cxf.ws.security.trust.STSUtils;
-
 import org.apache.wss4j.common.derivedKey.ConversationConstants;
-import org.apache.wss4j.common.derivedKey.ConversationException;
+import org.apache.wss4j.common.ext.WSSecurityException;
 import org.apache.wss4j.dom.message.token.SecurityContextToken;
 
 /**
@@ -196,7 +194,7 @@ public class SCTProvider implements TokenProvider {
     /**
      * Get the Secure Conversation version from the TokenType parameter
      */
-    private static int getWSCVersion(String tokenType) throws ConversationException {
+    private static int getWSCVersion(String tokenType) throws WSSecurityException {
         if (tokenType == null) {
             return ConversationConstants.DEFAULT_VERSION;
         }
@@ -206,7 +204,8 @@ public class SCTProvider implements TokenProvider {
         } else if (tokenType.startsWith(ConversationConstants.WSC_NS_05_12)) {
             return ConversationConstants.getWSTVersion(ConversationConstants.WSC_NS_05_12);
         } else {
-            throw new ConversationException("unsupportedSecConvVersion");
+            throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, 
+                                          "unsupportedSecConvVersion");
         }
     }
     

http://git-wip-us.apache.org/repos/asf/cxf/blob/ed8ac501/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SymmetricKeyHandler.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SymmetricKeyHandler.java
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SymmetricKeyHandler.java
index 1e04b82..600426a 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SymmetricKeyHandler.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SymmetricKeyHandler.java
@@ -30,7 +30,6 @@ import org.apache.cxf.sts.request.BinarySecret;
 import org.apache.cxf.sts.request.Entropy;
 import org.apache.cxf.sts.request.KeyRequirements;
 import org.apache.cxf.ws.security.sts.provider.STSException;
-import org.apache.wss4j.common.derivedKey.ConversationException;
 import org.apache.wss4j.common.derivedKey.P_SHA1;
 import org.apache.wss4j.common.ext.WSSecurityException;
 import org.apache.wss4j.dom.WSConstants;
@@ -180,7 +179,7 @@ public class SymmetricKeyHandler {
                     P_SHA1 psha1 = new P_SHA1();
                     secret = psha1.createKey(nonce, entropyBytes, 0, keySize / 8);
                     computedKey = true;
-                } catch (ConversationException ex) {
+                } catch (WSSecurityException ex) {
                     LOG.log(Level.WARNING, "", ex);
                     throw new STSException("Error in creating symmetric key", STSException.INVALID_REQUEST);
                 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/ed8ac501/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/batch/SimpleBatchSTSClient.java
----------------------------------------------------------------------
diff --git a/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/batch/SimpleBatchSTSClient.java
b/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/batch/SimpleBatchSTSClient.java
index 6fc6bb9..4036035 100644
--- a/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/batch/SimpleBatchSTSClient.java
+++ b/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/batch/SimpleBatchSTSClient.java
@@ -93,7 +93,6 @@ import org.apache.neethi.PolicyComponent;
 import org.apache.wss4j.common.crypto.Crypto;
 import org.apache.wss4j.common.crypto.CryptoFactory;
 import org.apache.wss4j.common.crypto.CryptoType;
-import org.apache.wss4j.common.derivedKey.ConversationException;
 import org.apache.wss4j.common.derivedKey.P_SHA1;
 import org.apache.wss4j.common.ext.WSSecurityException;
 import org.apache.wss4j.dom.WSConstants;
@@ -930,7 +929,7 @@ public class SimpleBatchSTSClient implements Configurable, InterceptorProvider
{
                     }
                     try {
                         secret = psha1.createKey(requestorEntropy, serviceEntr, 0, length
/ 8);
-                    } catch (ConversationException e) {
+                    } catch (WSSecurityException e) {
                         throw new TrustException("DERIVED_KEY_ERROR", LOG, e);
                     }
                 } else {


Mime
View raw message