com.nimbusds.oauth2.sdk.token
Class RefreshToken

java.lang.Object
  extended by com.nimbusds.oauth2.sdk.id.Identifier
      extended by com.nimbusds.oauth2.sdk.token.Token
          extended by com.nimbusds.oauth2.sdk.token.RefreshToken
All Implemented Interfaces:
Comparable<RefreshToken>, net.minidev.json.JSONAware

@Immutable
public final class RefreshToken
extends Token
implements Comparable<RefreshToken>

Refresh token. This class is immutable.

Related specifications:

Author:
Vladimir Dzhuvinov

Constructor Summary
RefreshToken()
          Creates a new refresh token with a randomly generated value.
RefreshToken(int length)
          Creates a new refresh token with a randomly generated value of the specified length.
RefreshToken(String value)
          Creates a new refresh token with the specified value.
 
Method Summary
 int compareTo(RefreshToken other)
           
 boolean equals(Object object)
          Overrides Object.equals().
static RefreshToken parse(net.minidev.json.JSONObject jsonObject)
          Parses a refresh token from a JSON object access token response.
 net.minidev.json.JSONObject toJSONObject()
          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.id.Identifier
getValue, hashCode, toJSONString, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RefreshToken

public RefreshToken()
Creates a new refresh token with a randomly generated value. The value will be made up of 32 mixed-case alphanumeric ASCII characters.


RefreshToken

public RefreshToken(int length)
Creates a new refresh token with a randomly generated value of the specified length. The value will be made up of mixed-case alphanumeric ASCII characters.

Parameters:
length - The number of characters. Must be a positive integer.

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 Detail

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<String,Object>.

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)
Description copied from class: Identifier
Overrides Object.equals().

Specified by:
equals in class Identifier
Parameters:
object - The object to compare to.
Returns:
true if the objects have the same value, otherwise false.

compareTo

public int compareTo(RefreshToken other)
Specified by:
compareTo in interface Comparable<RefreshToken>


Copyright © 2013 NimbusDS. All Rights Reserved.