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 TypeMethodDescriptionlongdeleteByExpiresAtBefore(LocalDateTime cutoff) Removes codes that expired before the given moment.voiddeleteByUserId(UUID userId) 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, saveMethods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlushMethods inherited from interface org.springframework.data.repository.ListCrudRepository
findAll, findAllById, saveAllMethods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
findFirstByUserIdOrderByCreatedAtDesc
The newest code issued to a user, used or not. -
deleteByUserId
Removes every code for a user, so issuing a new one invalidates the old. -
deleteByExpiresAtBefore
Removes codes that expired before the given moment.- Parameters:
cutoff- Codes expiring before this are deleted.- Returns:
- How many rows were removed.
-