开发者

spring_security_last_username

Can we access "spring_security_last_username" form the Controller inst开发者_StackOverflow中文版ead of jsp?


SPRING_SECURITY_LAST_USERNAME is a session attribute, therefore you can access it from the controller like any session attribute:

public ModelAndView controller(..., Session s) {
    String lastUsername = s.getAttribute("SPRING_SECURITY_LAST_USERNAME");
    ...
}


I just want to add that the SPRING_SECURITY_LAST_USERNAME_KEY is deprecated. As mentioned in its deprecation note, you should use your custom failureHandler to retain any user information.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜