Package com.iizix.server.oauth
Class AccessToken
java.lang.Object
com.iizix.server.oauth.AccessToken
The access token wrapper for OAuth 2.0 and OAuth 1.0a access tokens.
- Author:
- Christopher Mindus
Constructor Summary
ConstructorDescriptionAccessToken
(com.github.scribejava.core.model.OAuth1AccessToken accessToken1, com.github.scribejava.core.model.OAuth1RequestToken requestToken) Constructs the access token for OAuth 1.0a.AccessToken
(com.github.scribejava.core.model.OAuth2AccessToken accessToken2) Constructs the access token for OAuth 2.0.Method Summary
Modifier and TypeMethodDescriptionboolean
Returns if two access tokens are equal.Returns the access token.long
Gets the expiry date.int
hashCode()
Gets the hash code.boolean
isValid
(long additionalTime) Checks if the access token would expire within the requested additional time, e.g.toString()
Gets a String.
Constructor Details
AccessToken
public AccessToken(com.github.scribejava.core.model.OAuth2AccessToken accessToken2) Constructs the access token for OAuth 2.0.- Parameters:
accessToken2
- The access token.- Throws:
NullPointerException
- If the {code accessToken2} parameter is null.
AccessToken
public AccessToken(com.github.scribejava.core.model.OAuth1AccessToken accessToken1, com.github.scribejava.core.model.OAuth1RequestToken requestToken) Constructs the access token for OAuth 1.0a.- Parameters:
accessToken1
- The access token.requestToken
- The request token used to get the access token.- Throws:
NullPointerException
- If the {code accessToken1} or {code requestToken} parameter is null.
Method Details
isValid
public boolean isValid(long additionalTime) Checks if the access token would expire within the requested additional time, e.g. 20_000 ms (20 seconds) that an operation would require to run.- Returns:
- true If the access token has expired or would expire, false if it's OK to use it.
getExpiresTime
public long getExpiresTime()Gets the expiry date.- Returns:
- The access token expiry time in milliseconds since the epoch, zero if unknown.
getAccessToken
Returns the access token.- Returns:
- The access token String.
hashCode
public int hashCode()Gets the hash code.equals
Returns if two access tokens are equal.toString
Gets a String.