java - Spring LDAP - 错误代码 32 - 问题 2001 (NO_OBJECT)
问题描述
大家下午好
我正在为我的 Spring Web 应用程序实现与 Active Directory 的 LDAP 连接。
我的项目依赖项是:spring-security-ldap & spring-ldap-core
这是我的课程 WebSecurityConfig
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
public class WebSecurityConfig extends WebSecurityConfigurerAdapter{
@Value("${ldap.principal.encrypted.password}")
private String ldapPrincipalPassword;
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.anyRequest().fullyAuthenticated()
.and().formLogin();
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.ldapAuthentication()
.userSearchBase("OU=Technical_department,OU=Users,DC=society,DC=loc")
.userSearchFilter("(sAMAccountName={0})")
.contextSource()
.url("ldap://SPCL004.society.loc:389/DC=society,DC=loc")
.managerDn("CN=admin_account,OU=Service accounts,DC=society,DC=loc")
.managerPassword(ldapPrincipalPassword);
}
}
当我想使用 sAMAccountName 登录时:“PDURAND”和我的密码,我仍然有这个错误:
Caused by: javax.naming.NameNotFoundException: [LDAP: error code 32 - 0000208D: NameErr: DSID-03100241, problem 2001 (NO_OBJECT), data 0, best match of:
'DC=society,DC=loc'
我检查了与 AD Explorer 的连接并使用相同的参数,我可以在 AD 树中找到用户:CN=DURAND Patrick,OU=Technical_department,OU=Users,DC=society,DC=loc
预先感谢您的帮助
解决方案
推荐阅读
- sql - 使用 CASE 将附加列组合成一行?
- html - Ajax 为项目中的数据请求 API
- c++ - 使用变换矩阵时,如何将方向和缩放从全局参考系转换为局部参考系?
- kubernetes - Rookio Ceph 集群:mon c is low on available space 消息
- python-3.x - 元音识别(子字符串):为更大的输入编写有效的代码
- javascript - Dayjs:无法将自定义 24 小时时间格式化为 12 小时
- c++ - 使用lambda函数进行向量排序,当不在同一范围内时如何传递变量来捕获组?
- azure - Azure 函数 CLI 命令
- jquery - 将 CSS 应用于选择性元素
- amazon-web-services - AWS:如何在 YAML 数据库名称中使用转换 cloudformation 函数