Package com.nimbusds.oauth2.sdk.token
Class RefreshToken
java.lang.Object
com.nimbusds.oauth2.sdk.id.Identifier
com.nimbusds.oauth2.sdk.token.Token
com.nimbusds.oauth2.sdk.token.RefreshToken
- All Implemented Interfaces:
Serializable
,Comparable<Identifier>
,net.minidev.json.JSONAware
Refresh token.
Related specifications:
- OAuth 2.0 (RFC 6749), section 1.5.
- See Also:
-
Field Summary
Fields inherited from class com.nimbusds.oauth2.sdk.id.Identifier
DEFAULT_BYTE_LENGTH, secureRandom
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new refresh token with a randomly generated 256-bit (32-byte) value, Base64URL-encoded.RefreshToken
(int byteLength) Creates a new refresh token with a randomly generated value of the specified length, Base64URL-encoded.RefreshToken
(String value) Creates a new refresh token with the specified value. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns the token parameter names included in the JSON object, as required for the composition of an access token response.static RefreshToken
parse
(net.minidev.json.JSONObject jsonObject) Parses a refresh token from a JSON object access token response.net.minidev.json.JSONObject
Returns the token parameters as a JSON object, as required for the composition of an access token response.Methods inherited from class com.nimbusds.oauth2.sdk.token.Token
getCustomParameters
Methods inherited from class com.nimbusds.oauth2.sdk.id.Identifier
compareTo, getValue, hashCode, toJSONString, toString, toStringList
-
Constructor Details
-
RefreshToken
public RefreshToken()Creates a new refresh token with a randomly generated 256-bit (32-byte) value, Base64URL-encoded. -
RefreshToken
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
Creates a new refresh token with the specified value.- Parameters:
value
- The refresh token value. Must not benull
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 classToken
- Returns:
- The token parameter names.
-
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<String,Object>.
Example:
{ "access_token" : "2YotnFZFEjr1zCsicMWpAA", "token_type" : "example", "expires_in" : 3600, "example_parameter" : "example_value" }
- Specified by:
toJSONObject
in classToken
- Returns:
- The token parameters as a JSON object.
-
parse
Parses a refresh token from a JSON object access token response.- Parameters:
jsonObject
- The JSON object to parse. Must not benull
.- Returns:
- The refresh token,
null
if not found. - Throws:
ParseException
- If the JSON object couldn't be parsed to a refresh token.
-
equals
- Overrides:
equals
in classIdentifier
-