public class AccessToken extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
AccessToken()
Create empty store.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(AccessTokenRefreshListener listener,
boolean fireNow)
Add listener to this access token.
|
static AccessToken |
copyToken(AccessToken otherToken)
Create a copy of existing token object but without registered in it listeners.
|
static AccessToken |
createToken(String accessToken,
String refreshToken,
Long expiresInSeconds,
String scope)
Init token from existing data.
|
protected void |
fireListeners() |
String |
getAccessToken() |
Calendar |
getExpirationTime() |
String |
getRefreshToken() |
String |
getScope() |
void |
init(String accessToken,
String refreshToken,
Long expiresInSeconds,
String scope)
Set new OAuth2 token data and fire registered listeners.
|
boolean |
isExpired()
Return
true if access token expired and should be renewed. |
boolean |
isExpired(Calendar toDate)
Return
true if access token expired to given date. |
boolean |
isInitialized()
Return
true if this instance of AccessToken initialized with access token. |
void |
load(String accessToken,
String refreshToken,
Calendar expirationTime,
String scope)
Load OAuth2 token from given data.
|
void |
merge(AccessToken newToken)
Import OAuth2 tokens from a new
AccessToken and unregister listeners of that instance. |
static AccessToken |
newToken()
Create empty not initialized token object.
|
void |
removeListener(AccessTokenRefreshListener listener) |
protected void |
removeListeners() |
public static AccessToken newToken()
#init(String, String, long, String) to set access
data to the object.AccessTokenpublic static AccessToken createToken(String accessToken, String refreshToken, Long expiresInSeconds, String scope)
accessToken - refreshToken - expiresInSeconds - scope - AccessTokenpublic static AccessToken copyToken(AccessToken otherToken)
otherToken - AccessTokenAccessTokenpublic void addListener(AccessTokenRefreshListener listener, boolean fireNow)
listener - AccessTokenRefreshListenerfireNow - boolean if true fire given listener on this access tokenpublic void removeListener(AccessTokenRefreshListener listener)
public String getAccessToken()
public String getRefreshToken()
nullpublic Calendar getExpirationTime()
public String getScope()
nullpublic void merge(AccessToken newToken)
AccessToken and unregister listeners of that instance.newToken - AccessTokenCloudDriveExceptionpublic void init(String accessToken, String refreshToken, Long expiresInSeconds, String scope)
accessToken - refreshToken - expiresInSeconds - Long when token expires in secondsscope - public void load(String accessToken, String refreshToken, Calendar expirationTime, String scope)
accessToken - refreshToken - expirationTime - Calendarscope - public boolean isExpired()
true if access token expired and should be renewed.true if expired, false otherwisepublic boolean isExpired(Calendar toDate)
true if access token expired to given date.toDate - Calendar some date to check if this token will be expired after ittrue if expired, false otherwisepublic boolean isInitialized()
true if this instance of AccessToken initialized with access token.true if initialized, false otherwiseprotected void removeListeners()
protected void fireListeners()
Copyright © 2003–2015 eXo Platform SAS. All rights reserved.