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 2021/03/09 11:45:55 UTC

[camel] branch camel-3.7.x updated: CAMEL-16138: Resolve class of AuthenticationCallBackHandler to avoid ClassNotFoundException in OSGI environment. (#5188)

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

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


The following commit(s) were added to refs/heads/camel-3.7.x by this push:
     new bd7271e  CAMEL-16138: Resolve class of AuthenticationCallBackHandler to avoid ClassNotFoundException in OSGI environment. (#5188)
bd7271e is described below

commit bd7271e11215dfdd7e6d1395690694e2f4f3838c
Author: Jörg Jansen <57...@users.noreply.github.com>
AuthorDate: Tue Mar 9 12:43:39 2021 +0100

    CAMEL-16138: Resolve class of AuthenticationCallBackHandler to avoid ClassNotFoundException in OSGI environment. (#5188)
---
 .../main/java/org/apache/camel/component/kafka/KafkaEndpoint.java    | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaEndpoint.java b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaEndpoint.java
index 84d705c..85a1e07 100644
--- a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaEndpoint.java
+++ b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaEndpoint.java
@@ -36,6 +36,7 @@ import org.apache.kafka.clients.consumer.ConsumerConfig;
 import org.apache.kafka.clients.consumer.ConsumerRecord;
 import org.apache.kafka.clients.producer.Partitioner;
 import org.apache.kafka.clients.producer.ProducerConfig;
+import org.apache.kafka.common.security.auth.AuthenticateCallbackHandler;
 import org.apache.kafka.common.serialization.Deserializer;
 import org.apache.kafka.common.serialization.Serializer;
 import org.slf4j.Logger;
@@ -126,6 +127,10 @@ public class KafkaEndpoint extends DefaultEndpoint implements MultipleConsumersS
                 replaceWithClass(props, ProducerConfig.PARTITIONER_CLASS_CONFIG, resolver, Partitioner.class);
                 replaceWithClass(props, ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, resolver, Deserializer.class);
                 replaceWithClass(props, ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, resolver, Deserializer.class);
+
+                // as long as the property is not available in Kafka client, use a static string
+                final String CH_PROPERTY = "sasl.login.callback.handler.class";
+                replaceWithClass(props, CH_PROPERTY, resolver, AuthenticateCallbackHandler.class);
             }
         } catch (Throwable t) {
             // can ignore and Kafka itself might be able to handle it, if not,