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

Add code to detect whether the session cookie is set.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2014 44740490-163a-0410-bde0-09ae8108e29a
parent f1afdcce
No related branches found
No related tags found
No related merge requests found
...@@ -940,6 +940,20 @@ class SimpleSAML_Session { ...@@ -940,6 +940,20 @@ class SimpleSAML_Session {
return $this->logoutState; return $this->logoutState;
} }
/**
* Check whether the session cookie is set.
*
* This function will only return FALSE if is is certain that the cookie isn't set.
*
* @return bool TRUE if it was set, FALSE if not.
*/
public function hasSessionCookie() {
$sh = SimpleSAML_SessionHandler::getSessionHandler();
return $sh->hasSessionCookie();
}
} }
?> ?>
\ No newline at end of file
...@@ -115,6 +115,20 @@ abstract class SimpleSAML_SessionHandler { ...@@ -115,6 +115,20 @@ abstract class SimpleSAML_SessionHandler {
/* Set the session handler. */ /* Set the session handler. */
self::$sessionHandler = $sh; self::$sessionHandler = $sh;
} }
/**
* Check whether the session cookie is set.
*
* This function will only return FALSE if is is certain that the cookie isn't set.
*
* @return bool TRUE if it was set, FALSE if not.
*/
public function hasSessionCookie() {
return TRUE;
}
} }
?> ?>
\ No newline at end of file
...@@ -117,6 +117,20 @@ extends SimpleSAML_SessionHandler { ...@@ -117,6 +117,20 @@ extends SimpleSAML_SessionHandler {
return TRUE; return TRUE;
} }
/**
* Check whether the session cookie is set.
*
* This function will only return FALSE if is is certain that the cookie isn't set.
*
* @return bool TRUE if it was set, FALSE if not.
*/
public function hasSessionCookie() {
return array_key_exists('SimpleSAMLSessionID', $_COOKIE);
}
} }
?> ?>
\ No newline at end of file
...@@ -93,6 +93,21 @@ class SimpleSAML_SessionHandlerPHP extends SimpleSAML_SessionHandler { ...@@ -93,6 +93,21 @@ class SimpleSAML_SessionHandlerPHP extends SimpleSAML_SessionHandler {
return $_SESSION[$key]; return $_SESSION[$key];
} }
/**
* Check whether the session cookie is set.
*
* This function will only return FALSE if is is certain that the cookie isn't set.
*
* @return bool TRUE if it was set, FALSE if not.
*/
public function hasSessionCookie() {
$cookieName = session_name();
return array_key_exists($cookieName, $_COOKIE);
}
} }
?> ?>
\ No newline at end of file
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