diff options
author | Andjelko Horvat <comel@vingd.com> | 2013-09-13 11:03:54 +0000 |
---|---|---|
committer | Andjelko Horvat <comel@vingd.com> | 2013-09-13 11:03:54 +0000 |
commit | cddb7d91015669ad8998715751bde2fbd5be49b6 (patch) | |
tree | 33b80b14d1bcc2502c489d2f535450f0c9e93e23 /lib/SimpleSAML/SessionHandlerPHP.php | |
parent | acb4051cde566edac3495e39dd91b47122475609 (diff) | |
download | simplesamlphp-cddb7d91015669ad8998715751bde2fbd5be49b6.zip simplesamlphp-cddb7d91015669ad8998715751bde2fbd5be49b6.tar.gz simplesamlphp-cddb7d91015669ad8998715751bde2fbd5be49b6.tar.bz2 |
Add SimpleSAML_SessionHandler::getSessionCookieName() (patch 1 from issue #571).
git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@3275 44740490-163a-0410-bde0-09ae8108e29a
Diffstat (limited to 'lib/SimpleSAML/SessionHandlerPHP.php')
-rw-r--r-- | lib/SimpleSAML/SessionHandlerPHP.php | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/lib/SimpleSAML/SessionHandlerPHP.php b/lib/SimpleSAML/SessionHandlerPHP.php index 17480b6..1e73054 100644 --- a/lib/SimpleSAML/SessionHandlerPHP.php +++ b/lib/SimpleSAML/SessionHandlerPHP.php @@ -13,6 +13,10 @@ */ class SimpleSAML_SessionHandlerPHP extends SimpleSAML_SessionHandler { + /* This variable contains the session cookie name. */ + protected $cookie_name; + + /* Initialize the PHP session handling. This constructor is protected * because it should only be called from * SimpleSAML_SessionHandler::createSessionHandler(...). @@ -42,8 +46,12 @@ class SimpleSAML_SessionHandlerPHP extends SimpleSAML_SessionHandler { session_set_cookie_params($params['lifetime'], $params['path'], $params['domain'], $params['secure'], $params['httponly']); } - $cookiename = $config->getString('session.phpsession.cookiename', NULL); - if (!empty($cookiename)) session_name($cookiename); + $this->cookie_name = $config->getString('session.phpsession.cookiename', NULL); + if (!empty($this->cookie_name)) { + session_name($this->cookie_name); + } else { + $this->cookie_name = session_name(); + } $savepath = $config->getString('session.phpsession.savepath', NULL); if(!empty($savepath)) { @@ -110,6 +118,17 @@ class SimpleSAML_SessionHandlerPHP extends SimpleSAML_SessionHandler { /** + * Retrieve the session cookie name. + * + * @return string The session cookie name. + */ + public function getSessionCookieName() { + + return $this->cookie_name; + } + + + /** * Save the current session to the PHP session array. * * @param SimpleSAML_Session $session The session object we should save. @@ -169,8 +188,7 @@ class SimpleSAML_SessionHandlerPHP extends SimpleSAML_SessionHandler { */ public function hasSessionCookie() { - $cookieName = session_name(); - return array_key_exists($cookieName, $_COOKIE); + return array_key_exists($this->cookie_name, $_COOKIE); } |