【发布时间】:2022-01-07 11:20:50
【问题描述】:
我正在尝试使用 Confluent.Kafka 包连接到 Kafka。但是,我需要使用 jaas 作为身份验证方法。我找不到使用 Confluent.Kafka for .NET 的方法。
编辑:
我收到了以下要连接的数据:
bootstrap.servers=pkc.....cloud:9092
ssl.endpoint.identification.algorithm=https
security.protocol=SASL_SSL
sasl.mechanism=PLAIN
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="********" password="*******";
我正在尝试像这样创建连接:
var config = new ProducerConfig
{
BootstrapServers = "pkc.....cloud:9092",
SslEndpointIdentificationAlgorithm = SslEndpointIdentificationAlgorithm.Https,
SecurityProtocol = SecurityProtocol.SaslSsl,
SaslMechanism = SaslMechanism.Plain,
//Jaas?***
};
你们知道如何设置我收到的 Jaas 吗?
【问题讨论】:
-
JAAS 是特定于 Java 的。您是在问如何添加 SASL 属性?
-
嗨@OneCricketeer,我在问题中包含了更多细节。我收到了一个 jaas,我需要在 .net 中以某种方式进行配置
-
sasl.jaas.config仅适用于 Java 客户端,对于基于 librdkafka 的客户端可以忽略 -
您可能对这个 Confluent Cloud 示例程序感兴趣 - github.com/confluentinc/confluent-kafka-dotnet/blob/master/…
-
谢谢@OneCricketeer,我试图添加 jaas 而不仅仅是设置用户名和密码
标签: apache-kafka jaas