Hi i have a question to make you gays,
I'm a new in CAS so i have a question to make, i authenticate my
applications with the CAS server but when i log out from one aplication i
still be log in the another application for example.
I have an application cal app-b and another call app-c, so when i clic on
the logout button from the app-c it log out succesfully and when i try to
get into the app-c again it shows me the login window but if i turn to the
app-b it stiil have a validate session so i have to log out from it, so i
wanted to know how to log out from the two application at the same time, im
using the next method to log out
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;
switch (request.getServerName()) {
case "siampv5.mp":
reconstructedURL = new URL(request.getScheme(),
"siamp.mp",
request.getServerPort(), ""
);
break;
case "siampv3.mp":
reconstructedURL = new URL(request.getScheme(),
"siamp.mp",
request.getServerPort(), ""
);
break;
default:
reconstructedURL = new URL(request.getScheme(),
request.getServerName(),
request.getServerPort(), ""
);
break;
}
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);
}
}
thanks a lot
--
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
---
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%2Bd0uZzE3V%2BmQcEW7ezYSv4oOdWRP5Ac3j%2BWAZBSk1PbeQ%40mail.gmail.com.