@@ -82,7 +82,7 @@ public final class JdbcOneTimeTokenService implements OneTimeTokenService, Dispo
82
82
// @formatter:on
83
83
84
84
// @formatter:off
85
- private static final String SAVE_AUTHORIZED_CLIENT_SQL = "INSERT INTO " + TABLE_NAME
85
+ private static final String SAVE_ONE_TIME_TOKEN_SQL = "INSERT INTO " + TABLE_NAME
86
86
+ " (" + COLUMN_NAMES + ") VALUES (?, ?, ?)" ;
87
87
// @formatter:on
88
88
@@ -97,7 +97,7 @@ public final class JdbcOneTimeTokenService implements OneTimeTokenService, Dispo
97
97
// @formatter:on
98
98
99
99
// @formatter:off
100
- private static final String DELETE_SESSIONS_BY_EXPIRY_TIME_QUERY = "DELETE FROM "
100
+ private static final String DELETE_ONE_TIME_TOKENS_BY_EXPIRY_TIME_QUERY = "DELETE FROM "
101
101
+ TABLE_NAME
102
102
+ " WHERE expires_at < ?" ;
103
103
// @formatter:on
@@ -113,7 +113,7 @@ public JdbcOneTimeTokenService(JdbcOperations jdbcOperations) {
113
113
}
114
114
115
115
/**
116
- * Sets the chron expression used for cleaning up expired sessions . The default is to
116
+ * Sets the chron expression used for cleaning up expired tokens . The default is to
117
117
* run hourly.
118
118
*
119
119
* For more advanced use cases the cleanupCron may be set to null which will disable
@@ -141,7 +141,7 @@ public OneTimeToken generate(GenerateOneTimeTokenRequest request) {
141
141
private void insertOneTimeToken (OneTimeToken oneTimeToken ) {
142
142
List <SqlParameterValue > parameters = this .oneTimeTokenParametersMapper .apply (oneTimeToken );
143
143
PreparedStatementSetter pss = new ArgumentPreparedStatementSetter (parameters .toArray ());
144
- this .jdbcOperations .update (SAVE_AUTHORIZED_CLIENT_SQL , pss );
144
+ this .jdbcOperations .update (SAVE_ONE_TIME_TOKEN_SQL , pss );
145
145
}
146
146
147
147
@ Override
@@ -192,7 +192,7 @@ private ThreadPoolTaskScheduler createTaskScheduler(String cleanupCron) {
192
192
public void cleanupExpiredTokens () {
193
193
List <SqlParameterValue > parameters = List .of (new SqlParameterValue (Types .TIMESTAMP , Instant .now ()));
194
194
PreparedStatementSetter pss = new ArgumentPreparedStatementSetter (parameters .toArray ());
195
- int deletedCount = this .jdbcOperations .update (DELETE_SESSIONS_BY_EXPIRY_TIME_QUERY , pss );
195
+ int deletedCount = this .jdbcOperations .update (DELETE_ONE_TIME_TOKENS_BY_EXPIRY_TIME_QUERY , pss );
196
196
if (this .logger .isDebugEnabled ()) {
197
197
this .logger .debug ("Cleaned up " + deletedCount + " expired tokens" );
198
198
}
0 commit comments