Class DatabaseSessions
java.lang.Object
rife.database.DbQueryManager
rife.authentication.sessionmanagers.DatabaseSessions
- All Implemented Interfaces:
Cloneable,SessionManager
-
Constructor Summary
Constructors -
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 booleanprotected String_startSession(Insert startSession, long userId, String authData, boolean remembered) protected boolean_wasRemembered(Select wasRemembered, String authId) abstract longCounts the number of active sessions.booleanObtains the restriction policy of the authentication ID in regard to the user's auth data.longObtains the maximum time that a user can stay inactive before an active session becomes invalid.intObtains the frequency at which the purging will happen in relationship to the scale.intObtains the scale at which the purging will happen in relationship to the frequency.abstract booleaninstall()abstract booleanremove()voidsetRestrictAuthData(boolean flag) Sets the restriction policy of the authentication ID in regard to the user's auth data.voidsetSessionDuration(long milliseconds) Sets the maximum time that a user can stay inactive before an active session becomes invalid.voidsetSessionPurgeFrequency(int frequency) Set the frequency at which the purging will happen in relationship to the scale.voidsetSessionPurgeScale(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, reserveConnectionMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:SessionManagerObtains the maximum time that a user can stay inactive before an active session becomes invalid.- Specified by:
getSessionDurationin interfaceSessionManager- Returns:
- The maximum time of inactivity in milliseconds.
-
setSessionDuration
public void setSessionDuration(long milliseconds) Description copied from interface:SessionManagerSets the maximum time that a user can stay inactive before an active session becomes invalid.- Specified by:
setSessionDurationin interfaceSessionManager- Parameters:
milliseconds- The maximum time of inactivity in milliseconds.
-
getRestrictAuthData
public boolean getRestrictAuthData()Description copied from interface:SessionManagerObtains the restriction policy of the authentication ID in regard to the user's auth data.The default is
false, or no restriction.- Specified by:
getRestrictAuthDatain interfaceSessionManager- Returns:
trueif the authentication is restricted to one auth data; orfalseif the authentication ID can be used with any auth data
-
setRestrictAuthData
public void setRestrictAuthData(boolean flag) Description copied from interface:SessionManagerSets the restriction policy of the authentication ID in regard to the user's auth data.The default is
false, or no restriction.- Specified by:
setRestrictAuthDatain interfaceSessionManager- Parameters:
flag-trueto activate the auth data restriction; orfalseotherwise
-
getSessionPurgeFrequency
public int getSessionPurgeFrequency()Description copied from interface:SessionManagerObtains the frequency at which the purging will happen in relationship to the scale.This defaults to
RifeConfig.AuthenticationConfig.getSessionPurgeFrequency().- Specified by:
getSessionPurgeFrequencyin interfaceSessionManager- Returns:
- the purge frequency
- See Also:
-
setSessionPurgeFrequency
public void setSessionPurgeFrequency(int frequency) Description copied from interface:SessionManagerSet 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:
setSessionPurgeFrequencyin interfaceSessionManager- Parameters:
frequency- the purge frequency- See Also:
-
getSessionPurgeScale
public int getSessionPurgeScale()Description copied from interface:SessionManagerObtains the scale at which the purging will happen in relationship to the frequency.This defaults to
RifeConfig.AuthenticationConfig.getSessionPurgeScale().- Specified by:
getSessionPurgeScalein interfaceSessionManager- Returns:
- the purge scale
- See Also:
-
setSessionPurgeScale
public void setSessionPurgeScale(int scale) Description copied from interface:SessionManagerSet 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:
setSessionPurgeScalein interfaceSessionManager- Parameters:
scale- the purge scale- See Also:
-
install
- Throws:
SessionManagerException
-
remove
- Throws:
SessionManagerException
-
countSessions
Description copied from interface:SessionManagerCounts the number of active sessions.- Specified by:
countSessionsin 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
-