public class OAuth2Tokens extends Object
Modifier and Type | Field and Description |
---|---|
protected String |
accessToken |
protected Date |
expiry |
protected String |
refreshToken |
Constructor and Description |
---|
OAuth2Tokens(String accessToken,
String refreshToken)
Store token data without the expiry date of the access token.
|
OAuth2Tokens(String accessToken,
String refreshToken,
Date expiry)
Store token data including the expiry date of the access token.
|
Modifier and Type | Method and Description |
---|---|
static Date |
calculateExpiry(Number expiresInSeconds)
Calculate a date timestamp a given number of seconds in the future.
|
void |
expireAccessToken()
Forcibly expire the access token by setting the expiry
timestamp to the epoch.
|
String |
getAccessToken() |
Date |
getExpiry() |
String |
getRefreshToken() |
boolean |
isAccessTokenExpired() |
String |
toString() |
protected final String accessToken
protected final String refreshToken
protected Date expiry
public OAuth2Tokens(String accessToken, String refreshToken, Date expiry)
accessToken
- refreshToken
- expiry
- public String getAccessToken()
public String getRefreshToken()
public Date getExpiry()
public void expireAccessToken()
public boolean isAccessTokenExpired()
getExpiry()
is null) since the expiry time is unknown.public static Date calculateExpiry(Number expiresInSeconds)
expiresInSeconds
- how many seconds in the future the result should be. May be null,
in which case the current date/time is returned.Copyright © 2006–2018. All rights reserved.