Skip to content

Commit

Permalink
Fix authentication issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Bdegraaf1234 committed Jun 10, 2024
1 parent e4415c2 commit 68ec900
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
6 changes: 6 additions & 0 deletions java-sdk/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ val githubIssueUrl = "https://github.com/$githubRepoName/issues"
subprojects {
apply(plugin = "org.radarbase.radar-kotlin")

repositories{
mavenCentral()
gradlePluginPortal()
maven(url = "https://jitpack.io")
}

radarKotlin {
javaVersion.set(Versions.java)
kotlinVersion.set(Versions.kotlin)
Expand Down
2 changes: 1 addition & 1 deletion java-sdk/buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ object Versions {
const val java = 17
const val avroGenerator = "1.9.1"

const val radarCommons = "1.1.2"
const val radarCommons = "1.1.3-SNAPSHOT"
const val avro = "1.11.3"
const val jackson = "2.16.1"
const val argparse = "0.9.0"
Expand Down
4 changes: 0 additions & 4 deletions java-sdk/radar-schemas-registration/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
description = "RADAR Schemas specification and validation tools"

repositories {
maven(url = "https://jitpack.io")
}

dependencies {
api(project(":radar-schemas-commons"))
api(project(":radar-schemas-core"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
package org.radarbase.schema.registration

import io.ktor.client.*
import io.ktor.client.engine.cio.*
import io.ktor.client.plugins.auth.Auth
import io.ktor.client.plugins.auth.providers.BasicAuthCredentials
import io.ktor.client.plugins.auth.providers.basic
Expand Down Expand Up @@ -44,6 +46,7 @@ import org.radarcns.kafka.ObservationKey
import org.slf4j.LoggerFactory
import java.io.IOException
import java.net.MalformedURLException
import java.net.URI
import java.time.Duration
import kotlin.streams.asSequence
import kotlin.time.Duration.Companion.seconds
Expand All @@ -62,7 +65,7 @@ class SchemaRegistry(
private val topicConfiguration: Map<String, TopicConfig> = emptyMap(),
) {
private val schemaClient: SchemaRetriever = schemaRetriever(baseUrl) {
httpClient {
httpClient = HttpClient(CIO) {
timeout(10.seconds)
if (apiKey != null && apiSecret != null) {
install(Auth) {
Expand Down Expand Up @@ -94,7 +97,7 @@ class SchemaRegistry(
.mapNotNull {
try {
httpClient.request<List<String>> {
url("subjects")
url(URI(baseUrl).resolve("subjects").toString())
if (apiKey != null && apiSecret != null) {
basicAuth(apiKey, apiSecret)
}
Expand Down Expand Up @@ -224,7 +227,7 @@ class SchemaRegistry(
logger.info("Setting compatibility to {}", compatibility)
return try {
httpClient.requestEmpty {
url("config")
url(URI(baseUrl).resolve("config").toString())
method = HttpMethod.Put
contentType(ContentType("application", "vnd.schemaregistry.v1+json"))
setBody("{\"compatibility\": \"${compatibility.name}\"}")
Expand Down
4 changes: 0 additions & 4 deletions java-sdk/radar-schemas-tools/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
description = "RADAR Schemas specification and validation tools."

repositories {
maven(url = "https://jitpack.io")
}

dependencies {
implementation(project(":radar-schemas-registration"))
implementation(platform("com.fasterxml.jackson:jackson-bom:${Versions.jackson}"))
Expand Down

0 comments on commit 68ec900

Please sign in to comment.