question: private static boolean isMisroutedRequest ( HttpServletRequest request , HttpServletResponse response , PrintWriter out , Object session ) throws SAML2Exception , SessionException { String classMethod = "IDPSingleLogout.isMisroutedRequest : " ; String idpSessionIndex = IDPSSOUtil . getSessionIndex ( session ) ; if ( idpSessionIndex == null ) { if ( debug . messageEnabled ( ) ) { debug . message ( classMethod + "No SP session participant(s)" ) ; } MultiProtocolUtils . invalidateSession ( session , request , response , SingleLogoutManager . SAML2 ) ; return true ; } String serverId = idpSessionIndex . substring ( idpSessionIndex . length ( ) - 2 ) ; if ( debug . messageEnabled ( ) ) { debug . message ( classMethod + "idpSessionIndex=" + idpSessionIndex + ", id=" + serverId ) ; } if ( ! serverId . equals ( SAML2Utils . getLocalServerID ( ) ) ) { if ( debug . warningEnabled ( ) ) { debug . warning ( classMethod + "SLO request is mis-routed, we are " + SAML2Utils . getLocalServerID ( ) + " and request is owned by " + serverId ) ; } String remoteServiceURL = SAML2Utils . getRemoteServiceURL ( serverId ) ; String remoteLogoutURL = remoteServiceURL + SAML2Utils . removeDeployUri ( request . getRequestURI ( ) ) ; String queryString = request . getQueryString ( ) ; if ( queryString != null ) { remoteLogoutURL = remoteLogoutURL + QUESTION_MARK + queryString ; } HashMap remoteRequestData = SAML2Utils . sendRequestToOrigServer ( request , response , remoteLogoutURL ) ; String redirect_url = null ; String output_data = null ; if ( remoteRequestData != null && ! remoteRequestData . isEmpty ( ) ) { redirect_url = ( String ) remoteRequestData . get ( SAML2Constants . AM_REDIRECT_URL ) ; output_data = ( String ) remoteRequestData . get ( SAML2Constants . OUTPUT_DATA ) ; } if ( debug . messageEnabled ( ) ) { debug . message ( classMethod + "redirect_url : " + redirect_url ) ; debug . message ( classMethod + "output_data : " + output_data ) ; } if ( ( redirect_url != null ) && ! redirect_url . equals ( "" ) ) { if ( debug . messageEnabled ( ) ) { debug . message ( classMethod + "Redirecting the response, " + "redirect actioned by the JSP" ) ; } try { response . sendRedirect ( redirect_url ) ; } catch ( IOException ex ) { debug . error ( classMethod + "Error when redirecting" , ex ) ; } return true ; } if ( ( output_data != null ) && ( ! output_data . equals ( "" ) ) ) { if ( debug . messageEnabled ( ) ) { debug . message ( classMethod + "Printing the forwarded response" ) ; } response . setContentType ( "text/html; charset=UTF-8" ) ; out . println ( output_data ) ; return true ; } } return false ; }
target:  Checks if a SAML2 request has been misrouted, if so, send the request to  the original server, gets the response and redirects it or posts it back