Spring-boot LDAP - 未设置属性 'userDn'

标签 spring-boot ldap spring-ldap

我正在运行一个 Spring-boot 应用程序,它使用 spring-security-ldap 通过我们的内部 LDAP 对用户进行身份验证。
默认情况下,它与 LDAP 匿名绑定(bind)。Property 'userDn' not set - anonymous context will be used for read-write operations但我希望第一个绑定(bind)是当前用户名。
我应该在哪里指定 userDn 属性?
感谢您的意见

最佳答案

我不是最了解 Spring-boot 的人,在 LDAP 方面更是如此。
也就是说,您的 LDAP 配置属性应该在您的 application.properties 中提及。文件并命名为 spring.ldap.* .
它们在文档 here 中有所提及。 .
初始化您的身份验证提供程序时,您可以使用以下方法传递重要属性,例如基本 DN(要搜索的根)和过滤器:

.userSearchBase("ou=<your users container>").userSearchFilter("(uid={0})")
您的搜索过滤器很可能是 uid={0}cn={0} .

关于Spring-boot LDAP - 未设置属性 'userDn',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62897293/

相关文章:

Ajax Thymeleaf Springboot

spring - 为 servlet 应用程序使用 WebTestClient 模拟 OAuth2 客户端导致空 httpHandlerBuilder

jpa - Spring启动数据jpa多个数据源entityManagerFactory错误

java - Java 中 LDAP 目录的更新插入

java - Spring安全配置来验证LDAP用户

java - spring-boot 编译使用 jdk 1.7 但运行使用 1.6

c# - 询问 ActiveDirectory 计算机是否是组的成员

tomcat - 将 AD 与在 Tomcat 上运行的 Web 应用程序集成

grails - 如何从 spring-security 获取明文密码?