Class RefreshToken

All Implemented Interfaces:
Serializable, Comparable<Identifier>, net.minidev.json.JSONAware

@Immutable public final class RefreshToken extends Token
Refresh token.

Related specifications:

  • OAuth 2.0 (RFC 6749), section 1.5.
See Also:
  • Constructor Details

    • RefreshToken

      public RefreshToken()
      Creates a new refresh token with a randomly generated 256-bit (32-byte) value, Base64URL-encoded.
    • RefreshToken

      public RefreshToken(int byteLength)
      Creates a new refresh token with a randomly generated value of the specified length, Base64URL-encoded.
      Parameters:
      byteLength - The byte length of the value to generate. Must be greater than one.
    • RefreshToken

      public RefreshToken(String value)
      Creates a new refresh token with the specified value.
      Parameters:
      value - The refresh token value. Must not be null or empty string.
  • Method Details

    • getParameterNames

      Description copied from class: Token
      Returns the token parameter names included in the JSON object, as required for the composition of an access token response. See OAuth 2.0 (RFC 6749), section 5.1.
      Specified by:
      getParameterNames in class Token
      Returns:
      The token parameter names.
    • toJSONObject

      public net.minidev.json.JSONObject toJSONObject()
      Description copied from class: Token
      Returns the token parameters as a JSON object, as required for the composition of an access token response. See OAuth 2.0 (RFC 6749), section 5.1.

      Note that JSONObject implements Map&lt;String,Object&gt;.

      Example:

       {
         "access_token"      : "2YotnFZFEjr1zCsicMWpAA",
         "token_type"        : "example",
         "expires_in"        : 3600,
         "example_parameter" : "example_value"
       }
       
      Specified by:
      toJSONObject in class Token
      Returns:
      The token parameters as a JSON object.
    • parse

      public static RefreshToken parse(net.minidev.json.JSONObject jsonObject) throws ParseException
      Parses a refresh token from a JSON object access token response.
      Parameters:
      jsonObject - The JSON object to parse. Must not be null.
      Returns:
      The refresh token, null if not found.
      Throws:
      ParseException - If the JSON object couldn't be parsed to a refresh token.
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Identifier