Class AccessTokenResponse
java.lang.Object
org.openhab.core.auth.client.oauth2.AccessTokenResponse
- All Implemented Interfaces:
Serializable,Cloneable
This is the Access Token Response, a simple value-object that holds the result of the
from an Access Token Request, as listed in RFC 6749:
4.1.4 - Authorization Code grant - Access Token Response,
4.2.2 - Implicit Grant - Access Token Response,
4.3.3 - Resource Owner Password Credentials Grant - Access Token Response
4.4.3 - Client Credentials Grant - Access Token Response
- Author:
- Michael Bock - Initial contribution, Gary Tse - Adaptation for Eclipse SmartHome
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()booleanlonggetScope()getState()inthashCode()booleanCalculate if the token is expired against the given time.voidsetAccessToken(String accessToken) voidsetCreatedOn(Instant createdOn) voidsetExpiresIn(long expiresIn) voidsetRefreshToken(String refreshToken) voidvoidvoidsetTokenType(String tokenType) toString()
-
Constructor Details
-
AccessTokenResponse
public AccessTokenResponse()
-
-
Method Details
-
isExpired
Calculate if the token is expired against the given time. It also returns true even if the token is not initialized (i.e. object newly created).- Parameters:
givenTime- To calculate if the token is expired against the givenTime.tokenExpiresInBuffer- A positive integer in seconds to act as additional buffer to the calculation. This causes the OAuthToken to expire earlier then the stated expiry-time given by the authorization server.- Returns:
- true if object is not-initialized, or expired, or expired early due to buffer
-
getAccessToken
-
setAccessToken
-
getTokenType
-
setTokenType
-
getExpiresIn
public long getExpiresIn() -
setExpiresIn
public void setExpiresIn(long expiresIn) -
getRefreshToken
-
setRefreshToken
-
getScope
-
setScope
-
getState
-
setState
-
getCreatedOn
-
setCreatedOn
-
clone
-
hashCode
public int hashCode() -
equals
-
toString
-