有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

JavaSpring验证ldap示例和真实ldap服务器

长期听众,第一次来电者

我已在以下位置下载了spring验证ldap示例: https://spring.io/guides/gs/authenticating-ldap/ 变成STS。它很好用

但是,我想尝试使用一个真正的ldap数据库,比如forumsys的同类数据库。com已提供: http://www.forumsys.com/en/tutorials/integration-how-to/ldap/online-ldap-test-server/

我的configureGlobal当前配置为:

    @Autowired
public void configureGlobal(AuthenticationManagerBuilder authBuilder) throws Exception {

    authBuilder
        .ldapAuthentication()
        .userSearchFilter("(uid={0},dc=example,dc=com)")
        .userSearchBase("")
        .contextSource()
            .url("ldap://ldap.forumsys.com:389/dc=example,dc=com")
       .managerDn("cn=read-only-admin,dc=example,dc=com") 
            .managerPassword("password");

}

当我尝试使用“tesla/password”或“einstein/password”登录时,返回错误的凭据错误。 是否有人能够建议configureGlobal中的哪些设置将导致有效登录

谢谢, 酸痛的


共 (1) 个答案

  1. # 1 楼答案

    这似乎有效:

    authBuilder
                .ldapAuthentication()
                .userSearchFilter("(uid={0})")
                .userSearchBase("")
                .contextSource()
                    .url("ldap://ldap.forumsys.com:389/dc=example,dc=com")
               .managerDn("cn=read-only-admin,dc=example,dc=com") 
                    .managerPassword("password");