Class SessionService


  • @Singleton
    public class SessionService
    extends Object
    This class represents a Session Service.
    • Method Detail

      • getRestrictedTokenId

        public String getRestrictedTokenId​(String masterSid,
                                           TokenRestriction restriction)
                                    throws SessionException
        Returns the restricted token
        Parameters:
        masterSid - master session id
        restriction - TokenRestriction Object
        Returns:
        restricted token id
        Throws:
        SessionException - if the restricted token cannot be created
      • newInternalSession

        public InternalSession newInternalSession​(String domain,
                                                  boolean stateless,
                                                  boolean checkCts)
      • destroySession

        public void destroySession​(Session requester,
                                   SessionID sessionToDestroy)
                            throws SessionException
        Destroy a Internal Session, depending on the value of the user's permissions. Performs no action if the sessionID cannot be matched.
        Parameters:
        requester - The requesting Session.
        sessionToDestroy - The session to destroy.
        Throws:
        SessionException - If the user has insufficient permissions.
      • destroyAuthenticationSession

        public void destroyAuthenticationSession​(SessionID sessionID)
        Destroy a Internal Session, whose session id has been specified.
        Parameters:
        sessionID - the session id of the authentication session to destroy
      • checkSessionExists

        public boolean checkSessionExists​(SessionID sessionId)
                                   throws SessionException
        Check whether a session identified by {code sessionId} can be retrieved.
        Parameters:
        sessionId - the session ID to check.
        Returns:
        returns true if the session is local
        Throws:
        SessionException - if the session could not be accessed.
      • getSessionInfo

        public SessionInfo getSessionInfo​(SessionID sid,
                                          boolean reset)
                                   throws SessionException
        Returns the Session information.
        Parameters:
        sid - the session id to retrieve information for
        reset - whether to reset the idle time of the session
        Throws:
        SessionException - if the session information cannot be retrieved
      • getValidSessions

        public SearchResults<SessionInfo> getValidSessions​(Session s,
                                                           String pattern)
                                                    throws SessionException
        Gets all valid Internal Sessions, depending on the value of the user's preferences.
        Parameters:
        s - the requesting session
        pattern - the search pattern used to match sessions
        Throws:
        SessionException - if the valid sessions cannot be retrieved
      • getMatchingSessions

        public Collection<PartialSession> getMatchingSessions​(Session caller,
                                                              CrestQuery crestQuery)
                                                       throws SessionException
        Returns partial (stateful) sessions matching the provided CREST query. The resultset size is limited by the "iplanet-am-session-max-session-list-size" attribute. The returned sessions are only "partial" sessions, meaning that they do not represent the full session state.
        Parameters:
        caller - The session that initiated the query request. May not be null.
        crestQuery - The CREST query based on which we should look for matching sessions. May not be null.
        Returns:
        The collection of matching partial sessions.
        Throws:
        SessionException - If the request fails.
        See Also:
        SessionOperations.getMatchingSessions(CrestQuery)
      • addSessionListener

        public void addSessionListener​(SSOToken clientToken,
                                       Session session,
                                       String url)
                                throws SessionException
        Adds listener to a Internal Sessions.
        Parameters:
        session - Session
        url - the notification URL to which session events are sent
        Throws:
        SessionException - Session is null OR the Session is invalid
      • setExternalProperty

        public void setExternalProperty​(SSOToken clientToken,
                                        SessionID sessionId,
                                        String name,
                                        String value)
                                 throws SessionException
        Sets external property in the Internal Session as long as it is not protected
        Parameters:
        clientToken - - Token of the client setting external property.
        sessionId - the session id on which to set the property
        name - the name of the property to set
        value - the value to set for the property
        Throws:
        SessionException - if the property cannot be set
      • isSuperUser

        public boolean isSuperUser​(String uuid)
        Returns true if the user is super user
        Parameters:
        uuid - the uuid of the login user
      • getAMServerID

        public static String getAMServerID()
        Gets the AM Server ID.
        Returns:
        the AM Server Id or null if WebtopNaming was unable to detmin the ID of this server.