Skip to content

Commit

Permalink
Fix basic authentication during schema registry init
Browse files Browse the repository at this point in the history
  • Loading branch information
pvannierop committed Mar 19, 2024
1 parent f8523a5 commit 6e3ce3b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
6 changes: 6 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kafka:
bootstrap.servers: [pkc-lq8gm.westeurope.azure.confluent.cloud:9092]
security.protocol: SASL_SSL
sasl.jaas.config: org.apache.kafka.common.security.plain.PlainLoginModule required username="JSMEN2KHWOZMF3OW" password="m8CxdSYySbMCQHhqoSiRWXSVtX2xmHn2q/NXuvkG56fUgslbz5jkYdeRY11WQVt2";
ssl.endpoint.identification.algorithm: https
sasl.mechanism: PLAIN
6 changes: 6 additions & 0 deletions config_alt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kafka:
bootstrap.servers: [psrc-4kk0p.westeurope.azure.confluent.cloud:9092]
security.protocol: PLAINTEXT
sasl.jaas.config: org.apache.kafka.common.security.plain.PlainLoginModule required username="BUIWFXYYGOIK6MEX" password="ii3Z2XaWjSaJTNJjH2+xUESJFxZ3iizX3Fo+nUE6beZg99C4cFzMHv29nu8K4C5A";
ssl.endpoint.identification.algorithm: https
sasl.mechanism: PLAIN
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ import kotlin.time.toKotlinDuration
*/
class SchemaRegistry(
private val baseUrl: String,
apiKey: String? = null,
apiSecret: String? = null,
private val apiKey: String? = null,
private val apiSecret: String? = null,
private val topicConfiguration: Map<String, TopicConfig> = emptyMap(),
) {
private val schemaClient: SchemaRetriever = schemaRetriever(baseUrl) {
Expand All @@ -66,6 +66,7 @@ class SchemaRegistry(
if (apiKey != null && apiSecret != null) {
install(Auth) {
basic {
sendWithoutRequest { true }
credentials {
BasicAuthCredentials(username = apiKey, password = apiSecret)
}
Expand Down Expand Up @@ -93,6 +94,9 @@ class SchemaRegistry(
try {
httpClient.request<List<String>> {
url("subjects")
// if (apiKey != null && apiSecret != null) {
// basicAuth(apiKey, apiSecret)
// }
}
} catch (ex: RestException) {
logger.error(
Expand Down

0 comments on commit 6e3ce3b

Please sign in to comment.