Reputation: 195
I'm trying to connect to Kafka using the Confluent.Kafka package. However, I need to use jaas as authentication method. I couldn't find a way to do it using the Confluent.Kafka for .NET.
Edit:
I received the following data to connect:
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="*******";
And I'm trying to create the connection like this:
var config = new ProducerConfig
{
BootstrapServers = "pkc.....cloud:9092",
SslEndpointIdentificationAlgorithm = SslEndpointIdentificationAlgorithm.Https,
SecurityProtocol = SecurityProtocol.SaslSsl,
SaslMechanism = SaslMechanism.Plain,
//Jaas?***
};
Do you guys know how can I set the Jaas I received?
Upvotes: 2
Views: 2619
Reputation: 195
As @OneCricketeer said, the Jaas is Java specific. What I need is just to set the UserName and Password.
The final code is this:
var config = new ProducerConfig
{
BootstrapServers = "pkc.....cloud:9092",
SslEndpointIdentificationAlgorithm = SslEndpointIdentificationAlgorithm.Https,
SecurityProtocol = SecurityProtocol.SaslSsl,
SaslMechanism = SaslMechanism.Plain,
SaslUsername = "******",
SaslPassword = "*****"
};
Upvotes: 5