Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SASL config properties sugar function to ConsumerSettings #1226

Open
wants to merge 4 commits into
base: series/3.x
Choose a base branch
from

Conversation

wonk1132
Copy link

@wonk1132 wonk1132 commented Jul 15, 2023

Adds a sugar function in ConsumerSettings for SASL. A primary use case for this new withPlainSasl method is when the client needs to authenticate to Kafka hosted in Confluent Cloud.

@wonk1132 wonk1132 changed the title wip: add sasl config poperties add sasl config properties sugar function to ConsumerSettings Jul 15, 2023
Copy link
Contributor

@aartigao aartigao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! 🙇🏽

Just some minor adjustments and the PR is ready to 🚀

@@ -417,6 +425,15 @@ object ConsumerSettings {
override val recordMetadata: ConsumerRecord[K, V] => String,
override val maxPrefetchBatches: Int
) extends ConsumerSettings[F, K, V] {

def withPlainSasl(usernameToken: String, passwordToken: String): ConsumerSettings[F, K, V] =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never worked with SASL but from what I can see here in PlainLoginModule there's no reference to any token.

Why not removing that prefix? 👇🏽

Suggested change
def withPlainSasl(usernameToken: String, passwordToken: String): ConsumerSettings[F, K, V] =
def withPlainSasl(username: String, password: String): ConsumerSettings[F, K, V] =

Comment on lines +408 to +409
* provides SASL credentials to Kafka host. A typical use case for this would be
* interacting with Confluent Cloud.
Copy link
Contributor

@aartigao aartigao Sep 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel the second sentence is not needed. A user should be aware of what SASL is at this point (either by reading the docs or because he/she knows what's doing).

Suggested change
* provides SASL credentials to Kafka host. A typical use case for this would be
* interacting with Confluent Cloud.
* Provides SASL credentials to Kafka host.

@@ -122,6 +122,23 @@ ConsumerSettings(
.withGroupId("group")
```

### Sasl setting
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Sasl setting
### SASL settings

Comment on lines +137 to +138
<idToken>,
<passwordToken>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, I don't think mentioning token is needed.

Also, here you are using id instead of username. I'd suggest to use the same convention everywhere.

@aartigao aartigao changed the title add sasl config properties sugar function to ConsumerSettings Add SASL config properties sugar function to ConsumerSettings Sep 30, 2023
* provides SASL credentials to Kafka host. A typical use case for this would be
* interacting with Confluent Cloud.
*/
def withPlainSasl(usernameToken: String, passwordToken: String): ConsumerSettings[F, K, V]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be a new KafkaCredentialStore rather than being directly on the consumer settings? That would also add support for the producer and admin client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants