public void processIDPRequest(
      HttpServletRequest httpRequest, HttpServletResponse httpResponse, RequestAbstractType request)
      throws InvalidRequestException {
    if (!(request instanceof LogoutRequestType)) {
      throw new InvalidRequestException("Request should be a single logout request.");
    }

    LogoutRequestType logoutRequest = (LogoutRequestType) request;
    SamlExternalIdentityProvider idp =
        (SamlExternalIdentityProvider) samlDialogue.getExternalProvider();

    NameIDType nameIdJaxb = logoutRequest.getNameID();
    SamlNameId samlNameId =
        new SamlNameIdImpl(
            nameIdJaxb.getValue(), nameIdJaxb.getFormat(), nameIdJaxb.getNameQualifier());
    removeSessions(samlNameId, idp.getEntityId(), logoutRequest.getSessionIndex());

    StatusResponseType statusResponse =
        samlMessageFactory.createStatusResponse(SamlConstants.STATUS_SUCCESS, null);

    samlMessageSender.sendResponse(idp, statusResponse, SamlProfile.SINGLE_LOGOUT, httpResponse);

    dialogue.setFinished(true);
  }
 public void processIDPResponse(
     HttpServletRequest httpRequest,
     HttpServletResponse httpResponse,
     StatusResponseType statusResponse) {
   StatusType status = statusResponse.getStatus();
   if (status.getStatusCode().getValue().equals(SamlConstants.STATUS_SUCCESS)) {
     samlServiceProviderSpi
         .get()
         .globalLogoutSucceeded(responseHandler.createResponseHolder(httpResponse));
   } else {
     String statusCodeLevel1 = status.getStatusCode().getValue();
     String statusCodeLevel2 = null;
     if (status.getStatusCode().getStatusCode() != null) {
       statusCodeLevel2 = status.getStatusCode().getStatusCode().getValue();
     }
     samlServiceProviderSpi
         .get()
         .globalLogoutFailed(
             statusCodeLevel1,
             statusCodeLevel2,
             responseHandler.createResponseHolder(httpResponse));
   }
   dialogue.setFinished(true);
 }