i want that when i logout of one application or service it kills the others
but it dosent i haveto logout of every service i loggin  how can i do this?

what i do now is this.

<h:commandLink action="#{sesionMB.logout()}" style="text-decoration: none;">
                                    <h:graphicImage library="images"
name="logout.png" style="right: 0px; margin-top: 10px; position: relative;"
width="30px;"  />
                                    <h:outputLabel value="Logout"
style="font-size: 16px; color: #F2F2F2; text-decoration: none; display:
block;"/>
                                </h:commandLink>




 public void logout() {
        Factory<org.apache.shiro.mgt.SecurityManager> factory = new
IniSecurityManagerFactory("classpath:shiro.ini");
        org.apache.shiro.mgt.SecurityManager securityManager =
factory.getInstance();
        SecurityUtils.setSecurityManager(securityManager);
        if (SecurityUtils.getSubject() != null) {
            SecurityUtils.getSubject().logout();
        }
        redirectToLogOut();
    }



private void redirectToLogOut() {
        try {
            HttpServletRequest request = (HttpServletRequest) FacesContext.
getCurrentInstance().getExternalContext().getRequest();
            /*String url = request.getRequestURL().toString();
             String baseURL = url.substring(0, url.length() -
request.getRequestURI().length()) + request.getContextPath() + "/";*/

            URL reconstructedURL = new URL(request.getScheme(),
                    request.getServerName(),
                    request.getServerPort(), ""
            );
            reconstructedURL.toString();
            log.info(String.format("ReconstructedURL: %s",
reconstructedURL.toString()));
            //log.info(String.format("BaseURL obtained: %s", baseURL));
            
FacesContext.getCurrentInstance().getExternalContext().redirect(reconstructedURL.toString()
+ "/cas/logout");
            FacesContext.getCurrentInstance().getExternalContext().
invalidateSession();
        } catch (IOException ex) {
            log.error(ex);
        }
    }

-- 
- CAS gitter chatroom: https://gitter.im/apereo/cas
- CAS mailing list guidelines: https://apereo.github.io/cas/Mailing-Lists.html
- CAS documentation website: https://apereo.github.io/cas
- CAS project website: https://github.com/apereo/cas
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/CANEG9%2Bf3iES_KWEc4Z1wbUG3kOv3S9MmOocuu%2BzW-3pdonnH-Q%40mail.gmail.com.

Reply via email to