Cronjob for deleting expired Sessions
This commit is contained in:
@@ -13,4 +13,6 @@ public interface SessionRepository extends JpaRepository<Session, Long> {
|
||||
Session findByAccount(Account account);
|
||||
|
||||
Session getSessionByToken(UUID token);
|
||||
|
||||
void deleteSessionsByTimeoutBefore(Long timeoutBefore);
|
||||
}
|
||||
|
||||
@@ -19,4 +19,6 @@ public interface SessionService {
|
||||
boolean isValid(UUID token, String email);
|
||||
|
||||
boolean isAdmin(UUID token, String email);
|
||||
|
||||
void deleteExpired();
|
||||
}
|
||||
|
||||
@@ -92,4 +92,9 @@ public class SessionServiceImpl implements SessionService {
|
||||
log.info("Session with email {} allowed to access Admin Services", email);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteExpired() {
|
||||
sessionRepository.deleteSessionsByTimeoutBefore(System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user