【问题标题】:Active Directory LDAP Authentication using Spring Boot and Java使用 Spring Boot 和 Java 的 Active Directory LDAP 身份验证
【发布时间】:2021-09-11 18:07:48
【问题描述】:

我正在尝试通过组织 ldap 服务器进行身份验证。当我输入凭据时,我遇到了这个错误。有人可以帮忙吗?

Uncategorized exception occured during LDAP processing; nested exception is javax.naming.NamingException: [LDAP: error code 1 - 000004DC: LdapErr: DSID-0C090A7D, comment: In order to perform this operation a successful bind must be completed on the connection., data 0, v3839]; remaining name 'username=aestools,ou=people'

这是我的配置:

@Override
    public void configure(AuthenticationManagerBuilder auth) throws Exception {
        auth
        .ldapAuthentication().userDnPatterns("username={0},ou=people").contextSource()
        .url("ldap://ldap.example.com:389/dc=ms,ddc=ds,dc=example,dc=com").and().passwordCompare()
        .passwordAttribute("password");

【问题讨论】:

    标签: java spring spring-boot ldap spring-security-ldap


    【解决方案1】:

    我认为您需要验证一个可以查看 LDAP 记录或其他内容的帐户,也许这会起作用

      auth
        .ldapAuthentication()
        .userDnPatterns("username={0},ou=people")
        .contextSource()
        .managerDn("cn=admin,ou=people,dc=ms,dc=ds,dc=example,dc=com")
        .managerPassword("adminPassword123") 
        .url("ldap://ldap.example.com:389/dc=ms,dc=ds,dc=example,dc=com")
        .and()
        .passwordCompare()
        .passwordAttribute("password");
    

    所以基本上你需要在.managerDn().managerPassword() 中填写有权查看LDAP 服务器记录的帐户信息。这个 Spring 安全 LDAP 对我来说很新,如果我的回答不起作用,请见谅。

    【讨论】:

      猜你喜欢
      • 2020-07-06
      • 2020-04-08
      • 2014-06-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-16
      相关资源
      最近更新 更多