Ast*_*ton 2 grails grails-plugin
我目前正在使用Grails和Spring Security插件,并尝试实现密码到期工作流程.我按预期配置了插件:
grails.plugins.springsecurity.failureHandler.exceptionMappings = [
    'org.springframework.security.authentication.CredentialsExpiredException': '/login/passwordExpired'
]
在我的密码中,如果我打电话给我:
def username = session['SPRING_SECURITY_LAST_USERNAME']
然后在用户名中,HTML特殊字符将被转义为
my_user => my_user
my-user => my-user
是否可以关闭这个逃脱?
仅限Ritesh这里提到spring_security_last_username该SPRING_SECURITY_LAST_USERNAME被弃用,因此我可以使用什么呢?
如有任何帮助,请提前感谢!
'SPRING_SECURITY_LAST_USERNAME'不推荐使用String - 具有该值的旧常量是,并且已使用新名称移动但值相同.所以你的代码将继续有效.
你可以轻松地逃脱,而不是改变不逃避的事物:
import org.apache.commons.lang.StringEscapeUtils
...
String username = StringEscapeUtils.unescapeHtml(session['SPRING_SECURITY_LAST_USERNAME'])
| 归档时间: | 
 | 
| 查看次数: | 933 次 | 
| 最近记录: |