Class FedletSessionProvider

  • All Implemented Interfaces:
    SessionProvider

    public class FedletSessionProvider
    extends Object
    implements SessionProvider
    The FedletSessionProvider class is an implementation of SessionProvider interface for Fedlet deployment. The implementation performs no operation on the methods.
    • Constructor Detail

      • FedletSessionProvider

        public FedletSessionProvider()
        Default Constructor
    • Method Detail

      • matchSecret

        public static boolean matchSecret​(String secret)
        Indicates whether a secret originally comes from this class or not
        Parameters:
        secret - the secret string to be matched
        Returns:
        true if there is a match, false otherwise
      • createSession

        public Object createSession​(Map info,
                                    jakarta.servlet.http.HttpServletRequest request,
                                    jakarta.servlet.http.HttpServletResponse response,
                                    StringBuffer targetApplication)
                             throws SessionException
        Meaningful only for SP side, the implementation of this method will create a local session for the local user identified by the information in the map. The underline mechanism of the session creation and management is application specific. For example, it could be cookie setting or url rewriting, which is expected to be done by the implementation of this method. Note that only the first input parameter is mandatory. Normally, at least one of the last two parameters should not be null
        Specified by:
        createSession in interface SessionProvider
        Parameters:
        info - a Map with keys and values being of type String; The keys will include "principalName" (returned from SPAccountMapper), "realm", "authLevel", and may include "resourceOffering" and/or "idpEntityID"; The implementation of this method could choose to set some of the information contained in the map into the newly created Session by calling setProperty(), later the target application may consume the information.
        request - the HttpServletRequest the user made to initiate the SSO; Note that it should be the initial request coming from the browser as opposed to the possible subsequent back-channel HTTP request for delivering SOAP message.
        response - the HttpServletResponse that will be sent to the user (for example it could be used to set a cookie).
        targetApplication - the original resource that was requested as the target of the SSO by the end user; If needed, this String could be modified, e.g., by appending query string(s) or by url rewriting, hence this is an in/out parameter.
        Returns:
        the newly created local user session.
        Throws:
        SessionException - if an error occurred during session creation.
      • getSession

        public Object getSession​(String sessionID)
                          throws SessionException
        May be used by both SP and IDP side for getting an existing session given an session ID.
        Specified by:
        getSession in interface SessionProvider
        Parameters:
        sessionID - the unique session handle.
        Returns:
        the corresponding session object.
        Throws:
        SessionException - if an error occurred during session retrieval.
      • getSession

        public Object getSession​(jakarta.servlet.http.HttpServletRequest request)
                          throws SessionException
        May be used by both SP and IDP side for getting an existing session given a browser initiated HTTP request.
        Specified by:
        getSession in interface SessionProvider
        Parameters:
        request - the browser initiated HTTP request.
        Returns:
        the corresponding session object.
        Throws:
        SessionException - if an error occurred during session retrieval.
      • invalidateSession

        public void invalidateSession​(Object session,
                                      jakarta.servlet.http.HttpServletRequest request,
                                      jakarta.servlet.http.HttpServletResponse response)
                               throws SessionException
        May be used by both SP and IDP side to invalidate a session. In case of SLO with SOAP, the last two input parameters would have to be null
        Specified by:
        invalidateSession in interface SessionProvider
        Parameters:
        session - the session to be invalidated
        request - the browser initiated HTTP request.
        response - the HTTP response going back to browser.
        Throws:
        SessionException - if an error occurred during session retrieval.
      • isValid

        public boolean isValid​(Object session)
                        throws SessionException
        Indicates whether the session is still valid. This is useful for toolkit clean-up thread.
        Specified by:
        isValid in interface SessionProvider
        Parameters:
        session - Session object
        Returns:
        boolean value indicating whether the session is still valid
        Throws:
        SessionException
      • getSessionID

        public String getSessionID​(Object session)
        The returned session ID should be unique and not change during the lifetime of this session.
        Specified by:
        getSessionID in interface SessionProvider
        Returns:
        session ID.
      • rewriteURL

        public String rewriteURL​(Object session,
                                 String URL)
                          throws SessionException
        Description copied from interface: SessionProvider
        Returns rewritten URL. Rewrites an URL with session information in case cookie setting is not supported.
        Specified by:
        rewriteURL in interface SessionProvider
        Parameters:
        session - the session object.
        URL - the URL to be rewritten.
        Returns:
        the rewritten URL.
        Throws:
        SessionException - if rewritting the URL causes an error.
      • setLoadBalancerCookie

        public void setLoadBalancerCookie​(jakarta.servlet.http.HttpServletRequest request,
                                          jakarta.servlet.http.HttpServletResponse response)
        Sets a load balancer cookie in the suppled HTTP response. The load balancer cookie's value is set per server instance and is used to support sticky load balancing.
        Specified by:
        setLoadBalancerCookie in interface SessionProvider
        Parameters:
        request - The HTTP request.
        response - the HttpServletResponse that will be sent to the user.
      • getTimeLeft

        public long getTimeLeft​(Object session)
        Description copied from interface: SessionProvider
        Returns the time left for this session in seconds.
        Specified by:
        getTimeLeft in interface SessionProvider
        Parameters:
        session - Session object.
        Returns:
        The time left for this session.