camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/2] camel git commit: CAMEL-6443: Camel JSSE should favor creating SSLContext with a CamelContext.
Date Thu, 28 Apr 2016 13:53:51 GMT
CAMEL-6443: Camel JSSE should favor creating SSLContext with a CamelContext.


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

Branch: refs/heads/master
Commit: 89dc2e88b903df9ba1da9a38c4cc22a55186fd1a
Parents: 0099d07
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Thu Apr 28 15:46:52 2016 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Thu Apr 28 15:53:41 2016 +0200

----------------------------------------------------------------------
 .../camel/util/jsse/SSLContextParameters.java   | 46 ++++++++++++++++++--
 .../camel/component/ahc/ws/WssProducerTest.java |  2 +-
 .../apache/camel/component/ahc/AhcEndpoint.java |  4 +-
 .../apns/factory/ApnsServiceFactory.java        |  2 +-
 .../camel/component/cometd/CometdComponent.java |  2 +-
 .../component/etcd/AbstractEtcdEndpoint.java    |  2 +-
 .../component/file/remote/FtpsEndpoint.java     |  2 +-
 ...xtParametersSecureProtocolSocketFactory.java | 23 +++++++---
 .../http/HttpsSslContextParametersGetTest.java  |  2 +-
 .../camel/component/http4/HttpComponent.java    |  4 +-
 .../component/irc/CamelSSLIRCConnection.java    |  7 ++-
 .../camel/component/irc/IrcComponent.java       |  2 +-
 .../component/jetty/JettyHttpComponent.java     |  2 +-
 .../component/linkedin/LinkedInComponent.java   |  4 +-
 .../camel/component/mina2/Mina2Consumer.java    |  4 +-
 .../camel/component/mina2/Mina2Producer.java    |  2 +-
 .../netty/http/HttpClientPipelineFactory.java   |  2 +-
 .../netty/http/HttpServerPipelineFactory.java   |  2 +-
 .../netty/DefaultClientPipelineFactory.java     |  2 +-
 .../netty/DefaultServerPipelineFactory.java     |  2 +-
 .../http/HttpClientInitializerFactory.java      |  2 +-
 .../http/HttpServerInitializerFactory.java      |  2 +-
 .../netty4/DefaultClientInitializerFactory.java |  2 +-
 .../netty4/DefaultServerInitializerFactory.java |  2 +-
 .../component/olingo2/Olingo2Component.java     |  2 +-
 .../component/restlet/RestletComponent.java     |  2 +-
 .../salesforce/SalesforceComponent.java         |  2 +-
 .../salesforce/BulkApiIntegrationTest.java      |  2 +-
 .../salesforce/RestApiIntegrationTest.java      |  2 +-
 .../spring/ws/SpringWebserviceProducer.java     | 12 ++---
 .../camel/component/stomp/StompEndpoint.java    |  2 +-
 .../camel/component/stomp/StompBaseTest.java    |  4 +-
 .../component/undertow/UndertowEndpoint.java    |  2 +-
 .../component/websocket/WebsocketComponent.java |  2 +-
 ...ebsocketSSLContextInUriRouteExampleTest.java |  2 +-
 .../websocket/WebsocketSSLRouteExampleTest.java |  2 +-
 36 files changed, 108 insertions(+), 54 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextParameters.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextParameters.java b/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextParameters.java
index 26b4b69..d884ffd 100644
--- a/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextParameters.java
+++ b/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextParameters.java
@@ -30,6 +30,7 @@ import javax.net.ssl.SSLSocketFactory;
 import javax.net.ssl.TrustManager;
 import javax.net.ssl.X509KeyManager;
 
+import org.apache.camel.CamelContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -234,21 +235,60 @@ public class SSLContextParameters extends BaseSSLContextParameters {
     }
     
     ////////////////////////////////////////////
-    
+
     /**
      * Creates an {@link SSLContext} based on the related configuration options
      * of this instance. Namely, {@link #keyManagers}, {@link #trustManagers}, and
      * {@link #secureRandom}, but also respecting the chosen provider and secure
      * socket protocol as well.
-     * 
+     *
      * @return a newly configured instance
      *
      * @throws GeneralSecurityException if there is a problem in this instances
      *             configuration or that of its nested configuration options
      * @throws IOException if there is an error reading a key/trust store
+     * @deprecated use {@link #configureSSLContext(SSLContext)}
      */
+    @Deprecated
     public SSLContext createSSLContext() throws GeneralSecurityException, IOException {
-        
+        return createSSLContext(null);
+    }
+
+    /**
+     * Creates an {@link SSLContext} based on the related configuration options
+     * of this instance. Namely, {@link #keyManagers}, {@link #trustManagers}, and
+     * {@link #secureRandom}, but also respecting the chosen provider and secure
+     * socket protocol as well.
+     *
+     * @param camelContext  The camel context
+     *
+     * @return a newly configured instance
+     *
+     * @throws GeneralSecurityException if there is a problem in this instances
+     *             configuration or that of its nested configuration options
+     * @throws IOException if there is an error reading a key/trust store
+     */
+    public SSLContext createSSLContext(CamelContext camelContext) throws GeneralSecurityException, IOException {
+        if (camelContext != null) {
+            // setup CamelContext before creating SSLContext
+            setCamelContext(camelContext);
+            if (keyManagers != null) {
+                keyManagers.setCamelContext(camelContext);
+            }
+            if (trustManagers != null) {
+                trustManagers.setCamelContext(camelContext);
+            }
+            if (secureRandom != null) {
+                secureRandom.setCamelContext(camelContext);
+            }
+            if (clientParameters != null) {
+                clientParameters.setCamelContext(camelContext);
+            }
+            if (serverParameters != null) {
+                serverParameters.setCamelContext(camelContext);
+            }
+        }
+
         LOG.trace("Creating SSLContext from SSLContextParameters [{}].", this);
         
         LOG.info("Available providers: {}.", Security.getProviders());

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-ahc-ws/src/test/java/org/apache/camel/component/ahc/ws/WssProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-ahc-ws/src/test/java/org/apache/camel/component/ahc/ws/WssProducerTest.java b/components/camel-ahc-ws/src/test/java/org/apache/camel/component/ahc/ws/WssProducerTest.java
index b97066c..a43bc22 100644
--- a/components/camel-ahc-ws/src/test/java/org/apache/camel/component/ahc/ws/WssProducerTest.java
+++ b/components/camel-ahc-ws/src/test/java/org/apache/camel/component/ahc/ws/WssProducerTest.java
@@ -38,7 +38,7 @@ public class WssProducerTest extends WsProducerTestBase {
     protected Connector getConnector() throws Exception {
 
         SslContextFactory sslContextFactory = new SslContextFactory();
-        sslContextFactory.setSslContext(defineSSLContextServerParameters().createSSLContext());
+        sslContextFactory.setSslContext(defineSSLContextServerParameters().createSSLContext(camelContext));
 
         ServerConnector https = new ServerConnector(server,
                 new SslConnectionFactory(sslContextFactory, null));

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/AhcEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/AhcEndpoint.java b/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/AhcEndpoint.java
index 89b2c8e..45cee12 100644
--- a/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/AhcEndpoint.java
+++ b/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/AhcEndpoint.java
@@ -241,7 +241,7 @@ public class AhcEndpoint extends DefaultEndpoint implements AsyncEndpoint, Heade
                 AsyncHttpClientConfig.Builder builder = AhcComponent.cloneConfig(clientConfig);
                 
                 if (sslContextParameters != null) {
-                    SSLContext ssl = sslContextParameters.createSSLContext();
+                    SSLContext ssl = sslContextParameters.createSSLContext(getCamelContext());
                     builder.setSSLContext(ssl);
                 }
                 
@@ -249,7 +249,7 @@ public class AhcEndpoint extends DefaultEndpoint implements AsyncEndpoint, Heade
             } else {
                 if (sslContextParameters != null) {
                     AsyncHttpClientConfig.Builder builder = new AsyncHttpClientConfig.Builder();
-                    SSLContext ssl = sslContextParameters.createSSLContext();
+                    SSLContext ssl = sslContextParameters.createSSLContext(getCamelContext());
                     builder.setSSLContext(ssl);
                     config = builder.build();
                 }

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-apns/src/main/java/org/apache/camel/component/apns/factory/ApnsServiceFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-apns/src/main/java/org/apache/camel/component/apns/factory/ApnsServiceFactory.java b/components/camel-apns/src/main/java/org/apache/camel/component/apns/factory/ApnsServiceFactory.java
index 9f917da..a7de391 100644
--- a/components/camel-apns/src/main/java/org/apache/camel/component/apns/factory/ApnsServiceFactory.java
+++ b/components/camel-apns/src/main/java/org/apache/camel/component/apns/factory/ApnsServiceFactory.java
@@ -192,7 +192,7 @@ public class ApnsServiceFactory implements CamelContextAware {
 
     private void configureApnsCertificate(ApnsServiceBuilder builder) throws IOException, GeneralSecurityException {
         if (getSslContextParameters() != null) {
-            builder.withSSLContext(getSslContextParameters().createSSLContext());
+            builder.withSSLContext(getSslContextParameters().createSSLContext(getCamelContext()));
             return;
         }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdComponent.java b/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdComponent.java
index 00734d3..f01b160 100644
--- a/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdComponent.java
+++ b/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdComponent.java
@@ -220,7 +220,7 @@ public class CometdComponent extends UriEndpointComponent {
         ServerConnector sslSocketConnector = null;
         if (sslContextParameters != null) {
             SslContextFactory sslContextFactory = new CometdComponentSslContextFactory();
-            sslContextFactory.setSslContext(sslContextParameters.createSSLContext());
+            sslContextFactory.setSslContext(sslContextParameters.createSSLContext(getCamelContext()));
             sslSocketConnector = new ServerConnector(server, sslContextFactory);
         } else {
             SslContextFactory sslContextFactory = new SslContextFactory();

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdEndpoint.java b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdEndpoint.java
index 62a93aa..6847d85 100644
--- a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdEndpoint.java
+++ b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/AbstractEtcdEndpoint.java
@@ -93,7 +93,7 @@ public abstract class AbstractEtcdEndpoint extends DefaultEndpoint {
 
     private SSLContext createSslContext(EtcdConfiguration configuration) throws Exception {
         if (configuration.getSslContextParameters() != null) {
-            return configuration.getSslContextParameters().createSSLContext();
+            return configuration.getSslContextParameters().createSSLContext(getCamelContext());
         }
         return null;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpsEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpsEndpoint.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpsEndpoint.java
index da6eba2..f833d31 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpsEndpoint.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpsEndpoint.java
@@ -72,7 +72,7 @@ public class FtpsEndpoint extends FtpEndpoint<FTPFile> {
         FTPSClient client;
         
         if (sslContextParameters != null) {
-            SSLContext context = sslContextParameters.createSSLContext();
+            SSLContext context = sslContextParameters.createSSLContext(getCamelContext());
 
             client = new FTPSClient(getFtpsConfiguration().isImplicit(), context);
             

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-http/src/main/java/org/apache/camel/component/http/SSLContextParametersSecureProtocolSocketFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/SSLContextParametersSecureProtocolSocketFactory.java b/components/camel-http/src/main/java/org/apache/camel/component/http/SSLContextParametersSecureProtocolSocketFactory.java
index ea6a42c..68ca3aa 100644
--- a/components/camel-http/src/main/java/org/apache/camel/component/http/SSLContextParametersSecureProtocolSocketFactory.java
+++ b/components/camel-http/src/main/java/org/apache/camel/component/http/SSLContextParametersSecureProtocolSocketFactory.java
@@ -23,9 +23,9 @@ import java.net.UnknownHostException;
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLSocketFactory;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.util.jsse.SSLContextParameters;
-import org.apache.commons.httpclient.ConnectTimeoutException;
 import org.apache.commons.httpclient.params.HttpConnectionParams;
 import org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory;
 import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory;
@@ -55,11 +55,23 @@ public class SSLContextParametersSecureProtocolSocketFactory implements SecurePr
      * parameters.
      *
      * @param params the configuration parameters to use when creating the socket factory
+     * @deprecated use {@link #SSLContextParametersSecureProtocolSocketFactory(SSLContextParameters, CamelContext)}
      */
+    @Deprecated
     public SSLContextParametersSecureProtocolSocketFactory(SSLContextParameters params) {
+        this(params, null);
+    }
 
+    /**
+     * Creates a new instance using a factory created by the provided client configuration
+     * parameters.
+     *
+     * @param params the configuration parameters to use when creating the socket factory
+     * @param camelContext the Camel context
+     */
+    public SSLContextParametersSecureProtocolSocketFactory(SSLContextParameters params, CamelContext camelContext) {
         try {
-            this.context = params.createSSLContext();
+            this.context = params.createSSLContext(camelContext);
             this.factory = this.context.getSocketFactory();
         } catch (Exception e) {
             throw new RuntimeCamelException("Error creating the SSLContext.", e);
@@ -67,15 +79,12 @@ public class SSLContextParametersSecureProtocolSocketFactory implements SecurePr
     }    
 
     @Override
-    public Socket createSocket(String host, int port, 
-                               InetAddress localAddress, int localPort) throws IOException, UnknownHostException {
+    public Socket createSocket(String host, int port, InetAddress localAddress, int localPort) throws IOException {
         return this.factory.createSocket(host, port, localAddress, localPort);
     }
 
     @Override
-    public Socket createSocket(String host, int port, 
-                               InetAddress localAddress, int localPort, HttpConnectionParams params) throws IOException, UnknownHostException,
-        ConnectTimeoutException {
+    public Socket createSocket(String host, int port, InetAddress localAddress, int localPort, HttpConnectionParams params) throws IOException {
         
         if (params == null) {
             throw new IllegalArgumentException("Parameters may not be null");

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-http/src/test/java/org/apache/camel/component/http/HttpsSslContextParametersGetTest.java
----------------------------------------------------------------------
diff --git a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpsSslContextParametersGetTest.java b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpsSslContextParametersGetTest.java
index 19c5908..8e39f24 100644
--- a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpsSslContextParametersGetTest.java
+++ b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpsSslContextParametersGetTest.java
@@ -30,7 +30,7 @@ public class HttpsSslContextParametersGetTest extends HttpsGetTest {
                 SSLContextParameters params = new SSLContextParameters();
                 
                 ProtocolSocketFactory factory = 
-                    new SSLContextParametersSecureProtocolSocketFactory(params);
+                    new SSLContextParametersSecureProtocolSocketFactory(params, context);
                 
                 Protocol.registerProtocol("https",
                         new Protocol(

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
index 1ff3300..d59c60d 100644
--- a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
+++ b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
@@ -282,8 +282,8 @@ public class HttpComponent extends HttpCommonComponent {
         builder.register("http", PlainConnectionSocketFactory.getSocketFactory());
         builder.register("http4", PlainConnectionSocketFactory.getSocketFactory());
         if (sslContextParams != null) {
-            builder.register("https", new SSLConnectionSocketFactory(sslContextParams.createSSLContext(), x509HostnameVerifier));
-            builder.register("https4", new SSLConnectionSocketFactory(sslContextParams.createSSLContext(), x509HostnameVerifier));
+            builder.register("https", new SSLConnectionSocketFactory(sslContextParams.createSSLContext(getCamelContext()), x509HostnameVerifier));
+            builder.register("https4", new SSLConnectionSocketFactory(sslContextParams.createSSLContext(getCamelContext()), x509HostnameVerifier));
         } else {
             builder.register("https4", new SSLConnectionSocketFactory(SSLContexts.createDefault(), x509HostnameVerifier));
             builder.register("https", new SSLConnectionSocketFactory(SSLContexts.createDefault(), x509HostnameVerifier));

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-irc/src/main/java/org/apache/camel/component/irc/CamelSSLIRCConnection.java
----------------------------------------------------------------------
diff --git a/components/camel-irc/src/main/java/org/apache/camel/component/irc/CamelSSLIRCConnection.java b/components/camel-irc/src/main/java/org/apache/camel/component/irc/CamelSSLIRCConnection.java
index 72f131b..fe49d2d 100644
--- a/components/camel-irc/src/main/java/org/apache/camel/component/irc/CamelSSLIRCConnection.java
+++ b/components/camel-irc/src/main/java/org/apache/camel/component/irc/CamelSSLIRCConnection.java
@@ -24,6 +24,7 @@ import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLSocket;
 import javax.net.ssl.SSLSocketFactory;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.util.jsse.SSLContextParameters;
 import org.schwering.irc.lib.ssl.SSLIRCConnection;
@@ -36,6 +37,7 @@ import org.schwering.irc.lib.ssl.SSLNotSupportedException;
 public class CamelSSLIRCConnection extends SSLIRCConnection {
     
     private SSLContextParameters sslContextParameters;
+    private CamelContext camelContext;
 
     public CamelSSLIRCConnection(String host, int portMin, int portMax, String pass, 
                                  String nick, String username, String realname,
@@ -46,9 +48,10 @@ public class CamelSSLIRCConnection extends SSLIRCConnection {
 
     public CamelSSLIRCConnection(String host, int[] ports, String pass,
                                  String nick, String username, String realname,
-                                 SSLContextParameters sslContextParameters) {
+                                 SSLContextParameters sslContextParameters, CamelContext camelContext) {
         super(host, ports, pass, nick, username, realname);
         this.sslContextParameters = sslContextParameters;
+        this.camelContext = camelContext;
     }
 
     @Override
@@ -65,7 +68,7 @@ public class CamelSSLIRCConnection extends SSLIRCConnection {
             
             final SSLContext sslContext;
             try {
-                sslContext = sslContextParameters.createSSLContext();
+                sslContext = sslContextParameters.createSSLContext(camelContext);
             } catch (GeneralSecurityException e) {
                 throw new RuntimeCamelException("Error in SSLContextParameters configuration or instantiation.", e);
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcComponent.java b/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcComponent.java
index 1c2b09e..ef89aba 100644
--- a/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcComponent.java
+++ b/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcComponent.java
@@ -78,7 +78,7 @@ public class IrcComponent extends UriEndpointComponent {
             if (configuration.getSslContextParameters() != null) {
                 conn = new CamelSSLIRCConnection(configuration.getHostname(), configuration.getPorts(), configuration.getPassword(),
                                                  configuration.getNickname(), configuration.getUsername(), configuration.getRealname(),
-                                                 configuration.getSslContextParameters());
+                                                 configuration.getSslContextParameters(), getCamelContext());
             } else {
                 SSLIRCConnection sconn = new SSLIRCConnection(configuration.getHostname(), configuration.getPorts(), configuration.getPassword(),
                         configuration.getNickname(), configuration.getUsername(), configuration.getRealname());

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
index 7b3e7bf..40dbfcf 100644
--- a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
+++ b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
@@ -599,7 +599,7 @@ public abstract class JettyHttpComponent extends HttpCommonComponent implements
     private SslContextFactory createSslContextFactory(SSLContextParameters ssl) throws GeneralSecurityException, IOException {
         SslContextFactory answer = new SslContextFactory();
         if (ssl != null) {
-            answer.setSslContext(ssl.createSSLContext());
+            answer.setSslContext(ssl.createSSLContext(getCamelContext()));
         }
         return answer;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInComponent.java b/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInComponent.java
index aad21e9..0d05a8d 100644
--- a/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInComponent.java
+++ b/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInComponent.java
@@ -82,14 +82,14 @@ public class LinkedInComponent extends AbstractApiComponent<LinkedInApiName, Lin
         }
     }
 
-    private static LinkedInOAuthRequestFilter createRequestFilter(LinkedInConfiguration configuration) {
+    private LinkedInOAuthRequestFilter createRequestFilter(LinkedInConfiguration configuration) {
         // validate configuration
         configuration.validate();
 
         final String[] enabledProtocols;
         try {
             // use default SSP to create supported non-SSL protocols list
-            final SSLContext sslContext = new SSLContextParameters().createSSLContext();
+            final SSLContext sslContext = new SSLContextParameters().createSSLContext(getCamelContext());
             enabledProtocols = sslContext.createSSLEngine().getEnabledProtocols();
         } catch (GeneralSecurityException e) {
             throw ObjectHelper.wrapRuntimeCamelException(e);

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Consumer.java
----------------------------------------------------------------------
diff --git a/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Consumer.java b/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Consumer.java
index 2e913e7..c2a7c50 100644
--- a/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Consumer.java
+++ b/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Consumer.java
@@ -195,7 +195,7 @@ public class Mina2Consumer extends DefaultConsumer {
         }
         appendIoFiltersToChain(filters, acceptor.getFilterChain());
         if (configuration.getSslContextParameters() != null) {
-            SslFilter filter = new SslFilter(configuration.getSslContextParameters().createSSLContext(), configuration.isAutoStartTls());
+            SslFilter filter = new SslFilter(configuration.getSslContextParameters().createSSLContext(getEndpoint().getCamelContext()), configuration.isAutoStartTls());
             filter.setUseClientMode(false);
             acceptor.getFilterChain().addFirst("sslFilter", filter);
         }
@@ -222,7 +222,7 @@ public class Mina2Consumer extends DefaultConsumer {
         }
         appendIoFiltersToChain(filters, connector.getFilterChain());
         if (configuration.getSslContextParameters() != null) {
-            SslFilter filter = new SslFilter(configuration.getSslContextParameters().createSSLContext(), configuration.isAutoStartTls());
+            SslFilter filter = new SslFilter(configuration.getSslContextParameters().createSSLContext(getEndpoint().getCamelContext()), configuration.isAutoStartTls());
             filter.setUseClientMode(true);
             connector.getFilterChain().addFirst("sslFilter", filter);
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Producer.java
----------------------------------------------------------------------
diff --git a/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Producer.java b/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Producer.java
index 132abe3..fdd02dc 100644
--- a/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Producer.java
+++ b/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Producer.java
@@ -313,7 +313,7 @@ public class Mina2Producer extends DefaultProducer implements ServicePoolAware {
         }
         appendIoFiltersToChain(filters, connector.getFilterChain());
         if (configuration.getSslContextParameters() != null) {
-            SslFilter filter = new SslFilter(configuration.getSslContextParameters().createSSLContext(), configuration.isAutoStartTls());
+            SslFilter filter = new SslFilter(configuration.getSslContextParameters().createSSLContext(getEndpoint().getCamelContext()), configuration.isAutoStartTls());
             filter.setUseClientMode(true);
             connector.getFilterChain().addFirst("sslFilter", filter);
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpClientPipelineFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpClientPipelineFactory.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpClientPipelineFactory.java
index aa66874..c5e9b9d 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpClientPipelineFactory.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpClientPipelineFactory.java
@@ -128,7 +128,7 @@ public class HttpClientPipelineFactory extends ClientPipelineFactory {
 
         // create ssl context once
         if (configuration.getSslContextParameters() != null) {
-            answer = configuration.getSslContextParameters().createSSLContext();
+            answer = configuration.getSslContextParameters().createSSLContext(producer.getContext());
         } else {
             if (configuration.getKeyStoreFile() == null && configuration.getKeyStoreResource() == null) {
                 LOG.debug("keystorefile is null");

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java
index 56095e1..0435ffb 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java
@@ -138,7 +138,7 @@ public class HttpServerPipelineFactory extends ServerPipelineFactory {
 
         // create ssl context once
         if (configuration.getSslContextParameters() != null) {
-            answer = configuration.getSslContextParameters().createSSLContext();
+            answer = configuration.getSslContextParameters().createSSLContext(camelContext);
         } else {
             if (configuration.getKeyStoreFile() == null && configuration.getKeyStoreResource() == null) {
                 LOG.debug("keystorefile is null");

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultClientPipelineFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultClientPipelineFactory.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultClientPipelineFactory.java
index 1e40f4c..ee5cfa9 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultClientPipelineFactory.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultClientPipelineFactory.java
@@ -111,7 +111,7 @@ public class DefaultClientPipelineFactory extends ClientPipelineFactory  {
 
         // create ssl context once
         if (configuration.getSslContextParameters() != null) {
-            answer = configuration.getSslContextParameters().createSSLContext();
+            answer = configuration.getSslContextParameters().createSSLContext(producer.getContext());
         } else {
             if (configuration.getKeyStoreFile() == null && configuration.getKeyStoreResource() == null) {
                 LOG.debug("keystorefile is null");

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultServerPipelineFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultServerPipelineFactory.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultServerPipelineFactory.java
index 6e6ec9f..4859caf 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultServerPipelineFactory.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultServerPipelineFactory.java
@@ -128,7 +128,7 @@ public class DefaultServerPipelineFactory extends ServerPipelineFactory {
 
         // create ssl context once
         if (configuration.getSslContextParameters() != null) {
-            answer = configuration.getSslContextParameters().createSSLContext();
+            answer = configuration.getSslContextParameters().createSSLContext(camelContext);
         } else {
             if (configuration.getKeyStoreFile() == null && configuration.getKeyStoreResource() == null) {
                 LOG.debug("keystorefile is null");

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/HttpClientInitializerFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/HttpClientInitializerFactory.java b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/HttpClientInitializerFactory.java
index 898068a..04bae3d 100644
--- a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/HttpClientInitializerFactory.java
+++ b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/HttpClientInitializerFactory.java
@@ -133,7 +133,7 @@ public class HttpClientInitializerFactory extends ClientInitializerFactory {
 
         // create ssl context once
         if (configuration.getSslContextParameters() != null) {
-            answer = configuration.getSslContextParameters().createSSLContext();
+            answer = configuration.getSslContextParameters().createSSLContext(producer.getContext());
         } else {
             if (configuration.getKeyStoreFile() == null && configuration.getKeyStoreResource() == null) {
                 LOG.debug("keystorefile is null");

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/HttpServerInitializerFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/HttpServerInitializerFactory.java b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/HttpServerInitializerFactory.java
index 1001560..84a34c2 100644
--- a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/HttpServerInitializerFactory.java
+++ b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/HttpServerInitializerFactory.java
@@ -133,7 +133,7 @@ public class HttpServerInitializerFactory extends ServerInitializerFactory {
 
         // create ssl context once
         if (configuration.getSslContextParameters() != null) {
-            answer = configuration.getSslContextParameters().createSSLContext();
+            answer = configuration.getSslContextParameters().createSSLContext(camelContext);
         } else {
             if (configuration.getKeyStoreFile() == null && configuration.getKeyStoreResource() == null) {
                 LOG.debug("keystorefile is null");

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultClientInitializerFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultClientInitializerFactory.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultClientInitializerFactory.java
index ff7f50e..54c90c5 100644
--- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultClientInitializerFactory.java
+++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultClientInitializerFactory.java
@@ -112,7 +112,7 @@ public class DefaultClientInitializerFactory extends ClientInitializerFactory  {
 
         // create ssl context once
         if (configuration.getSslContextParameters() != null) {
-            answer = configuration.getSslContextParameters().createSSLContext();
+            answer = configuration.getSslContextParameters().createSSLContext(producer.getContext());
         } else {
             if (configuration.getKeyStoreFile() == null && configuration.getKeyStoreResource() == null) {
                 LOG.debug("keystorefile is null");

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultServerInitializerFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultServerInitializerFactory.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultServerInitializerFactory.java
index 6ec681c..248f9bf 100644
--- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultServerInitializerFactory.java
+++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultServerInitializerFactory.java
@@ -131,7 +131,7 @@ public class DefaultServerInitializerFactory extends ServerInitializerFactory {
 
         // create ssl context once
         if (configuration.getSslContextParameters() != null) {
-            answer = configuration.getSslContextParameters().createSSLContext();
+            answer = configuration.getSslContextParameters().createSSLContext(camelContext);
         } else {
             if (configuration.getKeyStoreFile() == null && configuration.getKeyStoreResource() == null) {
                 LOG.debug("keystorefile is null");

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Component.java
----------------------------------------------------------------------
diff --git a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Component.java b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Component.java
index 23863ec..8038a77 100644
--- a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Component.java
+++ b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Component.java
@@ -139,7 +139,7 @@ public class Olingo2Component extends AbstractApiComponent<Olingo2ApiName, Oling
                 sslContextParameters = new SSLContextParameters();
             }
             try {
-                clientBuilder.setSSLContext(sslContextParameters.createSSLContext());
+                clientBuilder.setSSLContext(sslContextParameters.createSSLContext(getCamelContext()));
             } catch (GeneralSecurityException e) {
                 throw ObjectHelper.wrapRuntimeCamelException(e);
             } catch (IOException e) {

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
index 322d0ec..8ba21f5 100644
--- a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
+++ b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
@@ -272,7 +272,7 @@ public class RestletComponent extends HeaderFilterStrategyComponent implements R
         params.add("sslContextFactory",
             "org.restlet.engine.ssl.DefaultSslContextFactory");
 
-        SSLContext context = scp.createSSLContext();
+        SSLContext context = scp.createSSLContext(getCamelContext());
         SSLEngine engine = context.createSSLEngine();
 
         params.add("enabledProtocols", stringArrayToString(engine.getEnabledProtocols()));

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java
index 84ad4b0..5f93441 100644
--- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java
@@ -191,7 +191,7 @@ public class SalesforceComponent extends UriEndpointComponent implements Endpoin
         final SSLContextParameters contextParameters = sslContextParameters != null
             ? sslContextParameters : new SSLContextParameters();
         final SslContextFactory sslContextFactory = httpClient.getSslContextFactory();
-        sslContextFactory.setSslContext(contextParameters.createSSLContext());
+        sslContextFactory.setSslContext(contextParameters.createSSLContext(getCamelContext()));
 
         // set HTTP client parameters
         if (httpClientProperties != null && !httpClientProperties.isEmpty()) {

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/BulkApiIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/BulkApiIntegrationTest.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/BulkApiIntegrationTest.java
index b8c6dfe..c647e04 100644
--- a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/BulkApiIntegrationTest.java
+++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/BulkApiIntegrationTest.java
@@ -38,7 +38,7 @@ public class BulkApiIntegrationTest extends AbstractBulkApiTestBase {
         String accessToken = sf.getSession().getAccessToken();
 
         SslContextFactory sslContextFactory = new SslContextFactory();
-        sslContextFactory.setSslContext(new SSLContextParameters().createSSLContext());
+        sslContextFactory.setSslContext(new SSLContextParameters().createSSLContext(context));
         HttpClient httpClient = new HttpClient(sslContextFactory);
         httpClient.setConnectTimeout(60000);
         httpClient.setTimeout(60000);

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/RestApiIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/RestApiIntegrationTest.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/RestApiIntegrationTest.java
index e87a21f..ad33a79 100644
--- a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/RestApiIntegrationTest.java
+++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/RestApiIntegrationTest.java
@@ -71,7 +71,7 @@ public class RestApiIntegrationTest extends AbstractSalesforceTestBase {
         String accessToken = sf.getSession().getAccessToken();
 
         SslContextFactory sslContextFactory = new SslContextFactory();
-        sslContextFactory.setSslContext(new SSLContextParameters().createSSLContext());
+        sslContextFactory.setSslContext(new SSLContextParameters().createSSLContext(context));
         HttpClient httpClient = new HttpClient(sslContextFactory);
         httpClient.setConnectTimeout(60000);
         httpClient.setTimeout(60000);

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceProducer.java b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceProducer.java
index 93bd595..a4bef18 100644
--- a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceProducer.java
+++ b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceProducer.java
@@ -26,6 +26,7 @@ import javax.net.ssl.SSLContext;
 import javax.xml.transform.Source;
 import javax.xml.transform.TransformerException;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 import org.apache.camel.RuntimeCamelException;
@@ -97,7 +98,7 @@ public class SpringWebserviceProducer extends DefaultProducer {
         }
     }
 
-    private static void prepareMessageSenders(SpringWebserviceConfiguration configuration) {
+    private void prepareMessageSenders(SpringWebserviceConfiguration configuration) {
         // Skip this whole thing if none of the relevant config options are set.
         if (!(configuration.getTimeout() > -1) && configuration.getSslContextParameters() == null) {
             return;
@@ -128,7 +129,7 @@ public class SpringWebserviceProducer extends DefaultProducer {
             } else if (messageSender.getClass().equals(HttpUrlConnectionMessageSender.class)) {
                 // Only if exact match denoting likely use of default configuration.  We don't want to get
                 // sub-classes that might have been otherwise injected.
-                messageSenders[i] = new AbstractHttpWebServiceMessageSenderDecorator((HttpUrlConnectionMessageSender) messageSender, configuration);
+                messageSenders[i] = new AbstractHttpWebServiceMessageSenderDecorator((HttpUrlConnectionMessageSender) messageSender, configuration, getEndpoint().getCamelContext());
             } else {
                 // For example this will be the case during unit-testing with the net.javacrumbs.spring-ws-test API
                 LOG.warn("Ignoring the timeout and SSLContextParameters options for {}.  You will need to configure "
@@ -145,14 +146,15 @@ public class SpringWebserviceProducer extends DefaultProducer {
     protected static final class AbstractHttpWebServiceMessageSenderDecorator extends AbstractHttpWebServiceMessageSender {
 
         private final AbstractHttpWebServiceMessageSender delegate;
-
         private final SpringWebserviceConfiguration configuration;
+        private final CamelContext camelContext;
 
         private SSLContext sslContext;
 
-        public AbstractHttpWebServiceMessageSenderDecorator(AbstractHttpWebServiceMessageSender delegate, SpringWebserviceConfiguration configuration) {
+        public AbstractHttpWebServiceMessageSenderDecorator(AbstractHttpWebServiceMessageSender delegate, SpringWebserviceConfiguration configuration, CamelContext camelContext) {
             this.delegate = delegate;
             this.configuration = configuration;
+            this.camelContext = camelContext;
         }
 
         @Override
@@ -169,7 +171,7 @@ public class SpringWebserviceProducer extends DefaultProducer {
                     try {
                         synchronized (this) {
                             if (sslContext == null) {
-                                sslContext = configuration.getSslContextParameters().createSSLContext();
+                                sslContext = configuration.getSslContextParameters().createSSLContext(camelContext);
                             }
                         }
                     } catch (GeneralSecurityException e) {

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-stomp/src/main/java/org/apache/camel/component/stomp/StompEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-stomp/src/main/java/org/apache/camel/component/stomp/StompEndpoint.java b/components/camel-stomp/src/main/java/org/apache/camel/component/stomp/StompEndpoint.java
index 5e600f9..537b77f 100644
--- a/components/camel-stomp/src/main/java/org/apache/camel/component/stomp/StompEndpoint.java
+++ b/components/camel-stomp/src/main/java/org/apache/camel/component/stomp/StompEndpoint.java
@@ -87,7 +87,7 @@ public class StompEndpoint extends DefaultEndpoint implements AsyncEndpoint {
         stomp.setLogin(configuration.getLogin());
         stomp.setPasscode(configuration.getPasscode());
         if (configuration.getSslContextParameters() != null) {
-            stomp.setSslContext(configuration.getSslContextParameters().createSSLContext());
+            stomp.setSslContext(configuration.getSslContextParameters().createSSLContext(getCamelContext()));
         }
         stomp.connectCallback(promise);
         if (configuration.getHost() != null && !configuration.getHost().isEmpty()) {

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-stomp/src/test/java/org/apache/camel/component/stomp/StompBaseTest.java
----------------------------------------------------------------------
diff --git a/components/camel-stomp/src/test/java/org/apache/camel/component/stomp/StompBaseTest.java b/components/camel-stomp/src/test/java/org/apache/camel/component/stomp/StompBaseTest.java
index 3551e7a..d3d8af0 100644
--- a/components/camel-stomp/src/test/java/org/apache/camel/component/stomp/StompBaseTest.java
+++ b/components/camel-stomp/src/test/java/org/apache/camel/component/stomp/StompBaseTest.java
@@ -131,7 +131,7 @@ public abstract class StompBaseTest extends CamelTestSupport {
 
     protected SSLContext getServerSSLContext() throws Exception {
         if (serverSslContext == null) {
-            serverSslContext = getServerSSLContextParameters().createSSLContext();
+            serverSslContext = getServerSSLContextParameters().createSSLContext(context);
         }
 
         return serverSslContext;
@@ -147,7 +147,7 @@ public abstract class StompBaseTest extends CamelTestSupport {
 
     protected SSLContext getClientSSLContext() throws Exception {
         if (clientSslContext == null) {
-            clientSslContext = getClientSSLContextParameters().createSSLContext();
+            clientSslContext = getClientSSLContextParameters().createSSLContext(context);
         }
 
         return clientSslContext;

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowEndpoint.java b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowEndpoint.java
index 0f2984a..ce71dea 100644
--- a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowEndpoint.java
+++ b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowEndpoint.java
@@ -289,7 +289,7 @@ public class UndertowEndpoint extends DefaultEndpoint implements AsyncEndpoint,
         super.doStart();
 
         if (sslContextParameters != null) {
-            sslContext = sslContextParameters.createSSLContext();
+            sslContext = sslContextParameters.createSSLContext(getCamelContext());
         }
 
         // create options map

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java
index 90e0d8d..7c9cbb7 100644
--- a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java
+++ b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java
@@ -489,7 +489,7 @@ public class WebsocketComponent extends UriEndpointComponent {
         ServerConnector sslSocketConnector = null;
         if (sslContextParameters != null) {
             SslContextFactory sslContextFactory = new WebSocketComponentSslContextFactory();
-            sslContextFactory.setSslContext(sslContextParameters.createSSLContext());
+            sslContextFactory.setSslContext(sslContextParameters.createSSLContext(getCamelContext()));
             sslSocketConnector = new ServerConnector(server, sslContextFactory);
         } else {
             SslContextFactory sslContextFactory = new SslContextFactory();

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketSSLContextInUriRouteExampleTest.java
----------------------------------------------------------------------
diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketSSLContextInUriRouteExampleTest.java b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketSSLContextInUriRouteExampleTest.java
index 937fb76..9ed1fe4 100644
--- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketSSLContextInUriRouteExampleTest.java
+++ b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketSSLContextInUriRouteExampleTest.java
@@ -106,7 +106,7 @@ public class WebsocketSSLContextInUriRouteExampleTest extends CamelTestSupport {
         AsyncHttpClientConfig.Builder builder =
                 new AsyncHttpClientConfig.Builder();
 
-        builder.setSSLContext(new SSLContextParameters().createSSLContext());
+        builder.setSSLContext(new SSLContextParameters().createSSLContext(context));
         builder.setAcceptAnyCertificate(true);
         config = builder.build();
         c = new AsyncHttpClient(config);

http://git-wip-us.apache.org/repos/asf/camel/blob/89dc2e88/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketSSLRouteExampleTest.java
----------------------------------------------------------------------
diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketSSLRouteExampleTest.java b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketSSLRouteExampleTest.java
index f364b12..5845914 100644
--- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketSSLRouteExampleTest.java
+++ b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketSSLRouteExampleTest.java
@@ -74,7 +74,7 @@ public class WebsocketSSLRouteExampleTest extends CamelTestSupport {
         AsyncHttpClientConfig.Builder builder =
                 new AsyncHttpClientConfig.Builder();
 
-        builder.setSSLContext(new SSLContextParameters().createSSLContext());
+        builder.setSSLContext(new SSLContextParameters().createSSLContext(context));
         builder.setAcceptAnyCertificate(true);
         config = builder.build();
         c = new AsyncHttpClient(config);


Mime
View raw message