Record Class UserAccount

java.lang.Object
java.lang.Record
com.irurueta.authserver.authorization.domain.password.UserAccount
Record Components:
id - unique identifier of the account.
username - name the user signs in with.
encodedPassword - password hash, including its encoding prefix; never a clear-text password.
enabled - whether the account can be used to sign in.
authorities - authorities (roles and permissions) granted to the account.
email - e-mail address of the user; null when the account has none.
emailVerified - whether the user proved to own the e-mail address.
tenant - tenant the account belongs to; feeds the tenant claim of issued tokens.

public record UserAccount(UUID id, String username, String encodedPassword, boolean enabled, List<String> authorities, String email, boolean emailVerified, String tenant) extends Record
A user that can sign in with a password.
  • Field Details

    • id

      private final UUID id
      The field for the id record component.
    • username

      private final String username
      The field for the username record component.
    • encodedPassword

      private final String encodedPassword
      The field for the encodedPassword record component.
    • enabled

      private final boolean enabled
      The field for the enabled record component.
    • authorities

      private final List<String> authorities
      The field for the authorities record component.
    • email

      private final String email
      The field for the email record component.
    • emailVerified

      private final boolean emailVerified
      The field for the emailVerified record component.
    • tenant

      private final String tenant
      The field for the tenant record component.
    • DEFAULT_TENANT

      public static final String DEFAULT_TENANT
      Tenant of the accounts that do not name one.
      See Also:
  • Constructor Details

    • UserAccount

      public UserAccount(UUID id, String username, String encodedPassword, boolean enabled, List<String> authorities)
      Creates an account without an e-mail address, in the default tenant.
      Parameters:
      id - unique identifier of the account.
      username - name the user signs in with.
      encodedPassword - password hash, including its encoding prefix.
      enabled - whether the account can be used to sign in.
      authorities - authorities granted to the account.
    • UserAccount

      public UserAccount(UUID id, String username, String encodedPassword, boolean enabled, List<String> authorities, String email, boolean emailVerified, String tenant)
      Validates the account and defensively copies its authorities.
      Throws:
      IllegalArgumentException - if the id is null, the username or encoded password is null or blank, or the authorities are null or contain a null element, the e-mail is blank or the tenant is null or blank.
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
    • id

      public UUID id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • username

      public String username()
      Returns the value of the username record component.
      Returns:
      the value of the username record component
    • encodedPassword

      public String encodedPassword()
      Returns the value of the encodedPassword record component.
      Returns:
      the value of the encodedPassword record component
    • enabled

      public boolean enabled()
      Returns the value of the enabled record component.
      Returns:
      the value of the enabled record component
    • authorities

      public List<String> authorities()
      Returns the value of the authorities record component.
      Returns:
      the value of the authorities record component
    • email

      public String email()
      Returns the value of the email record component.
      Returns:
      the value of the email record component
    • emailVerified

      public boolean emailVerified()
      Returns the value of the emailVerified record component.
      Returns:
      the value of the emailVerified record component
    • tenant

      public String tenant()
      Returns the value of the tenant record component.
      Returns:
      the value of the tenant record component