ServletContext servletCtx = httpContext.getServletContext();
IdentityServer server = (IdentityServer)servletCtx.getAttribute("IDENTITY_SERVER");
if(server == null)
throw new ProcessingException("Identity Server not found");
String originalIssuer = (relayState == null) ? issuer : relayState;
String participant = this.getParticipant(server, sessionID, originalIssuer);
if(participant == null || participant.equals(originalIssuer))
{
//All log out is done
session.invalidate();
server.stack().pop(sessionID);
generateSuccessStatusResponseType(logOutRequest.getID(),
request, response, originalIssuer);
}
else
{
//Put the participant in transit mode
server.stack().registerTransitParticipant(sessionID, participant);
if(relayState == null)
relayState = originalIssuer;
//send logout request to participant with relaystate to orig
response.setRelayState(originalIssuer);
response.setDestination(participant);
LogoutRequestType lort = saml2Request.createLogoutRequest(request.getIssuer().getValue());
response.setResultingDocument(saml2Request.convert(lort));
}
}
catch(ParserConfigurationException pe)
{
throw new ProcessingException(pe);
}
catch(ConfigurationException pe)
{
throw new ProcessingException(pe);
}
catch(JAXBException pe)
{
throw new ProcessingException(pe);
}
catch(IOException pe)
{
throw new ProcessingException(pe);
}
catch(SAXException pe)
{
throw new ProcessingException(pe);
}
return;
}