Interface PasswordResetTokenDao

All Known Implementing Classes:
MongoPasswordResetTokenDao

public interface PasswordResetTokenDao
DAO for single-use password reset tokens.
  • Field Details

  • Method Details

    • createToken

      String createToken(User user, Timestamp expiry)
      Creates and persists a new password reset token for the given user.
      Parameters:
      user - the user requesting the password reset
      expiry - the expiry timestamp after which the token is invalid
      Returns:
      the opaque token string (also the database primary key)
    • findToken

      Optional<PasswordResetToken> findToken(String token)
      Returns the token data if present and not expired.
      Parameters:
      token - the opaque token string
      Returns:
      an Optional containing the token, or empty if absent or expired
    • deleteToken

      void deleteToken(String token)
      Deletes a token. Call after successful password reset to enforce single-use semantics.
      Parameters:
      token - the opaque token string to delete
    • deleteTokensByUser

      void deleteTokensByUser(User user)
      Deletes all tokens belonging to the given user. Call on user deletion.
      Parameters:
      user - the user whose tokens should be removed