Class OAuth2ClientRequestInterceptor
- java.lang.Object
-
- no.nav.security.token.support.client.spring.oauth2.OAuth2ClientRequestInterceptor
-
- All Implemented Interfaces:
org.springframework.http.client.ClientHttpRequestInterceptor
public class OAuth2ClientRequestInterceptor extends Object implements org.springframework.http.client.ClientHttpRequestInterceptor
Interceptor that exchanges a token using theOAuth2AccessTokenServiceand sets Authorization header to this new token, where the aud claim is set to the destination app. The configuration fo this app is retrieved through a configurable matcher implementingClientConfigurationPropertiesMatcher. If no configuration is found, this interceptor is NOOP. Must be registered by the applications themselves, no automatic bean registration.
-
-
Constructor Summary
Constructors Constructor Description OAuth2ClientRequestInterceptor(ClientConfigurationProperties properties, OAuth2AccessTokenService service, ClientConfigurationPropertiesMatcher matcher)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.http.client.ClientHttpResponseintercept(org.springframework.http.HttpRequest req, byte[] body, org.springframework.http.client.ClientHttpRequestExecution execution)StringtoString()
-
-
-
Constructor Detail
-
OAuth2ClientRequestInterceptor
public OAuth2ClientRequestInterceptor(ClientConfigurationProperties properties, OAuth2AccessTokenService service, ClientConfigurationPropertiesMatcher matcher)
-
-
Method Detail
-
intercept
public org.springframework.http.client.ClientHttpResponse intercept(org.springframework.http.HttpRequest req, byte[] body, org.springframework.http.client.ClientHttpRequestExecution execution) throws IOException- Specified by:
interceptin interfaceorg.springframework.http.client.ClientHttpRequestInterceptor- Throws:
IOException
-
-