我正在使用 OpenDJ 并将 return-bind-error-messages 设置为 true。
我的代码如下所示
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 的类型为 org.springframework.security.authentication.BadCredentialsException:用户被锁定时凭据错误。
我还在 LDAP 日志中得到以下信息:
"[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"
如何获取登录尝试失败是由于 Spring 锁定导致的信息?