【问题标题】:Custom Ldapauthenticationprovider spring security自定义 Ldapauthenticationprovider spring security
【发布时间】:2013-01-24 06:41:34
【问题描述】:
我们正在开发一个 SaaS 应用程序,该应用程序应该能够针对每个客户端的 LDAP 服务器对用户进行身份验证。因此,与其在安全 xml 中硬编码 ldap 凭据,我应该能够从数据库中动态获取 url、dc 等 ldap 凭据并使用它们访问 ldap 服务器。为此,我需要自定义 Ldapautheticationprovider。任何有关如何自定义 Ldapauthenticationprovider 的教程、链接或指导将不胜感激。非常感谢您。
【问题讨论】:
标签:
spring
spring-security
ldap
【解决方案1】:
您可以编写 CustomLdapauthenticationprovider 并扩展原始的 Ldapauthenticationprovider。
在 CustomLdapauthenticationprovider 中,您可以覆盖需要更改的方法。
在 xml 中,您需要将身份验证提供程序更改为您的自定义类:
<beans:bean id="ldapAuthProvider" class="my.package.security.CustomLdapAuthenticationProvider">