diff --git a/java-sdk/radar-schemas-registration/src/main/java/org/radarbase/schema/registration/SchemaRegistry.kt b/java-sdk/radar-schemas-registration/src/main/java/org/radarbase/schema/registration/SchemaRegistry.kt index 4d235091..3728f5e5 100644 --- a/java-sdk/radar-schemas-registration/src/main/java/org/radarbase/schema/registration/SchemaRegistry.kt +++ b/java-sdk/radar-schemas-registration/src/main/java/org/radarbase/schema/registration/SchemaRegistry.kt @@ -18,6 +18,7 @@ package org.radarbase.schema.registration import io.ktor.client.plugins.auth.Auth import io.ktor.client.plugins.auth.providers.BasicAuthCredentials import io.ktor.client.plugins.auth.providers.basic +import io.ktor.client.request.basicAuth import io.ktor.client.request.setBody import io.ktor.client.request.url import io.ktor.http.ContentType @@ -56,8 +57,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 = emptyMap(), ) { private val schemaClient: SchemaRetriever = schemaRetriever(baseUrl) { @@ -66,6 +67,7 @@ class SchemaRegistry( if (apiKey != null && apiSecret != null) { install(Auth) { basic { + sendWithoutRequest { true } credentials { BasicAuthCredentials(username = apiKey, password = apiSecret) } @@ -93,6 +95,9 @@ class SchemaRegistry( try { httpClient.request> { url("subjects") + if (apiKey != null && apiSecret != null) { + basicAuth(apiKey, apiSecret) + } } } catch (ex: RestException) { logger.error( @@ -175,6 +180,7 @@ class SchemaRegistry( val record: SpecificRecord = AvroTopic.parseSpecificRecord(topicValueSchema) record.javaClass to record.schema } + defaultTopic != null -> defaultTopic.valueClass to defaultTopic.valueSchema else -> { logger.warn(