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 (roles and permissions) granted to the account.email- e-mail address of the user;nullwhen the account has none.emailVerified- whether the user proved to own the e-mail address.tenant- tenant the account belongs to; feeds thetenantclaim 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 Summary
FieldsModifier and TypeFieldDescriptionThe field for theauthoritiesrecord component.static final StringTenant of the accounts that do not name one.private final StringThe field for theemailrecord component.private final booleanThe field for theemailVerifiedrecord component.private final booleanThe field for theenabledrecord component.private final StringThe field for theencodedPasswordrecord component.private final UUIDThe field for theidrecord component.private final StringThe field for thetenantrecord component.private final StringThe field for theusernamerecord component. -
Constructor Summary
ConstructorsConstructorDescriptionUserAccount(UUID id, String username, String encodedPassword, boolean enabled, List<String> authorities) Creates an account without an e-mail address, in the default tenant.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. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theauthoritiesrecord component.email()Returns the value of theemailrecord component.booleanReturns the value of theemailVerifiedrecord component.booleanenabled()Returns the value of theenabledrecord component.Returns the value of theencodedPasswordrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.tenant()Returns the value of thetenantrecord component.final StringtoString()Returns a string representation of this record class.username()Returns the value of theusernamerecord component.
-
Field Details
-
id
The field for theidrecord component. -
username
The field for theusernamerecord component. -
encodedPassword
The field for theencodedPasswordrecord component. -
enabled
private final boolean enabledThe field for theenabledrecord component. -
authorities
The field for theauthoritiesrecord component. -
email
The field for theemailrecord component. -
emailVerified
private final boolean emailVerifiedThe field for theemailVerifiedrecord component. -
tenant
The field for thetenantrecord component. -
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
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
username
Returns the value of theusernamerecord component.- Returns:
- the value of the
usernamerecord component
-
encodedPassword
Returns the value of theencodedPasswordrecord component.- Returns:
- the value of the
encodedPasswordrecord component
-
enabled
public boolean enabled()Returns the value of theenabledrecord component.- Returns:
- the value of the
enabledrecord component
-
authorities
Returns the value of theauthoritiesrecord component.- Returns:
- the value of the
authoritiesrecord component
-
email
Returns the value of theemailrecord component.- Returns:
- the value of the
emailrecord component
-
emailVerified
public boolean emailVerified()Returns the value of theemailVerifiedrecord component.- Returns:
- the value of the
emailVerifiedrecord component
-
tenant
Returns the value of thetenantrecord component.- Returns:
- the value of the
tenantrecord component
-