From 1db83151ebe19d994b533dd71441827fe5cb092f Mon Sep 17 00:00:00 2001 From: Aleksandr Skoblikov Date: Mon, 1 Jul 2024 20:44:46 +0400 Subject: [PATCH] CB-5322 naming --- .../security/bruteforce/BruteForceUtils.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/bruteforce/BruteForceUtils.java b/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/bruteforce/BruteForceUtils.java index 00fc205b20..fecf508ec6 100644 --- a/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/bruteforce/BruteForceUtils.java +++ b/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/bruteforce/BruteForceUtils.java @@ -30,21 +30,22 @@ public class BruteForceUtils { private static final Log log = Log.getLog(BruteForceUtils.class); - public static void checkBruteforce(SMControllerConfiguration smConfig, List latestLogins) throws DBException { - if (latestLogins.isEmpty()) { + public static void checkBruteforce(SMControllerConfiguration smConfig, List latestLoginAttempts) + throws DBException { + if (latestLoginAttempts.isEmpty()) { return; } - var oldestLogin = latestLogins.get(latestLogins.size() - 1); - checkLoginInterval(oldestLogin.time(), smConfig.getMinimumLoginTimeout()); + var oldestLoginAttempt = latestLoginAttempts.get(latestLoginAttempts.size() - 1); + checkLoginInterval(oldestLoginAttempt.time(), smConfig.getMinimumLoginTimeout()); - long errorsCount = latestLogins.stream() + long errorsCount = latestLoginAttempts.stream() .filter(authAttemptSessionInfo -> authAttemptSessionInfo.smAuthStatus() == SMAuthStatus.ERROR).count(); boolean shouldBlock = errorsCount >= smConfig.getMaxFailedLogin(); if (shouldBlock) { int blockPeriod = smConfig.getBlockLoginPeriod(); - LocalDateTime unblockTime = oldestLogin.time().plusSeconds(blockPeriod); + LocalDateTime unblockTime = oldestLoginAttempt.time().plusSeconds(blockPeriod); LocalDateTime now = LocalDateTime.now(); shouldBlock = unblockTime.isAfter(now); @@ -54,7 +55,7 @@ public static void checkBruteforce(SMControllerConfiguration smConfig, List