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

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Name of the header that carries the proof.
    private static final String
    Scheme of a DPoP-bound token in the Authorization header.
    private final org.springframework.security.oauth2.client.OAuth2AuthorizedClientManager
    Obtains (and renews) the access token.
    private final org.springframework.security.core.Authentication
    Principal the token is cached under.
    private final DPoPProofs
    Creates the proofs.
    private final String
    Registration of the client that obtains the token.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.http.client.ClientHttpResponse
    intercept(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, wait

    Methods inherited from interface org.springframework.http.client.ClientHttpRequestInterceptor

    andThen, apply
  • Field Details

    • DPOP_HEADER

      public static final String DPOP_HEADER
      Name of the header that carries the proof.
      See Also:
    • DPOP_SCHEME

      private static final String DPOP_SCHEME
      Scheme of a DPoP-bound token in the Authorization header.
      See Also:
    • manager

      private final org.springframework.security.oauth2.client.OAuth2AuthorizedClientManager manager
      Obtains (and renews) the access token.
    • proofs

      private final DPoPProofs proofs
      Creates the proofs.
    • registrationId

      private final String registrationId
      Registration of the client that obtains the token.
    • principal

      private final org.springframework.security.core.Authentication principal
      Principal 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:
      intercept in interface org.springframework.http.client.ClientHttpRequestInterceptor
      Throws:
      IOException