-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Add support for basic auth to Kafka schema registry #25456
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
base: master
Are you sure you want to change the base?
Add support for basic auth to Kafka schema registry #25456
Conversation
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: DERBENEV Ivan V.
|
6129124
to
8ca276e
Compare
Please change commit message and add authored by tags from the original PR |
8ca276e
to
e91708f
Compare
@mosabua i've updated commit message, what do you mean by "authored by tags from the original PR"? |
270e91f
to
2c32e0c
Compare
So i guess i've passed all the CI checks, can i have a review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a test with dockerized schema registry?
.../src/main/java/io/trino/plugin/kafka/schema/KafkaSchemaRegistryClientPropertiesProvider.java
Outdated
Show resolved
Hide resolved
.../src/main/java/io/trino/plugin/kafka/schema/KafkaSchemaRegistryClientPropertiesProvider.java
Outdated
Show resolved
Hide resolved
...-kafka/src/main/java/io/trino/plugin/kafka/schema/confluent/ConfluentSchemaRegistryAuth.java
Outdated
Show resolved
Hide resolved
...a/src/main/java/io/trino/plugin/kafka/schema/confluent/ConfluentSchemaRegistryBasicAuth.java
Outdated
Show resolved
Hide resolved
...a/src/main/java/io/trino/plugin/kafka/schema/confluent/ConfluentSchemaRegistryBasicAuth.java
Outdated
Show resolved
Hide resolved
...a/src/main/java/io/trino/plugin/kafka/schema/confluent/ConfluentSchemaRegistryBasicAuth.java
Outdated
Show resolved
Hide resolved
...afka/src/main/java/io/trino/plugin/kafka/schema/confluent/ConfluentSchemaRegistryConfig.java
Outdated
Show resolved
Hide resolved
...afka/src/main/java/io/trino/plugin/kafka/schema/confluent/ConfluentSchemaRegistryConfig.java
Outdated
Show resolved
Hide resolved
...afka/src/main/java/io/trino/plugin/kafka/schema/confluent/ConfluentSchemaRegistryNoAuth.java
Outdated
Show resolved
Hide resolved
710705d
to
046ea5e
Compare
i've also updated confluent version in TestKafkaLatestConnectorSmokeTest.java to the value set in DEFAULT_CONFLUENT_PLATFORM_VERSION |
i'm not sure i'm competent enough to do it from scratch. Is there a reference i can look at? |
6df04e6
to
4420c09
Compare
also i don't understand - why is CI checking commit which was already overridden? |
4420c09
to
54291d4
Compare
It seems there is https://hub.docker.com/r/confluentinc/cp-schema-registry. You can refer to TestingPostgreSqlServer for understanding how to use docker container in tests. |
57e0316
to
c4aad06
Compare
@ebyhr done, i guess |
c4aad06
to
7da2e2e
Compare
Add basicauth option to authorize to kafka schema registry Update the code to master upstream
7da2e2e
to
b7d0575
Compare
Added doc section |
b7d0575
to
b721aa6
Compare
if (basicAuthConfig.isPresent()) { | ||
auth = new ConfluentSchemaRegistryBasicAuth( | ||
basicAuthConfig.get().getConfluentSchemaRegistryUsername(), | ||
basicAuthConfig.get().getConfluentSchemaRegistryPassword()); | ||
} | ||
else { | ||
auth = new ConfluentSchemaRegistryNoAuth(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use guice magic here ? i.e based on the config we could directly inject ConfluentSchemaRegistryBasicAuth
or ConfluentSchemaRegistryNoAuth
|
||
@Config("kafka.confluent-schema-registry.basic-auth.username") | ||
@ConfigDescription("The username for the Confluent Schema Registry") | ||
public BasicAuthConfig setConfluentSchemaRegistryUsername(String username) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add ConfigSecuritySensitive
to ensure it is masked as a part of bootstrap logs ?
@@ -54,6 +62,19 @@ public ConfluentSchemaRegistryConfig setConfluentSchemaRegistryUrls(Set<String> | |||
return this; | |||
} | |||
|
|||
public Optional<ConfluentSchemaRegistryAuthType> getConfluentSchemaRegistryAuthType() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need it to be Optional
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first commit is not specific to adding tests right ?
} | ||
|
||
@Test | ||
public void testBasicTopicBasicAuth2() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testTopicMixedCaste
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we apply the trino test guidelines here ?
schemaRegistryLogTemplate, | ||
"/etc/confluent/docker/log4j.properties.template") | ||
.dependsOn(kafka); | ||
if (this.withBasicAuth) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding withBasicAuth
flag - Can we extract SchemaRegistry container outside TestingKafka or have some sort of abuilder for them ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any readme file on how did we create this file would be helpful.
import static org.junit.jupiter.api.parallel.ExecutionMode.SAME_THREAD; | ||
|
||
@Execution(SAME_THREAD) | ||
public class KafkaWithConfluentSchemaRegistryUtils |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it Utils class or some test class ? In case of Utils only class it should be final
in case of test class can we have Test
as prefix
Description
This is a clone of #23317
add config options to pass username\password to confluent schema registry for kafka plugin
due to GitHub limitations (see isaacs/github#361) i've re-created the MR
Additional context and related issues
resolves #12195 and #22679
Release notes
Release notes are required. Please propose a release note for me.