All properties

spring_security_core reads two properties, both about password checks. Everything else is configured in code: beans (UserDetailsService, PasswordEncoder, RoleHierarchy, PermissionEvaluator, GrantedAuthorityDefaults) and annotations. The web properties (spring.security.user.*, the JWT resource server, sessions) belong to spring_boot_starter_security.

Why

Hashing a password takes hundreds of milliseconds of CPU and, with Argon2, megabytes of memory. Without a bound, a flood of logins with wrong passwords (no account needed) takes every core of the machine. These two limits keep a flood to a share of the CPU, so the rest of the application keeps its speed.

Example

# lib/resources/application.properties
# A machine with 8 cores: 2 hashes at once, 32 waiting, the rest refused at once.
spring.security.password-checks.max-concurrent=2
spring.security.password-checks.max-queued=32
spring:
  security:
    password-checks:
      max-concurrent: 2
      max-queued: 32

The properties

Key Type Default Meaning
spring.security.password-checks.max-concurrent int half the processors, at least 1 The most password hash checks running at once; more wait in the queue.
spring.security.password-checks.max-queued int eight times max-concurrent The most password checks waiting; more are refused at once.

A check refused because the queue is full throws PasswordChecksBusyException at once, without spending CPU or memory. The security starter answers it with 503 Service Unavailable and Retry-After: 1, never as a failed login: the credentials were not checked.

The limits apply to the logins of DaoAuthenticationProvider. On the Dart VM each check runs on another isolate; on the web it runs in place.

In Spring (Java)

Spring Security has no such properties: there, the servlet container's thread pool bounds the work. Limit logins in front of the application all the same (a proxy's rate limit, account lockout from the failure events).

See also