我正在使用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;
}
的类型为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锁定而导致的信息?
答案 0 :(得分:0)
使用OpenDJ,您需要使用绑定操作发送密码策略控件,以获取绑定失败原因的详细信息。 我不知道Spring是否支持控件。