From 359ac663bbf1bdd9e0ae0bbf8597bf0039a67651 Mon Sep 17 00:00:00 2001 From: Anton Fofanov Date: Wed, 28 Aug 2024 14:54:43 +0200 Subject: [PATCH] =?UTF-8?q?PEK-519=20legg=20p=C3=A5=20service-user=20heade?= =?UTF-8?q?r=20for=20GET=20og=20POST=20til=20gandalf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simulering/v1/consumer/GatewayTokenClient.kt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/no/nav/tjenestepensjon/simulering/v1/consumer/GatewayTokenClient.kt b/src/main/kotlin/no/nav/tjenestepensjon/simulering/v1/consumer/GatewayTokenClient.kt index e8695087..355f2bd6 100644 --- a/src/main/kotlin/no/nav/tjenestepensjon/simulering/v1/consumer/GatewayTokenClient.kt +++ b/src/main/kotlin/no/nav/tjenestepensjon/simulering/v1/consumer/GatewayTokenClient.kt @@ -30,7 +30,10 @@ class GatewayTokenClient(private val soapGatewayAuthWebClient: WebClient, soapGatewayAuthWebClient .post() .uri(TOKEN_EXCHANGE_PATH) - .headers { it.setBearerAuth(token) } + .headers { + it.setBearerAuth(token) + it["Service-User-Id"] = "3" + } .body(body(token)) .retrieve() .bodyToMono(TokenImpl::class.java) @@ -51,7 +54,10 @@ class GatewayTokenClient(private val soapGatewayAuthWebClient: WebClient, soapGatewayAuthWebClient .get() .uri(TOKEN_PATH) - .headers { it.setBearerAuth(token) } + .headers { + it.setBearerAuth(token) + it["Service-User-Id"] = "3" + } .retrieve() .bodyToMono(TokenImpl::class.java) .block() @@ -68,7 +74,7 @@ class GatewayTokenClient(private val soapGatewayAuthWebClient: WebClient, companion object { private const val DEFAULT_ERROR_MSG = "Failed to fetch SAML token from fss-gateway" private const val TOKEN_EXCHANGE_PATH = "/rest/v1/sts/token/exchange?serviceUserId=3" - private const val TOKEN_PATH = "/rest/v1/sts/token?grant_type=client_credentials&scope=openid&serviceUserId=3" + private const val TOKEN_PATH = "/rest/v1/sts/token?grant_type=client_credentials&scope=openid" private fun body(token: String) = BodyInserters