Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

session.invalidate() not working for SSO Logout(Client Authentication) in jdev 12c

user-ujht4Jul 6 2023

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

Comments
Post Details
Added on Jul 6 2023
1 comment
1,042 views