JdbcOneTimeTokenService.setCleanupCron
Spring Security uses setter methods for optional member variables. Allows for a null cleanupCron to disable the cleanup. In a clustered environment it is likely that users do not want all nodes to be performing a cleanup because it will cause contention on the ott table. Another example is if a user wants to invoke cleanUpExpiredTokens with a different strategy all together, they might want to disable the cron job. Issue gh-15735
This commit is contained in:
@@ -175,6 +175,17 @@ public class JdbcOneTimeTokenServiceTests {
|
||||
assertThat(deletedOneTimeToken2).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
void setCleanupChronWhenNullThenNoException() {
|
||||
this.oneTimeTokenService.setCleanupCron(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
void setCleanupChronWhenAlreadyNullThenNoException() {
|
||||
this.oneTimeTokenService.setCleanupCron(null);
|
||||
this.oneTimeTokenService.setCleanupCron(null);
|
||||
}
|
||||
|
||||
private void saveToken(OneTimeToken oneTimeToken) {
|
||||
List<SqlParameterValue> parameters = this.oneTimeTokenParametersMapper.apply(oneTimeToken);
|
||||
PreparedStatementSetter pss = new ArgumentPreparedStatementSetter(parameters.toArray());
|
||||
|
||||
Reference in New Issue
Block a user