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

Session: Track session ID in session object.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2495 44740490-163a-0410-bde0-09ae8108e29a
parent eceef567
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,15 @@ class SimpleSAML_Session {
*/
private static $instance = null;
/**
* The session ID of this session.
*
* @var string|NULL
*/
private $sessionId;
/**
* The track id is a new random unique identifier that is generate for each session.
* This is used in the debug logs and error messages to easily track more information
......@@ -127,6 +136,9 @@ class SimpleSAML_Session {
return;
}
$sh = SimpleSAML_SessionHandler::getSessionHandler();
$this->sessionId = $sh->getCookieSessionId();
$this->trackid = substr(md5(uniqid(rand(), true)), 0, 10);
$this->dirty = TRUE;
......@@ -200,6 +212,17 @@ class SimpleSAML_Session {
}
/**
* Retrieve the session ID of this session.
*
* @return string|NULL The session ID, or NULL if this is a transient session.
*/
public function getSessionId() {
return $this->sessionId;
}
/**
* Get a unique ID that will be permanent for this session.
* Used for debugging and tracing log files related to a session.
......@@ -754,6 +777,11 @@ class SimpleSAML_Session {
assert('$session instanceof self');
/* For backwardscompatibility. Remove after 1.7. */
if ($session->sessionId === NULL) {
$session->sessionId = $sh->getCookieSessionId();
}
if ($session->authToken !== NULL) {
if (!isset($_COOKIE['SimpleSAMLAuthToken'])) {
SimpleSAML_Logger::warning('Missing AuthToken cookie.');
......
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