Class BaseOAuth2RequestDecoder<T extends com.nimbusds.oauth2.sdk.Request>

Type Parameters:
T - The exact type of the request message, extends Request.
All Implemented Interfaces:
Component, DestructableComponent, InitializableComponent, UnmodifiableComponent, MessageDecoder, HttpServletRequestMessageDecoder
Direct Known Subclasses:
OAuth2AuthorizationRequestDecoder, OAuth2IntrospectionRequestDecoder, OAuth2RevocationRequestDecoder, OIDCAuthenticationRequestDecoder, OIDCClientRegistrationRequestDecoder, OIDCLogoutRequestDecoder, OIDCTokenRequestDecoder, OIDCUserInfoRequestDecoder

public abstract class BaseOAuth2RequestDecoder<T extends com.nimbusds.oauth2.sdk.Request> extends AbstractHttpServletRequestMessageDecoder
Base decoder for Nimbus OAuth2 request messages.
  • Field Details

    • log

      @Nonnull private final org.slf4j.Logger log
      Class logger.
    • removeIpAddressFromEndpointUri

      private boolean removeIpAddressFromEndpointUri
      A flag to remove the IP address from the endpoint URI.
  • Constructor Details

    • BaseOAuth2RequestDecoder

      public BaseOAuth2RequestDecoder()
      Constructor.
  • Method Details

    • setRemoveIpAddressFromEndpointUri

      public void setRemoveIpAddressFromEndpointUri(boolean flag)
      Set the flag to remove the IP address from the endpoint URI.
      Parameters:
      flag - What to set.
    • doDecode

      protected void doDecode() throws MessageDecodingException
      Specified by:
      doDecode in class AbstractMessageDecoder
      Throws:
      MessageDecodingException
    • parseMessage

      @Nullable protected abstract T parseMessage() throws MessageDecodingException
      Parses the message into the exact type of the request message.
      Returns:
      The request message
      Throws:
      MessageDecodingException - if there is a problem decoding the message context
    • getMessageToLog

      @Nullable protected abstract String getMessageToLog(T message)
      Get the string representation of what will be logged as the protocol message.
      Parameters:
      message - the request message
      Returns:
      the string representing the protocol message for logging purposes
    • serializeMessageForLogging

      @Nullable protected String serializeMessageForLogging(@Nullable Object message)
      Overrides:
      serializeMessageForLogging in class AbstractMessageDecoder
    • getEndpointURI

      @Nullable protected String getEndpointURI(T message)
      Returns the endpoint URI either from servlet request or from the given message, depending on the flag for removing IP address from the endpoint URI.
      Parameters:
      message - the message from which to take the endpoint URI (with IP address), if the flag is false
      Returns:
      the endpoint URI
    • switchIntoCustomResource

      protected void switchIntoCustomResource(@Nonnull com.nimbusds.oauth2.sdk.http.HTTPRequest httpRequest)
      Switches the 'resource' parameter names in the given HTTP request into a custom parameter name. This allows us to avoid Nimbus library's control over the values of the parameter.
      Parameters:
      httpRequest - The HTTP request object where the parameter names are switched