Logout when Session expired trigger NullPointerException
I've been configured a handler for logout
Code:
<logout delete-cookies="true" invalidate-session="true"
success-handler-ref="customLogoutSuccessHandler"/>
In method onLogoutSuccess of my handler class "CustomLogoutSuccessHandler" I've following
Code:
@Override
public void onLogoutSuccess(HttpServletRequest request,
HttpServletResponse response, Authentication authentication)
throws IOException, ServletException{
// TODO Auto-generated method stub
System.out.println("logout");
//code
}
I used the authentication object, but when session expired this object is null, so that I can't use it :(.
In logout I need the user stored within the authentication object. When the session expired, How do I get it?