Interface PasswordResetTokenRepository

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

public interface PasswordResetTokenRepository extends org.springframework.data.jpa.repository.JpaRepository<PasswordResetToken,Long>
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Same recency approximation, keyed by the requester's IP.
    long
    Requests made recently by this user.
    findByToken(String tokenHash)
    Lookup by the SHA-256 hash of the raw token.
    Outstanding (not yet consumed) tokens of a user, for invalidation.

    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

    • findByToken

      Optional<PasswordResetToken> findByToken(String tokenHash)
      Lookup by the SHA-256 hash of the raw token.
    • findByUserAndUsedAtIsNull

      List<PasswordResetToken> findByUserAndUsedAtIsNull(User user)
      Outstanding (not yet consumed) tokens of a user, for invalidation.
    • countByUserAndExpiresAtAfter

      long countByUserAndExpiresAtAfter(User user, OffsetDateTime expiresAfter)
      Requests made recently by this user. The table has no created_at column, so recency is derived from expires_at (creation + TTL): a token created within the last window has expires_at > now - window + ttl.
    • countByIpAddressAndExpiresAtAfter

      long countByIpAddressAndExpiresAtAfter(String ipAddress, OffsetDateTime expiresAfter)
      Same recency approximation, keyed by the requester's IP.