问题描述
我正在尝试将 LDAP 身份验证与 Spring 安全一起使用。我按照文章 https://spring.io/guides/gs/authenticating-ldap/ 进行实现。我收到错误“[LDAP:错误代码 50 - 访问权限不足];嵌套异常是 javax.naming.nopermissionException:[LDAP:错误代码 50 - 访问权限不足];剩余名称 'uid=pmerla,ou=people'” .如何解决这个问题?下面是我的配置代码
@Configuration
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.anyRequest().fullyAuthenticated()
.and()
.formLogin();
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.ldapAuthentication()
.userDnPatterns("uid={0},ou=people")
.groupSearchBase("ou=groups")
.contextSource()
.url("ldaps://ldap.uchicago.edu/dc=uchicago,dc=edu")
.and()
.passwordCompare()
.passwordEncoder(new BCryptPasswordEncoder())
.passwordAttribute("userPassword");
}
}
我还使用以下命令从我的终端测试了 ldap 连接是否处于活动状态 ldapsearch -H ldaps://ldap.uchicago.edu -D "uid=pmerla,ou=people,dc=uchicago,dc=edu" -W 它给了我正确的回应
# extended LDIF
#
# LDAPv3
# base <> (default) with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#
# search result
search: 2
result: 32 No such object
我怎样才能让我的 spring 安全 ldap 工作?我还检查了与此问题类似的其他堆栈溢出问题,但没有解决我的问题。因此发布了一个新线程。有人可以帮我解决这个问题
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)