Interface SessionManagement
-
- All Known Implementing Classes:
SessionManagementStub
,SessionManager
public interface SessionManagement
It defines the contract the session management implementation in Silverpeas should implement. It should have only one activated implementation in Silverpeas, and it should be managed by an IoC container under the name 'sessionManager'.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
closeSession(String sessionKey)
Closes the specified user session.Collection<SessionInfo>
getConnectedUsersList()
Gets the session information about all the connected users in the Silverpeas platform, whatever their domain and the applied domain isolation policy.Collection<SessionInfo>
getDistinctConnectedUsersList(User user)
Gets the session information about all the connected users that are accessible to the specified user.int
getNbConnectedUsersList(User user)
Gets the count of users that are connected to Silverpeas.SessionInfo
getSessionInfo(String sessionKey)
Gets information about the specified user session.boolean
isUserConnected(User user)
Is the specified user currently connected to Silverpeas?SessionInfo
openAnonymousSession(javax.servlet.http.HttpServletRequest request)
Opens explicitly a new anonymous session.SessionInfo
openOneShotSession(User user, javax.servlet.http.HttpServletRequest request)
Opens a new session for the specified user with the specified HTTP request at the origin of the session ask.SessionInfo
openSession(User user, javax.servlet.http.HttpServletRequest request)
Opens a new session for the specified user with the specified HTTP request at the origin of the session ask.SessionInfo
validateSession(String sessionKey)
CallsvalidateSession(SessionValidationContext)
method by specifying to it a context that contains only the specified session key.SessionInfo
validateSession(SessionValidationContext context)
Validates the session identified uniquely by the specified key.
-
-
-
Method Detail
-
getConnectedUsersList
Collection<SessionInfo> getConnectedUsersList()
Gets the session information about all the connected users in the Silverpeas platform, whatever their domain and the applied domain isolation policy.- Returns:
- Collection of session information.
-
getDistinctConnectedUsersList
Collection<SessionInfo> getDistinctConnectedUsersList(User user)
Gets the session information about all the connected users that are accessible to the specified user. According to the domain level isolation, a user can see either all the others connected users or only those in the same domain.- Parameters:
user
- a user from whom all the distinct connected users are visible.- Returns:
- Collection of session information.
-
getNbConnectedUsersList
int getNbConnectedUsersList(User user)
Gets the count of users that are connected to Silverpeas. The domain level isolation applied to the running Silverpeas is taken into account in the computation of the connected user count: either all the connected users are taken into account or only those in the same domain.- Parameters:
user
- the user from whom all the users to count are visible.- Returns:
- the count of connected users
-
getSessionInfo
@Nonnull SessionInfo getSessionInfo(String sessionKey)
Gets information about the specified user session.- Parameters:
sessionKey
- the key of the user session.- Returns:
- the information about the session mapped to the specified key.
-
isUserConnected
boolean isUserConnected(User user)
Is the specified user currently connected to Silverpeas?- Parameters:
user
- the user for which the connection is checked.- Returns:
- true if the user is connected, false otherwise.
-
validateSession
SessionInfo validateSession(String sessionKey)
CallsvalidateSession(SessionValidationContext)
method by specifying to it a context that contains only the specified session key.- Parameters:
sessionKey
- the key of the user session.- Returns:
- the result of
validateSession(SessionValidationContext)
execution.
-
validateSession
SessionInfo validateSession(SessionValidationContext context)
Validates the session identified uniquely by the specified key. The validation checks a session exists with the specified identifier and returns information about this session. At each access by the user to Silverpeas, its current session must be validated. The validation updates also useful information about the session like the timestamp of this access so that additional features can be performed (for example, the timeout computation of the session).- Parameters:
context
- the context of the validation that contains at least the session key- Returns:
- information about the session identified by the specified key or null if no such session exists.
-
openSession
SessionInfo openSession(User user, javax.servlet.http.HttpServletRequest request)
Opens a new session for the specified user with the specified HTTP request at the origin of the session ask. The opened session is built upon an HTTP one, and it is managed directly by the underlying HTTP server/container. If the specified user is anonymous, then anIllegalArgumentException
is thrown.- Parameters:
user
- the user for which an HTTP session with Silverpeas has to be opened.request
- the HTTP request at the origin of the session opening ask.- Returns:
- a SessionInfo instance representing the current opened session with information about that session.
-
openOneShotSession
SessionInfo openOneShotSession(User user, javax.servlet.http.HttpServletRequest request)
Opens a new session for the specified user with the specified HTTP request at the origin of the session ask. The opened session is only for the given HTTP request and it will be closed once the request processing is done.- Parameters:
user
- the user for which an HTTP session with Silverpeas has to be opened.request
- the HTTP request at the origin of the session opening ask.- Returns:
- a SessionInfo instance representing the current opened session with information about that session.
-
openAnonymousSession
SessionInfo openAnonymousSession(javax.servlet.http.HttpServletRequest request)
Opens explicitly a new anonymous session. The opened session is built upon an HTTP one managed directly by the underlying HTTP server/container. In Silverpeas, any anonymous access to it is done under the cover of a peculiar and specific user account, the anonymous user account. This requires the anonymous access to be enabled for Silverpeas and this is done by creating a specific account for the anonymous user (see the propertyanonymousId
in the properties fileorg/silverpeas/lookAndFeel/generalLook.properties
). So, any anonymous user are referred by a unique and same user account but have each of them a different and separate user session.- Returns:
- a SessionInfo instance representing the current opened anonymous session with information about that session.
-
closeSession
void closeSession(String sessionKey)
Closes the specified user session.- Parameters:
sessionKey
- the key of the session to close.
-
-