@Component(value="cuba_SessionHistory") public class UserSessionLogBean extends java.lang.Object implements UserSessionLog
Modifier and Type | Field and Description |
---|---|
protected Authentication |
authentication |
protected ClusterManagerAPI |
clusterManager |
protected DataManager |
dataManager |
protected GlobalConfig |
globalConfig |
protected Metadata |
metadata |
protected ServerInfoAPI |
serverInfoAPI |
protected TimeSource |
timeSource |
protected UserSessionsAPI |
userSessionsAPI |
NAME
Constructor and Description |
---|
UserSessionLogBean() |
Modifier and Type | Method and Description |
---|---|
protected void |
closeDeadSessionsOnStartup()
Set
finishedTs to all sessions that were interrupted by server reboot |
SessionLogEntry |
createSessionLogRecord(UserSession userSession,
SessionAction action,
java.util.Map<java.lang.String,java.lang.Object> params)
Create log entry for session with custom params.
|
SessionLogEntry |
createSessionLogRecord(UserSession userSession,
SessionAction action,
UserSession substitutedSession,
java.util.Map<java.lang.String,java.lang.Object> params)
Create log entry for session with custom params.
|
java.util.List<SessionLogEntry> |
getAllSessionLogRecords(java.util.UUID userSessionId)
Get all session log records.
|
SessionLogEntry |
getLastSessionLogRecord(java.util.UUID userSessionId)
Get latest session log record.
|
protected void |
initSessionHistoryCleanupListener() |
protected boolean |
shouldLogSession(UserSession userSession) |
SessionLogEntry |
updateSessionLogRecord(UserSession userSession,
SessionAction action)
Updates params on provided session log record.
|
@Inject protected GlobalConfig globalConfig
@Inject protected DataManager dataManager
@Inject protected Metadata metadata
@Inject protected TimeSource timeSource
@Inject protected ServerInfoAPI serverInfoAPI
@Inject protected ClusterManagerAPI clusterManager
@Inject protected UserSessionsAPI userSessionsAPI
@Inject protected Authentication authentication
@Nullable public SessionLogEntry createSessionLogRecord(UserSession userSession, SessionAction action, java.util.Map<java.lang.String,java.lang.Object> params)
UserSessionLog
createSessionLogRecord
in interface UserSessionLog
userSession
- log entry is created for this sessionaction
- session action, like login, logout, etcparams
- additional params for log entry, like client's address and other info.
Use id property of SessionParams entry to pass in params map.SessionParams
@Nullable public SessionLogEntry createSessionLogRecord(UserSession userSession, SessionAction action, @Nullable UserSession substitutedSession, @Nullable java.util.Map<java.lang.String,java.lang.Object> params)
UserSessionLog
createSessionLogRecord
in interface UserSessionLog
userSession
- log entry is created for this sessionaction
- session action, like login, logout, etcsubstitutedSession
- session that was substituted by new session from userSession
paramparams
- additional params for log entry, like client's address and other info.
Use id property of SessionParams entry to pass in params mapSessionParams
@Nullable public SessionLogEntry updateSessionLogRecord(UserSession userSession, @Nullable SessionAction action)
UserSessionLog
updateSessionLogRecord
in interface UserSessionLog
userSession
- update log record for this sessionaction
- last session actionpublic SessionLogEntry getLastSessionLogRecord(java.util.UUID userSessionId)
UserSessionLog
getLastSessionLogRecord
in interface UserSessionLog
userSessionId
- id of user sessionpublic java.util.List<SessionLogEntry> getAllSessionLogRecords(java.util.UUID userSessionId)
UserSessionLog
getAllSessionLogRecords
in interface UserSessionLog
userSessionId
- id of user sessionstartedTs
ascprotected void closeDeadSessionsOnStartup()
finishedTs
to all sessions that were interrupted by server reboot@PostConstruct protected void initSessionHistoryCleanupListener()
protected boolean shouldLogSession(UserSession userSession)