security - How to properly logout of a Java EE 6 Web Application after logging in -


a pretty simple requirement. after logging web j2ee 6 application, how can have user logout again?

most (all?) books , tutorials have seen show how add login/loginerror page application , demonstrate use of security principals/roles/realms etc using "j_security_check" method - good. it's not clear how give user power logout. indeed, how can force logout after, say, session times out, etc?

you should have logout servlet/jsp invalidates session using following ways:

  • before servlet 3.0, using session.invalidate() method invalidates session also.
  • servlet 3.0 provides api method httpservletrequest.logout() invalidates security context , session still exists.

and, application ui should providing link invokes logout servlet/jsp

question: indeed, how can force logout after, say, session times out, etc?

answer: <session-timeout> in web.xml lets define timeout value after session invalidated server.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -