public final class OAuthToken
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Method and Description |
---|---|
java.lang.String |
createAuthorizationHeader()
Returns authorization header from token type and access token.
|
java.lang.String |
getAccessToken()
Returns the access token issued by the authorization server.
|
java.util.HashMap<java.lang.String,java.lang.String> |
getAdditionalData()
Returns the HashMap of additional OAuth attributes.
|
java.util.Date |
getCreatedOn()
Returns the date the token was created.
|
java.util.Date |
getExpiresOn()
Returns a
Date object, representing when the token expires. |
java.lang.String |
getRefreshToken()
Returns the refresh token, which can be used to obtain new access tokens using the same
authorization grant.
|
java.lang.String[] |
getScope()
Returns the scope that the token has authorized.
|
java.lang.String |
getTokenType()
Returns the type of token issued.
|
boolean |
hasTokenExpired()
Returns whether the access token has expired.
|
static OAuthToken |
retrieve()
Loads the
OAuthToken object from SharedPreferences. |
boolean |
shouldRefresh()
The flag to indicate if the access token should be refreshed.
|
void |
store()
Saves the
OAuthToken object to SharedPreferences. |
public static OAuthToken retrieve()
OAuthToken
object from SharedPreferences.public void store()
OAuthToken
object to SharedPreferences.public java.lang.String getAccessToken()
public java.lang.String getRefreshToken()
public java.util.Date getExpiresOn()
Date
object, representing when the token expires.public java.lang.String getTokenType()
public java.lang.String[] getScope()
public java.util.Date getCreatedOn()
Date
the token was createdpublic boolean hasTokenExpired()
Date
represented by expiresOn
was before,
false otherwisepublic java.lang.String createAuthorizationHeader()
Bearer ABCD1234
public java.util.HashMap<java.lang.String,java.lang.String> getAdditionalData()
public boolean shouldRefresh()