Class DatabaseSessions
java.lang.Object
rife.database.DbQueryManager
rife.authentication.sessionmanagers.DatabaseSessions
- All Implemented Interfaces:
Cloneable
,SessionManager
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
_continueSession
(Update continueSession, String authId) protected long
_countSessions
(Select countSessions) protected void
_eraseAllSessions
(Delete eraseAllSessions) protected boolean
_eraseSession
(Delete eraseSession, String authId) protected boolean
_eraseUserSessions
(Delete eraseUserSessions, long userId) protected long
_getSessionUserId
(Select getSessionUserId, String authId) protected boolean
_install
(CreateTable createAuthentication, String createAuthenticationSessStartIndex) protected boolean
_isSessionValid
(Select sessionValidity, Select sessionValidityRestrictAuthData, String authId, String authData) protected boolean
_listSessions
(Select listSessions, ListSessions processor) protected void
_purgeSessions
(Delete purgeSession) protected boolean
protected String
_startSession
(Insert startSession, long userId, String authData, boolean remembered) protected boolean
_wasRemembered
(Select wasRemembered, String authId) abstract long
Counts the number of active sessions.boolean
Obtains the restriction policy of the authentication ID in regard to the user's auth data.long
Obtains the maximum time that a user can stay inactive before an active session becomes invalid.int
Obtains the frequency at which the purging will happen in relationship to the scale.int
Obtains the scale at which the purging will happen in relationship to the frequency.abstract boolean
install()
abstract boolean
remove()
void
setRestrictAuthData
(boolean flag) Sets the restriction policy of the authentication ID in regard to the user's auth data.void
setSessionDuration
(long milliseconds) Sets the maximum time that a user can stay inactive before an active session becomes invalid.void
setSessionPurgeFrequency
(int frequency) Set the frequency at which the purging will happen in relationship to the scale.void
setSessionPurgeScale
(int scale) Set the scale at which the purging will happen in relationship to the frequency.Methods inherited from class rife.database.DbQueryManager
clone, executeFetchAll, executeFetchAll, executeFetchAll, executeFetchAll, executeFetchAllBeans, executeFetchAllBeans, executeFetchFirst, executeFetchFirst, executeFetchFirst, executeFetchFirst, executeFetchFirstBean, executeFetchFirstBean, executeGetFirstBoolean, executeGetFirstBoolean, executeGetFirstByte, executeGetFirstByte, executeGetFirstBytes, executeGetFirstBytes, executeGetFirstDate, executeGetFirstDate, executeGetFirstDate, executeGetFirstDate, executeGetFirstDouble, executeGetFirstDouble, executeGetFirstFloat, executeGetFirstFloat, executeGetFirstInt, executeGetFirstInt, executeGetFirstLong, executeGetFirstLong, executeGetFirstShort, executeGetFirstShort, executeGetFirstString, executeGetFirstString, executeGetFirstTime, executeGetFirstTime, executeGetFirstTime, executeGetFirstTime, executeGetFirstTimestamp, executeGetFirstTimestamp, executeGetFirstTimestamp, executeGetFirstTimestamp, executeHasResultRows, executeHasResultRows, executeQuery, executeQuery, executeResultQuery, executeUpdate, executeUpdate, executeUpdate, executeUseFirstAsciiStream, executeUseFirstAsciiStream, executeUseFirstBinaryStream, executeUseFirstBinaryStream, executeUseFirstCharacterStream, executeUseFirstCharacterStream, fetch, fetch, fetch, fetchAll, fetchAll, getConnection, getDatasource, inTransaction, inTransaction, reserveConnection
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface rife.authentication.SessionManager
continueSession, eraseAllSessions, eraseSession, eraseUserSessions, getSessionUserId, isSessionValid, listSessions, purgeSessions, startSession, wasRemembered
-
Constructor Details
-
DatabaseSessions
-
-
Method Details
-
getSessionDuration
public long getSessionDuration()Description copied from interface:SessionManager
Obtains the maximum time that a user can stay inactive before an active session becomes invalid.- Specified by:
getSessionDuration
in interfaceSessionManager
- Returns:
- The maximum time of inactivity in milliseconds.
-
setSessionDuration
public void setSessionDuration(long milliseconds) Description copied from interface:SessionManager
Sets the maximum time that a user can stay inactive before an active session becomes invalid.- Specified by:
setSessionDuration
in interfaceSessionManager
- Parameters:
milliseconds
- The maximum time of inactivity in milliseconds.
-
getRestrictAuthData
public boolean getRestrictAuthData()Description copied from interface:SessionManager
Obtains the restriction policy of the authentication ID in regard to the user's auth data.The default is
false
, or no restriction.- Specified by:
getRestrictAuthData
in interfaceSessionManager
- Returns:
true
if the authentication is restricted to one auth data; orfalse
if the authentication ID can be used with any auth data
-
setRestrictAuthData
public void setRestrictAuthData(boolean flag) Description copied from interface:SessionManager
Sets the restriction policy of the authentication ID in regard to the user's auth data.The default is
false
, or no restriction.- Specified by:
setRestrictAuthData
in interfaceSessionManager
- Parameters:
flag
-true
to activate the auth data restriction; orfalse
otherwise
-
getSessionPurgeFrequency
public int getSessionPurgeFrequency()Description copied from interface:SessionManager
Obtains the frequency at which the purging will happen in relationship to the scale.This defaults to
RifeConfig.AuthenticationConfig.getSessionPurgeFrequency()
.- Specified by:
getSessionPurgeFrequency
in interfaceSessionManager
- Returns:
- the purge frequency
- See Also:
-
setSessionPurgeFrequency
public void setSessionPurgeFrequency(int frequency) Description copied from interface:SessionManager
Set the frequency at which the purging will happen in relationship to the scale.By default, the frequency and scale respectively are 20 and 1000, which means that the purging will have once every fifty times the authentication sessions are accessed.
- Specified by:
setSessionPurgeFrequency
in interfaceSessionManager
- Parameters:
frequency
- the purge frequency- See Also:
-
getSessionPurgeScale
public int getSessionPurgeScale()Description copied from interface:SessionManager
Obtains the scale at which the purging will happen in relationship to the frequency.This defaults to
RifeConfig.AuthenticationConfig.getSessionPurgeScale()
.- Specified by:
getSessionPurgeScale
in interfaceSessionManager
- Returns:
- the purge scale
- See Also:
-
setSessionPurgeScale
public void setSessionPurgeScale(int scale) Description copied from interface:SessionManager
Set the scale at which the purging will happen in relationship to the frequency.By default, the frequency and scale respectively are 20 and 1000, which means that the purging will have once every fifty times the authentication sessions are accessed.
- Specified by:
setSessionPurgeScale
in interfaceSessionManager
- Parameters:
scale
- the purge scale- See Also:
-
install
- Throws:
SessionManagerException
-
remove
- Throws:
SessionManagerException
-
countSessions
Description copied from interface:SessionManager
Counts the number of active sessions.- Specified by:
countSessions
in interfaceSessionManager
- Returns:
- The number of active sessions.
- Throws:
SessionManagerException
- An undefined number of exceptional cases or error situations can occur when a session is counted. They are all indicated by throwing an instance ofSessionManagerException
. It's up to the implementations of this interface to give more specific meanings to these exceptions.
-
_install
protected boolean _install(CreateTable createAuthentication, String createAuthenticationSessStartIndex) -
_remove
-
_purgeSessions
- Throws:
SessionManagerException
-
_startSession
protected String _startSession(Insert startSession, long userId, String authData, boolean remembered) throws SessionManagerException - Throws:
SessionManagerException
-
_isSessionValid
protected boolean _isSessionValid(Select sessionValidity, Select sessionValidityRestrictAuthData, String authId, String authData) throws SessionManagerException - Throws:
SessionManagerException
-
_continueSession
public boolean _continueSession(Update continueSession, String authId) throws SessionManagerException - Throws:
SessionManagerException
-
_eraseSession
- Throws:
SessionManagerException
-
_wasRemembered
protected boolean _wasRemembered(Select wasRemembered, String authId) throws SessionManagerException - Throws:
SessionManagerException
-
_eraseUserSessions
protected boolean _eraseUserSessions(Delete eraseUserSessions, long userId) throws SessionManagerException - Throws:
SessionManagerException
-
_eraseAllSessions
- Throws:
SessionManagerException
-
_countSessions
- Throws:
SessionManagerException
-
_getSessionUserId
protected long _getSessionUserId(Select getSessionUserId, String authId) throws SessionManagerException - Throws:
SessionManagerException
-
_listSessions
protected boolean _listSessions(Select listSessions, ListSessions processor) throws SessionManagerException - Throws:
SessionManagerException
-