authentication - Grails-在LoginController的authfail中拦截输入的用户名

标签 authentication grails login spring-security

我试图强制用户在首次登录时更改其密码(如此处Grails spring-security - Can I intercept before success action to check required password change?所述)。

但是,UsernamePasswordAuthenticationFilter.SPRING_SECURITY_LAST_USERNAME_KEY(也已弃用)和springSecurityService.authentication.name都不提供输入的用户名。我得到的只是__grails.anonymous.user__,不能用于设置用户的新密码。

你们中有谁知道如何确定输入的用户名?

非常感谢你。

最佳答案

您可以使用session.getAttribute(SpringSecurityUtils.SPRING_SECURITY_LAST_USERNAME_KEY)我也必须在config.groovy中启用此属性

grails.plugin.springsecurity.apf.storeLastUsername=true

关于authentication - Grails-在LoginController的authfail中拦截输入的用户名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24994486/

相关文章:

grails - 使用ClearDB在Heroku上设置Grails 2.3.5 App时出现问题

grails - 如何在 Grails 中拆分域逻辑和数据访问

php - PHP成功将if语句传递到新文件

javascript - Facebook FB.login() 弹出窗口不会在 IE8 中关闭

authentication - 跨平台登录

servlets - 当用户未登录时,Servlet 过滤器在无限重定向循环中运行

authentication - Swift - Parse.Com - 登录 - 'selector' 未找到

tomcat - Grails:WAR 文件部署:查找端口

php - Symfony2-显示错误的凭证错误

login - 我们是否应该弃用 "Remember Me"复选框并开始假设?