[jboss-user] [JBoss Seam] - Re: Logout problem
Try this: | import javax.faces.context.FacesContext; | import javax.servlet.http.Cookie; | import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletResponse; | | import org.acegisecurity.context.SecurityContextHolder; | import org.acegisecurity.ui.rememberme.TokenBasedRememberMeServices; | import org.jboss.seam.Seam; | | | ... | | private void logoutAuthentication() { | HttpServletRequest request = | (HttpServletRequest)FacesContext.getCurrentInstance() | .getExternalContext().getRequest(); | HttpServletResponse response = (HttpServletResponse)FacesContext.getCurrentInstance() | .getExternalContext().getResponse(); | try { | if (request.getRemoteUser() != null) { | Seam.invalidateSession(); // invalidate session | Cookie terminate = new Cookie(TokenBasedRememberMeServices | .ACEGI_SECURITY_HASHED_REMEMBER_ME_COOKIE_KEY, null); | terminate.setMaxAge(0); | terminate.setPath(/); // You need to add this! | response.addCookie(terminate); | SecurityContextHolder.clearContext(); // invalidate | // authentication | } | | } catch (Exception e) { | log.error(Error logging out: , e); | } | log.debug(SecurityContext invalidated!); | } | | View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4093559#4093559 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4093559 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Logout problem
easiest way i know of is to add a link in your jsf as such: s:link action=#{identity.logout} value=Logout | rendered=#{identity.loggedIn} the identity.logout action will invalidate the session. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4093666#4093666 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4093666 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Logout problem
Again, please, please, please. Can anyone help? View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4091540#4091540 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4091540 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Logout problem
From seam javadoc of Session: anonymous wrote : | Controls HttpSession invalidation in any servlet or JSF environment. Since Seam keeps internal state in the HttpSession, is is illegal to call HttpSession.invalidate() while Seam contexts are active. Applications using Seam security should call Identity.logout() instead of calling this component directly. | Seems like you should try Identity.logout(). best, Dustin View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4091611#4091611 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4091611 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Logout problem
Please anyone?? View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4090566#4090566 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4090566 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user