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);
}
}