Interface UserAccountRepository
public interface UserAccountRepository
Port that provides the user accounts able to sign in with a password. An implementation never returns
null and never lets a framework or storage type escape through it.-
Method Summary
Modifier and TypeMethodDescriptionbooleanexistsByUsername(String username) Tells whether an account with a username exists.findByEmail(String email) Finds a user account by its e-mail address.Finds a user account by its identifier.findByUsername(String username) Finds a user account by the name the user signs in with.booleanmarkEmailVerified(UUID userId) Marks the e-mail address of an account as verified and enables the account, but only while the address is still unverified: the transition happens once, so a replayed verification never re-enables an account that was disabled after its address had been verified.voidsave(UserAccount account) Stores a new account, with its authorities.voidupdatePassword(UUID userId, String encodedPassword) Replaces the encoded password of an account.
-
Method Details
-
findByUsername
Finds a user account by the name the user signs in with.- Parameters:
username- name the user signs in with.- Returns:
- the account, or an empty optional when no account has that username.
-
findById
Finds a user account by its identifier.- Parameters:
id- identifier of the account.- Returns:
- the account, or an empty optional when there is none.
-
findByEmail
Finds a user account by its e-mail address.- Parameters:
email- e-mail address of the user.- Returns:
- the account, or an empty optional when no account has that address.
-
existsByUsername
Tells whether an account with a username exists.- Parameters:
username- name the user signs in with.- Returns:
truewhen an account has that username.
-
save
Stores a new account, with its authorities.- Parameters:
account- the account to create.
-
updatePassword
Replaces the encoded password of an account.- Parameters:
userId- identifier of the account.encodedPassword- the new encoded password.
-
markEmailVerified
Marks the e-mail address of an account as verified and enables the account, but only while the address is still unverified: the transition happens once, so a replayed verification never re-enables an account that was disabled after its address had been verified.- Parameters:
userId- identifier of the account.- Returns:
truewhen the address was unverified and is now verified,falsewhen the account does not exist or its address had already been verified (nothing changes then).
-