@Immutable public class Tokens extends java.lang.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.
|
java.util.Set<java.lang.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.
|
java.lang.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 java.util.Set<java.lang.String> getParameterNames()
public net.minidev.json.JSONObject toJSONObject()
Example JSON object:
{ "access_token" : "dZdt8BlltORMTz5U", "refresh_token" : "E87zjAoeNXaSoF1U" }
public java.lang.String toString()
toString
in class java.lang.Object
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 © 2015 Connect2id Ltd.. All Rights Reserved.