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() methodinvalidates 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
Post a Comment