Skip to content

Commit 7a90dc5

Browse files
Polish JdbcOneTimeTokenService
1 parent dfdf6e0 commit 7a90dc5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

core/src/main/java/org/springframework/security/authentication/ott/JdbcOneTimeTokenService.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public final class JdbcOneTimeTokenService implements OneTimeTokenService, Dispo
8282
// @formatter:on
8383

8484
// @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
8686
+ " (" + COLUMN_NAMES + ") VALUES (?, ?, ?)";
8787
// @formatter:on
8888

@@ -97,7 +97,7 @@ public final class JdbcOneTimeTokenService implements OneTimeTokenService, Dispo
9797
// @formatter:on
9898

9999
// @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 "
101101
+ TABLE_NAME
102102
+ " WHERE expires_at < ?";
103103
// @formatter:on
@@ -113,7 +113,7 @@ public JdbcOneTimeTokenService(JdbcOperations jdbcOperations) {
113113
}
114114

115115
/**
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
117117
* run hourly.
118118
*
119119
* For more advanced use cases the cleanupCron may be set to null which will disable
@@ -141,7 +141,7 @@ public OneTimeToken generate(GenerateOneTimeTokenRequest request) {
141141
private void insertOneTimeToken(OneTimeToken oneTimeToken) {
142142
List<SqlParameterValue> parameters = this.oneTimeTokenParametersMapper.apply(oneTimeToken);
143143
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);
145145
}
146146

147147
@Override
@@ -192,7 +192,7 @@ private ThreadPoolTaskScheduler createTaskScheduler(String cleanupCron) {
192192
public void cleanupExpiredTokens() {
193193
List<SqlParameterValue> parameters = List.of(new SqlParameterValue(Types.TIMESTAMP, Instant.now()));
194194
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);
196196
if (this.logger.isDebugEnabled()) {
197197
this.logger.debug("Cleaned up " + deletedCount + " expired tokens");
198198
}

0 commit comments

Comments
 (0)