spring-boot - 使用 uniqueMember 属性的 Spring LDAP 身份验证
问题描述
当我尝试使用uid={0},ou=Groups进行身份验证时,我可以成功登录,但当我尝试将模式缩小到特定组时却不能。
uid={0},CN=ROM,OU=USER,OU=APPOU,ou=组
我可能需要使用 uniqueMember 属性,但找不到方法。如何通过仅使用他/她的 uid 来验证具有组的 uniqueMember 属性的用户?
@Override
public void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.ldapAuthentication()
.contextSource()
.url("ldapUrl")
.managerDn("username")
.managerPassword("password")
.and()
.userDnPatterns("uid={0},CN=ROM,OU=USER,OU=APPOU,ou=Groups");
}
解决方案
以下是感兴趣的人的方式:
public void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.ldapAuthentication()
.contextSource()
.url(ldapUrl")
.managerDn("username")
.managerPassword("password")
.and()
.userSearchFilter("uid={0}")
.groupSearchBase("CN=ROM,OU=USER,ou=APPOU,ou=Groups")
.groupSearchFilter("uniqueMember{0}");
}
推荐阅读
- java - 使用 spark-submit 部署我的程序时出现 java.lang.NoSuchMethodError
- angular - 使用 angular 和 rxjs 可配置轮询间隔
- php - 我想在一个类中读取一个函数
- apache-spark - 增加 yarn-site.xml 中的 yarn.scheduler.maximum-allocation-mb 值
- c# - 通过正则表达式查找所有匹配的字符串
- r - 行中的条件标签
- clojure - 构建用户数据和通过应用函数关联它们的函数
- lua - 为什么我的闪光激光无法杀死 Roblox 中的玩家?
- python - Python:在有小数点的情况下使用点使每个句子换行
- python - 根据值从一组列中选择一个值并使用该值创建新列?