From c76d83a4bda48577dc23f5b107db2cc20370b2bb Mon Sep 17 00:00:00 2001 From: joesantos418 Date: Wed, 22 Mar 2023 09:48:44 -0300 Subject: [PATCH] Adds plaintext authentication option Adds a new option for authentitcation using the value "PLAINTEXT" for the security protocol setting. This new option is useful when using goduck in integration tests with local kafka images that can take advantage of simplified authentication options. --- pipeline/inputstreams/kafka_options.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pipeline/inputstreams/kafka_options.go b/pipeline/inputstreams/kafka_options.go index 9820376..e7e1781 100644 --- a/pipeline/inputstreams/kafka_options.go +++ b/pipeline/inputstreams/kafka_options.go @@ -52,6 +52,16 @@ func WithKafkaSaslPlainAuthentication(username, password string) KafkaOption { } } +// WithKafkaPlaintextAuthentication configures kafka plaintext authentication. +func WithKafkaPlaintextAuthentication(username, password string) KafkaOption { + return func(kp *kafkaProvider) { + kp.configMap["security.protocol"] = "PLAINTEXT" + kp.configMap["sasl.mechanisms"] = "PLAIN" + kp.configMap["sasl.username"] = username + kp.configMap["sasl.password"] = password + } +} + // WithKafkaBrokers sets the kafka topics for the input stream. func WithKafkaBrokers(brokers ...string) KafkaOption { return func(kp *kafkaProvider) {