0Pricing
Spring Security 6 & JWT Authentication · Ders

Hesap Kilitleme ve Kaba Kuvvet Saldırısı Koruması

Başarısız denemeleri izleyip Spring Security'de hesapları geçici olarak kilitleyerek oturum açma uç noktalarını parola tahminlerine karşı korumayı öğrenin.

Hesap Kilitleme ve Kaba Kuvvet Saldırısı Koruması, CoddyKit'te ücretsiz bir Spring Security 6 & JWT Authentication dersidir. Bu, 4 dersinin 4. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Spring Security 6 & JWT Authentication öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Spring Security 6 & JWT Authentication kursu toplamda 4 dersten oluşur.

Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.

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.

Sıkça Sorulan Sorular

“Hesap Kilitleme ve Kaba Kuvvet Saldırısı Koruması” dersi ücretsiz mi?

Evet — “Hesap Kilitleme ve Kaba Kuvvet Saldırısı Koruması” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Spring Security 6 & JWT Authentication kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Spring Security 6 & JWT Authentication kursu toplamda 4 dersten oluşur.

“Hesap Kilitleme ve Kaba Kuvvet Saldırısı Koruması” dersinde ne öğreneceğim?

Başarısız denemeleri izleyip Spring Security'de hesapları geçici olarak kilitleyerek oturum açma uç noktalarını parola tahminlerine karşı korumayı öğrenin. Spring Security 6 & JWT Authentication ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.

Spring Security 6 & JWT Authentication öğrenmeye başlamak için deneyim gerekli mi?

Önceden deneyim gerekmez. CoddyKit'te Spring Security 6 & JWT Authentication, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 4. dersidir.

“Hesap Kilitleme ve Kaba Kuvvet Saldırısı Koruması” dersi ne kadar sürer?

Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.

Bu Spring Security 6 & JWT Authentication dersinde kod yazıp çalıştırabilir miyim?

Evet. Her Spring Security 6 & JWT Authentication dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.

Bu kursun tüm dersleri

  1. Çok faktörlü kimlik doğrulamayı uygulama
  2. API erişimini hız sınırlama
  3. Özel kimlik doğrulama olayı işleme
  4. Hesap Kilitleme ve Kaba Kuvvet Saldırısı Koruması
← Spring Security 6 & JWT Authentication Sayfasına Dön