Class OAuth2ClientRequestInterceptor
-
- All Implemented Interfaces:
-
org.springframework.http.client.ClientHttpRequestInterceptor
public final class OAuth2ClientRequestInterceptor implements ClientHttpRequestInterceptorInterceptor that exchanges a token using the OAuth2AccessTokenService and sets the 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 implementing ClientConfigurationPropertiesMatcher. If no configuration is found, the interceptor is NOOP. The same applies if there is no Authorization header present, as there will be nothing to exchange in that case. This again means that the interceptor can be safely registered on clients used for unauthenticated calls, such as pings/healthchecks. This intercptor must be registered by the applications themselves, there is no automatic bean registration.
-
-
Constructor Summary
Constructors Constructor Description OAuth2ClientRequestInterceptor(ClientConfigurationProperties properties, OAuth2AccessTokenService service, ClientConfigurationPropertiesMatcher matcher)
-
Method Summary
-
-
Constructor Detail
-
OAuth2ClientRequestInterceptor
OAuth2ClientRequestInterceptor(ClientConfigurationProperties properties, OAuth2AccessTokenService service, ClientConfigurationPropertiesMatcher matcher)
-
-
-
-