I am using OpenDJ and have set return-bind-error-messages to true.
My code looks as follows
BindAuthenticator authenticator = new BindAuthenticator(contextSource);
authenticator.setUserSearch(new FilterBasedLdapUserSearch(
searchBase,
new EqualsFilter("uid", username).encode(),
contextSource));
try {
authenticator.authenticate(new UsernamePasswordAuthenticationToken(
username,
authentication.getCredentials(),
authentication.getAuthorities()
));
} catch (NameNotFoundException e) {
loginService.auditAuthentication(usernameWithDomainString,false,0,userDetails.getRemoteAddress());
return null;
} catch (RuntimeException e) {
throw e;
}
e is of type org.springframework.security.authentication.BadCredentialsException: Bad credentials when the user has been locked out.
Also I get the following in the LDAP log:
"[17/Sep/2013:15:44:13 -0400] BIND RES conn=106 op=0 msgID=1 result=49 message="R
ejecting a bind request for user uid=doctor.uno,ou=people,dc=example,dc=com becaus
e the account has been locked due to too many failed authentication attempts" et
ime=1"
How Do I get the information that a failed login attempt was due to a lockout with Spring?