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 com.nimbusds.oauth2.sdk.http.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 com.nimbusds.oauth2.sdk.http.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 com.nimbusds.oauth2.sdk.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, introspetion and revocation.
      Parameters:
      response - The response message
      Returns:
      The response message specific log message
    • getProtocolMessageForAuthenticationResponse

      @Nullable public static String getProtocolMessageForAuthenticationResponse(@Nonnull com.nimbusds.openid.connect.sdk.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 com.nimbusds.oauth2.sdk.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 com.nimbusds.openid.connect.sdk.rp.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 com.nimbusds.oauth2.sdk.client.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 com.nimbusds.oauth2.sdk.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 com.nimbusds.oauth2.sdk.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 com.nimbusds.oauth2.sdk.token.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 com.nimbusds.openid.connect.sdk.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 com.nimbusds.oauth2.sdk.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 com.nimbusds.oauth2.sdk.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 com.nimbusds.oauth2.sdk.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 com.nimbusds.jwt.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 com.nimbusds.openid.connect.sdk.claims.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 com.nimbusds.openid.connect.sdk.claims.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 com.nimbusds.jwt.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