Interface RefreshTokenRepository

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

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

    Modifier and Type
    Method
    Description
    int
     
     
    void
     

    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

    • revokeAllByUser

      @Modifying @Query(" update RefreshToken rt\n set rt.revoked = true\n where rt.user.id = :userId\n") void revokeAllByUser(@Param("userId") Long userId)
    • findByTokenIdAndRevokedFalse

      Optional<RefreshToken> findByTokenIdAndRevokedFalse(String tokenId)
    • deleteExpiredAndOldRevoked

      @Modifying @Query(" DELETE FROM RefreshToken rt\n WHERE rt.expiresAt < :now\n OR (rt.revoked = true AND rt.createdAt < :cutoff)\n") int deleteExpiredAndOldRevoked(@Param("now") Instant now, @Param("cutoff") Instant cutoff)