@Immutable public class Tokens extends Object
| Constructor and Description |
|---|
Tokens(AccessToken accessToken,
RefreshToken refreshToken)
Creates a new tokens instance.
|
| Modifier and Type | Method and Description |
|---|---|
AccessToken |
getAccessToken()
Returns the access token.
|
BearerAccessToken |
getBearerAccessToken()
Returns the access token as type bearer.
|
Set<String> |
getParameterNames()
Returns the token parameter names for the included tokens.
|
RefreshToken |
getRefreshToken()
Returns the optional refresh token.
|
static Tokens |
parse(net.minidev.json.JSONObject jsonObject)
Parses an access and optional refresh token from the specified JSON
object.
|
net.minidev.json.JSONObject |
toJSONObject()
Returns the JSON object representation of this token pair.
|
String |
toString() |
public Tokens(AccessToken accessToken, RefreshToken refreshToken)
accessToken - The access token. Must not be null.refreshToken - The refresh token. If none null.public AccessToken getAccessToken()
public BearerAccessToken getBearerAccessToken()
null if the type is
different.public RefreshToken getRefreshToken()
null if none.public Set<String> getParameterNames()
public net.minidev.json.JSONObject toJSONObject()
Example JSON object:
{
"access_token" : "dZdt8BlltORMTz5U",
"refresh_token" : "E87zjAoeNXaSoF1U"
}
public static Tokens parse(net.minidev.json.JSONObject jsonObject) throws ParseException
jsonObject - The JSON object to parse. Must not be null.ParseException - If the JSON object couldn't be parsed to a
tokens instance.Copyright © 2016 Connect2id Ltd.. All rights reserved.