Class IDPSingleLogout


  • public class IDPSingleLogout
    extends Object
    This class reads the required data from HttpServletRequest and initiates the LogoutRequest from IDP to SP.
    • Method Detail

      • initiateLogoutRequest

        public static void initiateLogoutRequest​(jakarta.servlet.http.HttpServletRequest request,
                                                 jakarta.servlet.http.HttpServletResponse response,
                                                 PrintWriter out,
                                                 String binding,
                                                 Map paramsMap)
                                          throws SAML2Exception
        Parses the request parameters and initiates the Logout Request to be sent to the SP.
        Parameters:
        request - the HttpServletRequest.
        response - the HttpServletResponse.
        out - the print writer for writing out presentation
        binding - binding used for this request.
        paramsMap - Map of all other parameters. Following parameters names with their respective String values are allowed in this paramsMap. "RelayState" - the target URL on successful Single Logout "Destination" - A URI Reference indicating the address to which the request has been sent. "Consent" - Specifies a URI a SAML defined identifier known as Consent Identifiers. "Extension" - Specifies a list of Extensions as list of String objects.
        Throws:
        SAML2Exception - if error initiating request to SP.
      • processLogoutRequest

        public static void processLogoutRequest​(jakarta.servlet.http.HttpServletRequest request,
                                                jakarta.servlet.http.HttpServletResponse response,
                                                PrintWriter out,
                                                String samlRequest,
                                                String relayState)
                                         throws SAML2Exception,
                                                SessionException
        Gets and processes the Single LogoutRequest from SP.
        Parameters:
        request - the HttpServletRequest.
        response - the HttpServletResponse.
        out - the print writer for writing out presentation
        samlRequest - LogoutRequest in the XML string format.
        relayState - the target URL on successful LogoutRequest.
        Throws:
        SAML2Exception - if error processing LogoutRequest.
        SessionException - if error processing LogoutRequest.
      • processLogoutResponse

        public static boolean processLogoutResponse​(jakarta.servlet.http.HttpServletRequest request,
                                                    jakarta.servlet.http.HttpServletResponse response,
                                                    PrintWriter out,
                                                    String samlResponse,
                                                    String relayState)
                                             throws SAML2Exception,
                                                    SessionException
        Gets and processes the Single LogoutResponse from SP, destroys the local session, checks response's issuer and inResponseTo.
        Parameters:
        request - the HttpServletRequest.
        response - the HttpServletResponse.
        out - the print writer for writing out presentation
        samlResponse - LogoutResponse in the XML string format.
        relayState - the target URL on successful LogoutResponse.
        Returns:
        true if jsp has sendRedirect for relayState, false otherwise
        Throws:
        SAML2Exception - if error processing LogoutResponse.
        SessionException - if error processing LogoutResponse.
      • processLogoutRequest

        public static LogoutResponse processLogoutRequest​(LogoutRequest logoutReq,
                                                          jakarta.servlet.http.HttpServletRequest request,
                                                          jakarta.servlet.http.HttpServletResponse response,
                                                          PrintWriter out,
                                                          String binding,
                                                          String relayState,
                                                          String idpEntityID,
                                                          String realm,
                                                          boolean isVerified)
                                                   throws SAML2Exception
        Gets and processes the Single LogoutRequest from SP and return LogoutResponse.
        Parameters:
        logoutReq - LogoutRequest from SP
        request - the HttpServletRequest.
        response - the HttpServletResponse.
        out - the print writer for writing out presentation
        binding - name of binding will be used for request processing.
        relayState - the relay state.
        idpEntityID - name of host entity ID.
        realm - name of host entity.
        isVerified - true if the request is verified already.
        Returns:
        LogoutResponse the target URL on successful LogoutRequest.
        Throws:
        SAML2Exception - if error processing LogoutRequest.
      • getSPSLOServiceEndpoints

        public static List<SingleLogoutServiceElement> getSPSLOServiceEndpoints​(String realm,
                                                                                String spEntityID)
                                                                         throws SAML2Exception
        Gets the single log out end points for the Service Provider.
        Parameters:
        realm - the realm that the service provider is configured within
        spEntityID - the id for the service provider configuration entity
        Returns:
        a list of Single Logout Service elements
        Throws:
        SAML2Exception - if there was a problem retrieving the SP SSO Descriptor Element