Class DeviceCodeResponseDTO

java.lang.Object
org.openhab.core.auth.client.oauth2.DeviceCodeResponseDTO
All Implemented Interfaces:
Serializable, Cloneable

public final class DeviceCodeResponseDTO extends Object implements Serializable, Cloneable
This DeviceCodeResponseDTO is a DTO with fields that encapsulate the data from RFC-8628 device code responses.

Note: RFC-8628 says 'verificationUriComplete' and 'interval' are OPTIONAL fields.

See AccessTokenResponse for reference.

Author:
Andrew Fiddian-Green - Initial contribution
See Also:
  • Constructor Details

    • DeviceCodeResponseDTO

      public DeviceCodeResponseDTO()
  • Method Details

    • clone

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

      public Instant getCreatedOn()
    • getDeviceCode

      public String getDeviceCode()
    • getExpiresIn

      public long getExpiresIn()
    • getInterval

      public Long getInterval()
    • getUserCode

      public String getUserCode()
    • getVerificationUri

      public String getVerificationUri()
    • getVerificationUriComplete

      public String getVerificationUriComplete()
    • isExpired

      public boolean isExpired(Instant givenTime, int tokenExpiresInBuffer)
      Calculate if the device code response is expired against the given time. It also returns true even if the response is not initialized (i.e. newly created).
      Parameters:
      givenTime - To calculate if the response is expired against the givenTime.
      tokenExpiresInBuffer - A positive integer in seconds to act as additional buffer to the calculation. This causes the response to expire earlier then the stated expiry-time given.
      Returns:
      true if object is not-initialized, or expired, or expired early due to buffer.
    • setCreatedOn

      public void setCreatedOn(Instant createdOn)
    • setDeviceCode

      public void setDeviceCode(String deviceCode)
    • setExpiresIn

      public void setExpiresIn(long expiresIn)
    • setInterval

      public void setInterval(Long interval)
    • setUserCode

      public void setUserCode(String userCode)
    • setVerificationUri

      public void setVerificationUri(String verificationUri)
    • setVerificationUriComplete

      public void setVerificationUriComplete(String verificationUriComplete)
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object