You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2009/02/04 22:38:53 UTC

svn commit: r740902 - in /cxf/trunk: api/src/main/java/org/apache/cxf/configuration/jsse/TLSClientParameters.java rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java

Author: dkulp
Date: Wed Feb  4 21:38:52 2009
New Revision: 740902

URL: http://svn.apache.org/viewvc?rev=740902&view=rev
Log:
[CXF-1549] Patch applied

Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/configuration/jsse/TLSClientParameters.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/configuration/jsse/TLSClientParameters.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/configuration/jsse/TLSClientParameters.java?rev=740902&r1=740901&r2=740902&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/configuration/jsse/TLSClientParameters.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/configuration/jsse/TLSClientParameters.java Wed Feb  4 21:38:52 2009
@@ -18,6 +18,8 @@
  */
 package org.apache.cxf.configuration.jsse;
 
+import javax.net.ssl.SSLSocketFactory;
+
 /**
  * This class extends {@link TLSParameterBase} with client-specific
  * SSL/TLS parameters.
@@ -25,6 +27,7 @@
  */
 public class TLSClientParameters extends TLSParameterBase {
     private boolean disableCNCheck;
+    private SSLSocketFactory sslSocketFactory;    
 
     /**
      * Set whether or not JSEE should omit checking if the host name
@@ -44,4 +47,20 @@
     public boolean isDisableCNCheck() {
         return disableCNCheck;
     }
+
+    /**
+     * This sets the SSLSocketFactory to use, causing all other properties of
+     * this bean (and its superclass) to get ignored (this takes precendence).
+     */
+    public final void setSSLSocketFactory(SSLSocketFactory factory) {
+        sslSocketFactory = factory;
+    }
+
+
+    /**
+     * Returns the SSLSocketFactory to be used, or null if none has been set.
+     */
+    public final SSLSocketFactory getSSLSocketFactory() {
+        return sslSocketFactory;
+    }    
 }

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java?rev=740902&r1=740901&r2=740902&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java (original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java Wed Feb  4 21:38:52 2009
@@ -156,7 +156,19 @@
         throws NoSuchAlgorithmException,
                NoSuchProviderException,
                KeyManagementException {
-        
+
+        // First see if an SSLSocketFactory was set.  This allows easy interop
+        // with not-yet-commons-ssl.jar, or even just people who like doing their
+        // own JSSE.
+        if (socketFactory == null) {
+            SSLSocketFactory preSetFactory = tlsClientParameters.getSSLSocketFactory();
+            if ( preSetFactory != null ) {
+                socketFactory = preSetFactory;
+            }
+        }
+
+        // Okay, no SSLSocketFactory available in TLSClientParameters.  Maybe
+        // TrustManagers, KeyManagers, etc?
         if (socketFactory == null) {
             String provider = tlsClientParameters.getJsseProvider();