java - Spring认证LDAP示例和真实的LDAP服务器

标签 java spring 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中的哪些设置会导致有效登录?

谢谢, 酸痛

最佳答案

这似乎有效:

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");

关于java - Spring认证LDAP示例和真实的LDAP服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41601316/

相关文章:

python - Django 默认管理中的 LDAP

java - 使用 pdfBox 禁用 pdf 文本搜索

java - 从数字 EditText 字段获取 NumberFormatException

Spring:在运行时覆盖子上下文中的属性

java - 在 Spring Boot 测试中测试 @Cacheable : Caffeine cache not invoked on MockBean

java - Spring JPA Repository动态查询

java - Primefaces:如何获取 Java 中的当前排序顺序?

java - 在安装 Eclipse/ADT 之前在 Linux 上配置 Android SDK?

java - 是否可以通过 Java 应用程序使用 eDirectory 进行 LDAP 身份验证?

java - 如何通过基于 TLS 的 LDAP 对 Active Directory 进行身份验证?