public class SpringSessionBackedSessionRegistry extends Object implements org.springframework.security.core.session.SessionRegistry
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.
| Constructor and Description |
|---|
SpringSessionBackedSessionRegistry(FindByIndexNameSessionRepository<ExpiringSession> sessionRepository) |
| Modifier and Type | Method and Description |
|---|---|
List<Object> |
getAllPrincipals() |
List<org.springframework.security.core.session.SessionInformation> |
getAllSessions(Object principal,
boolean includeExpiredSessions) |
org.springframework.security.core.session.SessionInformation |
getSessionInformation(String sessionId) |
protected String |
name(Object principal)
Derives a String name for the given principal.
|
void |
refreshLastRequest(String sessionId) |
void |
registerNewSession(String sessionId,
Object principal) |
void |
removeSessionInformation(String sessionId) |
public SpringSessionBackedSessionRegistry(FindByIndexNameSessionRepository<ExpiringSession> sessionRepository)
public List<Object> getAllPrincipals()
getAllPrincipals in interface org.springframework.security.core.session.SessionRegistrypublic List<org.springframework.security.core.session.SessionInformation> getAllSessions(Object principal, boolean includeExpiredSessions)
getAllSessions in interface org.springframework.security.core.session.SessionRegistrypublic org.springframework.security.core.session.SessionInformation getSessionInformation(String sessionId)
getSessionInformation in interface org.springframework.security.core.session.SessionRegistrypublic void refreshLastRequest(String sessionId)
refreshLastRequest in interface org.springframework.security.core.session.SessionRegistrypublic void registerNewSession(String sessionId, Object principal)
registerNewSession in interface org.springframework.security.core.session.SessionRegistrypublic void removeSessionInformation(String sessionId)
removeSessionInformation in interface org.springframework.security.core.session.SessionRegistry