java.lang.Object
com.irurueta.authserver.serviceclient.infrastructure.resourceserver.ResourceServerInterceptors

@Component public class ResourceServerInterceptors extends Object
Creates the interceptors that put the access token on the calls to the resource server: Spring Security's OAuth2ClientHttpRequestInterceptor (bearer), or the DPoP one when service-client.auth.dpop is on. Either way a call that ends up without a token is refused instead of sent.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final org.springframework.beans.factory.ObjectProvider<DPoPProofs>
    Creates the DPoP proofs; absent unless DPoP is enabled.
    private final org.springframework.security.oauth2.client.OAuth2AuthorizedClientManager
    Obtains and renews the access tokens.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    List<org.springframework.http.client.ClientHttpRequestInterceptor>
    create(String registrationId, org.springframework.security.core.Authentication principal)
    Creates the interceptors of one client.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • manager

      private final org.springframework.security.oauth2.client.OAuth2AuthorizedClientManager manager
      Obtains and renews the access tokens.
    • dpopProofs

      private final org.springframework.beans.factory.ObjectProvider<DPoPProofs> dpopProofs
      Creates the DPoP proofs; absent unless DPoP is enabled.
  • Constructor Details

    • ResourceServerInterceptors

      public ResourceServerInterceptors()
  • Method Details

    • create

      public List<org.springframework.http.client.ClientHttpRequestInterceptor> create(String registrationId, org.springframework.security.core.Authentication principal)
      Creates the interceptors of one client.
      Parameters:
      registrationId - registration of the OAuth2 client that obtains the token.
      principal - principal the token is cached under; the CLI has no security context to read it from.
      Returns:
      the interceptors, in the order they run.