Interface TwoFactorTokenRepository

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

@Repository public interface TwoFactorTokenRepository extends org.springframework.data.jpa.repository.JpaRepository<TwoFactorToken,UUID>
TwoFactorTokenRepository.java - Persistence for one-time sign-in codes.
Author:
Kristian Popov
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Removes codes that expired before the given moment.
    void
    Removes every code for a user, so issuing a new one invalidates the old.
    The newest code issued to a user, used or not.

    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

    • findFirstByUserIdOrderByCreatedAtDesc

      Optional<TwoFactorToken> findFirstByUserIdOrderByCreatedAtDesc(UUID userId)
      The newest code issued to a user, used or not.
    • deleteByUserId

      void deleteByUserId(UUID userId)
      Removes every code for a user, so issuing a new one invalidates the old.
    • deleteByExpiresAtBefore

      long deleteByExpiresAtBefore(LocalDateTime cutoff)
      Removes codes that expired before the given moment.
      Parameters:
      cutoff - Codes expiring before this are deleted.
      Returns:
      How many rows were removed.