Skip to content

Commit 3694244

Browse files
committed
interceptor back in, create client directly
1 parent edd0be0 commit 3694244

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

token-client-spring/src/main/kotlin/no/nav/security/token/support/client/spring/oauth2/DefaultOAuth2HttpClient.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ import org.springframework.util.LinkedMultiValueMap
99
import org.springframework.web.client.RestClient
1010
import org.springframework.web.client.body
1111

12-
open class DefaultOAuth2HttpClient(val restClient: RestClient) : OAuth2HttpClient {
12+
open class DefaultOAuth2HttpClient : OAuth2HttpClient {
1313

14+
val restClient = RestClient.create()
1415

1516
override fun post(req: OAuth2HttpRequest) =
1617
restClient.post()

token-client-spring/src/main/kotlin/no/nav/security/token/support/client/spring/oauth2/OAuth2ClientConfiguration.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ class OAuth2ClientConfiguration : ImportAware {
3131
attrs = requireNotNull(fromMap(meta.getAnnotationAttributes(EnableOAuth2Client::class.java.name, false))) { "@EnableOAuth2Client is not present on importing class ${meta.className}" }
3232
}
3333

34+
@Bean
35+
fun oAuth2ClientRequestInterceptor(properties: ClientConfigurationProperties, service: OAuth2AccessTokenService) = OAuth2ClientRequestInterceptor(properties, service)
36+
37+
3438
@Bean
3539
fun oAuth2AccessTokenService(bearerTokenResolver: JwtBearerTokenResolver, client: OAuth2HttpClient) =
3640
if (attrs?.getBoolean("cacheEnabled") == true) {

0 commit comments

Comments
 (0)