You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/08/10 16:07:17 UTC

[camel] branch master updated: CAMEL-15384: camel-vertx-http - configure more options on component level.

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new bdddf5b  CAMEL-15384: camel-vertx-http - configure more options on component level.
bdddf5b is described below

commit bdddf5bef03fba9cc6737f2b8d6945f33bdbc176
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Aug 10 18:06:31 2020 +0200

    CAMEL-15384: camel-vertx-http - configure more options on component level.
---
 .../vertx/http/VertxHttpComponentConfigurer.java   | 20 +++++++
 .../camel/component/vertx/http/vertx-http.json     |  4 ++
 .../src/main/docs/vertx-http-component.adoc        |  6 +-
 .../component/vertx/http/VertxHttpComponent.java   | 65 ++++++++++++++++++++++
 .../vertx/http/VertxHttpConfiguration.java         |  4 +-
 .../dsl/VertxHttpComponentBuilderFactory.java      | 53 ++++++++++++++++++
 6 files changed, 149 insertions(+), 3 deletions(-)

diff --git a/components/camel-vertx-http/src/generated/java/org/apache/camel/component/vertx/http/VertxHttpComponentConfigurer.java b/components/camel-vertx-http/src/generated/java/org/apache/camel/component/vertx/http/VertxHttpComponentConfigurer.java
index bbabab4..0e9a67e 100644
--- a/components/camel-vertx-http/src/generated/java/org/apache/camel/component/vertx/http/VertxHttpComponentConfigurer.java
+++ b/components/camel-vertx-http/src/generated/java/org/apache/camel/component/vertx/http/VertxHttpComponentConfigurer.java
@@ -21,8 +21,14 @@ public class VertxHttpComponentConfigurer extends PropertyConfigurerSupport impl
         switch (ignoreCase ? name.toLowerCase() : name) {
         case "allowjavaserializedobject":
         case "allowJavaSerializedObject": target.setAllowJavaSerializedObject(property(camelContext, boolean.class, value)); return true;
+        case "basicauthpassword":
+        case "basicAuthPassword": target.setBasicAuthPassword(property(camelContext, java.lang.String.class, value)); return true;
+        case "basicauthusername":
+        case "basicAuthUsername": target.setBasicAuthUsername(property(camelContext, java.lang.String.class, value)); return true;
         case "basicpropertybinding":
         case "basicPropertyBinding": target.setBasicPropertyBinding(property(camelContext, boolean.class, value)); return true;
+        case "bearertoken":
+        case "bearerToken": target.setBearerToken(property(camelContext, java.lang.String.class, value)); return true;
         case "headerfilterstrategy":
         case "headerFilterStrategy": target.setHeaderFilterStrategy(property(camelContext, org.apache.camel.spi.HeaderFilterStrategy.class, value)); return true;
         case "lazystartproducer":
@@ -37,6 +43,8 @@ public class VertxHttpComponentConfigurer extends PropertyConfigurerSupport impl
         case "proxyType": target.setProxyType(property(camelContext, io.vertx.core.net.ProxyType.class, value)); return true;
         case "proxyusername":
         case "proxyUsername": target.setProxyUsername(property(camelContext, java.lang.String.class, value)); return true;
+        case "sslcontextparameters":
+        case "sslContextParameters": target.setSslContextParameters(property(camelContext, org.apache.camel.support.jsse.SSLContextParameters.class, value)); return true;
         case "useglobalsslcontextparameters":
         case "useGlobalSslContextParameters": target.setUseGlobalSslContextParameters(property(camelContext, boolean.class, value)); return true;
         case "vertx": target.setVertx(property(camelContext, io.vertx.core.Vertx.class, value)); return true;
@@ -52,7 +60,10 @@ public class VertxHttpComponentConfigurer extends PropertyConfigurerSupport impl
     public Map<String, Object> getAllOptions(Object target) {
         Map<String, Object> answer = new CaseInsensitiveMap();
         answer.put("allowJavaSerializedObject", boolean.class);
+        answer.put("basicAuthPassword", java.lang.String.class);
+        answer.put("basicAuthUsername", java.lang.String.class);
         answer.put("basicPropertyBinding", boolean.class);
+        answer.put("bearerToken", java.lang.String.class);
         answer.put("headerFilterStrategy", org.apache.camel.spi.HeaderFilterStrategy.class);
         answer.put("lazyStartProducer", boolean.class);
         answer.put("proxyHost", java.lang.String.class);
@@ -60,6 +71,7 @@ public class VertxHttpComponentConfigurer extends PropertyConfigurerSupport impl
         answer.put("proxyPort", java.lang.Integer.class);
         answer.put("proxyType", io.vertx.core.net.ProxyType.class);
         answer.put("proxyUsername", java.lang.String.class);
+        answer.put("sslContextParameters", org.apache.camel.support.jsse.SSLContextParameters.class);
         answer.put("useGlobalSslContextParameters", boolean.class);
         answer.put("vertx", io.vertx.core.Vertx.class);
         answer.put("vertxHttpBinding", org.apache.camel.component.vertx.http.VertxHttpBinding.class);
@@ -73,8 +85,14 @@ public class VertxHttpComponentConfigurer extends PropertyConfigurerSupport impl
         switch (ignoreCase ? name.toLowerCase() : name) {
         case "allowjavaserializedobject":
         case "allowJavaSerializedObject": return target.isAllowJavaSerializedObject();
+        case "basicauthpassword":
+        case "basicAuthPassword": return target.getBasicAuthPassword();
+        case "basicauthusername":
+        case "basicAuthUsername": return target.getBasicAuthUsername();
         case "basicpropertybinding":
         case "basicPropertyBinding": return target.isBasicPropertyBinding();
+        case "bearertoken":
+        case "bearerToken": return target.getBearerToken();
         case "headerfilterstrategy":
         case "headerFilterStrategy": return target.getHeaderFilterStrategy();
         case "lazystartproducer":
@@ -89,6 +107,8 @@ public class VertxHttpComponentConfigurer extends PropertyConfigurerSupport impl
         case "proxyType": return target.getProxyType();
         case "proxyusername":
         case "proxyUsername": return target.getProxyUsername();
+        case "sslcontextparameters":
+        case "sslContextParameters": return target.getSslContextParameters();
         case "useglobalsslcontextparameters":
         case "useGlobalSslContextParameters": return target.isUseGlobalSslContextParameters();
         case "vertx": return target.getVertx();
diff --git a/components/camel-vertx-http/src/generated/resources/org/apache/camel/component/vertx/http/vertx-http.json b/components/camel-vertx-http/src/generated/resources/org/apache/camel/component/vertx/http/vertx-http.json
index 7a2a233..2a44f96 100644
--- a/components/camel-vertx-http/src/generated/resources/org/apache/camel/component/vertx/http/vertx-http.json
+++ b/components/camel-vertx-http/src/generated/resources/org/apache/camel/component/vertx/http/vertx-http.json
@@ -33,6 +33,10 @@
     "proxyPort": { "kind": "property", "displayName": "Proxy Port", "group": "proxy", "label": "proxy", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "secret": false, "description": "The proxy server port" },
     "proxyType": { "kind": "property", "displayName": "Proxy Type", "group": "proxy", "label": "proxy", "required": false, "type": "object", "javaType": "io.vertx.core.net.ProxyType", "enum": [ "HTTP", "SOCKS4", "SOCKS5" ], "deprecated": false, "secret": false, "description": "The proxy server type" },
     "proxyUsername": { "kind": "property", "displayName": "Proxy Username", "group": "proxy", "label": "proxy", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "The proxy server username if authentication is required" },
+    "basicAuthPassword": { "kind": "property", "displayName": "Basic Auth Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "The password to use for basic authentication" },
+    "basicAuthUsername": { "kind": "property", "displayName": "Basic Auth Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "The user name to use for basic authentication" },
+    "bearerToken": { "kind": "property", "displayName": "Bearer Token", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "The bearer token to use for bearer token authentication" },
+    "sslContextParameters": { "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "secret": false, "description": "To configure security using SSLContextParameters" },
     "useGlobalSslContextParameters": { "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": "false", "description": "Enable usage of global SSL context parameters" }
   },
   "properties": {
diff --git a/components/camel-vertx-http/src/main/docs/vertx-http-component.adoc b/components/camel-vertx-http/src/main/docs/vertx-http-component.adoc
index ebcdd24..4206f8d 100644
--- a/components/camel-vertx-http/src/main/docs/vertx-http-component.adoc
+++ b/components/camel-vertx-http/src/main/docs/vertx-http-component.adoc
@@ -36,7 +36,7 @@ vertx-http:hostname[:port][/resourceUri][?options]
 == Options
 
 // component options: START
-The Vert.x HTTP Client component supports 13 options, which are listed below.
+The Vert.x HTTP Client component supports 17 options, which are listed below.
 
 
 
@@ -55,6 +55,10 @@ The Vert.x HTTP Client component supports 13 options, which are listed below.
 | *proxyPort* (proxy) | The proxy server port |  | Integer
 | *proxyType* (proxy) | The proxy server type. The value can be one of: HTTP, SOCKS4, SOCKS5 |  | ProxyType
 | *proxyUsername* (proxy) | The proxy server username if authentication is required |  | String
+| *basicAuthPassword* (security) | The password to use for basic authentication |  | String
+| *basicAuthUsername* (security) | The user name to use for basic authentication |  | String
+| *bearerToken* (security) | The bearer token to use for bearer token authentication |  | String
+| *sslContextParameters* (security) | To configure security using SSLContextParameters |  | SSLContextParameters
 | *useGlobalSslContextParameters* (security) | Enable usage of global SSL context parameters | false | boolean
 |===
 // component options: END
diff --git a/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxHttpComponent.java b/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxHttpComponent.java
index 18ae652..0a90d6b 100644
--- a/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxHttpComponent.java
+++ b/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxHttpComponent.java
@@ -35,6 +35,7 @@ import org.apache.camel.spi.annotations.Component;
 import org.apache.camel.support.CamelContextHelper;
 import org.apache.camel.support.HeaderFilterStrategyComponent;
 import org.apache.camel.support.RestProducerFactoryHelper;
+import org.apache.camel.support.jsse.SSLContextParameters;
 import org.apache.camel.support.service.ServiceHelper;
 import org.apache.camel.util.FileUtil;
 import org.apache.camel.util.ObjectHelper;
@@ -46,6 +47,14 @@ public class VertxHttpComponent extends HeaderFilterStrategyComponent implements
 
     private volatile boolean managedVertx;
 
+    @Metadata(label = "security")
+    private String basicAuthUsername;
+    @Metadata(label = "security")
+    private String basicAuthPassword;
+    @Metadata(label = "security")
+    private String bearerToken;
+    @Metadata(label = "security")
+    private SSLContextParameters sslContextParameters;
     @Metadata(label = "proxy")
     private String proxyHost;
     @Metadata(label = "proxy")
@@ -77,6 +86,18 @@ public class VertxHttpComponent extends HeaderFilterStrategyComponent implements
         VertxHttpEndpoint endpoint = new VertxHttpEndpoint(uri, this, configuration);
         setProperties(endpoint, parameters);
 
+        if (configuration.getBasicAuthUsername() == null) {
+            configuration.setBasicAuthUsername(getBasicAuthUsername());
+        }
+        if (configuration.getBasicAuthPassword() == null) {
+            configuration.setBasicAuthPassword(getBasicAuthPassword());
+        }
+        if (configuration.getBearerToken() == null) {
+            configuration.setBearerToken(getBearerToken());
+        }
+        if (configuration.getSslContextParameters() == null) {
+            configuration.setSslContextParameters(getSslContextParameters());
+        }
         if (configuration.getProxyType() == null) {
             configuration.setProxyType(getProxyType());
         }
@@ -318,4 +339,48 @@ public class VertxHttpComponent extends HeaderFilterStrategyComponent implements
         return proxyType;
     }
 
+    /**
+     * The user name to use for basic authentication
+     */
+    public void setBasicAuthUsername(String basicAuthUsername) {
+        this.basicAuthUsername = basicAuthUsername;
+    }
+
+    public String getBasicAuthUsername() {
+        return basicAuthUsername;
+    }
+
+    /**
+     * The password to use for basic authentication
+     */
+    public void setBasicAuthPassword(String basicAuthPassword) {
+        this.basicAuthPassword = basicAuthPassword;
+    }
+
+    public String getBasicAuthPassword() {
+        return basicAuthPassword;
+    }
+
+    /**
+     * The bearer token to use for bearer token authentication
+     */
+    public void setBearerToken(String bearerToken) {
+        this.bearerToken = bearerToken;
+    }
+
+    public String getBearerToken() {
+        return bearerToken;
+    }
+
+    /**
+     * To configure security using SSLContextParameters
+     */
+    public SSLContextParameters getSslContextParameters() {
+        return sslContextParameters;
+    }
+
+    public void setSslContextParameters(SSLContextParameters sslContextParameters) {
+        this.sslContextParameters = sslContextParameters;
+    }
+
 }
diff --git a/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxHttpConfiguration.java b/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxHttpConfiguration.java
index 9b7f35c..a146e1b 100644
--- a/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxHttpConfiguration.java
+++ b/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxHttpConfiguration.java
@@ -64,6 +64,8 @@ public class VertxHttpConfiguration {
     private String basicAuthPassword;
     @UriParam(label = "security")
     private String bearerToken;
+    @UriParam(label = "security")
+    private SSLContextParameters sslContextParameters;
     @UriParam(label = "proxy")
     private String proxyHost;
     @UriParam(label = "proxy")
@@ -76,8 +78,6 @@ public class VertxHttpConfiguration {
     private String proxyPassword;
     @UriParam(label = "producer")
     private WebClientOptions webClientOptions;
-    @UriParam(label = "security")
-    private SSLContextParameters sslContextParameters;
 
     /**
      * The HTTP URI to connect to
diff --git a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/VertxHttpComponentBuilderFactory.java b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/VertxHttpComponentBuilderFactory.java
index 1942b81..e2f9f90 100644
--- a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/VertxHttpComponentBuilderFactory.java
+++ b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/VertxHttpComponentBuilderFactory.java
@@ -211,6 +211,55 @@ public interface VertxHttpComponentBuilderFactory {
             return this;
         }
         /**
+         * The password to use for basic authentication.
+         * 
+         * The option is a: <code>java.lang.String</code> type.
+         * 
+         * Group: security
+         */
+        default VertxHttpComponentBuilder basicAuthPassword(
+                java.lang.String basicAuthPassword) {
+            doSetProperty("basicAuthPassword", basicAuthPassword);
+            return this;
+        }
+        /**
+         * The user name to use for basic authentication.
+         * 
+         * The option is a: <code>java.lang.String</code> type.
+         * 
+         * Group: security
+         */
+        default VertxHttpComponentBuilder basicAuthUsername(
+                java.lang.String basicAuthUsername) {
+            doSetProperty("basicAuthUsername", basicAuthUsername);
+            return this;
+        }
+        /**
+         * The bearer token to use for bearer token authentication.
+         * 
+         * The option is a: <code>java.lang.String</code> type.
+         * 
+         * Group: security
+         */
+        default VertxHttpComponentBuilder bearerToken(
+                java.lang.String bearerToken) {
+            doSetProperty("bearerToken", bearerToken);
+            return this;
+        }
+        /**
+         * To configure security using SSLContextParameters.
+         * 
+         * The option is a:
+         * <code>org.apache.camel.support.jsse.SSLContextParameters</code> type.
+         * 
+         * Group: security
+         */
+        default VertxHttpComponentBuilder sslContextParameters(
+                org.apache.camel.support.jsse.SSLContextParameters sslContextParameters) {
+            doSetProperty("sslContextParameters", sslContextParameters);
+            return this;
+        }
+        /**
          * Enable usage of global SSL context parameters.
          * 
          * The option is a: <code>boolean</code> type.
@@ -252,6 +301,10 @@ public interface VertxHttpComponentBuilderFactory {
             case "proxyPort": ((VertxHttpComponent) component).setProxyPort((java.lang.Integer) value); return true;
             case "proxyType": ((VertxHttpComponent) component).setProxyType((io.vertx.core.net.ProxyType) value); return true;
             case "proxyUsername": ((VertxHttpComponent) component).setProxyUsername((java.lang.String) value); return true;
+            case "basicAuthPassword": ((VertxHttpComponent) component).setBasicAuthPassword((java.lang.String) value); return true;
+            case "basicAuthUsername": ((VertxHttpComponent) component).setBasicAuthUsername((java.lang.String) value); return true;
+            case "bearerToken": ((VertxHttpComponent) component).setBearerToken((java.lang.String) value); return true;
+            case "sslContextParameters": ((VertxHttpComponent) component).setSslContextParameters((org.apache.camel.support.jsse.SSLContextParameters) value); return true;
             case "useGlobalSslContextParameters": ((VertxHttpComponent) component).setUseGlobalSslContextParameters((boolean) value); return true;
             default: return false;
             }