Class AccessTokenResponse

  • All Implemented Interfaces:
    Serializable, Cloneable

    public final class AccessTokenResponse
    extends Object
    implements 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
    Michael Bock - Initial contribution, Gary Tse - Adaptation for Eclipse SmartHome
    See Also:
    Serialized Form
    • Constructor Detail

      • AccessTokenResponse

        public AccessTokenResponse()
    • Method Detail

      • isExpired

        public boolean isExpired​(LocalDateTime givenTime,
                                 int tokenExpiresInBuffer)
        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).
        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.
        true if object is not-initialized, or expired, or expired early due to buffer
      • getAccessToken

        public String getAccessToken()
      • setAccessToken

        public void setAccessToken​(String accessToken)
      • getTokenType

        public String getTokenType()
      • setTokenType

        public void setTokenType​(String tokenType)
      • getExpiresIn

        public long getExpiresIn()
      • setExpiresIn

        public void setExpiresIn​(long expiresIn)
      • getRefreshToken

        public String getRefreshToken()
      • setRefreshToken

        public void setRefreshToken​(String refreshToken)
      • getScope

        public String getScope()
      • setScope

        public void setScope​(String scope)
      • getState

        public String getState()
      • setState

        public void setState​(String state)
      • setCreatedOn

        public void setCreatedOn​(LocalDateTime createdOn)
      • hashCode

        public int hashCode()
        hashCode in class Object
      • equals

        public boolean equals​(Object thatAuthTokenObj)
        equals in class Object