0

我正在使用 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 锁定导致的信息?

4

1 回答 1

0

使用 OpenDJ,您需要使用绑定操作发送密码策略控件,以获取有关绑定失败原因的详细信息。我不知道Spring是否支持控件。

于 2013-09-27T07:42:29.950 回答