Class LoginAttemptConfigurationLoader
java.lang.Object
com.svenruppert.jsentinel.bruteforce.LoginAttemptConfigurationLoader
Loads
LoginAttemptConfiguration from system properties and
environment variables, with a caller-supplied default.
Sources, in order of precedence
- System property (highest)
- Environment variable
- Caller-provided default (lowest)
Keys
| System property | Environment variable |
|---|---|
security.login.attempts.threshold |
SECURITY_LOGIN_ATTEMPTS_THRESHOLD |
security.login.attempts.window |
SECURITY_LOGIN_ATTEMPTS_WINDOW |
security.login.attempts.initial-lockout |
SECURITY_LOGIN_ATTEMPTS_INITIAL_LOCKOUT |
security.login.attempts.max-lockout |
SECURITY_LOGIN_ATTEMPTS_MAX_LOCKOUT |
Duration values are parsed as ISO-8601 (e.g. PT5M,
PT1H). The forBootstrap() variant uses
security.bootstrap.attempts.* prefixes so the bootstrap
endpoint can be tuned independently of the normal login endpoint.
Invalid values fail fast with IllegalArgumentException.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
ConstructorsConstructorDescriptionDefault loader reading fromSystem.getProperty(String)andSystem.getenv(String).Test seam: inject custom sources. -
Method Summary
Modifier and TypeMethodDescriptionLoads configuration for the bootstrap-admin endpoint, falling back toLoginAttemptConfiguration.strictBootstrap()when no source supplies a value.forLogin()Loads configuration for the standard login endpoint, falling back toLoginAttemptConfiguration.defaults()when no source supplies a value.
-
Field Details
-
LOGIN_THRESHOLD_PROPERTY
- See Also:
-
LOGIN_THRESHOLD_ENV
- See Also:
-
LOGIN_WINDOW_PROPERTY
- See Also:
-
LOGIN_WINDOW_ENV
- See Also:
-
LOGIN_INITIAL_LOCKOUT_PROPERTY
- See Also:
-
LOGIN_INITIAL_LOCKOUT_ENV
- See Also:
-
LOGIN_MAX_LOCKOUT_PROPERTY
- See Also:
-
LOGIN_MAX_LOCKOUT_ENV
- See Also:
-
BOOTSTRAP_THRESHOLD_PROPERTY
- See Also:
-
BOOTSTRAP_THRESHOLD_ENV
- See Also:
-
BOOTSTRAP_WINDOW_PROPERTY
- See Also:
-
BOOTSTRAP_WINDOW_ENV
- See Also:
-
BOOTSTRAP_INITIAL_LOCKOUT_PROPERTY
- See Also:
-
BOOTSTRAP_INITIAL_LOCKOUT_ENV
- See Also:
-
BOOTSTRAP_MAX_LOCKOUT_PROPERTY
- See Also:
-
BOOTSTRAP_MAX_LOCKOUT_ENV
- See Also:
-
-
Constructor Details
-
LoginAttemptConfigurationLoader
public LoginAttemptConfigurationLoader()Default loader reading fromSystem.getProperty(String)andSystem.getenv(String). -
LoginAttemptConfigurationLoader
public LoginAttemptConfigurationLoader(Function<String, String> sysprop, Function<String, String> env) Test seam: inject custom sources.- Parameters:
sysprop- function returning system-property values (typicallySystem.getProperty(String))env- function returning environment-variable values (typicallySystem.getenv(String))
-
-
Method Details
-
forLogin
Loads configuration for the standard login endpoint, falling back toLoginAttemptConfiguration.defaults()when no source supplies a value. -
forBootstrap
Loads configuration for the bootstrap-admin endpoint, falling back toLoginAttemptConfiguration.strictBootstrap()when no source supplies a value.
-