-
1. Re: Seam 3 - Invalidate session on logout
lightguard Jul 25, 2011 5:07 PM (in response to bschoen)Please create a JIRA ticket
-
2. Re: Seam 3 - Invalidate session on logout
bschoen Jul 26, 2011 8:08 AM (in response to bschoen)SEAMSECURITY-83
-
3. Re: Seam 3 - Invalidate session on logout
smurfs.smurfsturf.googlemail.com Jul 28, 2011 7:20 AM (in response to bschoen)You've probably figured it out, but for the benefit of others one solution is to define a method which observes the PostLoggedOutEvent fired by IdentityImpl.logout(). This is an approach I've used.
@RequestScoped public class EventHandler { private static final Logger logger = Logger.getLogger(EventHandler.class); @Inject private HttpServletRequest httpRequest; public void handlePostLoggedOutEvent(@Observes final PostLoggedOutEvent event) { logger.logv(Level.DEBUG, "PostLoggedOutEvent triggered by user: {0}", event.getUser().getId()); httpRequest.getSession().invalidate(); } }
The injection of HttpServletRequest does create a dependency on the Seam 3 Servlet module though.
-
4. Re: Seam 3 - Invalidate session on logout
kwutzke Oct 21, 2011 12:55 AM (in response to bschoen)What would probably be the easiest solutions without the dependency to Seam 3 Servlet?
Thanks
Karsten -
5. Re: Seam 3 - Invalidate session on logout
lightguard Oct 21, 2011 1:42 AM (in response to bschoen)If you're using JSF you can get the session from the FacesContext via the external context
-
6. Re: Seam 3 - Invalidate session on logout
kwutzke Oct 21, 2011 2:32 AM (in response to bschoen)Works perfectly, thanks.
I still wonder how to get the @Inject solution to work. I get a warning in Eclipse saying
No bean is eligible for injection to the injection point §5.2.1
(and later the expected Weld exception)...Karsten
-
7. Re: Seam 3 - Invalidate session on logout
lightguard Oct 21, 2011 3:07 AM (in response to bschoen)The injection solution works fine if you include Seam Servlet (pre 3.1.0.Beta3) because there are producers for all of the Servlet API classes like HttpSession, the request, etc.
-
8. Re: Seam 3 - Invalidate session on logout
kwutzke Oct 21, 2011 8:11 AM (in response to bschoen)Oh that's why the Servlet module got moved. Thanks for the info. I appreciate it.
Karsten