HttpSession httpSession = httpRequest.getSession(false);
String relayState = request.getRelayState();
ServletContext servletCtx = httpContext.getServletContext();
IdentityServer server = (IdentityServer)servletCtx.getAttribute("IDENTITY_SERVER");
if(server == null)
throw new ProcessingException("Identity Server not found");
String sessionID = httpSession.getId();
String statusIssuer = statusResponseType.getIssuer().getValue();
server.stack().deRegisterTransitParticipant(sessionID, statusIssuer);
String nextParticipant = this.getParticipant(server, sessionID, relayState);
if(nextParticipant == null || nextParticipant.equals(relayState))
{
//we are done with logout
//TODO: check the in transit map for partial logouts
try
{
generateSuccessStatusResponseType(statusResponseType.getInResponseTo(),
request, response, relayState);
}
catch (Exception e)
{
throw new ProcessingException(e);
}
}
else
{
//Put the participant in transit mode
server.stack().registerTransitParticipant(sessionID, nextParticipant);
//send logout request to participant with relaystate to orig
response.setRelayState(relayState);
response.setDestination(nextParticipant);