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 Type
    Method
    Description
    boolean
    Tells whether an account with a username exists.
    Finds a user account by its e-mail address.
    Finds a user account by its identifier.
    Finds a user account by the name the user signs in with.
    boolean
    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.
    void
    save(UserAccount account)
    Stores a new account, with its authorities.
    void
    updatePassword(UUID userId, String encodedPassword)
    Replaces the encoded password of an account.
  • Method Details

    • findByUsername

      Optional<UserAccount> findByUsername(String username)
      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

      Optional<UserAccount> findById(UUID id)
      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

      Optional<UserAccount> findByEmail(String email)
      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

      boolean existsByUsername(String username)
      Tells whether an account with a username exists.
      Parameters:
      username - name the user signs in with.
      Returns:
      true when an account has that username.
    • save

      void save(UserAccount account)
      Stores a new account, with its authorities.
      Parameters:
      account - the account to create.
    • updatePassword

      void updatePassword(UUID userId, String encodedPassword)
      Replaces the encoded password of an account.
      Parameters:
      userId - identifier of the account.
      encodedPassword - the new encoded password.
    • markEmailVerified

      boolean markEmailVerified(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.
      Parameters:
      userId - identifier of the account.
      Returns:
      true when the address was unverified and is now verified, false when the account does not exist or its address had already been verified (nothing changes then).