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 2024/08/18 09:38:05 UTC
(camel) 01/01: CAMEL-20774: Add configuration of existing keystore instance to Spring XML DSL
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch keystore-xml
in repository https://gitbox.apache.org/repos/asf/camel.git
commit ee2506fb378dca77cd5334905e2aff07af2c6675
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun Aug 18 11:32:03 2024 +0200
CAMEL-20774: Add configuration of existing keystore instance to Spring XML DSL
---
.../main/camel-main-configuration-metadata.json | 4 +-
.../apache/camel/catalog/schemas/camel-spring.xsd | 40 +++++++-----
.../camel/spring/xml/keyStoreParameters.json | 11 ++--
.../camel/spring/xml/secureRandomParameters.json | 4 +-
.../camel/spring/xml/sslContextParameters.json | 6 +-
.../KeyStoreParametersFactoryBeanTest-context.xml | 2 -
.../camel/support/jsse/KeyManagersParameters.java | 56 +++--------------
.../camel/support/jsse/KeyStoreParameters.java | 73 +++++++---------------
.../support/jsse/SSLContextClientParameters.java | 5 +-
.../camel/support/jsse/SSLContextParameters.java | 12 ++--
.../support/jsse/SSLContextServerParameters.java | 8 ---
.../camel/support/jsse/SecureRandomParameters.java | 24 +------
.../support/jsse/TrustManagersParameters.java | 30 ++-------
.../AbstractKeyManagersParametersFactoryBean.java | 12 ++--
.../AbstractKeyStoreParametersFactoryBean.java | 46 +++++++++-----
.../AbstractSSLContextParametersFactoryBean.java | 11 ++--
...tractSSLContextServerParametersFactoryBean.java | 3 +-
.../AbstractSecureRandomParametersFactoryBean.java | 8 +--
...AbstractTrustManagersParametersFactoryBean.java | 13 ++--
.../jsse/CipherSuitesParametersDefinition.java | 3 +
.../SecureSocketProtocolsParametersDefinition.java | 6 +-
.../camel-main-configuration-metadata.json | 4 +-
core/camel-main/src/main/docs/main.adoc | 4 +-
.../org/apache/camel/main/BaseMainSupport.java | 7 +--
.../camel/main/SSLConfigurationProperties.java | 8 ++-
25 files changed, 160 insertions(+), 240 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 a3855ebe4d7..6a6a55e1292 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
@@ -284,14 +284,14 @@
{ "name": "camel.ssl.enabled", "description": "Enables SSL in your Camel application.", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" },
{ "name": "camel.ssl.keyManagerAlgorithm", "description": "Algorithm name used for creating the KeyManagerFactory. See https:\/\/docs.oracle.com\/en\/java\/javase\/17\/docs\/specs\/security\/standard-names.html", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "string", "javaType": "java.lang.String" },
{ "name": "camel.ssl.keyManagerProvider", "description": "To use a specific provider for creating KeyManagerFactory. The list of available providers returned by java.security.Security.getProviders() or null to use the highest priority provider implementing the secure socket protocol.", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "string", "javaType": "java.lang.String" },
- { "name": "camel.ssl.keyStore", "description": "The file path, class path resource, or URL of the resource used to load the key store. An existing java.security.KeyStore can also be referred using #bean:name syntax.", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "string", "javaType": "java.lang.String" },
+ { "name": "camel.ssl.keyStore", "description": "The file path, class path resource, or URL of the resource used to load the key store. file:nameOfFile - to refer to the file system classpath:nameOfFile - to refer to the classpath (default) http:uri - to load the resource using HTTP ref:nameOfBean - to lookup an existing KeyStore instance from the registry.", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "string", "javaType": "java.lang.String" },
{ "name": "camel.ssl.keystorePassword", "description": "Sets the SSL Keystore password.", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "string", "javaType": "java.lang.String" },
{ "name": "camel.ssl.keyStoreProvider", "description": "To use a specific provider for creating KeyStore. The list of available providers returned by java.security.Security.getProviders() or null to use the highest priority provider implementing the secure socket protocol.", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "string", "javaType": "java.lang.String" },
{ "name": "camel.ssl.keyStoreType", "description": "The type of the key store to load. See https:\/\/docs.oracle.com\/en\/java\/javase\/17\/docs\/specs\/security\/standard-names.html", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "string", "javaType": "java.lang.String" },
{ "name": "camel.ssl.provider", "description": "To use a specific provider for creating SSLContext. The list of available providers returned by java.security.Security.getProviders() or null to use the highest priority provider implementing the secure socket protocol.", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "string", "javaType": "java.lang.String" },
{ "name": "camel.ssl.secureRandomAlgorithm", "description": "Algorithm name used for creating the SecureRandom. See https:\/\/docs.oracle.com\/en\/java\/javase\/17\/docs\/specs\/security\/standard-names.html", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "string", "javaType": "java.lang.String" },
{ "name": "camel.ssl.secureRandomProvider", "description": "To use a specific provider for creating SecureRandom. The list of available providers returned by java.security.Security.getProviders() or null to use the highest priority provider implementing the secure socket protocol.", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "string", "javaType": "java.lang.String" },
- { "name": "camel.ssl.secureSocketProtocol", "description": "The optional protocol for the secure sockets created by the SSLContext. See https:\/\/docs.oracle.com\/en\/java\/javase\/17\/docs\/specs\/security\/standard-names.html", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "TLSv1.3" },
+ { "name": "camel.ssl.secureSocketProtocol", "description": "The protocol for the secure sockets created by the SSLContext. See https:\/\/docs.oracle.com\/en\/java\/javase\/17\/docs\/specs\/security\/standard-names.html", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "TLSv1.3" },
{ "name": "camel.ssl.sessionTimeout", "description": "Timeout in seconds to use for SSLContext. The default is 24 hours.", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "integer", "javaType": "int", "defaultValue": 86400 },
{ "name": "camel.ssl.trustStore", "description": "The file path, class path resource, or URL of the resource used to load the trust store. An existing java.security.KeyStore can also be referred using #bean:name syntax.", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "string", "javaType": "java.lang.String" },
{ "name": "camel.ssl.trustStorePassword", "description": "Sets the SSL Truststore password.", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "string", "javaType": "java.lang.String" },
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
index 5b85cda3304..82642faec57 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
@@ -3370,12 +3370,14 @@ the rules must return true. Default value: false
<xs:complexContent>
<xs:extension base="tns:abstractJsseUtilFactoryBean">
<xs:sequence/>
- <xs:attribute name="type" type="xs:string">
+ <xs:attribute name="resource" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="en">
<![CDATA[
-The optional type of the key store to load. See Appendix A in the Java Cryptography Architecture Standard Algorithm Name
-Documentation for more information on standard names.
+The keystore to load. The keystore is by default loaded from classpath. If you must load from file system, then use
+file: as prefix. file:nameOfFile (to refer to the file system) classpath:nameOfFile (to refer to the classpath; default)
+http:uri (to load the resource using HTTP) ref:nameOfBean (to lookup an existing KeyStore instance from the registry,
+for example for testing and development).
]]>
</xs:documentation>
</xs:annotation>
@@ -3384,7 +3386,17 @@ Documentation for more information on standard names.
<xs:annotation>
<xs:documentation xml:lang="en">
<![CDATA[
-The optional password for reading/opening/verifying the key store.
+The password for reading/opening/verifying the key store.
+]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="type" type="xs:string">
+ <xs:annotation>
+ <xs:documentation xml:lang="en">
+<![CDATA[
+The type of the key store to create and load. See
+https://docs.oracle.com/en/java/javase/17/docs/specs/security/standard-names.html.
]]>
</xs:documentation>
</xs:annotation>
@@ -3393,16 +3405,16 @@ The optional password for reading/opening/verifying the key store.
<xs:annotation>
<xs:documentation xml:lang="en">
<![CDATA[
-The optional provider identifier for instantiating the key store.
+The provider identifier for instantiating the key store.
]]>
</xs:documentation>
</xs:annotation>
</xs:attribute>
- <xs:attribute name="resource" type="xs:string">
+ <xs:attribute name="keyStore" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="en">
<![CDATA[
-The optional file path, class path resource, or URL of the resource used to load the key store.
+To lookup an existing KeyStore instance from the registry, for example for testing and development.
]]>
</xs:documentation>
</xs:annotation>
@@ -3419,8 +3431,8 @@ The optional file path, class path resource, or URL of the resource used to load
<xs:documentation xml:lang="en">
<![CDATA[
The Random Number Generator algorithm identifier for the SecureRandom factory method used to create the SecureRandom
-represented by this object's configuration. See Appendix A in the Java Cryptography Architecture API Specification and
-Reference guide for information about standard RNG algorithm names.
+represented by this object's configuration. See
+https://docs.oracle.com/en/java/javase/17/docs/specs/security/standard-names.html.
]]>
</xs:documentation>
</xs:annotation>
@@ -3429,8 +3441,8 @@ Reference guide for information about standard RNG algorithm names.
<xs:annotation>
<xs:documentation xml:lang="en">
<![CDATA[
-The optional provider identifier for the SecureRandom factory method used to create the SecureRandom represented by this
-object's configuration.
+The provider identifier for the SecureRandom factory method used to create the SecureRandom represented by this object's
+configuration.
]]>
</xs:documentation>
</xs:annotation>
@@ -18177,7 +18189,7 @@ The optional SSLSessionContext timeout time for javax.net.ssl.SSLSession in seco
<xs:annotation>
<xs:documentation xml:lang="en">
<![CDATA[
-The optional provider identifier for the JSSE implementation to use when constructing an SSLContext.
+The provider identifier for the JSSE implementation to use when constructing an SSLContext.
]]>
</xs:documentation>
</xs:annotation>
@@ -18186,8 +18198,8 @@ The optional provider identifier for the JSSE implementation to use when constru
<xs:annotation>
<xs:documentation xml:lang="en">
<![CDATA[
-The optional protocol for the secure sockets created by the SSLContext represented by this instance's configuration. See
-Appendix A in the Java Secure Socket Extension Reference Guide for information about standard protocol names.
+The protocol for the secure sockets created by the SSLContext represented by this instance's configuration. See
+https://docs.oracle.com/en/java/javase/17/docs/specs/security/standard-names.html.
]]>
</xs:documentation>
</xs:annotation>
diff --git a/components/camel-spring-xml/src/generated/resources/META-INF/org/apache/camel/spring/xml/keyStoreParameters.json b/components/camel-spring-xml/src/generated/resources/META-INF/org/apache/camel/spring/xml/keyStoreParameters.json
index 4c9ddb6e9d2..4da11dce0eb 100644
--- a/components/camel-spring-xml/src/generated/resources/META-INF/org/apache/camel/spring/xml/keyStoreParameters.json
+++ b/components/camel-spring-xml/src/generated/resources/META-INF/org/apache/camel/spring/xml/keyStoreParameters.json
@@ -13,10 +13,11 @@
},
"properties": {
"id": { "index": 0, "kind": "attribute", "displayName": "Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The id of this node" },
- "type": { "index": 1, "kind": "attribute", "displayName": "Type", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The optional type of the key store to load. See Appendix A in the Java Cryptography Architecture Standard Algorithm Name Documentation for more information on standard names." },
- "password": { "index": 2, "kind": "attribute", "displayName": "Password", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The optional password for reading\/opening\/verifying the key store" },
- "provider": { "index": 3, "kind": "attribute", "displayName": "Provider", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The optional provider identifier for instantiating the key store" },
- "resource": { "index": 4, "kind": "attribute", "displayName": "Resource", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The optional file path, class path resource, or URL of the resource used to load the key store" },
- "camelContextId": { "index": 5, "kind": "attribute", "displayName": "Camel Context Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Id of CamelContext to use if there are multiple CamelContexts in the same JVM" }
+ "resource": { "index": 1, "kind": "attribute", "displayName": "Resource", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The keystore to load. The keystore is by default loaded from classpath. If you must load from file system, then use file: as prefix. file:nameOfFile (to refer to the file system) classpath:nameOfFile (to refer to the classpath; default) http:uri (to lo [...]
+ "password": { "index": 2, "kind": "attribute", "displayName": "Password", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The password for reading\/opening\/verifying the key store" },
+ "type": { "index": 3, "kind": "attribute", "displayName": "Type", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The type of the key store to create and load. See https:\/\/docs.oracle.com\/en\/java\/javase\/17\/docs\/specs\/security\/standard-names.html" },
+ "provider": { "index": 4, "kind": "attribute", "displayName": "Provider", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The provider identifier for instantiating the key store" },
+ "keyStore": { "index": 5, "kind": "attribute", "displayName": "Key Store", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To lookup an existing KeyStore instance from the registry, for example for testing and development" },
+ "camelContextId": { "index": 6, "kind": "attribute", "displayName": "Camel Context Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Id of CamelContext to use if there are multiple CamelContexts in the same JVM" }
}
}
diff --git a/components/camel-spring-xml/src/generated/resources/META-INF/org/apache/camel/spring/xml/secureRandomParameters.json b/components/camel-spring-xml/src/generated/resources/META-INF/org/apache/camel/spring/xml/secureRandomParameters.json
index 4603f5aba28..fdbd0daf82d 100644
--- a/components/camel-spring-xml/src/generated/resources/META-INF/org/apache/camel/spring/xml/secureRandomParameters.json
+++ b/components/camel-spring-xml/src/generated/resources/META-INF/org/apache/camel/spring/xml/secureRandomParameters.json
@@ -13,8 +13,8 @@
},
"properties": {
"id": { "index": 0, "kind": "attribute", "displayName": "Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The id of this node" },
- "algorithm": { "index": 1, "kind": "attribute", "displayName": "Algorithm", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The Random Number Generator algorithm identifier for the SecureRandom factory method used to create the SecureRandom represented by this object's configuration. See Appendix A in the Java Cryptography Architecture API Specification and Reference guid [...]
- "provider": { "index": 2, "kind": "attribute", "displayName": "Provider", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The optional provider identifier for the SecureRandom factory method used to create the SecureRandom represented by this object's configuration." },
+ "algorithm": { "index": 1, "kind": "attribute", "displayName": "Algorithm", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The Random Number Generator algorithm identifier for the SecureRandom factory method used to create the SecureRandom represented by this object's configuration. See https:\/\/docs.oracle.com\/en\/java\/javase\/17\/docs\/specs\/security\/standard-name [...]
+ "provider": { "index": 2, "kind": "attribute", "displayName": "Provider", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The provider identifier for the SecureRandom factory method used to create the SecureRandom represented by this object's configuration." },
"camelContextId": { "index": 3, "kind": "attribute", "displayName": "Camel Context Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Id of CamelContext to use if there are multiple CamelContexts in the same JVM" }
}
}
diff --git a/components/camel-spring-xml/src/generated/resources/META-INF/org/apache/camel/spring/xml/sslContextParameters.json b/components/camel-spring-xml/src/generated/resources/META-INF/org/apache/camel/spring/xml/sslContextParameters.json
index 9f78dd56f24..febf4e41358 100644
--- a/components/camel-spring-xml/src/generated/resources/META-INF/org/apache/camel/spring/xml/sslContextParameters.json
+++ b/components/camel-spring-xml/src/generated/resources/META-INF/org/apache/camel/spring/xml/sslContextParameters.json
@@ -13,9 +13,9 @@
},
"properties": {
"id": { "index": 0, "kind": "attribute", "displayName": "Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The id of this node" },
- "provider": { "index": 1, "kind": "attribute", "displayName": "Provider", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The optional provider identifier for the JSSE implementation to use when constructing an SSLContext." },
- "secureSocketProtocol": { "index": 2, "kind": "attribute", "displayName": "Secure Socket Protocol", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The optional protocol for the secure sockets created by the SSLContext represented by this instance's configuration. See Appendix A in the Java Secure Socket Extension Reference Guide for information about standard protocol na [...]
- "certAlias": { "index": 3, "kind": "attribute", "displayName": "Cert Alias", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "An optional certificate alias to use. This is useful when the keystore has multiple certificates." },
+ "provider": { "index": 1, "kind": "attribute", "displayName": "Provider", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The provider identifier for the JSSE implementation to use when constructing an SSLContext." },
+ "secureSocketProtocol": { "index": 2, "kind": "attribute", "displayName": "Secure Socket Protocol", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The protocol for the secure sockets created by the SSLContext represented by this instance's configuration. See https:\/\/docs.oracle.com\/en\/java\/javase\/17\/docs\/specs\/security\/standard-names.html" },
+ "certAlias": { "index": 3, "kind": "attribute", "displayName": "Cert Alias", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "An optional certificate alias to use. This is useful when the keystore has multiple certificates." },
"sessionTimeout": { "index": 4, "kind": "attribute", "displayName": "Session Timeout", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The optional SSLSessionContext timeout time for javax.net.ssl.SSLSession in seconds." },
"camelContextId": { "index": 5, "kind": "attribute", "displayName": "Camel Context Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Id of CamelContext to use if there are multiple CamelContexts in the same JVM" }
}
diff --git a/components/camel-spring-xml/src/test/resources/org/apache/camel/util/spring/KeyStoreParametersFactoryBeanTest-context.xml b/components/camel-spring-xml/src/test/resources/org/apache/camel/util/spring/KeyStoreParametersFactoryBeanTest-context.xml
index 4b2675cc99d..187840ff45e 100644
--- a/components/camel-spring-xml/src/test/resources/org/apache/camel/util/spring/KeyStoreParametersFactoryBeanTest-context.xml
+++ b/components/camel-spring-xml/src/test/resources/org/apache/camel/util/spring/KeyStoreParametersFactoryBeanTest-context.xml
@@ -26,8 +26,6 @@
<camel:camelContext id="test"/>
- <camel:tr
-
<camel:keyStoreParameters
id="ksp"
resource="keystore.jks"
diff --git a/core/camel-api/src/main/java/org/apache/camel/support/jsse/KeyManagersParameters.java b/core/camel-api/src/main/java/org/apache/camel/support/jsse/KeyManagersParameters.java
index 064e08942d6..3a22524ba2a 100644
--- a/core/camel-api/src/main/java/org/apache/camel/support/jsse/KeyManagersParameters.java
+++ b/core/camel-api/src/main/java/org/apache/camel/support/jsse/KeyManagersParameters.java
@@ -34,30 +34,9 @@ public class KeyManagersParameters extends JsseParameters {
private static final Logger LOG = LoggerFactory.getLogger(KeyManagersParameters.class);
- /**
- * The key store configuration used to create the {@link KeyStoreParameters} that the {@link KeyManager}s produced
- * by this object's configuration expose.
- */
protected KeyStoreParameters keyStore;
-
- /**
- * The optional password for recovering keys in the key store. Used by the {@link KeyManagerFactory} that creates
- * the {@link KeyManager}s represented by this object's configuration.
- */
protected String keyPassword;
-
- /**
- * The optional provider identifier for the {@link KeyManagerFactory} used to create the {@link KeyManager}s
- * represented by this object's configuration.
- */
protected String provider;
-
- /**
- * The optional algorithm name for the {@link KeyManagerFactory} used to create the {@link KeyManager}s represented
- * by this object's configuration. See the
- * <a href= "http://download.oracle.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html" >Java Secure
- * Socket Extension Reference Guide</a> for information about standard algorithm names.
- */
protected String algorithm;
/**
@@ -74,9 +53,7 @@ public class KeyManagersParameters extends JsseParameters {
* @see KeyStoreParameters#createKeyStore()
*/
public KeyManager[] createKeyManagers() throws GeneralSecurityException, IOException {
-
LOG.trace("Creating KeyManager[] from KeyManagersParameters [{}].", this);
-
KeyManager[] keyManagers;
String kmfAlgorithm = this.parsePropertyValue(this.getAlgorithm());
@@ -109,16 +86,13 @@ public class KeyManagersParameters extends JsseParameters {
return keyManagers;
}
- /**
- * @see #setKeyStore(KeyStoreParameters)
- */
public KeyStoreParameters getKeyStore() {
return keyStore;
}
/**
- * Sets the key store configuration used to create the {@link KeyStore} that the {@link KeyManager}s produced by
- * this object's configuration expose.
+ * The key store configuration used to create the {@link KeyStore} that the {@link KeyManager}s produced by this
+ * object's configuration expose.
*
* @param value the configuration to use
*/
@@ -126,16 +100,13 @@ public class KeyManagersParameters extends JsseParameters {
this.keyStore = value;
}
- /**
- * @see #setKeyPassword(String)
- */
public String getKeyPassword() {
return keyPassword;
}
/**
- * Sets the optional password for recovering keys in the key store. Used by the {@link KeyManagerFactory} that
- * creates the {@link KeyManager}s represented by this object's configuration.
+ * The password for recovering keys in the key store. Used by the {@link KeyManagerFactory} that creates the
+ * {@link KeyManager}s represented by this object's configuration.
*
* @param value the value to use
*/
@@ -143,16 +114,13 @@ public class KeyManagersParameters extends JsseParameters {
this.keyPassword = value;
}
- /**
- * @see #setProvider(String)
- */
public String getProvider() {
return provider;
}
/**
- * Sets the optional provider identifier for the {@link KeyManagerFactory} used to create the {@link KeyManager}s
- * represented by this object's configuration.
+ * The provider identifier for the {@link KeyManagerFactory} used to create the {@link KeyManager}s represented by
+ * this object's configuration.
*
* @param value the desired provider identifier or {@code null} to use the highest priority provider implementing
* the algorithm
@@ -163,21 +131,17 @@ public class KeyManagersParameters extends JsseParameters {
this.provider = value;
}
- /**
- * @see KeyManagerFactory#getDefaultAlgorithm()
- */
public String getAlgorithm() {
return algorithm;
}
/**
- * Sets optional algorithm name for the {@link KeyManagerFactory} used to create the {@link KeyManager}s represented
- * by this object's configuration. See the
- * <a href= "http://download.oracle.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html" >Java Secure
- * Socket Extension Reference Guide</a> for information about standard algorithm names.
+ * The algorithm name for the {@link KeyManagerFactory} used to create the {@link KeyManager}s represented by this
+ * object's configuration. See the
*
- * @param value the desired algorithm or {@code null} to use default
+ * See https://docs.oracle.com/en/java/javase/17/docs/specs/security/standard-names.html
*
+ * @param value the desired algorithm or {@code null} to use default
* @see KeyManagerFactory#getDefaultAlgorithm()
*/
public void setAlgorithm(String value) {
diff --git a/core/camel-api/src/main/java/org/apache/camel/support/jsse/KeyStoreParameters.java b/core/camel-api/src/main/java/org/apache/camel/support/jsse/KeyStoreParameters.java
index b474dd0bc6d..113c246b07a 100644
--- a/core/camel-api/src/main/java/org/apache/camel/support/jsse/KeyStoreParameters.java
+++ b/core/camel-api/src/main/java/org/apache/camel/support/jsse/KeyStoreParameters.java
@@ -36,107 +36,68 @@ public class KeyStoreParameters extends JsseParameters {
private static final Logger LOG = LoggerFactory.getLogger(KeyStoreParameters.class);
- /**
- * The optional type of the key store to load. See Appendix A in the
- * <a href="http://download.oracle.com/javase/6/docs/technotes/guides/security/StandardNames.html#KeyStore"> Java
- * Cryptography Architecture Standard Algorithm Name Documentation</a> for more information on standard names.
- */
protected String type;
-
- /**
- * The optional password for reading/opening/verifying the key store.
- */
protected String password;
-
- /**
- * The optional provider identifier for instantiating the key store.
- */
protected String provider;
-
- /**
- * The optional key store, which has higher priority then value in resource below. If keyStore is non-null, resource
- * isn't taken into account. This is helpful say for in-memory KeyStore composed by the user "on the fly".
- */
protected KeyStore keyStore;
-
- /**
- * The optional file path, class path resource, or URL of the resource used to load the key store.
- */
protected String resource;
- /**
- * @see #setType(String)
- */
public String getType() {
return type;
}
/**
- * Sets the type of the key store to create and load. See Appendix A in the
- * <a href="http://download.oracle.com/javase/6/docs/technotes/guides/security/StandardNames.html#KeyStore" >Java
- * Cryptography Architecture Standard Algorithm Name Documentation</a> for more information on standard names.
+ * The type of the key store to create and load.
*
- * @param value the key store type identifier (may be {@code null})
+ * See https://docs.oracle.com/en/java/javase/17/docs/specs/security/standard-names.html
*/
public void setType(String value) {
this.type = value;
}
- /**
- * @see #getPassword()
- */
public String getPassword() {
return password;
}
/**
- * Set the optional password for reading/opening/verifying the key store.
- *
- * @param value the password value (may be {@code null})
+ * The password for reading/opening/verifying the key store.
*/
public void setPassword(String value) {
this.password = value;
}
- /**
- * @see #setProvider(String)
- */
public String getProvider() {
return provider;
}
/**
- * Sets the optional provider identifier for instantiating the key store.
- *
- * @param value the provider identifier (may be {@code null})
+ * The provider identifier for instantiating the key store.
*
- * @see Security#getProviders()
+ * @see Security#getProviders()
*/
public void setProvider(String value) {
this.provider = value;
}
- /**
- * @see #getResource()
- */
public String getResource() {
return resource;
}
/**
- * Sets the optional file path, class path resource, or URL of the resource used to load the key store.
+ * The keystore to load.
*
- * @param value the resource (may be {@code null})
+ * The keystore is by default loaded from classpath. If you must load from file system, then use file: as prefix.
+ *
+ * file:nameOfFile (to refer to the file system) classpath:nameOfFile (to refer to the classpath; default) http:uri
+ * (to load the resource using HTTP) ref:nameOfBean (to lookup an existing KeyStore instance from the registry, for
+ * example for testing and development).
*/
public void setResource(String value) {
this.resource = value;
}
/**
- * Sets the optional key store, which has higher priority then value in resource. NB Don't forget to call
- * setPassword() for password of this KeyStore.
- *
- * @param keyStore the KeyStore (may be {@code null})
+ * To use an existing KeyStore instead of loading. You must also set password so this keystore can be used.
*/
public void setKeyStore(KeyStore keyStore) {
this.keyStore = keyStore;
@@ -157,6 +118,14 @@ public class KeyStoreParameters extends JsseParameters {
* @throws IOException if there is an error resolving the configured resource to an input stream
*/
public KeyStore createKeyStore() throws GeneralSecurityException, IOException {
+ if (this.resource != null) {
+ this.resource = this.parsePropertyValue(this.resource);
+ }
+
+ if (this.keyStore == null && this.resource != null && this.resource.startsWith("ref:")) {
+ String ref = this.resource.substring(4);
+ this.keyStore = getCamelContext().getRegistry().lookupByNameAndType(ref, KeyStore.class);
+ }
if (keyStore != null) {
if (LOG.isDebugEnabled()) {
List<String> aliases = extractAliases(keyStore);
@@ -189,7 +158,7 @@ public class KeyStoreParameters extends JsseParameters {
if (this.resource == null) {
ks.load(null, ksPassword);
} else {
- InputStream is = this.resolveResource(this.parsePropertyValue(this.resource));
+ InputStream is = this.resolveResource(this.resource);
if (is == null) {
LOG.warn("No keystore could be found at {}.", this.resource);
} else {
diff --git a/core/camel-api/src/main/java/org/apache/camel/support/jsse/SSLContextClientParameters.java b/core/camel-api/src/main/java/org/apache/camel/support/jsse/SSLContextClientParameters.java
index ffbcaa17656..f2935566b72 100644
--- a/core/camel-api/src/main/java/org/apache/camel/support/jsse/SSLContextClientParameters.java
+++ b/core/camel-api/src/main/java/org/apache/camel/support/jsse/SSLContextClientParameters.java
@@ -37,6 +37,9 @@ public class SSLContextClientParameters extends BaseSSLContextParameters {
private static final Logger LOG = LoggerFactory.getLogger(SSLContextClientParameters.class);
+ /**
+ * SNI hostnames to be used for SSL (Server Name Indicator)
+ */
private final List<SNIServerName> sniHostNames = new ArrayList<>();
public void addAllSniHostNames(List<String> sniHostNames) {
@@ -71,8 +74,6 @@ public class SSLContextClientParameters extends BaseSSLContextParameters {
}
/**
- * {@inheritDoc}
- * <p/>
* This implementation returns the empty list as the enabled cipher suites and protocols are not client and server
* side specific in an {@code SSLEngine}. Consequently, overriding them here would be a bit odd as the client side
* specific configuration shouldn't really override a shared client/server configuration option.
diff --git a/core/camel-api/src/main/java/org/apache/camel/support/jsse/SSLContextParameters.java b/core/camel-api/src/main/java/org/apache/camel/support/jsse/SSLContextParameters.java
index 3ea967d6082..bfea52034db 100644
--- a/core/camel-api/src/main/java/org/apache/camel/support/jsse/SSLContextParameters.java
+++ b/core/camel-api/src/main/java/org/apache/camel/support/jsse/SSLContextParameters.java
@@ -85,9 +85,9 @@ public class SSLContextParameters extends BaseSSLContextParameters {
/**
* The optional protocol for the secure sockets created by the {@link SSLContext} represented by this instance's
- * configuration. See Appendix A in the
- * <a href="http://download.oracle.com/javase/6/docs/technotes/guides//security/jsse/JSSERefGuide.html#AppA" >Java
- * Secure Socket Extension Reference Guide</a> for information about standard protocol names.
+ * configuration.
+ *
+ * See https://docs.oracle.com/en/java/javase/17/docs/specs/security/standard-names.html
*/
private String secureSocketProtocol;
@@ -196,9 +196,9 @@ public class SSLContextParameters extends BaseSSLContextParameters {
/**
* Sets the optional protocol for the secure sockets created by the {@link SSLContext} represented by this
- * instance's configuration. Defaults to TLS. See Appendix A in the
- * <a href= "http://download.oracle.com/javase/6/docs/technotes/guides//security/jsse/JSSERefGuide.html#AppA" >Java
- * Secure Socket Extension Reference Guide</a> for information about standard protocol names.
+ * instance's configuration. Defaults to TLS.
+ *
+ * See https://docs.oracle.com/en/java/javase/17/docs/specs/security/standard-names.html
*
* @param secureSocketProtocol the name of the protocol or {@code null} to use the default (TLS)
*/
diff --git a/core/camel-api/src/main/java/org/apache/camel/support/jsse/SSLContextServerParameters.java b/core/camel-api/src/main/java/org/apache/camel/support/jsse/SSLContextServerParameters.java
index c160e2c6eb4..7531b5e2907 100644
--- a/core/camel-api/src/main/java/org/apache/camel/support/jsse/SSLContextServerParameters.java
+++ b/core/camel-api/src/main/java/org/apache/camel/support/jsse/SSLContextServerParameters.java
@@ -34,14 +34,8 @@ public class SSLContextServerParameters extends BaseSSLContextParameters {
private static final Logger LOG = LoggerFactory.getLogger(SSLContextServerParameters.class);
- /**
- * The optional configuration options for server-side client-authentication requirements.
- */
protected String clientAuthentication;
- /**
- * @see #setClientAuthentication(String)
- */
public String getClientAuthentication() {
return clientAuthentication;
}
@@ -73,8 +67,6 @@ public class SSLContextServerParameters extends BaseSSLContextParameters {
}
/**
- * {@inheritDoc}
- * <p/>
* This implementation allows for configuration of the need and want settings for client authentication, but ignores
* the enabled cipher suites and protocols as they are not client and server side specific in an {@code SSLEngine}.
* Consequently, overriding them here would be a bit odd as the server side specific configuration shouldn't really
diff --git a/core/camel-api/src/main/java/org/apache/camel/support/jsse/SecureRandomParameters.java b/core/camel-api/src/main/java/org/apache/camel/support/jsse/SecureRandomParameters.java
index 123e7710229..48c3fbfff64 100644
--- a/core/camel-api/src/main/java/org/apache/camel/support/jsse/SecureRandomParameters.java
+++ b/core/camel-api/src/main/java/org/apache/camel/support/jsse/SecureRandomParameters.java
@@ -27,19 +27,7 @@ public class SecureRandomParameters extends JsseParameters {
private static final Logger LOG = LoggerFactory.getLogger(SecureRandomParameters.class);
- /**
- * The Random Number Generator algorithm identifier for the {@link SecureRandom} factory method used to create the
- * {@link SecureRandom} represented by this object's configuration. See Appendix A in the
- * <a href= "http://download.oracle.com/javase/6/docs/technotes/guides/security/crypto/CryptoSpec.html#AppA" > Java
- * Cryptography Architecture API Specification & Reference</a> for information about standard RNG algorithm
- * names.
- */
protected String algorithm;
-
- /**
- * The optional provider identifier for the {@link SecureRandom} factory method used to create the
- * {@link SecureRandom} represented by this object's configuration.
- */
protected String provider;
/**
@@ -67,18 +55,15 @@ public class SecureRandomParameters extends JsseParameters {
return secureRandom;
}
- /**
- * @see #setAlgorithm(String)
- */
public String getAlgorithm() {
return algorithm;
}
/**
* Sets the Random Number Generator (RNG) algorithm identifier for the {@link SecureRandom} factory method used to
- * create the {@link SecureRandom} represented by this object's configuration. See Appendix A in the
- * <a href= "http://download.oracle.com/javase/6/docs/technotes/guides/security/crypto/CryptoSpec.html#AppA" > Java
- * Cryptography Architecture Reference Guide</a> for information about standard RNG algorithm names.
+ * create the {@link SecureRandom} represented by this object's configuration.
+ *
+ * See https://docs.oracle.com/en/java/javase/17/docs/specs/security/standard-names.html
*
* @param value the algorithm identifier
*/
@@ -86,9 +71,6 @@ public class SecureRandomParameters extends JsseParameters {
this.algorithm = value;
}
- /**
- * @see #setProvider(String)
- */
public String getProvider() {
return provider;
}
diff --git a/core/camel-api/src/main/java/org/apache/camel/support/jsse/TrustManagersParameters.java b/core/camel-api/src/main/java/org/apache/camel/support/jsse/TrustManagersParameters.java
index 76d9a322c34..43acae5ad05 100644
--- a/core/camel-api/src/main/java/org/apache/camel/support/jsse/TrustManagersParameters.java
+++ b/core/camel-api/src/main/java/org/apache/camel/support/jsse/TrustManagersParameters.java
@@ -31,30 +31,9 @@ public class TrustManagersParameters extends JsseParameters {
private static final Logger LOG = LoggerFactory.getLogger(TrustManagersParameters.class);
- /**
- * The key store configuration used to create the {@link KeyStoreParameters} that the {@link TrustManager}s produced
- * by this object's configuration expose.
- */
protected KeyStoreParameters keyStore;
-
- /**
- * The optional provider identifier for the {@link TrustManagerFactory} used to create the {@link TrustManager}s
- * represented by this object's configuration.
- */
protected String provider;
-
- /**
- * The optional algorithm name for the {@link TrustManagerFactory} used to create the {@link TrustManager}s
- * represented by this object's configuration. See the
- * <a href= "http://download.oracle.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html" >Java Secure
- * Socket Extension Reference Guide</a> for information about standard algorithm names.
- */
protected String algorithm;
-
- /**
- * To use a existing configured trust manager instead of using {@link TrustManagerFactory} to get the
- * {@link TrustManager}.
- */
protected TrustManager trustManager;
/**
@@ -143,12 +122,11 @@ public class TrustManagersParameters extends JsseParameters {
/**
* Sets optional algorithm name for the {@link TrustManagerFactory} used to create the {@link TrustManager}s
- * represented by this object's configuration. See the
- * <a href= "http://download.oracle.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html" >Java Secure
- * Socket Extension Reference Guide</a> for information about standard algorithm names.
+ * represented by this object's configuration.
*
- * @param value the desired algorithm or {@code null} to use default
+ * See https://docs.oracle.com/en/java/javase/17/docs/specs/security/standard-names.html
*
+ * @param value the desired algorithm or {@code null} to use default
* @see TrustManagerFactory#getDefaultAlgorithm()
*/
public void setAlgorithm(String value) {
@@ -160,7 +138,7 @@ public class TrustManagersParameters extends JsseParameters {
}
/**
- * To use a existing configured trust manager instead of using {@link TrustManagerFactory} to get the
+ * To use an existing configured trust manager instead of using {@link TrustManagerFactory} to get the
* {@link TrustManager}.
*/
public void setTrustManager(TrustManager trustManager) {
diff --git a/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/AbstractKeyManagersParametersFactoryBean.java b/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/AbstractKeyManagersParametersFactoryBean.java
index afeab2d4101..1c823c541b3 100644
--- a/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/AbstractKeyManagersParametersFactoryBean.java
+++ b/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/AbstractKeyManagersParametersFactoryBean.java
@@ -33,19 +33,19 @@ import org.apache.camel.support.jsse.KeyManagersParameters;
public abstract class AbstractKeyManagersParametersFactoryBean extends AbstractJsseUtilFactoryBean<KeyManagersParameters> {
@XmlAttribute
- @Metadata(description = "The optional password for recovering keys in the key store. Used by the KeyManagerFactory"
+ @Metadata(description = "The password for recovering keys in the key store. Used by the KeyManagerFactory"
+ " that creates the KeyManagers represented by this object's configuration.")
protected String keyPassword;
@XmlAttribute
- @Metadata(description = "The optional provider identifier for the KeyManagerFactory"
- + " used to create the KeyManagers represented by this object's configuration.")
+ @Metadata(label = "advanced", description = "The provider identifier for the KeyManagerFactory"
+ + " used to create the KeyManagers represented by this object's configuration.")
protected String provider;
@XmlAttribute
- @Metadata(description = "The optional algorithm name for the KeyManagerFactory used to create"
- + " the KeyManagers represented by this object's configuration."
- + " See the Java Secure Socket Extension Reference Guide</a> for information about standard algorithm names.")
+ @Metadata(label = "advanced", description = "The algorithm name for the KeyManagerFactory used to create"
+ + " the KeyManagers represented by this object's configuration."
+ + " See https://docs.oracle.com/en/java/javase/17/docs/specs/security/standard-names.html")
protected String algorithm;
@XmlTransient
diff --git a/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/AbstractKeyStoreParametersFactoryBean.java b/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/AbstractKeyStoreParametersFactoryBean.java
index 41dfb6d1d79..0dcfe4dae55 100644
--- a/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/AbstractKeyStoreParametersFactoryBean.java
+++ b/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/AbstractKeyStoreParametersFactoryBean.java
@@ -16,33 +16,41 @@
*/
package org.apache.camel.core.xml.util.jsse;
+import java.security.KeyStore;
+
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlTransient;
import org.apache.camel.spi.Metadata;
+import org.apache.camel.support.CamelContextHelper;
import org.apache.camel.support.jsse.KeyStoreParameters;
@XmlAccessorType(XmlAccessType.FIELD)
public abstract class AbstractKeyStoreParametersFactoryBean extends AbstractJsseUtilFactoryBean<KeyStoreParameters> {
@XmlAttribute
- @Metadata(description = "The optional type of the key store to load."
- + " See Appendix A in the Java Cryptography Architecture Standard Algorithm Name Documentation for more information on standard names.")
- protected String type;
-
+ @Metadata(description = "The keystore to load. The keystore is by default loaded from classpath. If you must load from file system, then use file: as prefix."
+ + " file:nameOfFile (to refer to the file system)"
+ + " classpath:nameOfFile (to refer to the classpath; default)"
+ + " http:uri (to load the resource using HTTP)"
+ + " ref:nameOfBean (to lookup an existing KeyStore instance from the registry, for example for testing and development)")
+ protected String resource;
@XmlAttribute
- @Metadata(description = "The optional password for reading/opening/verifying the key store")
+ @Metadata(description = "The password for reading/opening/verifying the key store")
protected String password;
-
@XmlAttribute
- @Metadata(description = "The optional provider identifier for instantiating the key store")
+ @Metadata(label = "advanced", description = "The type of the key store to create and load."
+ + " See https://docs.oracle.com/en/java/javase/17/docs/specs/security/standard-names.html")
+ protected String type;
+ @XmlAttribute
+ @Metadata(label = "advanced", description = "The provider identifier for instantiating the key store")
protected String provider;
-
@XmlAttribute
- @Metadata(description = "The optional file path, class path resource, or URL of the resource used to load the key store")
- protected String resource;
+ @Metadata(label = "advanced",
+ description = "To lookup an existing KeyStore instance from the registry, for example for testing and development")
+ protected String keyStore;
@XmlTransient
private KeyStoreParameters instance;
@@ -79,6 +87,14 @@ public abstract class AbstractKeyStoreParametersFactoryBean extends AbstractJsse
this.resource = value;
}
+ public String getKeyStore() {
+ return keyStore;
+ }
+
+ public void setKeyStore(String keyStore) {
+ this.keyStore = keyStore;
+ }
+
@Override
public KeyStoreParameters getObject() throws Exception {
if (this.isSingleton()) {
@@ -93,13 +109,15 @@ public abstract class AbstractKeyStoreParametersFactoryBean extends AbstractJsse
protected KeyStoreParameters createInstance() {
KeyStoreParameters newInstance = new KeyStoreParameters();
-
+ newInstance.setCamelContext(getCamelContext());
+ newInstance.setType(this.type);
newInstance.setPassword(this.password);
newInstance.setProvider(this.provider);
newInstance.setResource(this.resource);
- newInstance.setType(this.type);
- newInstance.setCamelContext(getCamelContext());
-
+ if (keyStore != null) {
+ KeyStore ks = CamelContextHelper.mandatoryLookup(getCamelContext(), keyStore, KeyStore.class);
+ newInstance.setKeyStore(ks);
+ }
return newInstance;
}
diff --git a/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/AbstractSSLContextParametersFactoryBean.java b/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/AbstractSSLContextParametersFactoryBean.java
index 6fda08c5ebf..61b456418ec 100644
--- a/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/AbstractSSLContextParametersFactoryBean.java
+++ b/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/AbstractSSLContextParametersFactoryBean.java
@@ -30,16 +30,19 @@ public abstract class AbstractSSLContextParametersFactoryBean
extends AbstractBaseSSLContextParametersFactoryBean<SSLContextParameters> {
@XmlAttribute
- @Metadata(description = "The optional provider identifier for the JSSE implementation to use when constructing an SSLContext.")
+ @Metadata(label = "advanced",
+ description = "The provider identifier for the JSSE implementation to use when constructing an SSLContext.")
private String provider;
@XmlAttribute
- @Metadata(description = "The optional protocol for the secure sockets created by the SSLContext"
- + " represented by this instance's configuration. See Appendix A in the Java Secure Socket Extension Reference Guide for information about standard protocol names.")
+ @Metadata(label = "advanced", description = "The protocol for the secure sockets created by the SSLContext"
+ + " represented by this instance's configuration."
+ + " See https://docs.oracle.com/en/java/javase/17/docs/specs/security/standard-names.html")
private String secureSocketProtocol;
@XmlAttribute
- @Metadata(description = "An optional certificate alias to use. This is useful when the keystore has multiple certificates.")
+ @Metadata(label = "advanced",
+ description = "An optional certificate alias to use. This is useful when the keystore has multiple certificates.")
private String certAlias;
@Override
diff --git a/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/AbstractSSLContextServerParametersFactoryBean.java b/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/AbstractSSLContextServerParametersFactoryBean.java
index e7b6b95068a..c6e7bea7ae3 100644
--- a/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/AbstractSSLContextServerParametersFactoryBean.java
+++ b/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/AbstractSSLContextServerParametersFactoryBean.java
@@ -30,7 +30,8 @@ public abstract class AbstractSSLContextServerParametersFactoryBean
extends AbstractBaseSSLContextParametersFactoryBean<SSLContextServerParameters> {
@XmlAttribute
- @Metadata(description = "The optional configuration options for server-side client-authentication requirements.")
+ @Metadata(description = "The configuration options for server-side client-authentication requirements.",
+ enums = "NONE,WANT,REQUIRE")
protected String clientAuthentication;
public String getClientAuthentication() {
diff --git a/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/AbstractSecureRandomParametersFactoryBean.java b/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/AbstractSecureRandomParametersFactoryBean.java
index 6bad12bd3da..7b8ff961938 100644
--- a/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/AbstractSecureRandomParametersFactoryBean.java
+++ b/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/AbstractSecureRandomParametersFactoryBean.java
@@ -28,13 +28,13 @@ import org.apache.camel.support.jsse.SecureRandomParameters;
public abstract class AbstractSecureRandomParametersFactoryBean extends AbstractJsseUtilFactoryBean<SecureRandomParameters> {
@XmlAttribute(required = true)
- @Metadata(description = "The Random Number Generator algorithm identifier for the SecureRandom factory method used to create the SecureRandom represented by this object's configuration. "
- + "See Appendix A in the Java Cryptography Architecture API Specification and Reference guide for information about standard RNG algorithm names.")
+ @Metadata(description = "The Random Number Generator algorithm identifier for the SecureRandom factory method used to create the SecureRandom represented by this object's configuration."
+ + " See https://docs.oracle.com/en/java/javase/17/docs/specs/security/standard-names.html")
protected String algorithm;
@XmlAttribute
- @Metadata(description = "The optional provider identifier for the SecureRandom factory"
- + " method used to create the SecureRandom represented by this object's configuration.")
+ @Metadata(label = "advanced", description = "The provider identifier for the SecureRandom factory"
+ + " method used to create the SecureRandom represented by this object's configuration.")
protected String provider;
@XmlTransient
diff --git a/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/AbstractTrustManagersParametersFactoryBean.java b/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/AbstractTrustManagersParametersFactoryBean.java
index 98ca0ee142c..8b549f3cf32 100644
--- a/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/AbstractTrustManagersParametersFactoryBean.java
+++ b/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/AbstractTrustManagersParametersFactoryBean.java
@@ -31,18 +31,19 @@ import org.apache.camel.support.jsse.TrustManagersParameters;
public abstract class AbstractTrustManagersParametersFactoryBean extends AbstractJsseUtilFactoryBean<TrustManagersParameters> {
@XmlAttribute
- @Metadata(description = "The optional provider identifier for the TrustManagerFactory used to create"
- + " TrustManagers represented by this object's configuration.")
+ @Metadata(label = "advanced", description = "The provider identifier for the TrustManagerFactory used to create"
+ + " TrustManagers represented by this object's configuration.")
protected String provider;
@XmlAttribute
- @Metadata(description = "The optional algorithm name for the TrustManagerFactory used to"
- + " create the TrustManagers represented by this objects configuration."
- + " See the Java Secure Socket Extension Reference Guide for information about standard algorithm names.")
+ @Metadata(label = "advanced", description = "The optional algorithm name for the TrustManagerFactory used to"
+ + " create the TrustManagers represented by this objects configuration."
+ + " See https://docs.oracle.com/en/java/javase/17/docs/specs/security/standard-names.html")
protected String algorithm;
@XmlAttribute
- @Metadata(description = "To use a existing configured trust manager instead of using TrustManagerFactory to get the TrustManager.")
+ @Metadata(label = "advanced",
+ description = "To use a existing configured trust manager instead of using TrustManagerFactory to get the TrustManager.")
protected String trustManager;
@XmlTransient
diff --git a/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/CipherSuitesParametersDefinition.java b/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/CipherSuitesParametersDefinition.java
index 89c046f0fbd..a66669c32ec 100644
--- a/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/CipherSuitesParametersDefinition.java
+++ b/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/CipherSuitesParametersDefinition.java
@@ -23,10 +23,13 @@ import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlType;
+import org.apache.camel.spi.Metadata;
+
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "cipherSuitesParameters", propOrder = { "cipherSuite" })
public class CipherSuitesParametersDefinition {
+ @Metadata(description = "List of TLS/SSL cipher suite algorithm names")
private List<String> cipherSuite;
/**
diff --git a/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/SecureSocketProtocolsParametersDefinition.java b/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/SecureSocketProtocolsParametersDefinition.java
index 4a13dc9fcc5..822cde4b143 100644
--- a/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/SecureSocketProtocolsParametersDefinition.java
+++ b/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/SecureSocketProtocolsParametersDefinition.java
@@ -23,13 +23,13 @@ import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlType;
-/**
- * Represents a list of TLS/SSL cipher suite names.
- */
+import org.apache.camel.spi.Metadata;
+
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "secureSocketProtocolsParameters", propOrder = { "secureSocketProtocol" })
public class SecureSocketProtocolsParametersDefinition {
+ @Metadata(description = "The protocol for the secure sockets created by the SSLContext")
private List<String> secureSocketProtocol;
/**
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 a3855ebe4d7..6a6a55e1292 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
@@ -284,14 +284,14 @@
{ "name": "camel.ssl.enabled", "description": "Enables SSL in your Camel application.", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" },
{ "name": "camel.ssl.keyManagerAlgorithm", "description": "Algorithm name used for creating the KeyManagerFactory. See https:\/\/docs.oracle.com\/en\/java\/javase\/17\/docs\/specs\/security\/standard-names.html", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "string", "javaType": "java.lang.String" },
{ "name": "camel.ssl.keyManagerProvider", "description": "To use a specific provider for creating KeyManagerFactory. The list of available providers returned by java.security.Security.getProviders() or null to use the highest priority provider implementing the secure socket protocol.", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "string", "javaType": "java.lang.String" },
- { "name": "camel.ssl.keyStore", "description": "The file path, class path resource, or URL of the resource used to load the key store. An existing java.security.KeyStore can also be referred using #bean:name syntax.", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "string", "javaType": "java.lang.String" },
+ { "name": "camel.ssl.keyStore", "description": "The file path, class path resource, or URL of the resource used to load the key store. file:nameOfFile - to refer to the file system classpath:nameOfFile - to refer to the classpath (default) http:uri - to load the resource using HTTP ref:nameOfBean - to lookup an existing KeyStore instance from the registry.", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "string", "javaType": "java.lang.String" },
{ "name": "camel.ssl.keystorePassword", "description": "Sets the SSL Keystore password.", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "string", "javaType": "java.lang.String" },
{ "name": "camel.ssl.keyStoreProvider", "description": "To use a specific provider for creating KeyStore. The list of available providers returned by java.security.Security.getProviders() or null to use the highest priority provider implementing the secure socket protocol.", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "string", "javaType": "java.lang.String" },
{ "name": "camel.ssl.keyStoreType", "description": "The type of the key store to load. See https:\/\/docs.oracle.com\/en\/java\/javase\/17\/docs\/specs\/security\/standard-names.html", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "string", "javaType": "java.lang.String" },
{ "name": "camel.ssl.provider", "description": "To use a specific provider for creating SSLContext. The list of available providers returned by java.security.Security.getProviders() or null to use the highest priority provider implementing the secure socket protocol.", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "string", "javaType": "java.lang.String" },
{ "name": "camel.ssl.secureRandomAlgorithm", "description": "Algorithm name used for creating the SecureRandom. See https:\/\/docs.oracle.com\/en\/java\/javase\/17\/docs\/specs\/security\/standard-names.html", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "string", "javaType": "java.lang.String" },
{ "name": "camel.ssl.secureRandomProvider", "description": "To use a specific provider for creating SecureRandom. The list of available providers returned by java.security.Security.getProviders() or null to use the highest priority provider implementing the secure socket protocol.", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "string", "javaType": "java.lang.String" },
- { "name": "camel.ssl.secureSocketProtocol", "description": "The optional protocol for the secure sockets created by the SSLContext. See https:\/\/docs.oracle.com\/en\/java\/javase\/17\/docs\/specs\/security\/standard-names.html", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "TLSv1.3" },
+ { "name": "camel.ssl.secureSocketProtocol", "description": "The protocol for the secure sockets created by the SSLContext. See https:\/\/docs.oracle.com\/en\/java\/javase\/17\/docs\/specs\/security\/standard-names.html", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "TLSv1.3" },
{ "name": "camel.ssl.sessionTimeout", "description": "Timeout in seconds to use for SSLContext. The default is 24 hours.", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "integer", "javaType": "int", "defaultValue": 86400 },
{ "name": "camel.ssl.trustStore", "description": "The file path, class path resource, or URL of the resource used to load the trust store. An existing java.security.KeyStore can also be referred using #bean:name syntax.", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "string", "javaType": "java.lang.String" },
{ "name": "camel.ssl.trustStorePassword", "description": "Sets the SSL Truststore password.", "sourceType": "org.apache.camel.main.SSLConfigurationProperties", "type": "string", "javaType": "java.lang.String" },
diff --git a/core/camel-main/src/main/docs/main.adoc b/core/camel-main/src/main/docs/main.adoc
index 9bcc5b3ae23..f4165a700b7 100644
--- a/core/camel-main/src/main/docs/main.adoc
+++ b/core/camel-main/src/main/docs/main.adoc
@@ -258,14 +258,14 @@ The camel.ssl supports 19 options, which are listed below.
| *camel.ssl.enabled* | Enables SSL in your Camel application. | false | boolean
| *camel.ssl.keyManagerAlgorithm* | Algorithm name used for creating the KeyManagerFactory. See \https://docs.oracle.com/en/java/javase/17/docs/specs/security/standard-names.html | | String
| *camel.ssl.keyManagerProvider* | To use a specific provider for creating KeyManagerFactory. The list of available providers returned by java.security.Security.getProviders() or null to use the highest priority provider implementing the secure socket protocol. | | String
-| *camel.ssl.keyStore* | The file path, class path resource, or URL of the resource used to load the key store. An existing java.security.KeyStore can also be referred using #bean:name syntax. | | String
+| *camel.ssl.keyStore* | The file path, class path resource, or URL of the resource used to load the key store. file:nameOfFile - to refer to the file system classpath:nameOfFile - to refer to the classpath (default) http:uri - to load the resource using HTTP ref:nameOfBean - to lookup an existing KeyStore instance from the registry. | | String
| *camel.ssl.keystorePassword* | Sets the SSL Keystore password. | | String
| *camel.ssl.keyStoreProvider* | To use a specific provider for creating KeyStore. The list of available providers returned by java.security.Security.getProviders() or null to use the highest priority provider implementing the secure socket protocol. | | String
| *camel.ssl.keyStoreType* | The type of the key store to load. See \https://docs.oracle.com/en/java/javase/17/docs/specs/security/standard-names.html | | String
| *camel.ssl.provider* | To use a specific provider for creating SSLContext. The list of available providers returned by java.security.Security.getProviders() or null to use the highest priority provider implementing the secure socket protocol. | | String
| *camel.ssl.secureRandom{zwsp}Algorithm* | Algorithm name used for creating the SecureRandom. See \https://docs.oracle.com/en/java/javase/17/docs/specs/security/standard-names.html | | String
| *camel.ssl.secureRandomProvider* | To use a specific provider for creating SecureRandom. The list of available providers returned by java.security.Security.getProviders() or null to use the highest priority provider implementing the secure socket protocol. | | String
-| *camel.ssl.secureSocketProtocol* | The optional protocol for the secure sockets created by the SSLContext. See \https://docs.oracle.com/en/java/javase/17/docs/specs/security/standard-names.html | TLSv1.3 | String
+| *camel.ssl.secureSocketProtocol* | The protocol for the secure sockets created by the SSLContext. See \https://docs.oracle.com/en/java/javase/17/docs/specs/security/standard-names.html | TLSv1.3 | String
| *camel.ssl.sessionTimeout* | Timeout in seconds to use for SSLContext. The default is 24 hours. | 86400 | int
| *camel.ssl.trustStore* | The file path, class path resource, or URL of the resource used to load the trust store. An existing java.security.KeyStore can also be referred using #bean:name syntax. | | String
| *camel.ssl.trustStorePassword* | Sets the SSL Truststore password. | | String
diff --git a/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java b/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
index 1bff8efdc48..ee56ba4864f 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
@@ -1659,12 +1659,7 @@ public abstract class BaseMainSupport extends BaseService {
KeyStoreParameters ksp = new KeyStoreParameters();
ksp.setCamelContext(camelContext);
- String store = sslConfig.getKeyStore();
- if (store != null && store.startsWith("#bean:")) {
- ksp.setKeyStore(CamelContextHelper.mandatoryLookup(camelContext, store.substring(6), KeyStore.class));
- } else {
- ksp.setResource(store);
- }
+ ksp.setResource(sslConfig.getKeyStore());
ksp.setType(sslConfig.getKeyStoreType());
ksp.setPassword(sslConfig.getKeystorePassword());
ksp.setProvider(sslConfig.getKeyStoreProvider());
diff --git a/core/camel-main/src/main/java/org/apache/camel/main/SSLConfigurationProperties.java b/core/camel-main/src/main/java/org/apache/camel/main/SSLConfigurationProperties.java
index 3f2d251c6ff..4a4c32120e7 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/SSLConfigurationProperties.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/SSLConfigurationProperties.java
@@ -110,7 +110,7 @@ public class SSLConfigurationProperties implements BootstrapCloseable {
}
/**
- * The optional protocol for the secure sockets created by the SSLContext.
+ * The protocol for the secure sockets created by the SSLContext.
* <p>
* See https://docs.oracle.com/en/java/javase/17/docs/specs/security/standard-names.html
*/
@@ -190,7 +190,8 @@ public class SSLConfigurationProperties implements BootstrapCloseable {
/**
* The file path, class path resource, or URL of the resource used to load the key store.
*
- * An existing java.security.KeyStore can also be referred using #bean:name syntax.
+ * file:nameOfFile - to refer to the file system classpath:nameOfFile - to refer to the classpath (default) http:uri
+ * - to load the resource using HTTP ref:nameOfBean - to lookup an existing KeyStore instance from the registry.
*/
public void setKeyStore(String keyStore) {
this.keyStore = keyStore;
@@ -405,7 +406,8 @@ public class SSLConfigurationProperties implements BootstrapCloseable {
/**
* The file path, class path resource, or URL of the resource used to load the key store.
*
- * An existing java.security.KeyStore can also be referred using #bean:name syntax.
+ * file:nameOfFile - to refer to the file system classpath:nameOfFile - to refer to the classpath (default) http:uri
+ * - to load the resource using HTTP ref:nameOfBean - to lookup an existing KeyStore instance from the registry.
*/
public SSLConfigurationProperties withKeyStore(String keyStore) {
this.keyStore = keyStore;