Skip to content

Commit

Permalink
PEK-519 legg på service-user header for GET og POST til gandalf
Browse files Browse the repository at this point in the history
  • Loading branch information
antonfofanov committed Aug 28, 2024
1 parent f001bdb commit 359ac66
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
Expand All @@ -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
Expand Down

0 comments on commit 359ac66

Please sign in to comment.