如何在Spring Security中阻止LDAP用户帐户而不锁定LDAP用户?
我是 Spring Security 的新手。在我的应用程序中,身份验证是通过 Ldap 完成的。在 Ldap 身份验证之后,我想处理登录时的失败和成功事件。我想跟踪数据库中的登录计数以实现锁定功能。 有人知道如何实现这一目标吗?
I'm new to Spring Security. In my application authentication is done through Ldap
.After Ldap authentication I want to handle failure and success events on login. I want to track login count in database for locking functionality.
any body knows how to achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
身份验证是通过 LDAP 完成的,但您希望在登录后锁定 ldap 用户。
如果您使用 spring 2.5,您可以自定义实现 InitializingBean 并检查如果主体是 LDAP 用户:
接下来在您的 loginFailureEventListener 上实现此自定义句柄(在 xml 中映射此侦听器)
绑定在 XML 中:
编辑:
您可以扩展
AuthenticationProcessingFilter
并覆盖onUnsuccessfulAuthentication
方法:XML 中的分箱:
现在您可以将此过滤器放入您的filterChainProxy 在
这里寻找灵感
http://www.harinair.com/2010/02/ spring-acegi-security-帐户锁定/
Authentication is done by LDAP but you want to lock the ldap user after he logged in.
If you use spring 2.5 you can make your custom implementation of a InitializingBean and check if principal is a LDAP user:
And next implement this custom handle on your loginFailureEventListener (map this listener in your xml)
binding in XML:
EDIT:
You can extend
AuthenticationProcessingFilter
and override theonUnsuccessfulAuthentication
method:Binning in XML:
Now you can put this filter in your filterChainProxy
Look here for inspiration
http://www.harinair.com/2010/02/spring-acegi-security-account-lockout/
什么锁定功能?您是否知道 LDAP 密码策略扩展,它可以为您管理诸如此类的各种内容?例如,多次登录失败后锁定、密码过期/锁定/强制重置、密码质量策略……
What locking functionality? Are you aware of the LDAP Password Policy extension, that manages all kinds of stuff like this for you? e.g. lockout after several unsuccessful logins, password expiry/lock/mandatory reset, password quality polices, ...