ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
|
Public Member Functions | |
serialize () | |
Serialize this session object. More... | |
unserialize ($serialized) | |
Unserialize a session object and load it. More... | |
save () | |
Save the session to the store. More... | |
cleanup () | |
Save the current session and clean any left overs that could interfere with the normal application behaviour. More... | |
markDirty () | |
Mark this session as dirty. More... | |
__destruct () | |
Destroy the session. More... | |
getSessionId () | |
Retrieve the session ID of this session. More... | |
isTransient () | |
Retrieve if session is transient. More... | |
getTrackID () | |
Get a unique ID that will be permanent for this session. More... | |
getRememberMeExpire () | |
Get remember me expire time. More... | |
setRememberMeExpire ($expire=null) | |
Set remember me expire time. More... | |
doLogin ($authority, array $data=null) | |
Marks the user as logged in with the specified authority. More... | |
doLogout ($authority) | |
Marks the user as logged out. More... | |
isValid ($authority) | |
Is the session representing an authenticated user, and is the session still alive. More... | |
updateSessionCookies ($params=null) | |
Update session cookies. More... | |
setAuthorityExpire ($authority, $expire=null) | |
Set the lifetime for authentication source. More... | |
registerLogoutHandler ($authority, $classname, $functionname) | |
This function registers a logout handler. More... | |
deleteData ($type, $id) | |
Delete data from the data store. More... | |
setData ($type, $id, $data, $timeout=null) | |
This function stores data in the data store. More... | |
getData ($type, $id) | |
This function retrieves data from the data store. More... | |
getDataOfType ($type) | |
This function retrieves all data of the specified type from the data store. More... | |
getAuthState ($authority) | |
Get the current persistent authentication state. More... | |
hasSessionCookie () | |
Check whether the session cookie is set. More... | |
addAssociation ($idp, array $association) | |
Add an SP association for an IdP. More... | |
getAssociations ($idp) | |
Retrieve the associations for an IdP. More... | |
terminateAssociation ($idp, $associationId) | |
Remove an SP association for an IdP. More... | |
getAuthData ($authority, $name) | |
Retrieve authentication data. More... | |
getAuthorities () | |
Retrieve a list of authorities (authentication sources) that are currently valid within this session. More... | |
Static Public Member Functions | |
static | getSessionFromRequest () |
Retrieves the current session. More... | |
static | getSession ($sessionId=null) |
Get a session from the session handler. More... | |
static | useTransientSession () |
Use a transient session. More... | |
static | createSession ($sessionId) |
Create a new session and cache it. More... | |
Data Fields | |
const | DATA_TIMEOUT_SESSION_END = 'sessionEndTimeout' |
This is a timeout value for setData, which indicates that the data should never be deleted, i.e. More... | |
Private Member Functions | |
__construct ($transient=false) | |
Private constructor that restricts instantiation to either getSessionFromRequest() for the current session or getSession() for a specific one. More... | |
callLogoutHandlers ($authority) | |
This function calls all registered logout handlers. More... | |
expireData () | |
This function removes expired data from the data store. More... | |
Static Private Member Functions | |
static | load (SimpleSAML_Session $session) |
Load a given session as the current one. More... | |
Private Attributes | |
$sessionId | |
$transient = false | |
$trackid = null | |
$rememberMeExpire = null | |
$dirty = false | |
$callback_registered = false | |
$dataStore = null | |
$associations = array() | |
$authToken | |
$authData | |
Static Private Attributes | |
static | $sessions = array() |
static | $instance = null |
This variable holds the instance of the session - Singleton approach. More... | |
Definition at line 19 of file Session.php.
|
private |
Private constructor that restricts instantiation to either getSessionFromRequest() for the current session or getSession() for a specific one.
boolean | $transient | Whether to create a transient session or not. |
Definition at line 143 of file Session.php.
References $globalConfig, $sessionId, $transient, array, defined, SimpleSAML_Configuration\getInstance(), SimpleSAML\SessionHandler\getSessionHandler(), markDirty(), and SimpleSAML\Logger\setTrackId().
SimpleSAML_Session::__destruct | ( | ) |
Destroy the session.
Destructor for this class. It will save the session to the session handler in case the session has been marked as dirty. Do nothing otherwise.
Definition at line 504 of file Session.php.
References save().
SimpleSAML_Session::addAssociation | ( | $idp, | |
array | $association | ||
) |
Add an SP association for an IdP.
This function is only for use by the SimpleSAML_IdP class.
string | $idp | The IdP id. |
array | $association | The association we should add. |
Definition at line 1056 of file Session.php.
References $association, $idp, array, and markDirty().
|
private |
This function calls all registered logout handlers.
string | $authority | The authentication source we are logging out from. |
Exception | If the handler is not a valid function or method. |
Definition at line 698 of file Session.php.
References $authority, and $handler.
Referenced by doLogout().
SimpleSAML_Session::cleanup | ( | ) |
Save the current session and clean any left overs that could interfere with the normal application behaviour.
Use this method if you are using PHP sessions in your application and in SimpleSAMLphp, after you are done using SimpleSAMLphp and before trying to access your application's session again.
Definition at line 462 of file Session.php.
References SimpleSAML\SessionHandler\getSessionHandler(), and save().
|
static |
Create a new session and cache it.
string | $sessionId | The new session we should create. |
Definition at line 418 of file Session.php.
References $sessionId.
Referenced by SimpleSAML\SessionHandlerCookie\newSessionId(), and SimpleSAML\SessionHandlerPHP\newSessionId().
SimpleSAML_Session::deleteData | ( | $type, | |
$id | |||
) |
Delete data from the data store.
This function immediately deletes the data with the given type and id from the data store.
string | $type | The type of the data. |
string | $id | The identifier of the data. |
Definition at line 834 of file Session.php.
References $id, $type, and markDirty().
SimpleSAML_Session::doLogin | ( | $authority, | |
array | $data = null |
||
) |
Marks the user as logged in with the specified authority.
If the user already has logged in, the user will be logged out first.
string | $authority | The authority the user logged in with. |
array | null | $data | The authentication data for this authority. |
Definition at line 579 of file Session.php.
References $authority, $authToken, $data, $globalConfig, array, SimpleSAML\Logger\debug(), doLogout(), SimpleSAML\Logger\error(), SimpleSAML\Utils\Random\generateID(), SimpleSAML_Configuration\getInstance(), SimpleSAML\SessionHandler\getSessionHandler(), markDirty(), SimpleSAML\Utils\HTTP\setCookie(), setRememberMeExpire(), and time.
SimpleSAML_Session::doLogout | ( | $authority | ) |
Marks the user as logged out.
This function will call any registered logout handlers before marking the user as logged out.
string | $authority | The authentication source we are logging out of. |
Definition at line 671 of file Session.php.
References $authority, callLogoutHandlers(), SimpleSAML\Logger\debug(), isValid(), markDirty(), and updateSessionCookies().
Referenced by doLogin().
|
private |
This function removes expired data from the data store.
Note that this function doesn't mark the session object as dirty. This means that if the only change to the session object is that some data has expired, it will not be written back to the session store.
Definition at line 923 of file Session.php.
References $id, $info, and time.
Referenced by getData(), and setData().
SimpleSAML_Session::getAssociations | ( | $idp | ) |
Retrieve the associations for an IdP.
This function is only for use by the SimpleSAML_IdP class.
string | $idp | The IdP id. |
Definition at line 1085 of file Session.php.
References $id, $idp, array, and time.
SimpleSAML_Session::getAuthData | ( | $authority, | |
$name | |||
) |
Retrieve authentication data.
string | $authority | The authentication source we should retrieve data from. |
string | $name | The name of the data we should retrieve. |
Definition at line 1147 of file Session.php.
References $authority, and $name.
SimpleSAML_Session::getAuthorities | ( | ) |
Retrieve a list of authorities (authentication sources) that are currently valid within this session.
Definition at line 1165 of file Session.php.
References $authority, array, and isValid().
SimpleSAML_Session::getAuthState | ( | $authority | ) |
Get the current persistent authentication state.
string | $authority | The authority to retrieve the data from. |
Definition at line 1022 of file Session.php.
References $authority.
SimpleSAML_Session::getData | ( | $type, | |
$id | |||
) |
This function retrieves data from the data store.
Note that this will not change when the data stored in the data store will expire. If that is required, the data should be written back with setData.
string | $type | The type of the data. This must match the type used when adding the data. |
string | null | $id | The identifier of the data. Can be null, in which case null will be returned. |
Definition at line 956 of file Session.php.
References $id, $type, and expireData().
SimpleSAML_Session::getDataOfType | ( | $type | ) |
This function retrieves all data of the specified type from the data store.
The data will be returned as an associative array with the id of the data as the key, and the data as the value of each key. The value will be stored as a copy of the original data. setData must be used to update the data.
An empty array will be returned if no data of the given type is found.
string | $type | The type of the data. |
Definition at line 995 of file Session.php.
References $id, $info, $ret, $type, and array.
SimpleSAML_Session::getRememberMeExpire | ( | ) |
Get remember me expire time.
Definition at line 545 of file Session.php.
References $rememberMeExpire.
|
static |
Get a session from the session handler.
string | null | $sessionId | The session we should get, or null to get the current session. |
Definition at line 317 of file Session.php.
References $_COOKIE, $globalConfig, $session, $sessionId, SimpleSAML_Configuration\getInstance(), SimpleSAML\SessionHandler\getSessionHandler(), and SimpleSAML\Logger\warning().
Referenced by sspmod_saml_SP_LogoutStore\addSession().
|
static |
Retrieves the current session.
Creates a new session if there's not one.
Exception | When session couldn't be initialized and the session fallback is disabled by configuration. |
Definition at line 243 of file Session.php.
References $session, SimpleSAML\Logger\error(), SimpleSAML_Configuration\getInstance(), and SimpleSAML\Error\CannotSetCookie\SECURE_COOKIE.
Referenced by SimpleSAML_XHTML_IdPDisco\__construct(), SimpleSAML_IdP\addAssociation(), SimpleSAML_Auth_Source\addLogoutCallback(), sspmod_saml_SP_LogoutStore\addSession(), sspmod_negotiate_Auth_Source_Negotiate\authenticate(), SimpleSAML_Auth_Source\callLogoutCallback(), SimpleSAML_Utilities\createHttpPostRedirectLink(), sspmod_multiauth_Auth_Source_MultiAuth\delegateAuthentication(), SimpleSAML\Logger\flush(), SimpleSAML_IdP\getAssociations(), ilSimpleSAMLphpWrapper\getParam(), SimpleSAML\Utils\HTTP\getSecurePOSTRedirectURL(), SimpleSAML_IdP\handleLogoutRequest(), SimpleSAML_IdP\handleLogoutResponse(), sspmod_saml_Auth_Source_SP\handleUnsolicitedAuth(), SimpleSAML_Auth_Default\initLogoutReturn(), SimpleSAML\Utils\Auth\isAdmin(), SimpleSAML_Auth_State\loadState(), SimpleSAML_Auth_Source\loginCompleted(), sspmod_multiauth_Auth_Source_MultiAuth\logout(), sspmod_negotiate_Auth_Source_Negotiate\logout(), SimpleSAML_Auth_Source\logoutCallback(), ilSimpleSAMLphpWrapper\popParam(), SimpleSAML_IdP\postAuth(), SimpleSAML_IdP\postAuthProc(), sspmod_core_Auth_Process_ExtendIdPSession\process(), SimpleSAML_Auth_Source\reauthenticate(), sspmod_saml_Auth_Source_SP\reauthenticate(), sspmod_saml_Auth_Source_SP\reauthPostLogin(), SimpleSAML_Error_Error\saveError(), SimpleSAML_Auth_State\saveState(), SimpleSAML_Error_Error\show(), ilSimpleSAMLphpWrapper\storeParam(), and SimpleSAML_IdP\terminateAssociation().
SimpleSAML_Session::getSessionId | ( | ) |
Retrieve the session ID of this session.
Definition at line 514 of file Session.php.
References $sessionId.
Referenced by SimpleSAML\SessionHandlerStore\saveSession().
SimpleSAML_Session::getTrackID | ( | ) |
Get a unique ID that will be permanent for this session.
Used for debugging and tracing log files related to a session.
Definition at line 535 of file Session.php.
References $trackid.
Referenced by load().
SimpleSAML_Session::hasSessionCookie | ( | ) |
Check whether the session cookie is set.
This function will only return false if is is certain that the cookie isn't set.
Definition at line 1041 of file Session.php.
References SimpleSAML\SessionHandler\getSessionHandler().
SimpleSAML_Session::isTransient | ( | ) |
Retrieve if session is transient.
Definition at line 524 of file Session.php.
References $transient.
Referenced by markDirty().
SimpleSAML_Session::isValid | ( | $authority | ) |
Is the session representing an authenticated user, and is the session still alive.
This function will return false after the user has timed out.
string | $authority | The authentication source that the user should be authenticated with. |
Definition at line 734 of file Session.php.
References $authority, SimpleSAML\Logger\debug(), and time.
Referenced by doLogout(), and getAuthorities().
|
staticprivate |
Load a given session as the current one.
This method will also set the track ID in the logger to the one in the given session.
Warning: never set self::$instance yourself, call this method instead.
SimpleSAML_Session | $session | The session to load. |
Definition at line 390 of file Session.php.
References $session, getTrackID(), and SimpleSAML\Logger\setTrackId().
SimpleSAML_Session::markDirty | ( | ) |
Mark this session as dirty.
This method will register a callback to save the session right before any output is sent to the browser.
Definition at line 477 of file Session.php.
References array, and isTransient().
Referenced by __construct(), addAssociation(), deleteData(), doLogin(), doLogout(), registerLogoutHandler(), setAuthorityExpire(), setData(), and terminateAssociation().
SimpleSAML_Session::registerLogoutHandler | ( | $authority, | |
$classname, | |||
$functionname | |||
) |
This function registers a logout handler.
string | $authority | The authority for which register the handler. |
string | $classname | The class which contains the logout handler. |
string | $functionname | The logout handler function. |
Exception | If the handler is not a valid function or method. |
Definition at line 809 of file Session.php.
References $authority, array, and markDirty().
SimpleSAML_Session::save | ( | ) |
Save the session to the store.
This method saves the session to the session handler in case it has been marked as dirty.
WARNING: please do not use this method directly unless you really need to and know what you are doing. Use markDirty() instead.
Definition at line 432 of file Session.php.
References SimpleSAML\Logger\error(), and SimpleSAML\SessionHandler\getSessionHandler().
Referenced by __destruct(), and cleanup().
SimpleSAML_Session::serialize | ( | ) |
Serialize this session object.
This method will be invoked by any calls to serialize().
Definition at line 197 of file Session.php.
SimpleSAML_Session::setAuthorityExpire | ( | $authority, | |
$expire = null |
|||
) |
Set the lifetime for authentication source.
string | $authority | The authentication source we are setting expire time for. |
int | $expire | The number of seconds authentication source is valid. |
Definition at line 785 of file Session.php.
References $authority, $expire, $globalConfig, SimpleSAML_Configuration\getInstance(), markDirty(), and time.
SimpleSAML_Session::setData | ( | $type, | |
$id, | |||
$data, | |||
$timeout = null |
|||
) |
This function stores data in the data store.
The timeout value can be SimpleSAML_Session::DATA_TIMEOUT_SESSION_END, which indicates that the data should never be deleted.
string | $type | The type of the data. This is checked when retrieving data from the store. |
string | $id | The identifier of the data. |
mixed | $data | The data. |
int | null | $timeout | The number of seconds this data should be stored after its last access. This parameter is optional. The default value is set in 'session.datastore.timeout', and the default is 4 hours. |
Exception | If the data couldn't be stored. |
Definition at line 867 of file Session.php.
References $data, $id, $type, array, expireData(), SimpleSAML_Configuration\getInstance(), markDirty(), and time.
SimpleSAML_Session::setRememberMeExpire | ( | $expire = null | ) |
Set remember me expire time.
int | $expire | Unix timestamp when remember me session cookies expire. |
Definition at line 555 of file Session.php.
References $expire, $globalConfig, array, SimpleSAML_Configuration\getInstance(), time, and updateSessionCookies().
Referenced by doLogin().
SimpleSAML_Session::terminateAssociation | ( | $idp, | |
$associationId | |||
) |
Remove an SP association for an IdP.
This function is only for use by the SimpleSAML_IdP class.
string | $idp | The IdP id. |
string | $associationId | The id of the association. |
Definition at line 1120 of file Session.php.
References $idp, and markDirty().
SimpleSAML_Session::unserialize | ( | $serialized | ) |
Unserialize a session object and load it.
This method will be invoked by any calls to unserialize(), allowing us to restore any data that might not be serializable in its original form (e.g.: DOM objects).
string | $serialized | The serialized representation of a session that we want to restore. |
Definition at line 212 of file Session.php.
References $authority, and $session.
SimpleSAML_Session::updateSessionCookies | ( | $params = null | ) |
Update session cookies.
array | $params | The parameters for the cookies. |
Definition at line 761 of file Session.php.
References $authToken, $globalConfig, $params, $sessionId, SimpleSAML_Configuration\getInstance(), SimpleSAML\SessionHandler\getSessionHandler(), and SimpleSAML\Utils\HTTP\setCookie().
Referenced by doLogout(), and setRememberMeExpire().
|
static |
Use a transient session.
Create a session that should not be saved at the end of the request. Subsequent calls to getInstance() will return this transient session.
Definition at line 403 of file Session.php.
|
private |
Definition at line 114 of file Session.php.
|
private |
Definition at line 134 of file Session.php.
|
private |
Definition at line 124 of file Session.php.
Referenced by doLogin(), and updateSessionCookies().
|
private |
Definition at line 90 of file Session.php.
|
private |
Definition at line 103 of file Session.php.
|
private |
Definition at line 82 of file Session.php.
|
staticprivate |
This variable holds the instance of the session - Singleton approach.
Warning: do not set the instance manually, call SimpleSAML_Session::load() instead.
Definition at line 44 of file Session.php.
|
private |
Definition at line 73 of file Session.php.
Referenced by getRememberMeExpire().
|
private |
Definition at line 52 of file Session.php.
Referenced by __construct(), createSession(), getSession(), getSessionId(), and updateSessionCookies().
|
staticprivate |
Definition at line 36 of file Session.php.
|
private |
Definition at line 70 of file Session.php.
Referenced by getTrackID().
|
private |
Definition at line 60 of file Session.php.
Referenced by __construct(), and isTransient().
const SimpleSAML_Session::DATA_TIMEOUT_SESSION_END = 'sessionEndTimeout' |
This is a timeout value for setData, which indicates that the data should never be deleted, i.e.
lasts the whole session lifetime.
Definition at line 26 of file Session.php.
Referenced by SimpleSAML_Auth_Source\addLogoutCallback(), sspmod_multiauth_Auth_Source_MultiAuth\delegateAuthentication(), and SimpleSAML_IdP\postAuthProc().