diff --git a/lib/SimpleSAML/Session.php b/lib/SimpleSAML/Session.php index 7ddd48b605bd7da83cefe95c76c2244dcee84712..bc272c90116aa5d28b5d272205941b40d3ead8c9 100644 --- a/lib/SimpleSAML/Session.php +++ b/lib/SimpleSAML/Session.php @@ -940,6 +940,20 @@ class SimpleSAML_Session { 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 diff --git a/lib/SimpleSAML/SessionHandler.php b/lib/SimpleSAML/SessionHandler.php index eee3b954af1380098a6b7bea4ff932996f85e702..562fed2b95fb1c62df759269421b49766c0c429b 100644 --- a/lib/SimpleSAML/SessionHandler.php +++ b/lib/SimpleSAML/SessionHandler.php @@ -115,6 +115,20 @@ abstract class SimpleSAML_SessionHandler { /* Set the session handler. */ 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 diff --git a/lib/SimpleSAML/SessionHandlerCookie.php b/lib/SimpleSAML/SessionHandlerCookie.php index 06cd8a188ba81f744534d47ea58663a8c08fc6c9..83a46231591b338277c7f36cb900d7363dd1c6ac 100644 --- a/lib/SimpleSAML/SessionHandlerCookie.php +++ b/lib/SimpleSAML/SessionHandlerCookie.php @@ -117,6 +117,20 @@ extends SimpleSAML_SessionHandler { 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 diff --git a/lib/SimpleSAML/SessionHandlerPHP.php b/lib/SimpleSAML/SessionHandlerPHP.php index 80dab625447503c9578c9b183585d875828db287..40af336ac5f64b6c62f8866337cb8c081c6adb06 100644 --- a/lib/SimpleSAML/SessionHandlerPHP.php +++ b/lib/SimpleSAML/SessionHandlerPHP.php @@ -93,6 +93,21 @@ class SimpleSAML_SessionHandlerPHP extends SimpleSAML_SessionHandler { 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