From c4b9e640d24dd70878d846b2cb54cf3050f0b6ef Mon Sep 17 00:00:00 2001 From: Jan-Niclas Struewer <j.n.struewer@gmail.com> Date: Mon, 11 Dec 2023 19:51:33 +0100 Subject: [PATCH] fixed auth api url --- .../dataprovider/repository/service/RepositoryService.kt | 7 +++++-- src/main/resources/application-dev.properties | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/de/fraunhofer/iem/dataprovider/repository/service/RepositoryService.kt b/src/main/kotlin/de/fraunhofer/iem/dataprovider/repository/service/RepositoryService.kt index 583c758e..4bd7ae97 100644 --- a/src/main/kotlin/de/fraunhofer/iem/dataprovider/repository/service/RepositoryService.kt +++ b/src/main/kotlin/de/fraunhofer/iem/dataprovider/repository/service/RepositoryService.kt @@ -94,7 +94,7 @@ class RepositoryService( suspend fun validateUser(validateUserDto: ValidateUserDto) { val userCookie = httpClient.get(openCodeApiProperties.auth) { url { - appendPathSegments(validateUserDto.b) + appendPathSegments("receive-session", validateUserDto.b) parameters.append("apiKey", openCodeApiProperties.authApiKey) } } @@ -103,16 +103,19 @@ class RepositoryService( println(userCookie.body<Any>()) val setCookies = userCookie.setCookie() println(setCookies) - + val sessionCookie = setCookies.first { it.name == "session" } val me = httpClient.get(openCodeApiProperties.auth) { url { appendPathSegments("me") parameters.append("apiKey", openCodeApiProperties.authApiKey) +// cookie(name = "session", value = sessionCookie.value) } } println(me) println(me.body<Any>()) +// val user = me.body<UserResponseDto>() +// user.userDetails.gitlabProfile } } diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties index f9d08a89..b2ef471b 100644 --- a/src/main/resources/application-dev.properties +++ b/src/main/resources/application-dev.properties @@ -8,7 +8,7 @@ opencode.user-name=${OC_GL_USER:} # Tool APIs opencode.api.base-path=https://sl.dev.o4oe.de/api/v1/project/ opencode.api.ort=/cve-result -opencode.api.auth=https://sl.dev.o4oe.de/api/receive-session +opencode.api.auth=https://sl.dev.o4oe.de/api/ opencode.api.auth-api-key=${AUTH_API_KEY} # API key to access this server's API -- GitLab