Class SessionServerConfig


  • @Singleton
    public class SessionServerConfig
    extends Object
    Responsible for collating WebtopNaming configuration state relating to the Session Service.
    Since:
    13.0.0
    • Constructor Detail

      • SessionServerConfig

        @Inject
        public SessionServerConfig​(@Named("amSession")
                                   Debug sessionDebug,
                                   SessionServiceURLService sessionServiceURLService)
        Constructor called by Guice to initialize the Singleton instance of SessionServerConfig. Initialization success is dependent on WebtopNaming being ready.
    • Method Detail

      • getPrimaryServerID

        public String getPrimaryServerID()
        Gets the ID of the primary server. The server identified varies depending on whether or not this server is running as part of a site: - If a site is running, the primary server details refer to the site's primary server (usu. load balancer). - If a site hasn't been setup, then the primary server details will match the local server details.
      • getPrimaryServerURL

        public URL getPrimaryServerURL()
        Gets the URL of the primary server. The server identified varies depending on whether or not this server is running as part of a site: - If a site is running, the primary server details refer to the site's primary server (usu. load balancer). - If a site hasn't been setup, then the primary server details will match the local server details.
      • getLocalServerID

        public String getLocalServerID()
        Gets ID for this OpenAM server from cache.
      • getLocalServerID

        public String getLocalServerID​(boolean forceReload)
        Gets ID for this OpenAM server from cache or refreshed depends on the parameter
        Parameters:
        forceReload - - if true reloads the localServerID and does not use the cashed value.
      • getLocalServerURL

        public URL getLocalServerURL()
        Gets the full URL for this OpenAM server. e.g. https://openam.example.com:8080/openam
      • getLocalServerSessionServiceURL

        public URL getLocalServerSessionServiceURL()
        Gets the full URL for this OpenAM server's session service servlet. e.g. https://openam.example.com:8080/openam/sessionservice
      • isSiteEnabled

        public boolean isSiteEnabled()
        Indicates if this server is part of a Site (or multiple sites).
      • getSiteID

        public String getSiteID()
        Returns the site ID for this Server.
        Returns:
        Returns a single Site ID for the server.
      • getSiteURL

        public URL getSiteURL()
        Returns:
        Resolves the Site URL for the Site ID.
      • getSecondarySiteIDs

        public Set<String> getSecondarySiteIDs()
        Returns:
        Returns the secondary Site IDs for the given Site ID.
      • isLocalServer

        public boolean isLocalServer​(String serverID)
        Checks if server instance identified by serverID is this OpenAM server.
        Parameters:
        serverID - server id, possibly null.
        Returns:
        true if serverID is the same as local instance, false otherwise.
      • isPrimaryServer

        public boolean isPrimaryServer​(String serverID)
        Checks if server instance identified by serverID is the primary server for this OpenAM server's site. How this check is performed varies depending on whether or not this server is running as part of a site: - If a site is running, the primary server details refer to the site's primary server (usu. load balancer). - If a site hasn't been setup, then the primary server details will match the local server details.
      • isLocalSite

        public boolean isLocalSite​(String siteID)
        This method is called by Session.getLocalServerSessionServiceURL, when routing a request to an individual session host. In this case, the SessionID.PRIMARY_ID extension is obtained from the SessionID instance (which corresponds to the AM-instance host of the session). WebtopNaming will then be called to turn this serverId (01,02, etc) into a URL which will point a PLL client GetSession request. Calling this method is part of insuring that the PLL GetSession request does not get routed to a site (load-balancer). This method checks whether the provided ID (let it be server or site ID) belongs to a local site. If the current server is not member of a site, then the ID will be compared to the current server's ID.
        Parameters:
        siteID - the server id (PRIMARY_ID) pulled from a presented cookie.
        Returns:
        true if the provided ID corresponds to a local server or site.
      • isSite

        public boolean isSite​(String serverOrSiteId)
        Checks whether the provided ID belongs to a site or not.
        Parameters:
        serverOrSiteId - The ID that needs to be checked.
        Returns:
        true if the ID corresponds to a site.
      • isLocalSite

        public boolean isLocalSite​(SessionID sid)
        Checks if server instance identified by serverID is the same as local instance
        Parameters:
        sid - server id
        Returns:
        true if serverID is the same as local instance, false otherwise
      • createLocalServerURL

        public URL createLocalServerURL​(String path)
                                 throws MalformedURLException
        Creates a new URL by adding the provided path to the end of this OpenAM server's URL. e.g. Given the path "GetHttpSession?op=create", if this OpenAM server is deployed to https://openam.example.com:8080/openam then the resulting URL will be https://openam.example.com:8080/openam/GetHttpSession?op=create
        Throws:
        MalformedURLException
      • createServerURL

        public URL createServerURL​(URL server,
                                   String path)
                            throws MalformedURLException
        Creates a new URL by adding the provided path to the end of the provided server's URL. This assumes that the provided server URL does not include the deployment path of OpenAM since it can be assumed to be the same as this server's deployment path. e.g. Given the server URL "https://remote.example.com:8080" and the path "GetHttpSession?op=create", if this OpenAM server is deployed to "/openam" then the resulting URL will be https://remote.example.com:8080/openam/GetHttpSession?op=create
        Throws:
        MalformedURLException
      • getServerIDsInLocalSite

        public Set<String> getServerIDsInLocalSite()
                                            throws Exception
        Returns IDs for all servers in the current site. If this OpenAM server is not deployed as part of one or more sites, the returned set will only include this server's ID.
        Throws:
        Exception
      • isLocalSessionService

        public boolean isLocalSessionService​(URL url)
        Returns true if the URL is the URL of the local session service.
        Parameters:
        url - the url to check
        Returns:
        true if the url represents the local session service.
      • isLocalNotificationService

        public boolean isLocalNotificationService​(URL url)
        Returns true if the url is the URL of the local notification service.
        Parameters:
        url - the url to check
        Returns:
        true if the url represents the local notification service.
      • getLBCookieValue

        public String getLBCookieValue()
        Returns the lbCookieValue corresponding to the server ID.