camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dval...@apache.org
Subject svn commit: r1187357 - in /camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty: DefaultClientPipelineFactory.java DefaultServerPipelineFactory.java NettyConfiguration.java
Date Fri, 21 Oct 2011 14:18:11 GMT
Author: dvaleri
Date: Fri Oct 21 14:18:11 2011
New Revision: 1187357

URL: http://svn.apache.org/viewvc?rev=1187357&view=rev
Log:
[CAMEL-4572] Add support for SSLContextParameters based TLS configuration.

Modified:
    camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultClientPipelineFactory.java
    camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultServerPipelineFactory.java
    camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java

Modified: camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultClientPipelineFactory.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultClientPipelineFactory.java?rev=1187357&r1=1187356&r2=1187357&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultClientPipelineFactory.java
(original)
+++ camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultClientPipelineFactory.java
Fri Oct 21 14:18:11 2011
@@ -18,6 +18,7 @@ package org.apache.camel.component.netty
 
 import java.util.List;
 
+import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLEngine;
 
 import org.apache.camel.AsyncCallback;
@@ -72,6 +73,11 @@ public class DefaultClientPipelineFactor
 
         if (producer.getConfiguration().getSslHandler() != null) {
             return producer.getConfiguration().getSslHandler();
+        } else if (producer.getConfiguration().getSslContextParameters() != null) {
+            SSLContext context = producer.getConfiguration().getSslContextParameters().createSSLContext();
+            SSLEngine engine = context.createSSLEngine();
+            engine.setUseClientMode(true);
+            return new SslHandler(engine);
         } else {
             if (producer.getConfiguration().getKeyStoreFile() == null) {
                 LOG.debug("keystorefile is null");

Modified: camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultServerPipelineFactory.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultServerPipelineFactory.java?rev=1187357&r1=1187356&r2=1187357&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultServerPipelineFactory.java
(original)
+++ camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultServerPipelineFactory.java
Fri Oct 21 14:18:11 2011
@@ -18,6 +18,7 @@ package org.apache.camel.component.netty
 
 import java.util.List;
 
+import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLEngine;
 
 import org.apache.camel.component.netty.handlers.ServerChannelHandler;
@@ -70,6 +71,11 @@ public class DefaultServerPipelineFactor
 
         if (consumer.getConfiguration().getSslHandler() != null) {
             return consumer.getConfiguration().getSslHandler();
+        } else if (consumer.getConfiguration().getSslContextParameters() != null) {
+            SSLContext context = consumer.getConfiguration().getSslContextParameters().createSSLContext();
+            SSLEngine engine = context.createSSLEngine();
+            engine.setUseClientMode(false);
+            return new SslHandler(engine);
         } else {
             SSLEngineFactory sslEngineFactory = new SSLEngineFactory(
                 consumer.getConfiguration().getKeyStoreFormat(),
@@ -80,6 +86,5 @@ public class DefaultServerPipelineFactor
             SSLEngine sslEngine = sslEngineFactory.createServerSSLEngine();
             return new SslHandler(sslEngine);
         }
-    }   
-
+    }
 }

Modified: camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java?rev=1187357&r1=1187356&r2=1187357&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
(original)
+++ camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
Fri Oct 21 14:18:11 2011
@@ -26,6 +26,7 @@ import java.util.Map;
 import org.apache.camel.LoggingLevel;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.util.EndpointHelper;
+import org.apache.camel.util.jsse.SSLContextParameters;
 import org.jboss.netty.channel.ChannelDownstreamHandler;
 import org.jboss.netty.channel.ChannelUpstreamHandler;
 import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder;
@@ -79,6 +80,7 @@ public class NettyConfiguration implemen
     private boolean allowDefaultCodec = true;
     private ClientPipelineFactory clientPipelineFactory;
     private ServerPipelineFactory serverPipelineFactory;
+    protected SSLContextParameters sslContextParameters;
     
     /**
      * Returns a copy of this configuration
@@ -493,4 +495,11 @@ public class NettyConfiguration implemen
         this.workerCount = workerCount;
     }
 
+    public SSLContextParameters getSslContextParameters() {
+        return sslContextParameters;
+    }
+
+    public void setSslContextParameters(SSLContextParameters sslContextParameters) {
+        this.sslContextParameters = sslContextParameters;
+    }
 }



Mime
View raw message