0

That would be useful, so that I don't have to check if session is valid before interacting with the currently login user. Even nicer if I could tell Spring to automatically redirect user to the login page if sesssion is already timed out.

There's a similar question here:Logout/Session timeout catching with spring security but what I really need is something more intuitive and elegant. Is that possible?

Community
  • 1
  • 1
Sandeep
  • 101
  • 1
  • 8

1 Answers1

1

Actually

<form-login login-page='/login.jsp'/>

will already do this. If the user requests a secured page and is not logged in (that also happens when the session isn't available due to a timeout), spring security sends a redirect to the specified login-page.

http://static.springsource.org/spring-security/site/docs/3.1.x/reference/ns-config.html#ns-form-and-basic

obecker
  • 2,132
  • 1
  • 19
  • 23