public class OAuth2Token extends java.lang.Object
Constructor and Description |
---|
OAuth2Token() |
Modifier and Type | Method and Description |
---|---|
boolean |
expiresIn(long time)
This returns true if the token has already expired, expires in the the given timeframe or does not have a valid
expiration time
|
static java.util.Date |
fromExpiresIn(java.lang.Long expiresIn) |
java.lang.String |
getAccessToken() |
java.util.Date |
getExpires() |
java.lang.String |
getRefreshToken() |
static com.google.gson.Gson |
getTokenGSONSerializer() |
java.lang.String |
getType() |
boolean |
isExpired()
Same as calling expiresIn(0)
|
boolean |
isValid()
Note: if you want to know if this token has expired, use isExpired() instead
Note: this does not validate the token stricly as defined by the OAuth2 spec
(e.g.
|
void |
setAccessToken(java.lang.String accessToken) |
void |
setExpires(java.util.Date expires) |
void |
setExpiresIn(java.lang.Long expiresIn) |
void |
setRefreshToken(java.lang.String refreshToken) |
void |
setType(java.lang.String type) |
static java.lang.Long |
toExpiresIn(java.util.Date expirationDate) |
public OAuth2Token()
public static com.google.gson.Gson getTokenGSONSerializer()
public static java.util.Date fromExpiresIn(java.lang.Long expiresIn)
expiresIn
- in secondspublic static java.lang.Long toExpiresIn(java.util.Date expirationDate)
expirationDate
- public boolean isValid()
public boolean isExpired()
expiresIn(long)
public boolean expiresIn(long time)
time
- the timeframe in mspublic java.lang.String getAccessToken()
public void setAccessToken(java.lang.String accessToken)
accessToken
- the accessToken to setpublic java.lang.String getRefreshToken()
public void setRefreshToken(java.lang.String refreshToken)
refreshToken
- the refreshToken to setpublic java.util.Date getExpires()
public void setExpires(java.util.Date expires)
expires
- the expires to setpublic void setExpiresIn(java.lang.Long expiresIn)
expiresIn
- (in seconds)public java.lang.String getType()
public void setType(java.lang.String type)
type
- the type to setCopyright © 2015 Tampere University of Technology, Pori Department.