使用Spring Boot和Java的Active Directory LDAP身份验证



我正在尝试使用组织ldap服务器进行身份验证。当我输入凭据时,我将面临此错误。有人能帮忙吗?

LDAP处理过程中发生未分类的异常;嵌套异常为javax.naming.NamingException:[LDAP:错误代码1-000004DC:LdapErr:DSID-0C090A7D,注释:为了执行此操作,必须在连接上完成成功绑定。,数据0,v3839];剩余名称'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");

我认为您需要验证一个可以查看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对我来说是全新的,所以很抱歉我的答案不起作用。

最新更新