Class DPoPClientHttpRequestInterceptor
java.lang.Object
com.irurueta.authserver.serviceclient.infrastructure.resourceserver.DPoPClientHttpRequestInterceptor
- All Implemented Interfaces:
org.springframework.http.client.ClientHttpRequestInterceptor
public class DPoPClientHttpRequestInterceptor
extends Object
implements org.springframework.http.client.ClientHttpRequestInterceptor
Sends the access token of an authorized client as
Authorization: DPoP <token> together with a DPoP
proof that binds the request and the token, when the token is DPoP-bound. Spring Security's own interceptor can
only set a bearer header, so this one replaces it when DPoP is enabled. A call without a token is never sent.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringName of the header that carries the proof.private static final StringScheme of a DPoP-bound token in theAuthorizationheader.private final org.springframework.security.oauth2.client.OAuth2AuthorizedClientManagerObtains (and renews) the access token.private final org.springframework.security.core.AuthenticationPrincipal the token is cached under.private final DPoPProofsCreates the proofs.private final StringRegistration of the client that obtains the token. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.client.ClientHttpResponseintercept(org.springframework.http.HttpRequest request, byte[] body, org.springframework.http.client.ClientHttpRequestExecution execution) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.http.client.ClientHttpRequestInterceptor
andThen, apply
-
Field Details
-
DPOP_HEADER
Name of the header that carries the proof.- See Also:
-
DPOP_SCHEME
Scheme of a DPoP-bound token in theAuthorizationheader.- See Also:
-
manager
private final org.springframework.security.oauth2.client.OAuth2AuthorizedClientManager managerObtains (and renews) the access token. -
proofs
Creates the proofs. -
registrationId
Registration of the client that obtains the token. -
principal
private final org.springframework.security.core.Authentication principalPrincipal the token is cached under.
-
-
Constructor Details
-
DPoPClientHttpRequestInterceptor
public DPoPClientHttpRequestInterceptor()
-
-
Method Details
-
intercept
public org.springframework.http.client.ClientHttpResponse intercept(org.springframework.http.HttpRequest request, byte[] body, org.springframework.http.client.ClientHttpRequestExecution execution) throws IOException - Specified by:
interceptin interfaceorg.springframework.http.client.ClientHttpRequestInterceptor- Throws:
IOException
-