Documentation for LockOutRealm does not specify if failed logins due to being locked out by the LockOutRealm count as failed logins for the purpose of locking out a user. For example: Lets say I'm protecting an API with LockOutRealm and the authentication fails either due to maliciously bad password, accidentally bad password, or back-end auth fail. This results in a LockOut condition because it happened x times in y period. But the machines legitimately hitting the API don't care and continue to fail to authenticate during the LockOut period. Will the machines ever be allowed to authenticate or is this a critical failure of the API?
Thanks for the report. To answer the question, the LockOutRealm currently treats any authentication attempt during the lock out period as a failure. This does mean that once an account is locked out, if the legitimate users attempts to login more frequently that the lockout period that user is never going to regain access. It does make sense to change this behaviour (and document it) so that valid logins do not extend the lockout period. I'll take a look at a patch.
Thanks for the clarification. I look forward to seeing this progress.
This has been fixed the trunk for all currently supported versions and will be included in: - 9.0.0.M9 onwards - 8.5.4 omwards - 8.0.37 onwards - 7.0.71 onwards - 6.0.46 onwards
Thanks for this fix. I'd like to ask one more technical question about it: Are the wrapped realms authenticated before the lockout or is the lockout checked before attempting real authentication? Example: <Lockout realm> <LDAP realm/> </Lockout realm> If I try to authenticate but I'm in lockout, is LDAP triggered? It looks like the answer is probably "yes" because of the 401 Unauthorized response, which usually indicates authentication was successful.
Yes, authentication is now always checked so Tomcat can vary the behaviour during a lock out depending on whether the authentication credentials provided were valid or not. For more details, you can always look at the source: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/realm/LockOutRealm.java?view=annotate