Class SpringSessionBackedSessionRegistry<S extends Session>
java.lang.Object
org.springframework.session.security.SpringSessionBackedSessionRegistry<S>
- Type Parameters:
S- theSessiontype.
- 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
ConstructorsConstructorDescriptionSpringSessionBackedSessionRegistry(FindByIndexNameSessionRepository<S> sessionRepository) -
Method Summary
Modifier and TypeMethodDescriptionList<org.springframework.security.core.session.SessionInformation>getAllSessions(Object principal, boolean includeExpiredSessions) org.springframework.security.core.session.SessionInformationgetSessionInformation(String sessionId) protected StringDerives a String name for the given principal.voidrefreshLastRequest(String sessionId) voidregisterNewSession(String sessionId, Object principal) voidremoveSessionInformation(String sessionId)
-
Constructor Details
-
SpringSessionBackedSessionRegistry
-
-
Method Details
-
getAllPrincipals
- Specified by:
getAllPrincipalsin interfaceorg.springframework.security.core.session.SessionRegistry
-
getAllSessions
public List<org.springframework.security.core.session.SessionInformation> getAllSessions(Object principal, boolean includeExpiredSessions) - Specified by:
getAllSessionsin interfaceorg.springframework.security.core.session.SessionRegistry
-
getSessionInformation
public org.springframework.security.core.session.SessionInformation getSessionInformation(String sessionId) - Specified by:
getSessionInformationin interfaceorg.springframework.security.core.session.SessionRegistry
-
refreshLastRequest
- Specified by:
refreshLastRequestin interfaceorg.springframework.security.core.session.SessionRegistry
-
registerNewSession
- Specified by:
registerNewSessionin interfaceorg.springframework.security.core.session.SessionRegistry
-
removeSessionInformation
- Specified by:
removeSessionInformationin 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
-