PHP Class SimpleSAML_SessionHandler, simplesamlphp

This file defines a base class for session handling. Instantiation of session handler objects should be done through the class method getSessionHandler().
Author: Olav Morken, UNINETT AS. ([email protected])
Mostra file Open project: simplesamlphp/simplesamlphp Class Usage Examples

Protected Properties

Property Type Description
$sessionHandler SimpleSAML_SessionHandler This static variable contains a reference to the current instance of the session handler. This variable will be NULL if we haven't instantiated a session handler yet.

Public Methods

Method Description
getCookieParams ( ) : array Get the cookie parameters that should be used for session cookies.
getCookieSessionId ( ) : string | null Retrieve the session ID saved in the session cookie, if there's one.
getSessionCookieName ( ) : string Retrieve the session cookie name.
getSessionHandler ( ) : SimpleSAML_SessionHandler This function retrieves the current instance of the session handler.
hasSessionCookie ( ) : boolean Check whether the session cookie is set.
loadSession ( string | null $sessionId = null ) : SimpleSAML_Session | null Load the session.
newSessionId ( ) : string Create a new session id.
saveSession ( SimpleSAML_Session $session ) Save the session.
setCookie ( string $sessionName, string | null $sessionID, array $cookieParams = null ) Set a session cookie.

Protected Methods

Method Description
__construct ( ) This constructor is included in case it is needed in the the future. Including it now allows us to write parent::__construct() in the subclasses of this class.

Private Methods

Method Description
createSessionHandler ( ) Initialize the session handler.

Method Details

__construct() protected method

This constructor is included in case it is needed in the the future. Including it now allows us to write parent::__construct() in the subclasses of this class.
protected __construct ( )

getCookieParams() public method

Get the cookie parameters that should be used for session cookies.
public getCookieParams ( ) : array
return array An array with the cookie parameters.

getCookieSessionId() abstract public method

Retrieve the session ID saved in the session cookie, if there's one.
abstract public getCookieSessionId ( ) : string | null
return string | null The session id saved in the cookie or null if no session cookie was set.

getSessionCookieName() abstract public method

Retrieve the session cookie name.
abstract public getSessionCookieName ( ) : string
return string The session cookie name.

getSessionHandler() public static method

The session handler will be instantiated if this is the first call to this function.
public static getSessionHandler ( ) : SimpleSAML_SessionHandler
return SimpleSAML_SessionHandler The current session handler.

hasSessionCookie() public method

This function will only return false if is is certain that the cookie isn't set.
public hasSessionCookie ( ) : boolean
return boolean True if it was set, false if not.

loadSession() abstract public method

Load the session.
abstract public loadSession ( string | null $sessionId = null ) : SimpleSAML_Session | null
$sessionId string | null The ID of the session we should load, or null to use the default.
return SimpleSAML_Session | null The session object, or null if it doesn't exist.

newSessionId() abstract public method

Create a new session id.
abstract public newSessionId ( ) : string
return string The new session id.

saveSession() abstract public method

Save the session.
abstract public saveSession ( SimpleSAML_Session $session )
$session SimpleSAML_Session The session object we should save.

setCookie() abstract public method

Set a session cookie.
abstract public setCookie ( string $sessionName, string | null $sessionID, array $cookieParams = null )
$sessionName string The name of the session.
$sessionID string | null The session ID to use. Set to null to delete the cookie.
$cookieParams array Additional parameters to use for the session cookie.

Property Details

$sessionHandler protected_oe static_oe property

This static variable contains a reference to the current instance of the session handler. This variable will be NULL if we haven't instantiated a session handler yet.
protected static SimpleSAML_SessionHandler $sessionHandler
return SimpleSAML_SessionHandler