我想在我的spring应用程序中集成LDAP。
要求:-根据请求,它应该转移到我的登录页面,然后询问用户/密码。然后在提交时,它应该从LDAP进行身份验证。
感谢
Spring中有一个名为Spring Security的特殊项目用于此目的。核心功能构建为一组servlet API过滤器。用户的数据库有多个连接器(LDAP、DB、Active Directory等)。在这里,您可以看到如何添加基本的conf。您的conf可能如下所示:
<http use-expressions="true">
<intercept-url pattern="/**" access="isAuthenticated()" />
<form-login />
<logout />
</http>
请注意,对于安全规则,我更喜欢使用SpEL表达式。在这里您可以看到如何添加LDAP。
希望能有所帮助。
除此之外,您还需要其他LDAP配置,如
<ldap-server url="ldap://localhost:10389/dc=example,dc=com" />
<authentication-manager alias="authenticationManager"
erase-credentials="true">
<ldap-authentication-provider
user-dn-pattern="uid={0},ou=people" group-search-base="ou=groups"
group-search-filter="(members={0})">
</ldap-authentication-provider>
</authentication-manager>