Class SpringSessionBackedSessionRegistry<S extends Session>
java.lang.Object
org.springframework.session.security.SpringSessionBackedSessionRegistry<S>
- Type Parameters:
S
- theSession
type.
- All Implemented Interfaces:
org.springframework.security.core.session.SessionRegistry
public class SpringSessionBackedSessionRegistry<S extends Session>
extends Object
implements org.springframework.security.core.session.SessionRegistry
A
SessionRegistry
that retrieves session information from Spring Session,
rather than maintaining it itself. This allows concurrent session management with
Spring Security in a clustered environment.
Relies on being able to derive the same String-based representation of the principal
given to getAllSessions(Object, boolean)
as used by Spring Session in order to
look up the user's sessions.
Does not support getAllPrincipals()
, since that information is not available.
- Since:
- 1.3
-
Constructor Summary
ConstructorDescriptionSpringSessionBackedSessionRegistry
(FindByIndexNameSessionRepository<S> sessionRepository) -
Method Summary
Modifier and TypeMethodDescriptionList<org.springframework.security.core.session.SessionInformation>
getAllSessions
(Object principal, boolean includeExpiredSessions) org.springframework.security.core.session.SessionInformation
getSessionInformation
(String sessionId) protected String
Derives a String name for the given principal.void
refreshLastRequest
(String sessionId) void
registerNewSession
(String sessionId, Object principal) void
removeSessionInformation
(String sessionId)
-
Constructor Details
-
SpringSessionBackedSessionRegistry
-
-
Method Details
-
getAllPrincipals
- Specified by:
getAllPrincipals
in interfaceorg.springframework.security.core.session.SessionRegistry
-
getAllSessions
public List<org.springframework.security.core.session.SessionInformation> getAllSessions(Object principal, boolean includeExpiredSessions) - Specified by:
getAllSessions
in interfaceorg.springframework.security.core.session.SessionRegistry
-
getSessionInformation
public org.springframework.security.core.session.SessionInformation getSessionInformation(String sessionId) - Specified by:
getSessionInformation
in interfaceorg.springframework.security.core.session.SessionRegistry
-
refreshLastRequest
- Specified by:
refreshLastRequest
in interfaceorg.springframework.security.core.session.SessionRegistry
-
registerNewSession
- Specified by:
registerNewSession
in interfaceorg.springframework.security.core.session.SessionRegistry
-
removeSessionInformation
- Specified by:
removeSessionInformation
in interfaceorg.springframework.security.core.session.SessionRegistry
-
name
Derives a String name for the given principal.- Parameters:
principal
- as provided by Spring Security- Returns:
- name of the principal, or its
toString()
representation if no name could be derived
-