Răsfoiți Sursa

Fix for JdbcOneTimeTokenService cleanupExpiredTokens failing with PostgreSQL

Closes gh-16344
Toshiaki Maki 8 luni în urmă
părinte
comite
5075869418

+ 2 - 1
core/src/main/java/org/springframework/security/authentication/ott/JdbcOneTimeTokenService.java

@@ -190,7 +190,8 @@ public final class JdbcOneTimeTokenService implements OneTimeTokenService, Dispo
 	}
 
 	public void cleanupExpiredTokens() {
-		List<SqlParameterValue> parameters = List.of(new SqlParameterValue(Types.TIMESTAMP, Instant.now()));
+		List<SqlParameterValue> parameters = List
+			.of(new SqlParameterValue(Types.TIMESTAMP, Timestamp.from(Instant.now())));
 		PreparedStatementSetter pss = new ArgumentPreparedStatementSetter(parameters.toArray());
 		int deletedCount = this.jdbcOperations.update(DELETE_ONE_TIME_TOKENS_BY_EXPIRY_TIME_QUERY, pss);
 		if (this.logger.isDebugEnabled()) {