@Override
    public void login(UserLoginRequest req) {
        String username = req.getUsername();
        UserLoginLockStatus userLoginLockStatus = loginLockStatusMap.getOrDefault(username, new UserLoginLockStatus());
        LocalDateTime lockoutTime = userLoginLockStatus.getLockoutTime();
        if (lockoutTime != null && lockoutTime.isAfter(LocalDateTime.now())) {
            // part of a minute counts as one minute
            long waitMinutes = Duration.between(LocalDateTime.now(), lockoutTime).toMinutes() + 1;
            throw new BusinessException("account has been locked, please try again in " + waitMinutes + " minutes");
        }

        Subject subject = SecurityUtils.getSubject();
        UsernamePasswordToken token = new UsernamePasswordToken(username, req.getPassword());
        try {
            subject.login(token);
        } catch (AuthenticationException e) {
            LOGGER.error("login error for request {}", req, e);
            int loginErrorCount = userLoginLockStatus.getLoginErrorCount() + 1;

            if (loginErrorCount % LOCKED_THRESHOLD == 0) {
                LocalDateTime lockedTime = LocalDateTime.now().plusMinutes(LOCKED_TIME);
                userLoginLockStatus.setLockoutTime(lockedTime);
                LOGGER.error("account {} is locked, lockout time: {}", username, lockedTime);
            }
            userLoginLockStatus.setLoginErrorCount(loginErrorCount);

            loginLockStatusMap.put(username, userLoginLockStatus);
            throw e;
        }

        LoginUserUtils.setUserLoginInfo((UserInfo) subject.getPrincipal());

        // login successfully, clear error count
        userLoginLockStatus.setLoginErrorCount(0);
        loginLockStatusMap.put(username, userLoginLockStatus);
    }
This implementation is just to intercept some error requests and reduce the pressure on the database.
<p/>
This is a memory-based implementation. There is a problem with concurrency security when there are
multiple service nodes because the data in memory cannot be shared.

@param req username login request
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/user/UserServiceImpl.java