Class TwoFactorTokenCleanupJob

java.lang.Object
springboot.bg.harisauto.job.TwoFactorTokenCleanupJob

@Component public class TwoFactorTokenCleanupJob extends Object
TwoFactorTokenCleanupJob.java - Removes expired sign-in codes.

A code is deleted when it is used, when somebody tries it after expiry, or when the attempt limit is reached. None of those cover an abandoned sign-in, so without this the table keeps a row - and a hash of authentication material - for every code that was never entered.

Author:
Kristian Popov
  • Constructor Details

    • TwoFactorTokenCleanupJob

      public TwoFactorTokenCleanupJob()
  • Method Details

    • removeExpiredTokens

      @Scheduled(cron="0 0 4 * * *") @Transactional public void removeExpiredTokens()
      Runs every day at 4:00 AM.