Skip to content
Snippets Groups Projects
Commit 19c0f945 authored by Olav Morken's avatar Olav Morken
Browse files

SimpleSAML_SessionHandler: Clean up createSessionHandler(), and make private.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1672 44740490-163a-0410-bde0-09ae8108e29a
parent 5dba9138
No related branches found
No related tags found
No related merge requests found
......@@ -82,36 +82,34 @@ abstract class SimpleSAML_SessionHandler {
abstract public function get($key);
/* This function creates an instance of the session handler which is
/**
* Initialize the session handler.
*
* This function creates an instance of the session handler which is
* selected in the 'session.handler' configuration directive. If no
* session handler is selected, then we will fall back to the default
* PHP session handler.
*/
public static function createSessionHandler() {
global $SIMPLESAML_INCPREFIX;
private static function createSessionHandler() {
/* Get the configuration. */
$config = SimpleSAML_Configuration::getInstance();
assert($config instanceof SimpleSAML_Configuration);
/* Get the session handler option from the configuration. */
$handler = $config->getValue('session.handler', 'phpsession');
assert('is_string($handler)');
$handler = $config->getString('session.handler', 'phpsession');
$handler = strtolower($handler);
if($handler === 'phpsession') {
switch ($handler) {
case 'phpsession':
$sh = new SimpleSAML_SessionHandlerPHP();
} else if($handler === 'memcache') {
break;
case 'memcache':
$sh = new SimpleSAML_SessionHandlerMemcache();
} else {
$e = 'Invalid value for the \'session.handler\'' .
' configuration option. Unknown session' .
' handler: ' . $handler;
error_log($e);
die($e);
break;
default:
throw new SimpleSAML_Error_Exception(
'Invalid session handler specified in the \'session.handler\'-option.');
}
/* Set the session handler. */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment