Hi,
Our requirement is to enable ADF Security with Client Authentication(SAML 2.0(IDCS) as IDP and SP) for our ADF Application developed in jdev 12.2.1.4.
We are able to achieve login functionality and is working fine.
But when we tried to implement Logout, session is not validated and is redirecting to Home Page(authenticated) again.
Can anyone please guide me for implementing Logout for this application. Below is the code I have included in logout Action Method.
FacesContext fctx = FacesContext.getCurrentInstance();
ExternalContext ectx = fctx.getExternalContext();
String url = ectx.getRequestContextPath() + "/adfAuthentication?logout=true&end\_url=/faces/Index.jspx";
HttpServletRequest request = (HttpServletRequest)ectx.getRequest();
HttpServletResponse response = (HttpServletResponse)ectx.getResponse();
HttpSession session = (HttpSession)ectx.getSession(false);
if (request.getCookies() != null) {
for (Cookie cookie : request.getCookies()) {
cookie.setMaxAge(0);
cookie.setPath("/");
response.addCookie(cookie);
}
}
try {
session.invalidate();
ectx.redirect(url);
} catch (IOException e) {
e.printStackTrace();
}
fctx.responseComplete();
Any suggestions would be helpful.
Thanks in Advance