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 2016/07/01 17:58:26 UTC

[1/2] cxf git commit: Temporarily applying a fix for crypto loading until the next WSS4J release is out

Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 222df318a -> a2702f30d


Temporarily applying a fix for crypto loading until the next WSS4J release is out

# Conflicts:
#	rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JInInterceptor.java


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

Branch: refs/heads/3.0.x-fixes
Commit: 92a7be8049d75100188734648c8ac99cd0b07498
Parents: 222df31
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Fri Jul 1 17:41:34 2016 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Fri Jul 1 17:45:27 2016 +0100

----------------------------------------------------------------------
 .../wss4j/PolicyBasedWSS4JInInterceptor.java    | 70 +++++++++++++++++++-
 1 file changed, 69 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/92a7be80/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JInInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JInInterceptor.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JInInterceptor.java
index ec0086a..6eaaee5 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JInInterceptor.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JInInterceptor.java
@@ -110,8 +110,9 @@ import org.apache.wss4j.policy.model.Wss11;
  * 
  */
 public class PolicyBasedWSS4JInInterceptor extends WSS4JInInterceptor {
+    
     private static final Logger LOG = LogUtils.getL7dLogger(PolicyBasedWSS4JInInterceptor.class);
-
+    
     /**
      * 
      */
@@ -128,6 +129,73 @@ public class PolicyBasedWSS4JInInterceptor extends WSS4JInInterceptor {
         }
     }
     
+    /**
+     * TODO - This method can be removed when WSS4J 2.1.7 is released - see WSS-582
+     * 
+     * Load a Crypto instance. Firstly, it tries to use the cryptoPropertyRefId tag to retrieve
+     * a Crypto object via a custom reference Id. Failing this, it tries to load the crypto
+     * instance via the cryptoPropertyFile tag.
+     *
+     * @param requestData the RequestData object
+     * @return a Crypto instance to use for Encryption creation/verification
+     */
+    @Override
+    protected Crypto loadCrypto(
+        String cryptoPropertyFile,
+        String cryptoPropertyRefId,
+        RequestData requestData
+    ) throws WSSecurityException {
+        Object mc = requestData.getMsgContext();
+        Crypto crypto = null;
+
+        //
+        // Try the Property Ref Id first
+        //
+        String refId = getString(cryptoPropertyRefId, mc);
+        if (refId != null) {
+            crypto = cryptos.get(refId);
+            if (crypto == null) {
+                Object obj = getProperty(mc, refId);
+                if (obj instanceof Properties) {
+                    crypto = CryptoFactory.getInstance((Properties)obj,
+                                                       Loader.getClassLoader(CryptoFactory.class),
+                                                       getPasswordEncryptor(requestData));
+                    cryptos.put(refId, crypto);
+                } else if (obj instanceof Crypto) {
+                    // No need to cache this as it's already loaded
+                    crypto = (Crypto)obj;
+                }
+            }
+            if (crypto == null) {
+                LOG.warning("The Crypto reference " + refId + " specified by "
+                    + cryptoPropertyRefId + " could not be loaded"
+                );
+            }
+        }
+
+        //
+        // Now try loading the properties file
+        //
+        if (crypto == null) {
+            String propFile = getString(cryptoPropertyFile, mc);
+            if (propFile != null) {
+                crypto = cryptos.get(propFile);
+                if (crypto == null) {
+                    crypto = loadCryptoFromPropertiesFile(propFile, requestData);
+                    cryptos.put(propFile, crypto);
+                }
+                if (crypto == null) {
+                    LOG.warning(
+                         "The Crypto properties file " + propFile + " specified by "
+                         + cryptoPropertyFile + " could not be loaded or found"
+                    );
+                }
+            }
+        }
+
+        return crypto;
+    }
+    
     private void handleWSS11(AssertionInfoMap aim, SoapMessage message) {
         if (isRequestor(message)) {
             message.put(WSHandlerConstants.ENABLE_SIGNATURE_CONFIRMATION, "false");


[2/2] cxf git commit: Recording .gitmergeinfo Changes

Posted by co...@apache.org.
Recording .gitmergeinfo Changes


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

Branch: refs/heads/3.0.x-fixes
Commit: a2702f30db882f460bc4ebe3c334b045590c2c9a
Parents: 92a7be8
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Fri Jul 1 17:45:28 2016 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Fri Jul 1 17:45:28 2016 +0100

----------------------------------------------------------------------
 .gitmergeinfo | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/a2702f30/.gitmergeinfo
----------------------------------------------------------------------
diff --git a/.gitmergeinfo b/.gitmergeinfo
index e7b9810..e751b94 100644
--- a/.gitmergeinfo
+++ b/.gitmergeinfo
@@ -1070,6 +1070,7 @@ M 51db79ca7bd2c703a4dbbd42d7761c97af3bad84
 M 52598eb9b31ea7dfc7b4b87048e4ded459fbeb87
 M 52b83045b6f7298117e9a66758c07fc9f1fba3af
 M 536293b5eb795c27a4521c6940c56377a4fa78f0
+M 55cb81445f7ec37fddec1278a6991fa00c6ae76d
 M 56c0db05126292a61a782f05848321b9b8b8b80c
 M 58e6563da54fd3237a9a1d21a2cf7115740795a2
 M 590313298b7a4d79c80b130357c5036adb6102c2