Class OidcDeviceAuthorization

java.lang.Object
com.codename1.io.oidc.OidcDeviceAuthorization

public final class OidcDeviceAuthorization extends Object

What an authorization server answers when a device starts the device authorization grant (RFC 8628): the code the user types, where they type it, and how the device waits.

Obtained from OidcClient.requestDeviceAuthorization(). Show getUserCode() and getVerificationUri() to the user -- or getVerificationUriComplete() as a QR code, which carries the code with it -- and hand this object to OidcClient.pollDeviceToken(OidcDeviceAuthorization).

  • Method Details

    • fromJson

      public static OidcDeviceAuthorization fromJson(Map<String,Object> json)

      Builds one from a parsed device authorization response.

      Parameters
      • json: the response, parsed
      Returns

      the authorization

      Throws
      • IllegalArgumentException: when the response has no device_code, no user_code or no verification address, or expires_in is not a nonnegative integer that can be represented as an expiry time, or a supplied interval is not a positive integer that fits the polling timer
    • getDeviceCode

      public String getDeviceCode()
      The code the device polls with. Not for the user's eyes.
    • getUserCode

      public String getUserCode()
      The short code the user types on the verification page.
    • getVerificationUri

      public String getVerificationUri()
      The page the user opens on another device to type the code.
    • getVerificationUriComplete

      public String getVerificationUriComplete()

      The same page with the code already in it, for a QR code.

      Returns

      the URI, or null when the server did not supply one

    • getExpiresAt

      public Date getExpiresAt()

      When the codes stop being valid.

      Returns

      the moment computed from the required expires_in response value

    • isExpired

      public boolean isExpired()
      Whether the codes have run out.
    • getInterval

      public int getInterval()
      The least number of seconds the device waits between two polls.