Class UserCode

java.lang.Object
com.nimbusds.oauth2.sdk.id.Identifier
com.nimbusds.oauth2.sdk.device.UserCode
All Implemented Interfaces:
Serializable, Comparable<Identifier>, net.minidev.json.JSONAware

@Immutable public final class UserCode extends Identifier
User code.

Related specifications:

  • OAuth 2.0 Device Authorization Grant (RFC 8628)
See Also:
  • Field Details

  • Constructor Details

    • UserCode

      public UserCode(String value, String charset)
      Creates a new user code with the specified value.
      Parameters:
      value - The code value. Must not be null or empty string.
      charset - The character set used by the identifier. The identifier can only contain characters from this set. If null, all characters are allowed.
    • UserCode

      public UserCode(String value)
      Creates a new user code with the specified value and the LETTER_CHAR_SET.
      Parameters:
      value - The code value. Must not be null or empty string.
    • UserCode

      public UserCode()
      Creates a new user code with a randomly generated value with 8 characters from LETTER_CHAR_SET, in the form WDJB-MJHT.
    • UserCode

      public UserCode(String charset, int length)
      Creates a new user code with a randomly generated value from the specified charset and length. A dash is added every 4 characters.
      Parameters:
      charset - The character set used by the identifier. The identifier will contain characters from this set. Must not be null or empty string.
      length - The length of the value to generate.
  • Method Details