This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch kaf-ssl in repository https://gitbox.apache.org/repos/asf/camel.git
commit 58b0e18e722944e5a7520a654aed94247b247bbf Author: Claus Ibsen <[email protected]> AuthorDate: Mon Jul 8 19:25:31 2024 +0200 CAMEL-20954: Cannot share SSLContextParameters between camel-kafka and other components --- .../org/apache/camel/component/kafka/KafkaConfiguration.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConfiguration.java b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConfiguration.java index 25b4ececf6b..df7f278405b 100755 --- a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConfiguration.java +++ b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConfiguration.java @@ -45,6 +45,7 @@ import org.apache.camel.support.jsse.SSLContextParameters; import org.apache.camel.support.jsse.SecureSocketProtocolsParameters; import org.apache.camel.support.jsse.TrustManagersParameters; import org.apache.camel.util.ObjectHelper; +import org.apache.camel.util.StringHelper; import org.apache.kafka.clients.CommonClientConfigs; import org.apache.kafka.clients.consumer.ConsumerConfig; import org.apache.kafka.clients.producer.ProducerConfig; @@ -570,8 +571,10 @@ public class KafkaConfiguration implements Cloneable, HeaderFilterStrategyAware addPropertyIfNotNull(props, SslConfigs.SSL_KEY_PASSWORD_CONFIG, keyManagers.getKeyPassword()); KeyStoreParameters keyStore = keyManagers.getKeyStore(); if (keyStore != null) { + // kakfa loads the resource and you cannot have prefix + String location = StringHelper.after(keyStore.getResource(), ":", keyStore.getResource()); addUpperCasePropertyIfNotEmpty(props, SslConfigs.SSL_KEYSTORE_TYPE_CONFIG, keyStore.getType()); - addPropertyIfNotNull(props, SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG, keyStore.getResource()); + addPropertyIfNotNull(props, SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG, location); addPropertyIfNotNull(props, SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG, keyStore.getPassword()); } } @@ -581,8 +584,10 @@ public class KafkaConfiguration implements Cloneable, HeaderFilterStrategyAware addPropertyIfNotNull(props, SslConfigs.SSL_TRUSTMANAGER_ALGORITHM_CONFIG, trustManagers.getAlgorithm()); KeyStoreParameters keyStore = trustManagers.getKeyStore(); if (keyStore != null) { + // kakfa loads the resource and you cannot have prefix + String location = StringHelper.after(keyStore.getResource(), ":", keyStore.getResource()); addPropertyIfNotNull(props, SslConfigs.SSL_TRUSTSTORE_TYPE_CONFIG, keyStore.getType()); - addPropertyIfNotNull(props, SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG, keyStore.getResource()); + addPropertyIfNotNull(props, SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG, location); addPropertyIfNotEmpty(props, SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG, keyStore.getPassword()); } }
