Alex Rex wrote:Thanks for the info, that's very helpful. So supposing I wanted to automatically redirect to the log on page when the session expires, how would I do that?
Horribly, if you do it like most people.
J2EE defines a built-in security system. If you use that when not logged in to access a protected URL (as defined in web.xml), the server will automatically intercept the request, put it on hold, present a login screen (assuming you defined form-based authentication in web.xml), and - assuming the login was successful - then resume the original web request, sending the user to the page he/she requested.
However, in real life, a depressingly large number of people don't use that system, invent their own, supply their own login page processors (aided and abetted by numerous examples in
Java books), and end up with an application that a 5-year old could hack into in under 15 minutes.
I'm dead serious. I've been working with J2EE since before JSPs were invented, seen innumerable "do it yourself" security systems, and most of them had all the impenetrability of wet cardboard. Not one of them could resist a halfway-determined attack, even the military ones. Which is why I don't recommend DIY security. The J2EE standard container-managed system was designed and vetted by security professionals, not people who were instructed to slap in security as part of the bigger project. It does most of its work by preventing access to the application by unauthorized users at the server level - unauthorized requests never get passed to application code at all, which means that the app doesn't have to worry about major security loopholes in the application code.
It also supports bookmarking, since the signon process intercepts and restores URL requests. However, if you absolutely must force people to a "home" page after signon, you can also do that. Just redirect the first request that comes in with a non-null userID. There is no actual "login event" to listen to, since in a single-signon environment, some other application might have been the one that caught the login.