Class AccessTokenResponse

java.lang.Object
org.openhab.core.auth.client.oauth2.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
Author:
Michael Bock - Initial contribution, Gary Tse - Adaptation for Eclipse SmartHome
See Also:
  • Constructor Details

    • AccessTokenResponse

      public AccessTokenResponse()
  • Method Details

    • isExpired

      public boolean isExpired(Instant 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).
      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

      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)
    • getCreatedOn

      public Instant getCreatedOn()
    • setCreatedOn

      public void setCreatedOn(Instant createdOn)
    • clone

      public Object clone()
      Overrides:
      clone in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object thatAuthTokenObj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object