Skip to content

Commit

Permalink
CB-4441 mariadb fix clear auth attempt info
Browse files Browse the repository at this point in the history
  • Loading branch information
yagudin10 committed Jan 18, 2024
1 parent 10c1b37 commit 609f7fb
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2861,12 +2861,13 @@ private boolean isProviderDisabled(@NotNull String providerId, @Nullable String
public void clearOldAuthAttemptInfo() throws DBException {
try (Connection dbCon = database.openConnection()) {
JDBCUtils.executeStatement(dbCon,
database.normalizeTableNames("DELETE FROM {table_prefix}CB_AUTH_ATTEMPT_INFO AAI " +
database.normalizeTableNames("DELETE FROM {table_prefix}CB_AUTH_ATTEMPT_INFO " +
"WHERE EXISTS " +
"(SELECT 1 FROM {table_prefix}CB_AUTH_ATTEMPT AA " +
"LEFT JOIN {table_prefix}CB_AUTH_TOKEN CAT ON AA.SESSION_ID = CAT.SESSION_ID " +
"WHERE (CAT.REFRESH_TOKEN_EXPIRATION_TIME < ? OR CAT.EXPIRATION_TIME IS NULL) " +
"AND AA.AUTH_ID=AAI.AUTH_ID AND AUTH_STATUS='" + SMAuthStatus.EXPIRED + "') " +
"AND AA.AUTH_ID={table_prefix}CB_AUTH_ATTEMPT_INFO.AUTH_ID " +
"AND AUTH_STATUS='" + SMAuthStatus.EXPIRED + "') " +
"AND CREATE_TIME<?"),
Timestamp.valueOf(LocalDateTime.now()),
Timestamp.valueOf(LocalDateTime.now().minusMinutes(smConfig.getExpiredAuthAttemptInfoTtl()))
Expand Down

0 comments on commit 609f7fb

Please sign in to comment.