Java 对LDAP的Spring引导安全调用
试图实现Spring关于如何连接的官方教程 但是总是会出现这种错误 LDAP处理过程中发生未分类异常;嵌套 异常为javax.naming.NamingException:[LDAP:错误代码1- 000004DC:LDAPPER:DSID-0C09075A,注释:为了执行此操作 操作必须在连接数据上完成成功绑定 0,v1db1];剩余名称'uid=UserName,OU=users,DC=ad,DC=corpName,DC=com' 目前,我的整个网络安全课程都是这样的Java 对LDAP的Spring引导安全调用,java,spring,ldap,Java,Spring,Ldap,试图实现Spring关于如何连接的官方教程 但是总是会出现这种错误 LDAP处理过程中发生未分类异常;嵌套 异常为javax.naming.NamingException:[LDAP:错误代码1- 000004DC:LDAPPER:DSID-0C09075A,注释:为了执行此操作 操作必须在连接数据上完成成功绑定 0,v1db1];剩余名称'uid=UserName,OU=users,DC=ad,DC=corpName,DC=com' 目前,我的整个网络安全课程都是这样的 @Configurat
@Configuration
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.anyRequest().fullyAuthenticated()
.and()
.formLogin();
}
@Override
public void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.ldapAuthentication()
.userDnPatterns("uid={0},OU=users,DC=ad,DC=corpName,DC=com")
// .userSearchFilter("(sAMAccountName={0})")
// .userSearchBase("DC=ad,DC=corpName,DC=com")
.groupSearchBase("ou=users")
// .groupSearchFilter("member={0}")
.contextSource()
.url("ldap://ad.corpName.com")
.and()
.passwordCompare()
.passwordEncoder(new LdapShaPasswordEncoder())
.passwordAttribute("userPassword");
}
}
你能帮我理解我做错了什么吗 LDAP错误:DSID-0C09075A表示LDAP服务器需要经过身份验证的userbinding来执行搜索。要进行身份验证,您的AuthenticationManagerBuilder需要如下所示:
@凌驾
public void configurationAuthenticationManagerBuilder身份验证引发异常{
认证
.LDA身份验证
.userDnPatternsuid={0},OU=users,DC=ad,DC=corpName,DC=com
.经理
.managerPassword
.groupSearchBaseou=用户
//.groupSearchFiltermember={0}
.contextSource
.urlldap://ad.corpName.com
和
.密码比较
.passwordEncodernew LdapShaPasswordEncoder
.passwordAttributeuserPassword;
}
注意.managerDn和.managerPassword这两个.managerDn和.managerPassword是某种可以查询广告的系统ID,对吗?@Sithole似乎对我来说还有其他问题;它返回错误代码52e;这个基于错误代码列表的错误代码应该是-'错误的密码,但即使我键入随机测试作为登录名和密码,它也会返回相同的错误;