Class MultiProtocolUtils


  • public class MultiProtocolUtils
    extends Object
    The MultiProtocolUtils class provides some utility methods.
    • Method Detail

      • geServerBaseURL

        public static String geServerBaseURL​(jakarta.servlet.http.HttpServletRequest request)
        Returns base URL for the server, the URL contains the protocol, server name, server port and deployment URI. For example: http://www.sun.com:80/amserver
        Parameters:
        request - HttpServlet request object.
        Returns:
        URL string containing the server protocol, name, port and deployment uri.
      • isMultiProtocolRelayState

        public static boolean isMultiProtocolRelayState​(String relayState)
        Returns true if the relay state if one of the URL for the multi-federation protocol processing.
        Parameters:
        relayState - relay state to be checked.
        Returns:
        true if it is one of the multi-federation protocol processing URL.
      • addFederationProtocol

        public static void addFederationProtocol​(Object session,
                                                 String protocol)
        Updates session property (SingleLogoutManager.FEDERATION_PROTOCOLS ) with the new protocol information.
        Parameters:
        session - Session Object to be updated
        protocol - Name of the Federation protocol to be added.
      • removeFederationProtocol

        public static void removeFederationProtocol​(Object session,
                                                    String protocol)
        Updates session property (SingleLogoutManager.FEDERATION_PROTOCOLS ) with the new protocol information.
        Parameters:
        session - Session Object to be updated
        protocol - Name of the Federation protocol to be added.
      • isMultipleProtocolSession

        public static boolean isMultipleProtocolSession​(jakarta.servlet.http.HttpServletRequest request,
                                                        String protocol)
        Returns true if the session is used in other federation protocols.
        Parameters:
        request - HttpServlet object
        protocol - Protocol of the caller. Value is one of the following: SingleLogoutManager.IDFF SingleLogoutManager.SAML2 SingleLogoutManager.WS_FED
        Returns:
        true if the session is used in other federation protocols, false otherwise.
      • isMultipleProtocolSession

        public static boolean isMultipleProtocolSession​(Object session,
                                                        String protocol)
        Returns true if the session is used in other federation protocols.
        Parameters:
        session - Session object
        protocol - Protocol of the caller. Value is one of the following: SingleLogoutManager.IDFF SingleLogoutManager.SAML2 SingleLogoutManager.WS_FED
        Returns:
        true if the session is used in other federation protocols, false otherwise.
      • usedInProtocol

        public static boolean usedInProtocol​(jakarta.servlet.http.HttpServletRequest request,
                                             String protocol)
        Returns true if the session is used in the specified federation protocol.
        Parameters:
        request - HttpServlet object
        protocol - Protocol of the caller. Value is one of the following: SingleLogoutManager.IDFF SingleLogoutManager.SAML2 SingleLogoutManager.WS_FED
        Returns:
        true if the session is used in this federation protocol, false otherwise.
      • usedInProtocol

        public static boolean usedInProtocol​(Object session,
                                             String protocol)
        Returns true if the session is used in the specified federation protocol.
        Parameters:
        session - Session object
        protocol - Protocol of the caller. Value is one of the following: SingleLogoutManager.IDFF SingleLogoutManager.SAML2 SingleLogoutManager.WS_FED
        Returns:
        true if the session is used in this federation protocol, false otherwise.
      • invalidateSession

        public static void invalidateSession​(Object session,
                                             jakarta.servlet.http.HttpServletRequest request,
                                             jakarta.servlet.http.HttpServletResponse response,
                                             String protocol)
                                      throws SessionException
        Invalidates session for a specific protocol. This method invaldates the session if it is not used in any other federation protocol, otherwise modifies session property to remove the sepcified protocol from the session.
        Parameters:
        session - the session object to be invalidated.
        request - HttpServletRequest object.
        response - HttpServletResponse object.
        protocol - the federaion protocol to be checked.
        Throws:
        SessionException
      • getLogoutStatus

        public static String getLogoutStatus​(int status)
        Returns logout status in string form.
        Parameters:
        status - Single Logout Status. Possible values: LOGOUT_SUCCEEDED_STATUS - single logout succeeded. LOGOUT_FAILED_STATUS - single logout failed. LOGOUT_PARTIAL_STATUS - single logout partially succeeded. LOGOUT_REDIRECTED_STATUS - single logout request redirected. LOGOUT_NO_ACTION_STATUS - single loglout not performed.
        Returns:
        single logout status in string form. Possible values: IFSConstants.LOGOUT_SUCCESS, IFSConstants.LOGOUT_FAILURE