java.lang.Object
net.shibboleth.idp.plugin.oidc.op.encoding.impl.ResponseUtil

public final class ResponseUtil extends Object
Response logging helper class.
  • Constructor Details

    • ResponseUtil

      private ResponseUtil()
      Private constructor.
  • Method Details

    • toString

      protected static String toString(@Nullable HTTPResponse httpResponse)
      Helper method to print response to string for logging.
      Parameters:
      httpResponse - response to be printed
      Returns:
      response as formatted string.
    • toString

      protected static String toString(@Nullable HTTPResponse httpResponse, @Nullable com.fasterxml.jackson.databind.ObjectMapper objectMapper)
      Helper method to print response to string for logging.
      Parameters:
      httpResponse - response to be printed
      objectMapper - object mapper used for pretty printing JSON content
      Returns:
      response as formatted string
      Since:
      4.1.0
    • toString

      @Nullable protected static String toString(@Nullable HttpServletResponse httpServletResponse, @Nullable String content)
      Helper method to print response to string for logging.
      Parameters:
      httpServletResponse - response to be printed
      content - message content
      Returns:
      response as formatted string.
    • getProtocolMessage

      @Nullable public static String getProtocolMessage(@Nullable Response response)
      Helper method for getting protocol message for a Nimbus response object. This method can currently recognize success and error responses for OIDC authentication, token, userinfo, introspection and revocation.
      Parameters:
      response - The response message
      Returns:
      The response message specific log message
    • getProtocolMessageForAuthenticationResponse

      @Nullable public static String getProtocolMessageForAuthenticationResponse(@Nonnull AuthenticationResponse response)
      Helper method for getting protocol message for OIDC authentication response.
      Parameters:
      response - The response message
      Returns:
      The response message specific log message
    • getProtocolMessageForAuthorizationResponse

      @Nullable public static String getProtocolMessageForAuthorizationResponse(@Nonnull AuthorizationResponse response)
      Helper method for getting protocol message for OAuth authorization response.
      Parameters:
      response - The response message
      Returns:
      The response message specific log message
    • getProtocolMessageForRegistrationResponse

      @Nullable public static String getProtocolMessageForRegistrationResponse(@Nonnull OIDCClientInformationResponse response)
      Helper method for getting protocol message for OIDC registration response.
      Parameters:
      response - The response message
      Returns:
      The response message specific log message
    • getProtocolMessageForClientInformation

      @Nullable public static String getProtocolMessageForClientInformation(@Nullable ClientInformation clientInformation)
      Helper method for getting protocol message for client information object.
      Parameters:
      clientInformation - The client information
      Returns:
      The log message
    • getProtocolMessageForTokenResponse

      @Nullable public static String getProtocolMessageForTokenResponse(@Nonnull TokenResponse response)
      Helper method for getting protocol message for token response.
      Parameters:
      response - The response message
      Returns:
      The response message specific log message
    • getProtocolMessageForErrorObject

      @Nullable public static String getProtocolMessageForErrorObject(@Nullable ErrorObject errorObject)
      Helper method for getting protocol message for error object.
      Parameters:
      errorObject - The error object
      Returns:
      The log message
    • getProtocolMessageForTokens

      @Nullable public static String getProtocolMessageForTokens(@Nullable Tokens tokens)
      Helper method for getting protocol message for tokens object.
      Parameters:
      tokens - The tokens object
      Returns:
      The log message
    • getProtocolMessageForUserInfoResponse

      @Nullable public static String getProtocolMessageForUserInfoResponse(@Nonnull UserInfoResponse response)
      Helper method for getting protocol message for OIDC user info response.
      Parameters:
      response - The response message
      Returns:
      The response message specific log message
    • getProtocolMessageForIntrospectionResponse

      @Nullable public static String getProtocolMessageForIntrospectionResponse(@Nonnull TokenIntrospectionResponse response)
      Helper method for getting protocol message for introspection response.
      Parameters:
      response - The response message
      Returns:
      The response message specific log message
    • getProtocolMessageForRevocationResponse

      @Nullable public static String getProtocolMessageForRevocationResponse(@Nonnull Response response)
      Helper method for getting protocol message for revocation response.
      Parameters:
      response - The response message
      Returns:
      The response message specific log message
    • getProtocolMessageForJSONSuccessResponse

      @Nullable public static String getProtocolMessageForJSONSuccessResponse(@Nonnull Response response)
      Helper method for getting protocol message for JSON success response.
      Parameters:
      response - The response message
      Returns:
      The response message specific log message
    • getJwtProtocolMessage

      @Nonnull public static String getJwtProtocolMessage(@Nonnull JWT jwt, @Nonnull com.fasterxml.jackson.databind.ObjectMapper objectMapper) throws ParseException
      Helper method for getting protocol message for JWT payload.
      Parameters:
      jwt - The JWT whose payload is included in the message
      objectMapper - object mapper used for pretty printing JSON content
      Returns:
      The protocol message containing JWT payload
      Throws:
      ParseException - IF the protocol message cannot be constructed
      Since:
      4.1.0
    • getIdTokenProtocolMessage

      @Nonnull public static String getIdTokenProtocolMessage(@Nonnull IDTokenClaimsSet idToken, @Nonnull com.fasterxml.jackson.databind.ObjectMapper objectMapper) throws ParseException
      Helper method for getting protocol message for ID token payload.
      Parameters:
      idToken - The ID token whose payload is included in the message
      objectMapper - object mapper used for pretty printing JSON content
      Returns:
      The protocol message containing JWT payload
      Throws:
      ParseException - IF the protocol message cannot be constructed
      Since:
      4.1.0
    • getLogoutTokenProtocolMessage

      @Nonnull public static String getLogoutTokenProtocolMessage(@Nonnull LogoutTokenClaimsSet logoutToken, @Nonnull com.fasterxml.jackson.databind.ObjectMapper objectMapper) throws ParseException
      Helper method for getting protocol message for logout token payload.
      Parameters:
      logoutToken - logout token whose payload is included in the message
      objectMapper - object mapper used for pretty printing JSON content
      Returns:
      The protocol message containing logout token payload
      Throws:
      ParseException - IF the protocol message cannot be constructed
      Since:
      4.1.0
    • getJwtProtocolMessage

      @Nonnull public static String getJwtProtocolMessage(@Nullable JWTClaimsSet claimsSet, @Nonnull com.fasterxml.jackson.databind.ObjectMapper objectMapper) throws ParseException
      Helper method for getting protocol message for JWT payload.
      Parameters:
      claimsSet - The claims set to be included in the message
      objectMapper - object mapper used for pretty printing JSON content
      Returns:
      The protocol message containing JWT payload
      Throws:
      ParseException - IF the protocol message cannot be constructed
      Since:
      4.1.0