Interface SilverpeasUserSession

  • All Known Implementing Classes:
    HTTPSessionInfo, OneShotSessionInfo, SessionInfo

    public interface SilverpeasUserSession
    Represents a session opened by a User in Silverpeas. It is a Silverpeas user session, distinct to any technical sessions.
    Author:
    silveryocha
    • Method Detail

      • getId

        String getId()
        Gets the unique identifier of the session.
        Returns:
        the unique identifier as string.
      • getUser

        User getUser()
        Gets the user which as opened to session.
        Returns:
        a User instance.
      • setAttribute

        <T> void setAttribute​(String name,
                              T value)
        Sets an attribute named by the specified name with the specified value. If no attributes exists with the specified name, then it is added to the session. The attributes are a way for the applications to put in the user session some peculiar and required information.
        Type Parameters:
        T - the type of the attribute value.
        Parameters:
        name - the name of the attribute to set.
        value - the value of the attribute to set.
      • getAttribute

        <T> T getAttribute​(String name)
        Gets the value of the attribute named by the specified name. The attributes are a way for the applications to put in the user session some peculiar and required information.
        Type Parameters:
        T - the type of the attribute value.
        Parameters:
        name - the name of the attribute to get.
        Returns:
        the value of the attribute or null if no such attribute exists.
      • unsetAttribute

        void unsetAttribute​(String name)
        Unsets the specified attribute. The consequence of an unset is the attribute is then removed from the session and cannot be retrieved later.
        Parameters:
        name - the name of the attribute to unset.
      • isDefined

        boolean isDefined()
        Is this session defined? A session is defined if it's a session opened for a user in Silverpeas.
        Returns:
        true if this session is defined, false otherwise.
      • isAnonymous

        boolean isAnonymous()
        Is this session an anonymous one? A session is anonymous when no users are explicitly authenticated and hence identified. In such a situation, the users uses Silverpeas under the cover of a transparent anonymous user account.
        Returns:
        true if this session is a defined anonymous one, false otherwise.
      • isOneShot

        boolean isOneShot()
        Is this session a one-shot one? A one-shot session is a short time living session that doesn't live over the scope of a single user call (id est over the scope of an HTTP request for web accesses). Usually a one-shot session is opened when accessing the Silverpeas Web resources API.
        Returns:
        true if this session is a one-shot one, false otherwise.