我正在运行一个 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/