You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2021/03/09 13:22:23 UTC
[camel] 02/04: CAMEL-16315 - Camel-Netty: Support Hostname
verification even though we are on Netty 4.1.x
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch camel-3.4.x
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 8493583675a1f40061a347f0dc4257831ace2c3c
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Mar 9 13:21:27 2021 +0100
CAMEL-16315 - Camel-Netty: Support Hostname verification even though we are on Netty 4.1.x
---
.../component/netty/NettyComponentConfigurer.java | 5 ++
.../component/netty/NettyEndpointConfigurer.java | 5 ++
.../services/org/apache/camel/component.properties | 2 +-
.../org/apache/camel/component/netty/netty.json | 4 +-
.../camel-netty/src/main/docs/netty-component.adoc | 6 +-
.../camel/component/netty/NettyConfiguration.java | 4 +-
.../dsl/NettyComponentBuilderFactory.java | 14 ++++
.../src/generated/resources/metadata.json | 2 +-
.../endpoint/dsl/NettyEndpointBuilderFactory.java | 78 ++++++++++++++++++++++
9 files changed, 113 insertions(+), 7 deletions(-)
diff --git a/components/camel-netty/src/generated/java/org/apache/camel/component/netty/NettyComponentConfigurer.java b/components/camel-netty/src/generated/java/org/apache/camel/component/netty/NettyComponentConfigurer.java
index 38d0542..884de37 100644
--- a/components/camel-netty/src/generated/java/org/apache/camel/component/netty/NettyComponentConfigurer.java
+++ b/components/camel-netty/src/generated/java/org/apache/camel/component/netty/NettyComponentConfigurer.java
@@ -66,6 +66,8 @@ public class NettyComponentConfigurer extends PropertyConfigurerSupport implemen
case "encoding": getOrCreateConfiguration(target).setEncoding(property(camelContext, java.lang.String.class, value)); return true;
case "executorservice":
case "executorService": target.setExecutorService(property(camelContext, io.netty.util.concurrent.EventExecutorGroup.class, value)); return true;
+ case "hostnameverification":
+ case "hostnameVerification": getOrCreateConfiguration(target).setHostnameVerification(property(camelContext, boolean.class, value)); return true;
case "keepalive":
case "keepAlive": getOrCreateConfiguration(target).setKeepAlive(property(camelContext, boolean.class, value)); return true;
case "keystorefile":
@@ -187,6 +189,7 @@ public class NettyComponentConfigurer extends PropertyConfigurerSupport implemen
answer.put("encoders", java.util.List.class);
answer.put("encoding", java.lang.String.class);
answer.put("executorService", io.netty.util.concurrent.EventExecutorGroup.class);
+ answer.put("hostnameVerification", boolean.class);
answer.put("keepAlive", boolean.class);
answer.put("keyStoreFile", java.io.File.class);
answer.put("keyStoreFormat", java.lang.String.class);
@@ -282,6 +285,8 @@ public class NettyComponentConfigurer extends PropertyConfigurerSupport implemen
case "encoding": return getOrCreateConfiguration(target).getEncoding();
case "executorservice":
case "executorService": return target.getExecutorService();
+ case "hostnameverification":
+ case "hostnameVerification": return getOrCreateConfiguration(target).isHostnameVerification();
case "keepalive":
case "keepAlive": return getOrCreateConfiguration(target).isKeepAlive();
case "keystorefile":
diff --git a/components/camel-netty/src/generated/java/org/apache/camel/component/netty/NettyEndpointConfigurer.java b/components/camel-netty/src/generated/java/org/apache/camel/component/netty/NettyEndpointConfigurer.java
index 545cfd1..34c05c3 100644
--- a/components/camel-netty/src/generated/java/org/apache/camel/component/netty/NettyEndpointConfigurer.java
+++ b/components/camel-netty/src/generated/java/org/apache/camel/component/netty/NettyEndpointConfigurer.java
@@ -60,6 +60,8 @@ public class NettyEndpointConfigurer extends PropertyConfigurerSupport implement
case "exceptionHandler": target.setExceptionHandler(property(camelContext, org.apache.camel.spi.ExceptionHandler.class, value)); return true;
case "exchangepattern":
case "exchangePattern": target.setExchangePattern(property(camelContext, org.apache.camel.ExchangePattern.class, value)); return true;
+ case "hostnameverification":
+ case "hostnameVerification": target.getConfiguration().setHostnameVerification(property(camelContext, boolean.class, value)); return true;
case "keepalive":
case "keepAlive": target.getConfiguration().setKeepAlive(property(camelContext, boolean.class, value)); return true;
case "keystorefile":
@@ -178,6 +180,7 @@ public class NettyEndpointConfigurer extends PropertyConfigurerSupport implement
answer.put("encoding", java.lang.String.class);
answer.put("exceptionHandler", org.apache.camel.spi.ExceptionHandler.class);
answer.put("exchangePattern", org.apache.camel.ExchangePattern.class);
+ answer.put("hostnameVerification", boolean.class);
answer.put("keepAlive", boolean.class);
answer.put("keyStoreFile", java.io.File.class);
answer.put("keyStoreFormat", java.lang.String.class);
@@ -273,6 +276,8 @@ public class NettyEndpointConfigurer extends PropertyConfigurerSupport implement
case "exceptionHandler": return target.getExceptionHandler();
case "exchangepattern":
case "exchangePattern": return target.getExchangePattern();
+ case "hostnameverification":
+ case "hostnameVerification": return target.getConfiguration().isHostnameVerification();
case "keepalive":
case "keepAlive": return target.getConfiguration().isKeepAlive();
case "keystorefile":
diff --git a/components/camel-netty/src/generated/resources/META-INF/services/org/apache/camel/component.properties b/components/camel-netty/src/generated/resources/META-INF/services/org/apache/camel/component.properties
index aacdf96..8e4e106 100644
--- a/components/camel-netty/src/generated/resources/META-INF/services/org/apache/camel/component.properties
+++ b/components/camel-netty/src/generated/resources/META-INF/services/org/apache/camel/component.properties
@@ -2,6 +2,6 @@
components=netty
groupId=org.apache.camel
artifactId=camel-netty
-version=3.4.5-SNAPSHOT
+version=3.4.6-SNAPSHOT
projectName=Camel :: Netty
projectDescription=Camel Netty NIO based socket communication component
diff --git a/components/camel-netty/src/generated/resources/org/apache/camel/component/netty/netty.json b/components/camel-netty/src/generated/resources/org/apache/camel/component/netty/netty.json
index 9781ab2..c8448b2 100644
--- a/components/camel-netty/src/generated/resources/org/apache/camel/component/netty/netty.json
+++ b/components/camel-netty/src/generated/resources/org/apache/camel/component/netty/netty.json
@@ -11,7 +11,7 @@
"supportLevel": "Stable",
"groupId": "org.apache.camel",
"artifactId": "camel-netty",
- "version": "3.4.5-SNAPSHOT",
+ "version": "3.4.6-SNAPSHOT",
"scheme": "netty",
"extendsScheme": "",
"syntax": "netty:protocol:host:port",
@@ -23,6 +23,7 @@
"componentProperties": {
"configuration": { "kind": "property", "displayName": "Configuration", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.netty.NettyConfiguration", "deprecated": false, "secret": false, "description": "To use the NettyConfiguration as configuration when creating endpoints." },
"disconnect": { "kind": "property", "displayName": "Disconnect", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.netty.NettyConfiguration", "configurationField": "configuration", "description": "Whether or not to disconnect(close) from Netty Channel right after use. Can be used for both consumer and producer." },
+ "hostnameVerification": { "kind": "property", "displayName": "Hostname Verification", "group": "common", "label": "common", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": "false", "configurationClass": "org.apache.camel.component.netty.NettyConfiguration", "configurationField": "configuration", "description": "To enable\/disable hostname verification on SSLEngine" },
"keepAlive": { "kind": "property", "displayName": "Keep Alive", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": "true", "configurationClass": "org.apache.camel.component.netty.NettyConfiguration", "configurationField": "configuration", "description": "Setting to ensure socket is not closed due to inactivity" },
"reuseAddress": { "kind": "property", "displayName": "Reuse Address", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": "true", "configurationClass": "org.apache.camel.component.netty.NettyConfiguration", "configurationField": "configuration", "description": "Setting to facilitate socket multiplexing" },
"reuseChannel": { "kind": "property", "displayName": "Reuse Channel", "group": "common", "label": "common", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.netty.NettyConfiguration", "configurationField": "configuration", "description": "This option allows producers and consumers (in client mode) to reuse the same Netty Channel for the lifecycle of processing th [...]
@@ -99,6 +100,7 @@
"host": { "kind": "path", "displayName": "Host", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "secret": false, "configurationClass": "org.apache.camel.component.netty.NettyConfiguration", "configurationField": "configuration", "description": "The hostname. For the consumer the hostname is localhost or 0.0.0.0. For the producer the hostname is the remote host to connect to" },
"port": { "kind": "path", "displayName": "Port", "group": "common", "label": "", "required": true, "type": "integer", "javaType": "int", "deprecated": false, "deprecationNote": "", "secret": false, "configurationClass": "org.apache.camel.component.netty.NettyConfiguration", "configurationField": "configuration", "description": "The host port number" },
"disconnect": { "kind": "parameter", "displayName": "Disconnect", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.netty.NettyConfiguration", "configurationField": "configuration", "description": "Whether or not to disconnect(close) from Netty Channel right after use. Can be used for both consumer and producer." },
+ "hostnameVerification": { "kind": "parameter", "displayName": "Hostname Verification", "group": "common", "label": "common", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": "false", "configurationClass": "org.apache.camel.component.netty.NettyConfiguration", "configurationField": "configuration", "description": "To enable\/disable hostname verification on SSLEngine" },
"keepAlive": { "kind": "parameter", "displayName": "Keep Alive", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": "true", "configurationClass": "org.apache.camel.component.netty.NettyConfiguration", "configurationField": "configuration", "description": "Setting to ensure socket is not closed due to inactivity" },
"reuseAddress": { "kind": "parameter", "displayName": "Reuse Address", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": "true", "configurationClass": "org.apache.camel.component.netty.NettyConfiguration", "configurationField": "configuration", "description": "Setting to facilitate socket multiplexing" },
"reuseChannel": { "kind": "parameter", "displayName": "Reuse Channel", "group": "common", "label": "common", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.netty.NettyConfiguration", "configurationField": "configuration", "description": "This option allows producers and consumers (in client mode) to reuse the same Netty Channel for the lifecycle of processing t [...]
diff --git a/components/camel-netty/src/main/docs/netty-component.adoc b/components/camel-netty/src/main/docs/netty-component.adoc
index 70bdf4b..f3c1048 100644
--- a/components/camel-netty/src/main/docs/netty-component.adoc
+++ b/components/camel-netty/src/main/docs/netty-component.adoc
@@ -58,7 +58,7 @@ You can append query options to the URI in the following format,
== Options
// component options: START
-The Netty component supports 72 options, which are listed below.
+The Netty component supports 73 options, which are listed below.
@@ -67,6 +67,7 @@ The Netty component supports 72 options, which are listed below.
| Name | Description | Default | Type
| *configuration* (common) | To use the NettyConfiguration as configuration when creating endpoints. | | NettyConfiguration
| *disconnect* (common) | Whether or not to disconnect(close) from Netty Channel right after use. Can be used for both consumer and producer. | false | boolean
+| *hostnameVerification* (common) | To enable/disable hostname verification on SSLEngine | false | boolean
| *keepAlive* (common) | Setting to ensure socket is not closed due to inactivity | true | boolean
| *reuseAddress* (common) | Setting to facilitate socket multiplexing | true | boolean
| *reuseChannel* (common) | This option allows producers and consumers (in client mode) to reuse the same Netty Channel for the lifecycle of processing the Exchange. This is useful if you need to call a server multiple times in a Camel route and want to use the same network connection. When using this, the channel is not returned to the connection pool until the Exchange is done; or disconnected if the disconnect option is set to true. The reused Channel is stored on the Exchange as an e [...]
@@ -162,13 +163,14 @@ with the following path and query parameters:
|===
-=== Query Parameters (71 parameters):
+=== Query Parameters (72 parameters):
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
| *disconnect* (common) | Whether or not to disconnect(close) from Netty Channel right after use. Can be used for both consumer and producer. | false | boolean
+| *hostnameVerification* (common) | To enable/disable hostname verification on SSLEngine | false | boolean
| *keepAlive* (common) | Setting to ensure socket is not closed due to inactivity | true | boolean
| *reuseAddress* (common) | Setting to facilitate socket multiplexing | true | boolean
| *reuseChannel* (common) | This option allows producers and consumers (in client mode) to reuse the same Netty Channel for the lifecycle of processing the Exchange. This is useful if you need to call a server multiple times in a Camel route and want to use the same network connection. When using this, the channel is not returned to the connection pool until the Exchange is done; or disconnected if the disconnect option is set to true. The reused Channel is stored on the Exchange as an e [...]
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
index 0d8937c..93abf58 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
@@ -65,8 +65,8 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem
private List<ChannelHandler> encoders = new ArrayList<>();
@UriParam(label = "codec")
private List<ChannelHandler> decoders = new ArrayList<>();
- @UriParam(label = "common", defaultValue = "true")
- private boolean hostnameVerification = true;
+ @UriParam(label = "common", defaultValue = "false")
+ private boolean hostnameVerification;
@UriParam
private boolean disconnect;
@UriParam(label = "producer,advanced", defaultValue = "true")
diff --git a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/NettyComponentBuilderFactory.java b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/NettyComponentBuilderFactory.java
index d324395..a53c5d4 100644
--- a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/NettyComponentBuilderFactory.java
+++ b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/NettyComponentBuilderFactory.java
@@ -75,6 +75,19 @@ public interface NettyComponentBuilderFactory {
return this;
}
/**
+ * To enable/disable hostname verification on SSLEngine.
+ *
+ * The option is a: <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: common
+ */
+ default NettyComponentBuilder hostnameVerification(
+ boolean hostnameVerification) {
+ doSetProperty("hostnameVerification", hostnameVerification);
+ return this;
+ }
+ /**
* Setting to ensure socket is not closed due to inactivity.
*
* The option is a: <code>boolean</code> type.
@@ -1102,6 +1115,7 @@ public interface NettyComponentBuilderFactory {
switch (name) {
case "configuration": ((NettyComponent) component).setConfiguration((org.apache.camel.component.netty.NettyConfiguration) value); return true;
case "disconnect": getOrCreateConfiguration((NettyComponent) component).setDisconnect((boolean) value); return true;
+ case "hostnameVerification": getOrCreateConfiguration((NettyComponent) component).setHostnameVerification((boolean) value); return true;
case "keepAlive": getOrCreateConfiguration((NettyComponent) component).setKeepAlive((boolean) value); return true;
case "reuseAddress": getOrCreateConfiguration((NettyComponent) component).setReuseAddress((boolean) value); return true;
case "reuseChannel": getOrCreateConfiguration((NettyComponent) component).setReuseChannel((boolean) value); return true;
diff --git a/core/camel-componentdsl/src/generated/resources/metadata.json b/core/camel-componentdsl/src/generated/resources/metadata.json
index f65692fa..5f89781 100644
--- a/core/camel-componentdsl/src/generated/resources/metadata.json
+++ b/core/camel-componentdsl/src/generated/resources/metadata.json
@@ -5035,7 +5035,7 @@
"supportLevel": "Stable",
"groupId": "org.apache.camel",
"artifactId": "camel-netty",
- "version": "3.4.5-SNAPSHOT",
+ "version": "3.4.6-SNAPSHOT",
"scheme": "netty",
"extendsScheme": "",
"syntax": "netty:protocol:host:port",
diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/NettyEndpointBuilderFactory.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/NettyEndpointBuilderFactory.java
index 2cf8a20..68f7334 100644
--- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/NettyEndpointBuilderFactory.java
+++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/NettyEndpointBuilderFactory.java
@@ -72,6 +72,32 @@ public interface NettyEndpointBuilderFactory {
return this;
}
/**
+ * To enable/disable hostname verification on SSLEngine.
+ *
+ * The option is a: <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: common
+ */
+ default NettyEndpointConsumerBuilder hostnameVerification(
+ boolean hostnameVerification) {
+ doSetProperty("hostnameVerification", hostnameVerification);
+ return this;
+ }
+ /**
+ * To enable/disable hostname verification on SSLEngine.
+ *
+ * The option will be converted to a <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: common
+ */
+ default NettyEndpointConsumerBuilder hostnameVerification(
+ String hostnameVerification) {
+ doSetProperty("hostnameVerification", hostnameVerification);
+ return this;
+ }
+ /**
* Setting to ensure socket is not closed due to inactivity.
*
* The option is a: <code>boolean</code> type.
@@ -1622,6 +1648,32 @@ public interface NettyEndpointBuilderFactory {
return this;
}
/**
+ * To enable/disable hostname verification on SSLEngine.
+ *
+ * The option is a: <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: common
+ */
+ default NettyEndpointProducerBuilder hostnameVerification(
+ boolean hostnameVerification) {
+ doSetProperty("hostnameVerification", hostnameVerification);
+ return this;
+ }
+ /**
+ * To enable/disable hostname verification on SSLEngine.
+ *
+ * The option will be converted to a <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: common
+ */
+ default NettyEndpointProducerBuilder hostnameVerification(
+ String hostnameVerification) {
+ doSetProperty("hostnameVerification", hostnameVerification);
+ return this;
+ }
+ /**
* Setting to ensure socket is not closed due to inactivity.
*
* The option is a: <code>boolean</code> type.
@@ -3067,6 +3119,32 @@ public interface NettyEndpointBuilderFactory {
return this;
}
/**
+ * To enable/disable hostname verification on SSLEngine.
+ *
+ * The option is a: <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: common
+ */
+ default NettyEndpointBuilder hostnameVerification(
+ boolean hostnameVerification) {
+ doSetProperty("hostnameVerification", hostnameVerification);
+ return this;
+ }
+ /**
+ * To enable/disable hostname verification on SSLEngine.
+ *
+ * The option will be converted to a <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: common
+ */
+ default NettyEndpointBuilder hostnameVerification(
+ String hostnameVerification) {
+ doSetProperty("hostnameVerification", hostnameVerification);
+ return this;
+ }
+ /**
* Setting to ensure socket is not closed due to inactivity.
*
* The option is a: <code>boolean</code> type.