This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 9bf87d37f8b CAMEL-20237: camel-platform-http-main - Make it possible
to configure http auth
9bf87d37f8b is described below
commit 9bf87d37f8b6b916e45b40ca074b0ebc805c0e2c
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Aug 8 09:06:11 2024 +0200
CAMEL-20237: camel-platform-http-main - Make it possible to configure http
auth
---
.../main/camel-main-configuration-metadata.json | 14 +-
.../http/main/DefaultMainHttpServerFactory.java | 76 ++---------
.../BasicAuthenticationConfigurer.java | 11 +-
.../JWTAuthenticationConfigurer.java | 16 +--
.../MainAuthenticationConfigurer.java | 10 +-
.../src/test/resources/basic-auth.properties | 6 +-
.../src/test/resources/incomplete-auth.properties | 9 +-
.../src/test/resources/jwt-auth.properties | 10 +-
...nticationConfigurationPropertiesConfigurer.java | 60 ---------
...nticationConfigurationPropertiesConfigurer.java | 51 -------
...verBasicAuthenticationPropertiesConfigurer.java | 32 -----
...ttpServerConfigurationPropertiesConfigurer.java | 39 +++++-
...nticationConfigurationPropertiesConfigurer.java | 63 ---------
.../camel-main-configuration-metadata.json | 14 +-
...HttpServerAuthenticationConfigurationProperties | 2 -
...erverBasicAuthenticationConfigurationProperties | 2 -
...el.main.HttpServerBasicAuthenticationProperties | 2 -
...pServerJWTAuthenticationConfigurationProperties | 2 -
core/camel-main/src/main/docs/main.adoc | 16 +--
...ConfigurationPropertiesWithMandatoryFields.java | 32 -----
...erverAuthenticationConfigurationProperties.java | 146 ---------------------
...BasicAuthenticationConfigurationProperties.java | 70 ----------
.../main/HttpServerConfigurationProperties.java | 135 +++++++++++++++----
...erJWTAuthenticationConfigurationProperties.java | 109 ---------------
24 files changed, 210 insertions(+), 717 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
index bca1d8b9d0e..32d8b4479be 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
@@ -256,22 +256,20 @@
{ "name": "camel.routecontroller.threadPoolSize", "description": "The
number of threads used by the route controller scheduled thread pool that are
used for restarting routes. The pool uses 1 thread by default, but you can
increase this to allow the controller to concurrently attempt to restart
multiple routes in case more than one route has problems starting.",
"sourceType": "org.apache.camel.main.RouteControllerConfigurationProperties",
"type": "integer", "javaType": "int", "defaul [...]
{ "name": "camel.routecontroller.unhealthyOnExhausted", "description":
"Whether to mark the route as unhealthy (down) when all restarting attempts
(backoff) have failed and the route is not successfully started and the route
manager is giving up. If setting this to false will make health checks ignore
this problem and allow to report the Camel application as UP.", "sourceType":
"org.apache.camel.main.RouteControllerConfigurationProperties", "type":
"boolean", "javaType": "boolean", " [...]
{ "name": "camel.routecontroller.unhealthyOnRestarting", "description":
"Whether to mark the route as unhealthy (down) when the route failed to
initially start, and is being controlled for restarting (backoff). If setting
this to false will make health checks ignore this problem and allow to report
the Camel application as UP.", "sourceType":
"org.apache.camel.main.RouteControllerConfigurationProperties", "type":
"boolean", "javaType": "boolean", "defaultValue": true },
- { "name": "camel.server.authentication", "description": "To configure
embedded HTTP server authentication (for standalone applications; not Spring
Boot or Quarkus)", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "object",
"javaType":
"org.apache.camel.main.HttpServerAuthenticationConfigurationProperties" },
- { "name": "camel.server.authenticationPropertiesFile", "description":
"Name of the file that contains authentication info for Vert.x property file
auth provider.", "sourceType":
"org.apache.camel.main.HttpServerBasicAuthenticationConfigurationProperties",
"type": "string", "javaType": "java.lang.String" },
- { "name": "camel.server.basic", "description": "To configure Basic HTTP
authentication for embedded server.", "sourceType":
"org.apache.camel.main.HttpServerAuthenticationConfigurationProperties",
"type": "object", "javaType":
"org.apache.camel.main.HttpServerBasicAuthenticationConfigurationProperties" },
+ { "name": "camel.server.authenticationEnabled", "description": "Whether to
enable HTTP authentication for embedded server (for standalone applications;
not Spring Boot or Quarkus).", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "boolean",
"javaType": "boolean", "defaultValue": "false" },
+ { "name": "camel.server.authenticationPath", "description": "Set HTTP url
path of embedded server that is protected by authentication configuration.",
"sourceType": "org.apache.camel.main.HttpServerConfigurationProperties",
"type": "string", "javaType": "java.lang.String" },
+ { "name": "camel.server.basicPropertiesFile", "description": "Name of the
file that contains basic authentication info for Vert.x file auth provider.",
"sourceType": "org.apache.camel.main.HttpServerConfigurationProperties",
"type": "string", "javaType": "java.lang.String" },
{ "name": "camel.server.devConsoleEnabled", "description": "Whether to
enable developer console (not intended for production use). Dev console must
also be enabled on CamelContext. For example by setting
camel.context.dev-console=true in application.properties, or via code
camelContext.setDevConsole(true); If enabled then you can access a basic
developer console on context-path: \/q\/dev.", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "boolean",
"j [...]
- { "name": "camel.server.enabled", "description": "Whether to enable HTTP
authentication for embedded server.", "sourceType":
"org.apache.camel.main.HttpServerAuthenticationConfigurationProperties",
"type": "boolean", "javaType": "boolean", "defaultValue": "false" },
{ "name": "camel.server.enabled", "description": "Whether embedded HTTP
server is enabled. By default, the server is not enabled.", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "boolean",
"javaType": "boolean", "defaultValue": "false" },
{ "name": "camel.server.healthCheckEnabled", "description": "Whether to
enable health-check console. If enabled then you can access health-check status
on context-path: \/q\/health", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "boolean",
"javaType": "boolean", "defaultValue": "false" },
{ "name": "camel.server.host", "description": "Hostname to use for binding
embedded HTTP server", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "string",
"javaType": "java.lang.String", "defaultValue": "0.0.0.0" },
{ "name": "camel.server.infoEnabled", "description": "Whether to enable
info console. If enabled then you can see some basic Camel information at
\/q\/info", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "boolean",
"javaType": "boolean", "defaultValue": "false" },
{ "name": "camel.server.jolokiaEnabled", "description": "Whether to enable
jolokia. If enabled then you can access jolokia api on context-path:
\/q\/jolokia", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "boolean",
"javaType": "boolean", "defaultValue": "false" },
- { "name": "camel.server.keystorePassword", "description": "Password from
the keystore used for JWT tokens validation.", "sourceType":
"org.apache.camel.main.HttpServerJWTAuthenticationConfigurationProperties",
"type": "string", "javaType": "java.lang.String" },
- { "name": "camel.server.keystorePath", "description": "Path to the
keystore file used for JWT tokens validation.", "sourceType":
"org.apache.camel.main.HttpServerJWTAuthenticationConfigurationProperties",
"type": "string", "javaType": "java.lang.String" },
- { "name": "camel.server.keystoreType", "description": "Type of the
keystore used for JWT tokens validation (jks, pkcs12, etc.).", "sourceType":
"org.apache.camel.main.HttpServerJWTAuthenticationConfigurationProperties",
"type": "string", "javaType": "java.lang.String" },
+ { "name": "camel.server.jwtKeystorePassword", "description": "Password
from the keystore used for JWT tokens validation.", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "string",
"javaType": "java.lang.String" },
+ { "name": "camel.server.jwtKeystorePath", "description": "Path to the
keystore file used for JWT tokens validation.", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "string",
"javaType": "java.lang.String" },
+ { "name": "camel.server.jwtKeystoreType", "description": "Type of the
keystore used for JWT tokens validation (jks, pkcs12, etc.).", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "string",
"javaType": "java.lang.String" },
{ "name": "camel.server.maxBodySize", "description": "Maximum HTTP body
size the embedded HTTP server can accept.", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "integer",
"javaType": "java.lang.Long" },
{ "name": "camel.server.metricsEnabled", "description": "Whether to enable
metrics. If enabled then you can access metrics on context-path: \/q\/metrics",
"sourceType": "org.apache.camel.main.HttpServerConfigurationProperties",
"type": "boolean", "javaType": "boolean", "defaultValue": "false" },
- { "name": "camel.server.path", "description": "Set HTTP url path of
embedded server that is protected by authentication configuration.",
"sourceType":
"org.apache.camel.main.HttpServerAuthenticationConfigurationProperties",
"type": "string", "javaType": "java.lang.String" },
{ "name": "camel.server.path", "description": "Context-path to use for
embedded HTTP server", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "string",
"javaType": "java.lang.String", "defaultValue": "\/" },
{ "name": "camel.server.port", "description": "Port to use for binding
embedded HTTP server", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "integer",
"javaType": "int", "defaultValue": 8080 },
{ "name": "camel.server.uploadEnabled", "description": "Whether to enable
file upload via HTTP (not intended for production use). This functionality is
for development to be able to reload Camel routes and code with source changes
(if reload is enabled). If enabled then you can upload\/delete files via HTTP
PUT\/DELETE on context-path: \/q\/upload\/{name}. You must also configure the
uploadSourceDir option.", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "t [...]
diff --git
a/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/DefaultMainHttpServerFactory.java
b/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/DefaultMainHttpServerFactory.java
index aba8ab3ea7c..61acbaf4613 100644
---
a/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/DefaultMainHttpServerFactory.java
+++
b/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/DefaultMainHttpServerFactory.java
@@ -16,23 +16,16 @@
*/
package org.apache.camel.component.platform.http.main;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Optional;
-
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.Service;
-import
org.apache.camel.component.platform.http.main.authentication.MainAuthenticationConfigurer;
-import
org.apache.camel.component.platform.http.vertx.auth.AuthenticationConfig;
-import org.apache.camel.main.ConfigurationPropertiesWithMandatoryFields;
-import org.apache.camel.main.HttpServerAuthenticationConfigurationProperties;
+import
org.apache.camel.component.platform.http.main.authentication.BasicAuthenticationConfigurer;
+import
org.apache.camel.component.platform.http.main.authentication.JWTAuthenticationConfigurer;
import org.apache.camel.main.HttpServerConfigurationProperties;
import org.apache.camel.main.MainConstants;
import org.apache.camel.main.MainHttpServerFactory;
-import org.apache.camel.spi.ClassResolver;
-import org.apache.camel.spi.Injector;
import org.apache.camel.spi.annotations.JdkService;
-import org.apache.camel.support.ObjectHelper;
+import org.apache.camel.util.ObjectHelper;
@JdkService(MainConstants.PLATFORM_HTTP_SERVER)
public class DefaultMainHttpServerFactory implements CamelContextAware,
MainHttpServerFactory {
@@ -69,7 +62,7 @@ public class DefaultMainHttpServerFactory implements
CamelContextAware, MainHttp
server.setUploadEnabled(configuration.isUploadEnabled());
server.setUploadSourceDir(configuration.getUploadSourceDir());
- if (configuration.authentication().isEnabled()) {
+ if (configuration.isAuthenticationEnabled()) {
configureAuthentication(server, configuration);
}
@@ -77,60 +70,15 @@ public class DefaultMainHttpServerFactory implements
CamelContextAware, MainHttp
}
private void configureAuthentication(MainHttpServer server,
HttpServerConfigurationProperties configuration) {
- AuthenticationConfig authenticationConfig =
server.getConfiguration().getAuthenticationConfig();
-
- HttpServerAuthenticationConfigurationProperties
authenticationProperties = configuration.getAuthentication();
- Optional<MainAuthenticationConfigurer> authenticationConfigurer
- =
findAuthenticationConfigurerByConfigurationProperties(authenticationProperties);
-
- authenticationConfigurer.ifPresentOrElse(
- (configurer ->
configurer.configureAuthentication(authenticationConfig,
authenticationProperties)),
- (() -> {
- throw new RuntimeException(
- "Authentication for camel-platform-http-main is
enabled but no complete authentication configuration is found.");
- }));
- }
-
- private Optional<MainAuthenticationConfigurer>
findAuthenticationConfigurerByConfigurationProperties(
- HttpServerAuthenticationConfigurationProperties
authenticationConfigurationProperties) {
-
- MainAuthenticationConfigurer result = null;
- for (String authenticationTypeName :
HttpServerAuthenticationConfigurationProperties.SUPPORTED_AUTHENTICATION_TYPES)
{
- if
(authenticationTypeIsEnabled(authenticationConfigurationProperties,
authenticationTypeName)) {
- try {
- if (result != null) {
- throw new RuntimeException(
- "Cannot configure authentication for
MainHttpServer as more than one authentication configuration is present");
- }
- String configurerQualifiedName =
MainAuthenticationConfigurer.class.getPackageName() + "."
- + authenticationTypeName
+ "AuthenticationConfigurer";
- ClassResolver resolver = camelContext.getClassResolver();
- Injector injector = camelContext.getInjector();
- result = injector.newInstance(
-
resolver.resolveMandatoryClass(configurerQualifiedName,
MainAuthenticationConfigurer.class));
- } catch (Exception e) {
- throw new RuntimeException(
- "Could not create MainAuthenticationConfigurer for
authentication type " + authenticationTypeName,
- e);
- }
- }
+ if (configuration.getBasicPropertiesFile() != null) {
+ BasicAuthenticationConfigurer auth = new
BasicAuthenticationConfigurer();
+
auth.configureAuthentication(server.getConfiguration().getAuthenticationConfig(),
configuration);
+ } else if (configuration.getJwtKeystoreType() != null) {
+ ObjectHelper.notNull(configuration.getJwtKeystorePath(),
"jwtKeyStorePath");
+ ObjectHelper.notNull(configuration.getJwtKeystorePassword(),
"jwtKeyStorePassword");
+ JWTAuthenticationConfigurer auth = new
JWTAuthenticationConfigurer();
+
auth.configureAuthentication(server.getConfiguration().getAuthenticationConfig(),
configuration);
}
- return Optional.ofNullable(result);
}
- private boolean authenticationTypeIsEnabled(
- HttpServerAuthenticationConfigurationProperties
authenticationProperties, String authenticationTypeName) {
- try {
- String authenticationTypeGetterMethodName = "get" +
authenticationTypeName;
- ConfigurationPropertiesWithMandatoryFields
propertiesForAuthenticationType
- = (ConfigurationPropertiesWithMandatoryFields) ObjectHelper
-
.invokeMethodSafe(authenticationTypeGetterMethodName, authenticationProperties);
- return propertiesForAuthenticationType.areMandatoryFieldsFilled();
- } catch (NoSuchMethodException noSuchMethodException) {
- throw new RuntimeException(
- "Not found authentication configuration of type " +
authenticationTypeName, noSuchMethodException);
- } catch (InvocationTargetException | IllegalAccessException e) {
- throw new RuntimeException(e);
- }
- }
}
diff --git
a/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/authentication/BasicAuthenticationConfigurer.java
b/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/authentication/BasicAuthenticationConfigurer.java
index a5f23826792..6394e836d28 100644
---
a/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/authentication/BasicAuthenticationConfigurer.java
+++
b/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/authentication/BasicAuthenticationConfigurer.java
@@ -20,19 +20,18 @@ import
io.vertx.ext.auth.properties.PropertyFileAuthentication;
import io.vertx.ext.web.handler.BasicAuthHandler;
import
org.apache.camel.component.platform.http.vertx.auth.AuthenticationConfig;
import
org.apache.camel.component.platform.http.vertx.auth.AuthenticationConfig.AuthenticationConfigEntry;
-import org.apache.camel.main.HttpServerAuthenticationConfigurationProperties;
-import
org.apache.camel.main.HttpServerBasicAuthenticationConfigurationProperties;
+import org.apache.camel.main.HttpServerConfigurationProperties;
import static org.apache.camel.util.ObjectHelper.isEmpty;
public class BasicAuthenticationConfigurer implements
MainAuthenticationConfigurer {
+
@Override
public void configureAuthentication(
AuthenticationConfig authenticationConfig,
- HttpServerAuthenticationConfigurationProperties
authenticationProperties) {
- HttpServerBasicAuthenticationConfigurationProperties properties =
authenticationProperties.getBasic();
- String authPropertiesFileName =
properties.getAuthenticationPropertiesFile();
- String path = isEmpty(authenticationProperties.getPath()) ?
authenticationProperties.getPath() : "/*";
+ HttpServerConfigurationProperties properties) {
+ String authPropertiesFileName = properties.getBasicPropertiesFile();
+ String path = isEmpty(properties.getAuthenticationPath()) ?
properties.getAuthenticationPath() : "/*";
AuthenticationConfigEntry entry = new AuthenticationConfigEntry();
entry.setPath(path);
diff --git
a/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/authentication/JWTAuthenticationConfigurer.java
b/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/authentication/JWTAuthenticationConfigurer.java
index 5de63a3cda9..02e82f1e41f 100644
---
a/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/authentication/JWTAuthenticationConfigurer.java
+++
b/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/authentication/JWTAuthenticationConfigurer.java
@@ -25,18 +25,18 @@ import io.vertx.ext.web.handler.JWTAuthHandler;
import
org.apache.camel.component.platform.http.vertx.auth.AuthenticationConfig;
import
org.apache.camel.component.platform.http.vertx.auth.AuthenticationConfig.AuthenticationConfigEntry;
import
org.apache.camel.component.platform.http.vertx.auth.AuthenticationConfig.AuthenticationHandlerFactory;
-import org.apache.camel.main.HttpServerAuthenticationConfigurationProperties;
-import
org.apache.camel.main.HttpServerJWTAuthenticationConfigurationProperties;
+import org.apache.camel.main.HttpServerConfigurationProperties;
import static org.apache.camel.util.ObjectHelper.isEmpty;
public class JWTAuthenticationConfigurer implements
MainAuthenticationConfigurer {
+
@Override
public void configureAuthentication(
AuthenticationConfig authenticationConfig,
- HttpServerAuthenticationConfigurationProperties
authenticationProperties) {
- HttpServerJWTAuthenticationConfigurationProperties properties =
authenticationProperties.getJWT();
- String path = isEmpty(authenticationProperties.getPath()) ?
authenticationProperties.getPath() : "/*";
+ HttpServerConfigurationProperties properties) {
+
+ String path = isEmpty(properties.getAuthenticationPath()) ?
properties.getAuthenticationPath() : "/*";
AuthenticationConfigEntry entry = new AuthenticationConfigEntry();
entry.setPath(path);
@@ -52,9 +52,9 @@ public class JWTAuthenticationConfigurer implements
MainAuthenticationConfigurer
vertx,
new JWTAuthOptions(
new JsonObject().put("keyStore", new JsonObject()
- .put("type", properties.getKeystoreType())
- .put("path", properties.getKeystorePath())
- .put("password",
properties.getKeystorePassword())))));
+ .put("type", properties.getJwtKeystoreType())
+ .put("path", properties.getJwtKeystorePath())
+ .put("password",
properties.getJwtKeystorePassword())))));
authenticationConfig.getEntries().add(entry);
authenticationConfig.setEnabled(true);
diff --git
a/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/authentication/MainAuthenticationConfigurer.java
b/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/authentication/MainAuthenticationConfigurer.java
index 29678fd3f7e..0460a3f62d6 100644
---
a/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/authentication/MainAuthenticationConfigurer.java
+++
b/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/authentication/MainAuthenticationConfigurer.java
@@ -17,10 +17,12 @@
package org.apache.camel.component.platform.http.main.authentication;
import
org.apache.camel.component.platform.http.vertx.auth.AuthenticationConfig;
-import org.apache.camel.main.HttpServerAuthenticationConfigurationProperties;
+import org.apache.camel.main.HttpServerConfigurationProperties;
+/**
+ * Configure authentication on the embedded HTTP server.
+ */
public interface MainAuthenticationConfigurer {
- void configureAuthentication(
- AuthenticationConfig authenticationConfig,
- HttpServerAuthenticationConfigurationProperties
authenticationProperties);
+
+ void configureAuthentication(AuthenticationConfig authenticationConfig,
HttpServerConfigurationProperties properties);
}
diff --git
a/components/camel-platform-http-main/src/test/resources/basic-auth.properties
b/components/camel-platform-http-main/src/test/resources/basic-auth.properties
index 7d42ec63f47..f68a2815c94 100644
---
a/components/camel-platform-http-main/src/test/resources/basic-auth.properties
+++
b/components/camel-platform-http-main/src/test/resources/basic-auth.properties
@@ -16,6 +16,6 @@
## ---------------------------------------------------------------------------
camel.server.enabled=true
-camel.server.authentication.enabled=true
-camel.server.authentication.path=/*
-camel.server.authentication.basic.authenticationPropertiesFile=camel-platform-http-vertx-auth.properties
+camel.server.authenticationEnabled=true
+camel.server.authenticationPath=/*
+camel.server.basicPropertiesFile=camel-platform-http-vertx-auth.properties
diff --git
a/components/camel-platform-http-main/src/test/resources/incomplete-auth.properties
b/components/camel-platform-http-main/src/test/resources/incomplete-auth.properties
index 6c56e1638c5..2c4f1483833 100644
---
a/components/camel-platform-http-main/src/test/resources/incomplete-auth.properties
+++
b/components/camel-platform-http-main/src/test/resources/incomplete-auth.properties
@@ -16,8 +16,7 @@
## ---------------------------------------------------------------------------
camel.server.enabled=true
-camel.server.authentication.enabled=true
-camel.server.authentication.path=/*
-camel.server.authentication.jwt.keystoreType=jks
-
-camel.server.authentication.jwt.keystorePassword=changeme
+camel.server.authenticationEnabled=true
+camel.server.authenticationPath=/*
+camel.server.jwtKeystoreType=jks
+camel.server.jwtKeystorePassword=changeme
diff --git
a/components/camel-platform-http-main/src/test/resources/jwt-auth.properties
b/components/camel-platform-http-main/src/test/resources/jwt-auth.properties
index 8b0a3ccda18..24ea678556a 100644
--- a/components/camel-platform-http-main/src/test/resources/jwt-auth.properties
+++ b/components/camel-platform-http-main/src/test/resources/jwt-auth.properties
@@ -16,8 +16,8 @@
## ---------------------------------------------------------------------------
camel.server.enabled=true
-camel.server.authentication.enabled=true
-camel.server.authentication.path=/*
-camel.server.authentication.jwt.keystoreType=jks
-camel.server.authentication.jwt.keystorePath=test-camel-main-auth-jwt.jks
-camel.server.authentication.jwt.keystorePassword=changeme
+camel.server.authenticationEnabled=true
+camel.server.authenticationPath=/*
+camel.server.jwtKeystoreType=jks
+camel.server.jwtKeystorePath=test-camel-main-auth-jwt.jks
+camel.server.jwtKeystorePassword=changeme
diff --git
a/core/camel-main/src/generated/java/org/apache/camel/main/HttpServerAuthenticationConfigurationPropertiesConfigurer.java
b/core/camel-main/src/generated/java/org/apache/camel/main/HttpServerAuthenticationConfigurationPropertiesConfigurer.java
deleted file mode 100644
index d741492ac23..00000000000
---
a/core/camel-main/src/generated/java/org/apache/camel/main/HttpServerAuthenticationConfigurationPropertiesConfigurer.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Generated by camel build tools - do NOT edit this file! */
-package org.apache.camel.main;
-
-import javax.annotation.processing.Generated;
-import java.util.Map;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.spi.ExtendedPropertyConfigurerGetter;
-import org.apache.camel.spi.PropertyConfigurerGetter;
-import org.apache.camel.spi.ConfigurerStrategy;
-import org.apache.camel.spi.GeneratedPropertyConfigurer;
-import org.apache.camel.util.CaseInsensitiveMap;
-import org.apache.camel.main.HttpServerAuthenticationConfigurationProperties;
-
-/**
- * Generated by camel build tools - do NOT edit this file!
- */
-@Generated("org.apache.camel.maven.packaging.GenerateConfigurerMojo")
-@SuppressWarnings("unchecked")
-public class HttpServerAuthenticationConfigurationPropertiesConfigurer extends
org.apache.camel.support.component.PropertyConfigurerSupport implements
GeneratedPropertyConfigurer, PropertyConfigurerGetter {
-
- @Override
- public boolean configure(CamelContext camelContext, Object obj, String
name, Object value, boolean ignoreCase) {
- org.apache.camel.main.HttpServerAuthenticationConfigurationProperties
target =
(org.apache.camel.main.HttpServerAuthenticationConfigurationProperties) obj;
- switch (ignoreCase ? name.toLowerCase() : name) {
- case "basic": target.setBasic(property(camelContext,
org.apache.camel.main.HttpServerBasicAuthenticationConfigurationProperties.class,
value)); return true;
- case "enabled": target.setEnabled(property(camelContext,
boolean.class, value)); return true;
- case "jwt":
- case "jWT": target.setJWT(property(camelContext,
org.apache.camel.main.HttpServerJWTAuthenticationConfigurationProperties.class,
value)); return true;
- case "path": target.setPath(property(camelContext,
java.lang.String.class, value)); return true;
- default: return false;
- }
- }
-
- @Override
- public Class<?> getOptionType(String name, boolean ignoreCase) {
- switch (ignoreCase ? name.toLowerCase() : name) {
- case "basic": return
org.apache.camel.main.HttpServerBasicAuthenticationConfigurationProperties.class;
- case "enabled": return boolean.class;
- case "jwt":
- case "jWT": return
org.apache.camel.main.HttpServerJWTAuthenticationConfigurationProperties.class;
- case "path": return java.lang.String.class;
- default: return null;
- }
- }
-
- @Override
- public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
- org.apache.camel.main.HttpServerAuthenticationConfigurationProperties
target =
(org.apache.camel.main.HttpServerAuthenticationConfigurationProperties) obj;
- switch (ignoreCase ? name.toLowerCase() : name) {
- case "basic": return target.getBasic();
- case "enabled": return target.isEnabled();
- case "jwt":
- case "jWT": return target.getJWT();
- case "path": return target.getPath();
- default: return null;
- }
- }
-}
-
diff --git
a/core/camel-main/src/generated/java/org/apache/camel/main/HttpServerBasicAuthenticationConfigurationPropertiesConfigurer.java
b/core/camel-main/src/generated/java/org/apache/camel/main/HttpServerBasicAuthenticationConfigurationPropertiesConfigurer.java
deleted file mode 100644
index 28590ac6f6d..00000000000
---
a/core/camel-main/src/generated/java/org/apache/camel/main/HttpServerBasicAuthenticationConfigurationPropertiesConfigurer.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Generated by camel build tools - do NOT edit this file! */
-package org.apache.camel.main;
-
-import javax.annotation.processing.Generated;
-import java.util.Map;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.spi.ExtendedPropertyConfigurerGetter;
-import org.apache.camel.spi.PropertyConfigurerGetter;
-import org.apache.camel.spi.ConfigurerStrategy;
-import org.apache.camel.spi.GeneratedPropertyConfigurer;
-import org.apache.camel.util.CaseInsensitiveMap;
-import
org.apache.camel.main.HttpServerBasicAuthenticationConfigurationProperties;
-
-/**
- * Generated by camel build tools - do NOT edit this file!
- */
-@Generated("org.apache.camel.maven.packaging.GenerateConfigurerMojo")
-@SuppressWarnings("unchecked")
-public class HttpServerBasicAuthenticationConfigurationPropertiesConfigurer
extends org.apache.camel.support.component.PropertyConfigurerSupport implements
GeneratedPropertyConfigurer, PropertyConfigurerGetter {
-
- @Override
- public boolean configure(CamelContext camelContext, Object obj, String
name, Object value, boolean ignoreCase) {
-
org.apache.camel.main.HttpServerBasicAuthenticationConfigurationProperties
target =
(org.apache.camel.main.HttpServerBasicAuthenticationConfigurationProperties)
obj;
- switch (ignoreCase ? name.toLowerCase() : name) {
- case "authenticationpropertiesfile":
- case "authenticationPropertiesFile":
target.setAuthenticationPropertiesFile(property(camelContext,
java.lang.String.class, value)); return true;
- default: return false;
- }
- }
-
- @Override
- public Class<?> getOptionType(String name, boolean ignoreCase) {
- switch (ignoreCase ? name.toLowerCase() : name) {
- case "authenticationpropertiesfile":
- case "authenticationPropertiesFile": return java.lang.String.class;
- default: return null;
- }
- }
-
- @Override
- public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
-
org.apache.camel.main.HttpServerBasicAuthenticationConfigurationProperties
target =
(org.apache.camel.main.HttpServerBasicAuthenticationConfigurationProperties)
obj;
- switch (ignoreCase ? name.toLowerCase() : name) {
- case "authenticationpropertiesfile":
- case "authenticationPropertiesFile": return
target.getAuthenticationPropertiesFile();
- default: return null;
- }
- }
-}
-
diff --git
a/core/camel-main/src/generated/java/org/apache/camel/main/HttpServerBasicAuthenticationPropertiesConfigurer.java
b/core/camel-main/src/generated/java/org/apache/camel/main/HttpServerBasicAuthenticationPropertiesConfigurer.java
deleted file mode 100644
index 8f7d54e5c3a..00000000000
---
a/core/camel-main/src/generated/java/org/apache/camel/main/HttpServerBasicAuthenticationPropertiesConfigurer.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Generated by camel build tools - do NOT edit this file! */
-package org.apache.camel.main;
-
-import javax.annotation.processing.Generated;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.spi.PropertyConfigurerGetter;
-import org.apache.camel.spi.GeneratedPropertyConfigurer;
-
-/**
- * Generated by camel build tools - do NOT edit this file!
- */
-@Generated("org.apache.camel.maven.packaging.GenerateConfigurerMojo")
-@SuppressWarnings("unchecked")
-public class HttpServerBasicAuthenticationPropertiesConfigurer extends
org.apache.camel.support.component.PropertyConfigurerSupport implements
GeneratedPropertyConfigurer, PropertyConfigurerGetter {
-
- @Override
- public boolean configure(CamelContext camelContext, Object obj, String
name, Object value, boolean ignoreCase) {
- return false;
- }
-
- @Override
- public Class<?> getOptionType(String name, boolean ignoreCase) {
- return null;
- }
-
- @Override
- public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
- return null;
- }
-}
-
diff --git
a/core/camel-main/src/generated/java/org/apache/camel/main/HttpServerConfigurationPropertiesConfigurer.java
b/core/camel-main/src/generated/java/org/apache/camel/main/HttpServerConfigurationPropertiesConfigurer.java
index 5d4397a141d..f258ced1bdc 100644
---
a/core/camel-main/src/generated/java/org/apache/camel/main/HttpServerConfigurationPropertiesConfigurer.java
+++
b/core/camel-main/src/generated/java/org/apache/camel/main/HttpServerConfigurationPropertiesConfigurer.java
@@ -23,7 +23,12 @@ public class HttpServerConfigurationPropertiesConfigurer
extends org.apache.came
public boolean configure(CamelContext camelContext, Object obj, String
name, Object value, boolean ignoreCase) {
org.apache.camel.main.HttpServerConfigurationProperties target =
(org.apache.camel.main.HttpServerConfigurationProperties) obj;
switch (ignoreCase ? name.toLowerCase() : name) {
- case "authentication": target.setAuthentication(property(camelContext,
org.apache.camel.main.HttpServerAuthenticationConfigurationProperties.class,
value)); return true;
+ case "authenticationenabled":
+ case "authenticationEnabled":
target.setAuthenticationEnabled(property(camelContext, boolean.class, value));
return true;
+ case "authenticationpath":
+ case "authenticationPath":
target.setAuthenticationPath(property(camelContext, java.lang.String.class,
value)); return true;
+ case "basicpropertiesfile":
+ case "basicPropertiesFile":
target.setBasicPropertiesFile(property(camelContext, java.lang.String.class,
value)); return true;
case "devconsoleenabled":
case "devConsoleEnabled":
target.setDevConsoleEnabled(property(camelContext, boolean.class, value));
return true;
case "enabled": target.setEnabled(property(camelContext,
boolean.class, value)); return true;
@@ -34,6 +39,12 @@ public class HttpServerConfigurationPropertiesConfigurer
extends org.apache.came
case "infoEnabled": target.setInfoEnabled(property(camelContext,
boolean.class, value)); return true;
case "jolokiaenabled":
case "jolokiaEnabled": target.setJolokiaEnabled(property(camelContext,
boolean.class, value)); return true;
+ case "jwtkeystorepassword":
+ case "jwtKeystorePassword":
target.setJwtKeystorePassword(property(camelContext, java.lang.String.class,
value)); return true;
+ case "jwtkeystorepath":
+ case "jwtKeystorePath":
target.setJwtKeystorePath(property(camelContext, java.lang.String.class,
value)); return true;
+ case "jwtkeystoretype":
+ case "jwtKeystoreType":
target.setJwtKeystoreType(property(camelContext, java.lang.String.class,
value)); return true;
case "maxbodysize":
case "maxBodySize": target.setMaxBodySize(property(camelContext,
java.lang.Long.class, value)); return true;
case "metricsenabled":
@@ -53,7 +64,12 @@ public class HttpServerConfigurationPropertiesConfigurer
extends org.apache.came
@Override
public Class<?> getOptionType(String name, boolean ignoreCase) {
switch (ignoreCase ? name.toLowerCase() : name) {
- case "authentication": return
org.apache.camel.main.HttpServerAuthenticationConfigurationProperties.class;
+ case "authenticationenabled":
+ case "authenticationEnabled": return boolean.class;
+ case "authenticationpath":
+ case "authenticationPath": return java.lang.String.class;
+ case "basicpropertiesfile":
+ case "basicPropertiesFile": return java.lang.String.class;
case "devconsoleenabled":
case "devConsoleEnabled": return boolean.class;
case "enabled": return boolean.class;
@@ -64,6 +80,12 @@ public class HttpServerConfigurationPropertiesConfigurer
extends org.apache.came
case "infoEnabled": return boolean.class;
case "jolokiaenabled":
case "jolokiaEnabled": return boolean.class;
+ case "jwtkeystorepassword":
+ case "jwtKeystorePassword": return java.lang.String.class;
+ case "jwtkeystorepath":
+ case "jwtKeystorePath": return java.lang.String.class;
+ case "jwtkeystoretype":
+ case "jwtKeystoreType": return java.lang.String.class;
case "maxbodysize":
case "maxBodySize": return java.lang.Long.class;
case "metricsenabled":
@@ -84,7 +106,12 @@ public class HttpServerConfigurationPropertiesConfigurer
extends org.apache.came
public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
org.apache.camel.main.HttpServerConfigurationProperties target =
(org.apache.camel.main.HttpServerConfigurationProperties) obj;
switch (ignoreCase ? name.toLowerCase() : name) {
- case "authentication": return target.getAuthentication();
+ case "authenticationenabled":
+ case "authenticationEnabled": return target.isAuthenticationEnabled();
+ case "authenticationpath":
+ case "authenticationPath": return target.getAuthenticationPath();
+ case "basicpropertiesfile":
+ case "basicPropertiesFile": return target.getBasicPropertiesFile();
case "devconsoleenabled":
case "devConsoleEnabled": return target.isDevConsoleEnabled();
case "enabled": return target.isEnabled();
@@ -95,6 +122,12 @@ public class HttpServerConfigurationPropertiesConfigurer
extends org.apache.came
case "infoEnabled": return target.isInfoEnabled();
case "jolokiaenabled":
case "jolokiaEnabled": return target.isJolokiaEnabled();
+ case "jwtkeystorepassword":
+ case "jwtKeystorePassword": return target.getJwtKeystorePassword();
+ case "jwtkeystorepath":
+ case "jwtKeystorePath": return target.getJwtKeystorePath();
+ case "jwtkeystoretype":
+ case "jwtKeystoreType": return target.getJwtKeystoreType();
case "maxbodysize":
case "maxBodySize": return target.getMaxBodySize();
case "metricsenabled":
diff --git
a/core/camel-main/src/generated/java/org/apache/camel/main/HttpServerJWTAuthenticationConfigurationPropertiesConfigurer.java
b/core/camel-main/src/generated/java/org/apache/camel/main/HttpServerJWTAuthenticationConfigurationPropertiesConfigurer.java
deleted file mode 100644
index 3d23f665a08..00000000000
---
a/core/camel-main/src/generated/java/org/apache/camel/main/HttpServerJWTAuthenticationConfigurationPropertiesConfigurer.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Generated by camel build tools - do NOT edit this file! */
-package org.apache.camel.main;
-
-import javax.annotation.processing.Generated;
-import java.util.Map;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.spi.ExtendedPropertyConfigurerGetter;
-import org.apache.camel.spi.PropertyConfigurerGetter;
-import org.apache.camel.spi.ConfigurerStrategy;
-import org.apache.camel.spi.GeneratedPropertyConfigurer;
-import org.apache.camel.util.CaseInsensitiveMap;
-import
org.apache.camel.main.HttpServerJWTAuthenticationConfigurationProperties;
-
-/**
- * Generated by camel build tools - do NOT edit this file!
- */
-@Generated("org.apache.camel.maven.packaging.GenerateConfigurerMojo")
-@SuppressWarnings("unchecked")
-public class HttpServerJWTAuthenticationConfigurationPropertiesConfigurer
extends org.apache.camel.support.component.PropertyConfigurerSupport implements
GeneratedPropertyConfigurer, PropertyConfigurerGetter {
-
- @Override
- public boolean configure(CamelContext camelContext, Object obj, String
name, Object value, boolean ignoreCase) {
-
org.apache.camel.main.HttpServerJWTAuthenticationConfigurationProperties target
= (org.apache.camel.main.HttpServerJWTAuthenticationConfigurationProperties)
obj;
- switch (ignoreCase ? name.toLowerCase() : name) {
- case "keystorepassword":
- case "keystorePassword":
target.setKeystorePassword(property(camelContext, java.lang.String.class,
value)); return true;
- case "keystorepath":
- case "keystorePath": target.setKeystorePath(property(camelContext,
java.lang.String.class, value)); return true;
- case "keystoretype":
- case "keystoreType": target.setKeystoreType(property(camelContext,
java.lang.String.class, value)); return true;
- default: return false;
- }
- }
-
- @Override
- public Class<?> getOptionType(String name, boolean ignoreCase) {
- switch (ignoreCase ? name.toLowerCase() : name) {
- case "keystorepassword":
- case "keystorePassword": return java.lang.String.class;
- case "keystorepath":
- case "keystorePath": return java.lang.String.class;
- case "keystoretype":
- case "keystoreType": return java.lang.String.class;
- default: return null;
- }
- }
-
- @Override
- public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
-
org.apache.camel.main.HttpServerJWTAuthenticationConfigurationProperties target
= (org.apache.camel.main.HttpServerJWTAuthenticationConfigurationProperties)
obj;
- switch (ignoreCase ? name.toLowerCase() : name) {
- case "keystorepassword":
- case "keystorePassword": return target.getKeystorePassword();
- case "keystorepath":
- case "keystorePath": return target.getKeystorePath();
- case "keystoretype":
- case "keystoreType": return target.getKeystoreType();
- default: return null;
- }
- }
-}
-
diff --git
a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
index bca1d8b9d0e..32d8b4479be 100644
---
a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
+++
b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
@@ -256,22 +256,20 @@
{ "name": "camel.routecontroller.threadPoolSize", "description": "The
number of threads used by the route controller scheduled thread pool that are
used for restarting routes. The pool uses 1 thread by default, but you can
increase this to allow the controller to concurrently attempt to restart
multiple routes in case more than one route has problems starting.",
"sourceType": "org.apache.camel.main.RouteControllerConfigurationProperties",
"type": "integer", "javaType": "int", "defaul [...]
{ "name": "camel.routecontroller.unhealthyOnExhausted", "description":
"Whether to mark the route as unhealthy (down) when all restarting attempts
(backoff) have failed and the route is not successfully started and the route
manager is giving up. If setting this to false will make health checks ignore
this problem and allow to report the Camel application as UP.", "sourceType":
"org.apache.camel.main.RouteControllerConfigurationProperties", "type":
"boolean", "javaType": "boolean", " [...]
{ "name": "camel.routecontroller.unhealthyOnRestarting", "description":
"Whether to mark the route as unhealthy (down) when the route failed to
initially start, and is being controlled for restarting (backoff). If setting
this to false will make health checks ignore this problem and allow to report
the Camel application as UP.", "sourceType":
"org.apache.camel.main.RouteControllerConfigurationProperties", "type":
"boolean", "javaType": "boolean", "defaultValue": true },
- { "name": "camel.server.authentication", "description": "To configure
embedded HTTP server authentication (for standalone applications; not Spring
Boot or Quarkus)", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "object",
"javaType":
"org.apache.camel.main.HttpServerAuthenticationConfigurationProperties" },
- { "name": "camel.server.authenticationPropertiesFile", "description":
"Name of the file that contains authentication info for Vert.x property file
auth provider.", "sourceType":
"org.apache.camel.main.HttpServerBasicAuthenticationConfigurationProperties",
"type": "string", "javaType": "java.lang.String" },
- { "name": "camel.server.basic", "description": "To configure Basic HTTP
authentication for embedded server.", "sourceType":
"org.apache.camel.main.HttpServerAuthenticationConfigurationProperties",
"type": "object", "javaType":
"org.apache.camel.main.HttpServerBasicAuthenticationConfigurationProperties" },
+ { "name": "camel.server.authenticationEnabled", "description": "Whether to
enable HTTP authentication for embedded server (for standalone applications;
not Spring Boot or Quarkus).", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "boolean",
"javaType": "boolean", "defaultValue": "false" },
+ { "name": "camel.server.authenticationPath", "description": "Set HTTP url
path of embedded server that is protected by authentication configuration.",
"sourceType": "org.apache.camel.main.HttpServerConfigurationProperties",
"type": "string", "javaType": "java.lang.String" },
+ { "name": "camel.server.basicPropertiesFile", "description": "Name of the
file that contains basic authentication info for Vert.x file auth provider.",
"sourceType": "org.apache.camel.main.HttpServerConfigurationProperties",
"type": "string", "javaType": "java.lang.String" },
{ "name": "camel.server.devConsoleEnabled", "description": "Whether to
enable developer console (not intended for production use). Dev console must
also be enabled on CamelContext. For example by setting
camel.context.dev-console=true in application.properties, or via code
camelContext.setDevConsole(true); If enabled then you can access a basic
developer console on context-path: \/q\/dev.", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "boolean",
"j [...]
- { "name": "camel.server.enabled", "description": "Whether to enable HTTP
authentication for embedded server.", "sourceType":
"org.apache.camel.main.HttpServerAuthenticationConfigurationProperties",
"type": "boolean", "javaType": "boolean", "defaultValue": "false" },
{ "name": "camel.server.enabled", "description": "Whether embedded HTTP
server is enabled. By default, the server is not enabled.", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "boolean",
"javaType": "boolean", "defaultValue": "false" },
{ "name": "camel.server.healthCheckEnabled", "description": "Whether to
enable health-check console. If enabled then you can access health-check status
on context-path: \/q\/health", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "boolean",
"javaType": "boolean", "defaultValue": "false" },
{ "name": "camel.server.host", "description": "Hostname to use for binding
embedded HTTP server", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "string",
"javaType": "java.lang.String", "defaultValue": "0.0.0.0" },
{ "name": "camel.server.infoEnabled", "description": "Whether to enable
info console. If enabled then you can see some basic Camel information at
\/q\/info", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "boolean",
"javaType": "boolean", "defaultValue": "false" },
{ "name": "camel.server.jolokiaEnabled", "description": "Whether to enable
jolokia. If enabled then you can access jolokia api on context-path:
\/q\/jolokia", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "boolean",
"javaType": "boolean", "defaultValue": "false" },
- { "name": "camel.server.keystorePassword", "description": "Password from
the keystore used for JWT tokens validation.", "sourceType":
"org.apache.camel.main.HttpServerJWTAuthenticationConfigurationProperties",
"type": "string", "javaType": "java.lang.String" },
- { "name": "camel.server.keystorePath", "description": "Path to the
keystore file used for JWT tokens validation.", "sourceType":
"org.apache.camel.main.HttpServerJWTAuthenticationConfigurationProperties",
"type": "string", "javaType": "java.lang.String" },
- { "name": "camel.server.keystoreType", "description": "Type of the
keystore used for JWT tokens validation (jks, pkcs12, etc.).", "sourceType":
"org.apache.camel.main.HttpServerJWTAuthenticationConfigurationProperties",
"type": "string", "javaType": "java.lang.String" },
+ { "name": "camel.server.jwtKeystorePassword", "description": "Password
from the keystore used for JWT tokens validation.", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "string",
"javaType": "java.lang.String" },
+ { "name": "camel.server.jwtKeystorePath", "description": "Path to the
keystore file used for JWT tokens validation.", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "string",
"javaType": "java.lang.String" },
+ { "name": "camel.server.jwtKeystoreType", "description": "Type of the
keystore used for JWT tokens validation (jks, pkcs12, etc.).", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "string",
"javaType": "java.lang.String" },
{ "name": "camel.server.maxBodySize", "description": "Maximum HTTP body
size the embedded HTTP server can accept.", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "integer",
"javaType": "java.lang.Long" },
{ "name": "camel.server.metricsEnabled", "description": "Whether to enable
metrics. If enabled then you can access metrics on context-path: \/q\/metrics",
"sourceType": "org.apache.camel.main.HttpServerConfigurationProperties",
"type": "boolean", "javaType": "boolean", "defaultValue": "false" },
- { "name": "camel.server.path", "description": "Set HTTP url path of
embedded server that is protected by authentication configuration.",
"sourceType":
"org.apache.camel.main.HttpServerAuthenticationConfigurationProperties",
"type": "string", "javaType": "java.lang.String" },
{ "name": "camel.server.path", "description": "Context-path to use for
embedded HTTP server", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "string",
"javaType": "java.lang.String", "defaultValue": "\/" },
{ "name": "camel.server.port", "description": "Port to use for binding
embedded HTTP server", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "integer",
"javaType": "int", "defaultValue": 8080 },
{ "name": "camel.server.uploadEnabled", "description": "Whether to enable
file upload via HTTP (not intended for production use). This functionality is
for development to be able to reload Camel routes and code with source changes
(if reload is enabled). If enabled then you can upload\/delete files via HTTP
PUT\/DELETE on context-path: \/q\/upload\/{name}. You must also configure the
uploadSourceDir option.", "sourceType":
"org.apache.camel.main.HttpServerConfigurationProperties", "t [...]
diff --git
a/core/camel-main/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.main.HttpServerAuthenticationConfigurationProperties
b/core/camel-main/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.main.HttpServerAuthenticationConfigurationProperties
deleted file mode 100644
index 45be2f173ef..00000000000
---
a/core/camel-main/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.main.HttpServerAuthenticationConfigurationProperties
+++ /dev/null
@@ -1,2 +0,0 @@
-# Generated by camel build tools - do NOT edit this file!
-class=org.apache.camel.main.HttpServerAuthenticationConfigurationPropertiesConfigurer
diff --git
a/core/camel-main/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.main.HttpServerBasicAuthenticationConfigurationProperties
b/core/camel-main/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.main.HttpServerBasicAuthenticationConfigurationProperties
deleted file mode 100644
index 8c4264fffa6..00000000000
---
a/core/camel-main/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.main.HttpServerBasicAuthenticationConfigurationProperties
+++ /dev/null
@@ -1,2 +0,0 @@
-# Generated by camel build tools - do NOT edit this file!
-class=org.apache.camel.main.HttpServerBasicAuthenticationConfigurationPropertiesConfigurer
diff --git
a/core/camel-main/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.main.HttpServerBasicAuthenticationProperties
b/core/camel-main/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.main.HttpServerBasicAuthenticationProperties
deleted file mode 100644
index c2658bf00f4..00000000000
---
a/core/camel-main/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.main.HttpServerBasicAuthenticationProperties
+++ /dev/null
@@ -1,2 +0,0 @@
-# Generated by camel build tools - do NOT edit this file!
-class=org.apache.camel.main.HttpServerBasicAuthenticationPropertiesConfigurer
diff --git
a/core/camel-main/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.main.HttpServerJWTAuthenticationConfigurationProperties
b/core/camel-main/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.main.HttpServerJWTAuthenticationConfigurationProperties
deleted file mode 100644
index bfc14a5405d..00000000000
---
a/core/camel-main/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.main.HttpServerJWTAuthenticationConfigurationProperties
+++ /dev/null
@@ -1,2 +0,0 @@
-# Generated by camel build tools - do NOT edit this file!
-class=org.apache.camel.main.HttpServerJWTAuthenticationConfigurationPropertiesConfigurer
diff --git a/core/camel-main/src/main/docs/main.adoc
b/core/camel-main/src/main/docs/main.adoc
index ce260ced54b..729faf79ba6 100644
--- a/core/camel-main/src/main/docs/main.adoc
+++ b/core/camel-main/src/main/docs/main.adoc
@@ -169,27 +169,25 @@ The camel.routecontroller supports 12 options, which are
listed below.
=== Camel Embedded HTTP Server (only for standalone; not Spring Boot or
Quarkus) configurations
-The camel.server supports 21 options, which are listed below.
+The camel.server supports 19 options, which are listed below.
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
-| *camel.server.authentication* | To configure embedded HTTP server
authentication (for standalone applications; not Spring Boot or Quarkus) | |
HttpServerAuthenticationConfigurationProperties
-| *camel.server.authentication{zwsp}PropertiesFile* | Name of the file that
contains authentication info for Vert.x property file auth provider. | | String
-| *camel.server.basic* | To configure Basic HTTP authentication for embedded
server. | | HttpServerBasicAuthenticationConfigurationProperties
+| *camel.server.authentication{zwsp}Enabled* | Whether to enable HTTP
authentication for embedded server (for standalone applications; not Spring
Boot or Quarkus). | false | boolean
+| *camel.server.authentication{zwsp}Path* | Set HTTP url path of embedded
server that is protected by authentication configuration. | | String
+| *camel.server.basicProperties{zwsp}File* | Name of the file that contains
basic authentication info for Vert.x file auth provider. | | String
| *camel.server.devConsoleEnabled* | Whether to enable developer console (not
intended for production use). Dev console must also be enabled on CamelContext.
For example by setting camel.context.dev-console=true in
application.properties, or via code camelContext.setDevConsole(true); If
enabled then you can access a basic developer console on context-path: /q/dev.
| false | boolean
-| *camel.server.enabled* | Whether to enable HTTP authentication for embedded
server. | false | boolean
| *camel.server.enabled* | Whether embedded HTTP server is enabled. By
default, the server is not enabled. | false | boolean
| *camel.server.healthCheck{zwsp}Enabled* | Whether to enable health-check
console. If enabled then you can access health-check status on context-path:
/q/health | false | boolean
| *camel.server.host* | Hostname to use for binding embedded HTTP server |
0.0.0.0 | String
| *camel.server.infoEnabled* | Whether to enable info console. If enabled then
you can see some basic Camel information at /q/info | false | boolean
| *camel.server.jolokiaEnabled* | Whether to enable jolokia. If enabled then
you can access jolokia api on context-path: /q/jolokia | false | boolean
-| *camel.server.keystorePassword* | Password from the keystore used for JWT
tokens validation. | | String
-| *camel.server.keystorePath* | Path to the keystore file used for JWT tokens
validation. | | String
-| *camel.server.keystoreType* | Type of the keystore used for JWT tokens
validation (jks, pkcs12, etc.). | | String
+| *camel.server.jwtKeystore{zwsp}Password* | Password from the keystore used
for JWT tokens validation. | | String
+| *camel.server.jwtKeystorePath* | Path to the keystore file used for JWT
tokens validation. | | String
+| *camel.server.jwtKeystoreType* | Type of the keystore used for JWT tokens
validation (jks, pkcs12, etc.). | | String
| *camel.server.maxBodySize* | Maximum HTTP body size the embedded HTTP server
can accept. | | Long
| *camel.server.metricsEnabled* | Whether to enable metrics. If enabled then
you can access metrics on context-path: /q/metrics | false | boolean
-| *camel.server.path* | Set HTTP url path of embedded server that is protected
by authentication configuration. | | String
| *camel.server.path* | Context-path to use for embedded HTTP server | / |
String
| *camel.server.port* | Port to use for binding embedded HTTP server | 8080 |
int
| *camel.server.uploadEnabled* | Whether to enable file upload via HTTP (not
intended for production use). This functionality is for development to be able
to reload Camel routes and code with source changes (if reload is enabled). If
enabled then you can upload/delete files via HTTP PUT/DELETE on context-path:
/q/upload/\{name}. You must also configure the uploadSourceDir option. | false
| boolean
diff --git
a/core/camel-main/src/main/java/org/apache/camel/main/ConfigurationPropertiesWithMandatoryFields.java
b/core/camel-main/src/main/java/org/apache/camel/main/ConfigurationPropertiesWithMandatoryFields.java
deleted file mode 100644
index 43dcd825603..00000000000
---
a/core/camel-main/src/main/java/org/apache/camel/main/ConfigurationPropertiesWithMandatoryFields.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.main;
-
-/**
- * This interface marks ConfigurationProperties classes that have one or more
mandatory fields, i.e. fields without
- * which configuration does not make sense.
- */
-public interface ConfigurationPropertiesWithMandatoryFields {
-
- /**
- * Checks is this ConfigurationProperties has no mandatory fields absent.
- *
- * @return true if all mandatory fields are filled, false otherwise
- */
- boolean areMandatoryFieldsFilled();
-
-}
diff --git
a/core/camel-main/src/main/java/org/apache/camel/main/HttpServerAuthenticationConfigurationProperties.java
b/core/camel-main/src/main/java/org/apache/camel/main/HttpServerAuthenticationConfigurationProperties.java
deleted file mode 100644
index 4f888f9aef4..00000000000
---
a/core/camel-main/src/main/java/org/apache/camel/main/HttpServerAuthenticationConfigurationProperties.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.main;
-
-import org.apache.camel.spi.BootstrapCloseable;
-import org.apache.camel.spi.Configurer;
-import org.apache.camel.spi.Metadata;
-
-/**
- * Authentication configuration for embedded HTTP server for standalone Camel
applications (not Spring Boot / Quarkus).
- */
-@Configurer(bootstrap = true)
-public class HttpServerAuthenticationConfigurationProperties implements
BootstrapCloseable {
-
- public static final String[] SUPPORTED_AUTHENTICATION_TYPES = { "Basic",
"JWT" };
-
- private HttpServerConfigurationProperties parent;
-
- @Metadata
- private boolean enabled;
-
- private String path;
-
- private HttpServerBasicAuthenticationConfigurationProperties basic;
-
- private HttpServerJWTAuthenticationConfigurationProperties jwt;
-
- public
HttpServerAuthenticationConfigurationProperties(HttpServerConfigurationProperties
parent) {
- basic = new HttpServerBasicAuthenticationConfigurationProperties(this);
- jwt = new HttpServerJWTAuthenticationConfigurationProperties(this);
- this.parent = parent;
- }
-
- public HttpServerConfigurationProperties end() {
- return parent;
- }
-
- @Override
- public void close() {
- if (basic != null) {
- basic.close();
- basic = null;
- }
- if (jwt != null) {
- jwt.close();
- jwt = null;
- }
- parent = null;
- }
-
- public boolean isEnabled() {
- return enabled;
- }
-
- /**
- * Whether to enable HTTP authentication for embedded server.
- */
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
-
- /**
- * Whether to enable HTTP authentication for embedded server.
- */
- public HttpServerAuthenticationConfigurationProperties withEnabled(boolean
enabled) {
- this.enabled = enabled;
- return this;
- }
-
- /**
- * To configure Basic HTTP authentication for embedded server.
- */
- public HttpServerBasicAuthenticationConfigurationProperties basic() {
- if (basic == null) {
- basic = new
HttpServerBasicAuthenticationConfigurationProperties(this);
- }
- return basic;
- }
-
- public HttpServerBasicAuthenticationConfigurationProperties getBasic() {
- return basic;
- }
-
- /**
- * To configure Basic HTTP authentication for embedded server.
- */
- public void setBasic(
- HttpServerBasicAuthenticationConfigurationProperties basic) {
- this.basic = basic;
- }
-
- /**
- * To configure JWT HTTP authentication for embedded server.
- */
- public HttpServerJWTAuthenticationConfigurationProperties jwt() {
- if (jwt == null) {
- jwt = new HttpServerJWTAuthenticationConfigurationProperties(this);
- }
- return jwt;
- }
-
- public HttpServerJWTAuthenticationConfigurationProperties getJWT() {
- return jwt;
- }
-
- /**
- * To configure JWT HTTP authentication for embedded server.
- */
- public void setJWT(
- HttpServerJWTAuthenticationConfigurationProperties jwt) {
- this.jwt = jwt;
- }
-
- public String getPath() {
- return path;
- }
-
- /**
- * Set HTTP url path of embedded server that is protected by
authentication configuration.
- */
- public void setPath(String path) {
- this.path = path;
- }
-
- /**
- * Set HTTP url path of embedded server that is protected by
authentication configuration.
- */
- public HttpServerAuthenticationConfigurationProperties withPath(String
path) {
- this.path = path;
- return this;
- }
-}
diff --git
a/core/camel-main/src/main/java/org/apache/camel/main/HttpServerBasicAuthenticationConfigurationProperties.java
b/core/camel-main/src/main/java/org/apache/camel/main/HttpServerBasicAuthenticationConfigurationProperties.java
deleted file mode 100644
index 4f2d9967c8f..00000000000
---
a/core/camel-main/src/main/java/org/apache/camel/main/HttpServerBasicAuthenticationConfigurationProperties.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.main;
-
-import org.apache.camel.spi.BootstrapCloseable;
-import org.apache.camel.spi.Configurer;
-
-import static org.apache.camel.util.ObjectHelper.isNotEmpty;
-
-/**
- * Basic HTTP authentication for embedded server.
- */
-@Configurer(bootstrap = true)
-public class HttpServerBasicAuthenticationConfigurationProperties
- implements ConfigurationPropertiesWithMandatoryFields,
BootstrapCloseable {
-
- private String authenticationPropertiesFile;
-
- private HttpServerAuthenticationConfigurationProperties parent;
-
- public
HttpServerBasicAuthenticationConfigurationProperties(HttpServerAuthenticationConfigurationProperties
parent) {
- this.parent = parent;
- }
-
- public String getAuthenticationPropertiesFile() {
- return authenticationPropertiesFile;
- }
-
- /**
- * Name of the file that contains authentication info for Vert.x <a
- * href=https://vertx.io/docs/vertx-auth-properties/java/>property file
auth provider</a>.
- */
- public void setAuthenticationPropertiesFile(String
authenticationPropertiesFile) {
- this.authenticationPropertiesFile = authenticationPropertiesFile;
- }
-
- /**
- * Name of the file that contains authentication info for Vert.x <a
- * href=https://vertx.io/docs/vertx-auth-properties/java/>property file
auth provider</a>.
- */
- public HttpServerBasicAuthenticationConfigurationProperties
withAuthenticationPropertiesFile(
- String authenticationPropertiesFile) {
- this.authenticationPropertiesFile = authenticationPropertiesFile;
- return this;
- }
-
- @Override
- public void close() {
- parent = null;
- }
-
- @Override
- public boolean areMandatoryFieldsFilled() {
- return isNotEmpty(authenticationPropertiesFile);
- }
-}
diff --git
a/core/camel-main/src/main/java/org/apache/camel/main/HttpServerConfigurationProperties.java
b/core/camel-main/src/main/java/org/apache/camel/main/HttpServerConfigurationProperties.java
index f56ad8c5325..91ed89ac025 100644
---
a/core/camel-main/src/main/java/org/apache/camel/main/HttpServerConfigurationProperties.java
+++
b/core/camel-main/src/main/java/org/apache/camel/main/HttpServerConfigurationProperties.java
@@ -47,10 +47,20 @@ public class HttpServerConfigurationProperties implements
BootstrapCloseable {
private boolean uploadEnabled;
private String uploadSourceDir;
- private HttpServerAuthenticationConfigurationProperties authentication;
+ @Metadata(label = "security")
+ private boolean authenticationEnabled;
+ @Metadata(label = "security")
+ private String authenticationPath;
+ @Metadata(label = "security")
+ private String basicPropertiesFile;
+ @Metadata(label = "security")
+ private String jwtKeystoreType;
+ @Metadata(label = "security")
+ private String jwtKeystorePath;
+ @Metadata(label = "security", secret = true)
+ private String jwtKeystorePassword;
public HttpServerConfigurationProperties(MainConfigurationProperties
parent) {
- authentication = new
HttpServerAuthenticationConfigurationProperties(this);
this.parent = parent;
}
@@ -60,10 +70,6 @@ public class HttpServerConfigurationProperties implements
BootstrapCloseable {
@Override
public void close() {
- if (authentication != null) {
- authentication.close();
- authentication = null;
- }
parent = null;
}
@@ -217,6 +223,73 @@ public class HttpServerConfigurationProperties implements
BootstrapCloseable {
this.uploadSourceDir = uploadSourceDir;
}
+ public boolean isAuthenticationEnabled() {
+ return authenticationEnabled;
+ }
+
+ /**
+ * Whether to enable HTTP authentication for embedded server (for
standalone applications; not Spring Boot or
+ * Quarkus).
+ */
+ public void setAuthenticationEnabled(boolean authenticationEnabled) {
+ this.authenticationEnabled = authenticationEnabled;
+ }
+
+ public String getAuthenticationPath() {
+ return authenticationPath;
+ }
+
+ /**
+ * Set HTTP url path of embedded server that is protected by
authentication configuration.
+ */
+ public void setAuthenticationPath(String authenticationPath) {
+ this.authenticationPath = authenticationPath;
+ }
+
+ public String getBasicPropertiesFile() {
+ return basicPropertiesFile;
+ }
+
+ /**
+ * Name of the file that contains basic authentication info for Vert.x
file auth provider.
+ */
+ public void setBasicPropertiesFile(String basicPropertiesFile) {
+ this.basicPropertiesFile = basicPropertiesFile;
+ }
+
+ public String getJwtKeystoreType() {
+ return jwtKeystoreType;
+ }
+
+ /**
+ * Type of the keystore used for JWT tokens validation (jks, pkcs12, etc.).
+ */
+ public void setJwtKeystoreType(String jwtKeystoreType) {
+ this.jwtKeystoreType = jwtKeystoreType;
+ }
+
+ public String getJwtKeystorePath() {
+ return jwtKeystorePath;
+ }
+
+ /**
+ * Path to the keystore file used for JWT tokens validation.
+ */
+ public void setJwtKeystorePath(String jwtKeystorePath) {
+ this.jwtKeystorePath = jwtKeystorePath;
+ }
+
+ public String getJwtKeystorePassword() {
+ return jwtKeystorePassword;
+ }
+
+ /**
+ * Password from the keystore used for JWT tokens validation.
+ */
+ public void setJwtKeystorePassword(String jwtKeystorePassword) {
+ this.jwtKeystorePassword = jwtKeystorePassword;
+ }
+
/**
* Whether embedded HTTP server is enabled. By default, the server is not
enabled.
*/
@@ -329,36 +402,52 @@ public class HttpServerConfigurationProperties implements
BootstrapCloseable {
}
/**
- * To configure embedded HTTP server authentication (for standalone
applications; not Spring Boot or Quarkus)
+ * Whether to enable HTTP authentication for embedded server (for
standalone applications; not Spring Boot or
+ * Quarkus).
*/
- public HttpServerAuthenticationConfigurationProperties authentication() {
- if (authentication == null) {
- authentication = new
HttpServerAuthenticationConfigurationProperties(this);
- }
- return authentication;
+ public HttpServerConfigurationProperties withAuthenticationEnabled(boolean
authenticationEnabled) {
+ this.authenticationEnabled = authenticationEnabled;
+ return this;
}
/**
- * To configure embedded HTTP server authentication (for standalone
applications; not Spring Boot or Quarkus)
+ * Set HTTP url path of embedded server that is protected by
authentication configuration.
*/
- public HttpServerAuthenticationConfigurationProperties getAuthentication()
{
- return authentication;
+ public HttpServerConfigurationProperties withAuthenticationPath(String
authenticationPath) {
+ this.authenticationPath = authenticationPath;
+ return this;
}
/**
- * To configure embedded HTTP server authentication (for standalone
applications; not Spring Boot or Quarkus)
+ * Name of the file that contains basic authentication info for Vert.x
file auth provider.
*/
- public void setAuthentication(
- HttpServerAuthenticationConfigurationProperties authentication) {
- this.authentication = authentication;
+ public HttpServerConfigurationProperties withBasicPropertiesFile(String
basicPropertiesFile) {
+ this.basicPropertiesFile = basicPropertiesFile;
+ return this;
+ }
+
+ /**
+ * Type of the keystore used for JWT tokens validation (jks, pkcs12, etc.).
+ */
+ public HttpServerConfigurationProperties withJwtKeystoreType(String
jwtKeystoreType) {
+ this.jwtKeystoreType = jwtKeystoreType;
+ return this;
}
/**
- * To configure embedded HTTP server authentication (for standalone
applications; not Spring Boot or Quarkus)
+ * Path to the keystore file used for JWT tokens validation.
*/
- public HttpServerConfigurationProperties withAuthentication(
- HttpServerAuthenticationConfigurationProperties authentication) {
- this.authentication = authentication;
+ public HttpServerConfigurationProperties withJwtKeystorePath(String
jwtKeystorePath) {
+ this.jwtKeystorePath = jwtKeystorePath;
return this;
}
+
+ /**
+ * Password from the keystore used for JWT tokens validation.
+ */
+ public HttpServerConfigurationProperties withJwtKeystorePassword(String
jwtKeystorePassword) {
+ this.jwtKeystorePassword = jwtKeystorePassword;
+ return this;
+ }
+
}
diff --git
a/core/camel-main/src/main/java/org/apache/camel/main/HttpServerJWTAuthenticationConfigurationProperties.java
b/core/camel-main/src/main/java/org/apache/camel/main/HttpServerJWTAuthenticationConfigurationProperties.java
deleted file mode 100644
index 0ac37c6d473..00000000000
---
a/core/camel-main/src/main/java/org/apache/camel/main/HttpServerJWTAuthenticationConfigurationProperties.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.main;
-
-import org.apache.camel.spi.BootstrapCloseable;
-import org.apache.camel.spi.Configurer;
-
-import static org.apache.camel.util.ObjectHelper.isNotEmpty;
-
-/**
- * JWT HTTP authentication for embedded server.
- */
-@Configurer(bootstrap = true)
-public class HttpServerJWTAuthenticationConfigurationProperties
- implements ConfigurationPropertiesWithMandatoryFields,
BootstrapCloseable {
-
- private String keystoreType;
-
- private String keystorePath;
-
- private String keystorePassword;
-
- private HttpServerAuthenticationConfigurationProperties parent;
-
- public
HttpServerJWTAuthenticationConfigurationProperties(HttpServerAuthenticationConfigurationProperties
parent) {
- this.parent = parent;
- }
-
- public String getKeystoreType() {
- return keystoreType;
- }
-
- /**
- * Type of the keystore used for JWT tokens validation (jks, pkcs12, etc.).
- */
- public void setKeystoreType(String keystoreType) {
- this.keystoreType = keystoreType;
- }
-
- /**
- * Type of the keystore used for JWT tokens validation (jks, pkcs12, etc.).
- */
- public HttpServerJWTAuthenticationConfigurationProperties
withKeystoreType(String keystoreType) {
- this.keystoreType = keystoreType;
- return this;
- }
-
- public String getKeystorePath() {
- return keystorePath;
- }
-
- /**
- * Path to the keystore file used for JWT tokens validation.
- */
- public void setKeystorePath(String keystorePath) {
- this.keystorePath = keystorePath;
- }
-
- /**
- * Path to the keystore file used for JWT tokens validation.
- */
- public HttpServerJWTAuthenticationConfigurationProperties
withKeystorePath(String keystorePath) {
- this.keystorePath = keystorePath;
- return this;
- }
-
- public String getKeystorePassword() {
- return keystorePassword;
- }
-
- /**
- * Password from the keystore used for JWT tokens validation.
- */
- public void setKeystorePassword(String keystorePassword) {
- this.keystorePassword = keystorePassword;
- }
-
- /**
- * Password from the keystore used for JWT tokens validation.
- */
- public HttpServerJWTAuthenticationConfigurationProperties
withKeystorePassword(String keystorePassword) {
- this.keystorePassword = keystorePassword;
- return this;
- }
-
- @Override
- public void close() {
- parent = null;
- }
-
- @Override
- public boolean areMandatoryFieldsFilled() {
- return isNotEmpty(keystoreType) && isNotEmpty(keystorePath) &&
isNotEmpty(keystorePassword);
- }
-}