Record Class DeviceAuthorization

java.lang.Object
java.lang.Record
com.irurueta.authserver.serviceclient.device.DeviceAuthorization
Record Components:
deviceCode - the code the CLI presents when polling; a secret, never printed.
userCode - the code the user types (or confirms) on the verification page.
verificationUri - the page where the user approves the request.
verificationUriComplete - the same page with the user code included; may be null (optional in the RFC).
expiresIn - seconds the device code lives; the default when the server sends none or sends null.
interval - minimum seconds between two polls; the default when the server sends none or sends null (Spring Authorization Server does not send one).

public record DeviceAuthorization(String deviceCode, String userCode, String verificationUri, String verificationUriComplete, long expiresIn, long interval) extends Record
Response of the device authorization endpoint (RFC 8628 section 3.2).
  • Field Details

    • deviceCode

      private final String deviceCode
      The field for the deviceCode record component.
    • userCode

      private final String userCode
      The field for the userCode record component.
    • verificationUri

      private final String verificationUri
      The field for the verificationUri record component.
    • verificationUriComplete

      private final String verificationUriComplete
      The field for the verificationUriComplete record component.
    • expiresIn

      private final long expiresIn
      The field for the expiresIn record component.
    • interval

      private final long interval
      The field for the interval record component.
    • DEFAULT_EXPIRES_IN_SECONDS

      public static final long DEFAULT_EXPIRES_IN_SECONDS
      Lifetime assumed when the server does not say (the Spring Authorization Server default is five minutes).
      See Also:
    • DEFAULT_INTERVAL_SECONDS

      public static final long DEFAULT_INTERVAL_SECONDS
      Polling interval assumed when the server does not say (RFC 8628 section 3.2).
      See Also:
  • Constructor Details

    • DeviceAuthorization

      public DeviceAuthorization(String deviceCode, String userCode, String verificationUri, String verificationUriComplete, long expiresIn, long interval)
      Validates the mandatory members and applies the defaults of the optional ones.
      Parameters:
      deviceCode - the device code.
      userCode - the user code.
      verificationUri - the verification page.
      verificationUriComplete - the verification page with the user code; optional.
      expiresIn - seconds the device code lives; zero or negative means the default.
      interval - seconds between polls; zero or negative means the default.
  • Method Details

    • toString

      public String toString()
      Describes the authorization without the device code, which is a secret.
      Specified by:
      toString in class Record
      Returns:
      a description without secrets.
    • isBlank

      private static boolean isBlank(String value)
      Tells whether a text is missing or blank.
      Parameters:
      value - the text.
      Returns:
      true when it has no content.
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • deviceCode

      public String deviceCode()
      Returns the value of the deviceCode record component.
      Returns:
      the value of the deviceCode record component
    • userCode

      public String userCode()
      Returns the value of the userCode record component.
      Returns:
      the value of the userCode record component
    • verificationUri

      public String verificationUri()
      Returns the value of the verificationUri record component.
      Returns:
      the value of the verificationUri record component
    • verificationUriComplete

      public String verificationUriComplete()
      Returns the value of the verificationUriComplete record component.
      Returns:
      the value of the verificationUriComplete record component
    • expiresIn

      public long expiresIn()
      Returns the value of the expiresIn record component.
      Returns:
      the value of the expiresIn record component
    • interval

      public long interval()
      Returns the value of the interval record component.
      Returns:
      the value of the interval record component