[英]Unable to Authenticate a User with an LDAP Server using LDAP User Search Query with Spring Security
根DSE:
DC =公司,DC = COM
OU =办事处
OU =地区办事处
OU = Region1 Office
OU =用户
CN = Jayesh Mulwani
public class LDAPSecurityConfig extends WebSecurityConfigurerAdapter{
protected void configure(AuthenticationManagerBuilder authenticationManagerBuilder) throws Exception {
authenticationManagerBuilder.ldapAuthentication()
.contextSource().url("ldap://server-url/CN=auth_support,OU=Misc,DC=company,DC=com")
.managerDn("username").managerPassword("password")
.and()
.userSearchBase("OU=Offices,DC=company,DC=com")
.userSearchFilter("(&(objectClass=user)(cn={0}))");
}
}
在Tomcat上安装了应用程序后,我输入了用户名及其密码,但是身份验证失败,并且未提示任何错误。
有人可以协助我采取这种方法,还是指定我在这里是否缺少什么?
我通过添加以下两个条件解决了该问题
.groupSearchFilter("(&(objectClass=group)(AccountName={0}))")
.groupSearchBase("CN=DEPT_All_Employees,OU=DepartmentSecurityGroups,OU=Resources,DC=company,DC=com")
我引用了这个示例来解决此问题, 网址为http://www.jcombat.com/spring/spring-security-ldap-authentication
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.