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.
精彩评论