Author: dkulp
Date: Tue Aug 21 19:28:20 2012
New Revision: 1375729
URL: http://svn.apache.org/viewvc?rev=1375729&view=rev
Log:
Merged revisions 1370690 via git cherry-pick from
https://svn.apache.org/repos/asf/camel/trunk
........
r1370690 | ningjiang | 2012-08-08 04:01:52 -0400 (Wed, 08 Aug 2012) | 2 lines
CAMEL-4303 Add camel-netty option to configure whether the server needs
client auth when using SSL
........
Modified:
camel/branches/camel-2.10.x/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultServerPipelineFactory.java
camel/branches/camel-2.10.x/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
camel/branches/camel-2.10.x/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyComponentWithConfigurationTest.java
Modified:
camel/branches/camel-2.10.x/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultServerPipelineFactory.java
URL:
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultServerPipelineFactory.java?rev=1375729&r1=1375728&r2=1375729&view=diff
==============================================================================
---
camel/branches/camel-2.10.x/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultServerPipelineFactory.java
(original)
+++
camel/branches/camel-2.10.x/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultServerPipelineFactory.java
Tue Aug 21 19:28:20 2012
@@ -90,6 +90,7 @@ public class DefaultServerPipelineFactor
SSLContext context =
consumer.getConfiguration().getSslContextParameters().createSSLContext();
SSLEngine engine = context.createSSLEngine();
engine.setUseClientMode(false);
+
engine.setNeedClientAuth(consumer.getConfiguration().isNeedClientAuth());
return new SslHandler(engine);
} else {
SSLEngineFactory sslEngineFactory = new SSLEngineFactory(
@@ -99,6 +100,8 @@ public class DefaultServerPipelineFactor
consumer.getConfiguration().getTrustStoreFile(),
consumer.getConfiguration().getPassphrase().toCharArray());
SSLEngine sslEngine = sslEngineFactory.createServerSSLEngine();
+ sslEngine.setUseClientMode(false);
+
sslEngine.setNeedClientAuth(consumer.getConfiguration().isNeedClientAuth());
return new SslHandler(sslEngine);
}
}
Modified:
camel/branches/camel-2.10.x/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
URL:
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java?rev=1375729&r1=1375728&r2=1375729&view=diff
==============================================================================
---
camel/branches/camel-2.10.x/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
(original)
+++
camel/branches/camel-2.10.x/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
Tue Aug 21 19:28:20 2012
@@ -75,6 +75,7 @@ public class NettyConfiguration implemen
private ClientPipelineFactory clientPipelineFactory;
private ServerPipelineFactory serverPipelineFactory;
private SSLContextParameters sslContextParameters;
+ private boolean needClientAuth;
/**
* Returns a copy of this configuration
@@ -370,6 +371,14 @@ public class NettyConfiguration implemen
this.ssl = ssl;
}
+ public boolean isNeedClientAuth() {
+ return needClientAuth;
+ }
+
+ public void setNeedClientAuth(boolean needClientAuth) {
+ this.needClientAuth = needClientAuth;
+ }
+
public long getReceiveBufferSize() {
return receiveBufferSize;
}
Modified:
camel/branches/camel-2.10.x/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyComponentWithConfigurationTest.java
URL:
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyComponentWithConfigurationTest.java?rev=1375729&r1=1375728&r2=1375729&view=diff
==============================================================================
---
camel/branches/camel-2.10.x/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyComponentWithConfigurationTest.java
(original)
+++
camel/branches/camel-2.10.x/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyComponentWithConfigurationTest.java
Tue Aug 21 19:28:20 2012
@@ -25,7 +25,7 @@ import org.junit.Test;
public class NettyComponentWithConfigurationTest extends CamelTestSupport {
@Test
- public void testMinaComponentWithConfiguration() throws Exception {
+ public void testNettyComponentWithConfiguration() throws Exception {
NettyComponent comp = context.getComponent("netty",
NettyComponent.class);
NettyConfiguration cfg = new NettyConfiguration();
@@ -34,7 +34,7 @@ public class NettyComponentWithConfigura
assertSame(cfg, comp.getConfiguration());
NettyEndpoint e1 = (NettyEndpoint)
comp.createEndpoint("netty://tcp://localhost:4455");
- NettyEndpoint e2 = (NettyEndpoint)
comp.createEndpoint("netty://tcp://localhost:5566?sync=false");
+ NettyEndpoint e2 = (NettyEndpoint)
comp.createEndpoint("netty://tcp://localhost:5566?sync=false&needClientAuth=true");
// should not be same
assertNotSame(e1, e2);
@@ -47,7 +47,9 @@ public class NettyComponentWithConfigura
e2.getConfiguration().setPort(5566);
assertEquals(true, e1.getConfiguration().isSync());
+ assertEquals(false, e1.getConfiguration().isNeedClientAuth());
assertEquals(false, e2.getConfiguration().isSync());
+ assertEquals(true, e2.getConfiguration().isNeedClientAuth());
assertEquals(4455, e1.getConfiguration().getPort());
assertEquals(5566, e2.getConfiguration().getPort());
}