Skip to content

Commit 7bf6243

Browse files
authored
E - Endrer RestTemplateConfig til å bruke AzureToken for bestemsak. (#334)
1 parent fd09b5d commit 7bf6243

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/main/kotlin/no/nav/eessi/pensjon/config/RestTemplateConfig.kt

+13-13
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class RestTemplateConfig(
3030
private val clientConfigurationProperties: ClientConfigurationProperties,
3131
private val oAuth2AccessTokenService: OAuth2AccessTokenService?,
3232
private val meterRegistry: MeterRegistry,
33-
) {
33+
) {
3434
private val logger = LoggerFactory.getLogger(RestTemplateConfig::class.java)
3535

3636
init {
@@ -81,7 +81,7 @@ class RestTemplateConfig(
8181
fun fagmodulOidcRestTemplate(): RestTemplate = opprettRestTemplate(fagmodulUrl, "fagmodul-credentials")
8282

8383
@Bean
84-
fun bestemSakOidcRestTemplate(): RestTemplate = opprettRestTemplate(bestemSakUrl, "proxy-credentials")
84+
fun bestemSakOidcRestTemplate(): RestTemplate = opprettRestTemplate(bestemSakUrl, "pensjon-credentials")
8585

8686
@Bean
8787
fun navansattRestTemplate(): RestTemplate? = opprettRestTemplate(navansattUrl, "navansatt-credentials")
@@ -114,17 +114,17 @@ class RestTemplateConfig(
114114

115115
private fun opprettRestTemplate(url: String, oAuthKey: String) : RestTemplate {
116116
return RestTemplateBuilder()
117-
.rootUri(url)
118-
.errorHandler(DefaultResponseErrorHandler())
119-
.additionalInterceptors(
120-
RequestIdHeaderInterceptor(),
121-
IOExceptionRetryInterceptor(),
122-
RequestCountInterceptor(meterRegistry),
123-
bearerTokenInterceptor(clientProperties(oAuthKey), oAuth2AccessTokenService!!)
124-
)
125-
.build().apply {
126-
requestFactory = BufferingClientHttpRequestFactory(SimpleClientHttpRequestFactory())
127-
}
117+
.rootUri(url)
118+
.errorHandler(DefaultResponseErrorHandler())
119+
.additionalInterceptors(
120+
RequestIdHeaderInterceptor(),
121+
IOExceptionRetryInterceptor(),
122+
RequestCountInterceptor(meterRegistry),
123+
bearerTokenInterceptor(clientProperties(oAuthKey), oAuth2AccessTokenService!!)
124+
)
125+
.build().apply {
126+
requestFactory = BufferingClientHttpRequestFactory(SimpleClientHttpRequestFactory())
127+
}
128128
}
129129

130130
private fun buildRestTemplate(url: String): RestTemplate {

0 commit comments

Comments
 (0)