0Pricing
Spring Security 6 & JWT Authentication · 강의

계정 잠금 및 무차별 대입 공격 방어

실패한 시도를 추적하고 Spring Security에서 계정을 일시적으로 잠가 비밀번호 추측 공격으로부터 로그인 엔드포인트를 방어하는 방법을 배워 보세요.

계정 잠금 및 무차별 대입 공격 방어은(는) CoddyKit의 무료 Spring Security 6 & JWT Authentication 강의입니다. 이것은 4개 중 4번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Spring Security 6 & JWT Authentication 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Spring Security 6 & JWT Authentication 강의에는 총 4개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

The Brute-Force Threat

Attackers automate thousands of login attempts to guess passwords. Without limits, even rate limiting may not stop a slow, distributed guessing campaign against a single account.

Lockout as Defense

Account lockout blocks login for an account after too many failed attempts within a window. This makes online guessing impractical.

Listening for Failures

Spring Security publishes events on authentication outcomes. Listen for AuthenticationFailureBadCredentialsEvent to count failures.

@EventListener
public void onFailure(AuthenticationFailureBadCredentialsEvent e) {
    String user = (String) e.getAuthentication().getPrincipal();
    attempts.recordFailure(user);
}

Tracking Attempt Counts

Keep a counter per username (or per username+IP). A simple cache with a time-to-live resets the count automatically after the window passes.

void recordFailure(String user) {
    int count = cache.getOrDefault(user, 0) + 1;
    cache.put(user, count, Duration.ofMinutes(15));
}

Resetting on Success

A successful login should clear the counter, so legitimate users who mistyped a few times are not punished later.

@EventListener
public void onSuccess(AuthenticationSuccessEvent e) {
    attempts.reset(e.getAuthentication().getName());
}

Enforcing the Lock

Implement a UserDetailsService (or check during login) that throws LockedException when the threshold is exceeded.

if (attempts.isBlocked(username)) {
    throw new LockedException('Account temporarily locked');
}

Marking the Account Non-Locked

The UserDetails contract has isAccountNonLocked(). Return false to make Spring reject the login automatically.

@Override
public boolean isAccountNonLocked() {
    return !attempts.isBlocked(username);
}

Temporary vs Permanent Locks

Prefer temporary locks that auto-expire (for example 15 minutes). Permanent locks frustrate users and create a denial-of-service vector where attackers lock victims out on purpose.

Avoid User Enumeration

Return the same generic error for wrong password and locked account when possible, so attackers cannot tell which usernames exist or are locked.

Adding Exponential Backoff

Instead of a hard lock, increase the delay after each failure. The first retry waits a second, the next two, then four, slowing attackers without fully blocking users.

long delayMs = (long) Math.pow(2, count) * 1000;

Persisting State

In a multi-instance deployment, store attempt counts in a shared store like Redis so a lock applies across all nodes, not just the one that saw the failures.

Quick Check

Test your understanding of brute-force protection.

Recap

You learned to protect logins from brute force:

  • Count failures via Spring authentication events
  • Lock the account through isAccountNonLocked() or a thrown LockedException
  • Reset counters on success and prefer temporary locks
  • Use backoff, avoid enumeration, and share state across instances

These measures make password guessing impractical without hurting real users.

자주 묻는 질문

“계정 잠금 및 무차별 대입 공격 방어” 강의는 무료인가요?

네 — “계정 잠금 및 무차별 대입 공격 방어” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Spring Security 6 & JWT Authentication 강의 전체를 잠금 해제할 수 있습니다. Spring Security 6 & JWT Authentication 강의에는 총 4개의 강의가 포함되어 있습니다.

“계정 잠금 및 무차별 대입 공격 방어”에서 뭘 배우나요?

실패한 시도를 추적하고 Spring Security에서 계정을 일시적으로 잠가 비밀번호 추측 공격으로부터 로그인 엔드포인트를 방어하는 방법을 배워 보세요. 브라우저에서 직접 실행하는 실습 코드로 Spring Security 6 & JWT Authentication을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

Spring Security 6 & JWT Authentication을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 Spring Security 6 & JWT Authentication은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 4번째 강의입니다.

“계정 잠금 및 무차별 대입 공격 방어” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 Spring Security 6 & JWT Authentication 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 Spring Security 6 & JWT Authentication 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. 다중 요소 인증 구현
  2. API 접근 속도 제한
  3. 사용자 지정 인증 이벤트 처리
  4. 계정 잠금 및 무차별 대입 공격 방어
← Spring Security 6 & JWT Authentication(으)로 돌아가기