Interface AdminRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<Admin,Long>, org.springframework.data.jpa.repository.JpaRepository<Admin,Long>, org.springframework.data.repository.ListCrudRepository<Admin,Long>, org.springframework.data.repository.ListPagingAndSortingRepository<Admin,Long>, org.springframework.data.repository.PagingAndSortingRepository<Admin,Long>, org.springframework.data.repository.query.QueryByExampleExecutor<Admin>, org.springframework.data.repository.Repository<Admin,Long>

@Repository public interface AdminRepository extends org.springframework.data.jpa.repository.JpaRepository<Admin,Long>
Spring Data JPA repository for Admin entities.

Provides CRUD operations inherited from JpaRepository and additional query methods specific to administrator management.

The repository is automatically implemented by Spring at runtime (no manual implementation required).

Key custom query:

  • findBySecretWord(String) – locates an admin by their secret recovery word/phrase. Used primarily for privileged operations or emergency authentication flows.

Since:
1.0
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Finds an administrator by their unique secret word (recovery phrase).

    Methods inherited from interface org.springframework.data.repository.CrudRepository

    count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save

    Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository

    deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlush

    Methods inherited from interface org.springframework.data.repository.ListCrudRepository

    findAll, findAllById, saveAll

    Methods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor

    count, exists, findAll, findBy, findOne
  • Method Details

    • findBySecretWord

      Optional<Admin> findBySecretWord(String secretWord)
      Finds an administrator by their unique secret word (recovery phrase).

      The secret word is treated as a secondary authentication factor. This method is typically used in high-privilege scenarios such as:

      • Password reset for administrators
      • Emergency access / account recovery
      • Two-step verification for destructive actions

      Security note: The secret word must be stored securely (e.g., hashed if feasible) and never logged or exposed in plain text.

      Parameters:
      secretWord - the secret recovery word/phrase to search for
      Returns:
      an Optional containing the matching Admin if found, or Optional.empty() if no admin has this secret word