S
- the Session
type.public class SpringSessionBackedSessionRegistry<S extends Session>
extends java.lang.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<S> sessionRepository) |
Modifier and Type | Method and Description |
---|---|
java.util.List<java.lang.Object> |
getAllPrincipals() |
java.util.List<org.springframework.security.core.session.SessionInformation> |
getAllSessions(java.lang.Object principal,
boolean includeExpiredSessions) |
org.springframework.security.core.session.SessionInformation |
getSessionInformation(java.lang.String sessionId) |
protected java.lang.String |
name(java.lang.Object principal)
Derives a String name for the given principal.
|
void |
refreshLastRequest(java.lang.String sessionId) |
void |
registerNewSession(java.lang.String sessionId,
java.lang.Object principal) |
void |
removeSessionInformation(java.lang.String sessionId) |
public SpringSessionBackedSessionRegistry(FindByIndexNameSessionRepository<S> sessionRepository)
public java.util.List<java.lang.Object> getAllPrincipals()
getAllPrincipals
in interface org.springframework.security.core.session.SessionRegistry
public java.util.List<org.springframework.security.core.session.SessionInformation> getAllSessions(java.lang.Object principal, boolean includeExpiredSessions)
getAllSessions
in interface org.springframework.security.core.session.SessionRegistry
public org.springframework.security.core.session.SessionInformation getSessionInformation(java.lang.String sessionId)
getSessionInformation
in interface org.springframework.security.core.session.SessionRegistry
public void refreshLastRequest(java.lang.String sessionId)
refreshLastRequest
in interface org.springframework.security.core.session.SessionRegistry
public void registerNewSession(java.lang.String sessionId, java.lang.Object principal)
registerNewSession
in interface org.springframework.security.core.session.SessionRegistry
public void removeSessionInformation(java.lang.String sessionId)
removeSessionInformation
in interface org.springframework.security.core.session.SessionRegistry
protected java.lang.String name(java.lang.Object principal)
principal
- as provided by Spring SecuritytoString()
representation if no name
could be derived