From 0ecd7f985706fbcf7e935add8052b97a40feca99 Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Tue, 18 Dec 2007 13:08:53 +0000
Subject: [PATCH] SessionHandler - Implemented getSessionId() method.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@124 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SimpleSAML/SessionHandler.php       |  8 ++++++++
 lib/SimpleSAML/SessionHandlerCookie.php | 10 ++++++++++
 lib/SimpleSAML/SessionHandlerPHP.php    | 10 ++++++++++
 3 files changed, 28 insertions(+)

diff --git a/lib/SimpleSAML/SessionHandler.php b/lib/SimpleSAML/SessionHandler.php
index 2a96749ea..1ceb3696b 100644
--- a/lib/SimpleSAML/SessionHandler.php
+++ b/lib/SimpleSAML/SessionHandler.php
@@ -48,6 +48,14 @@ abstract class SimpleSAML_SessionHandler {
 	}
 
 
+	/* This function retrieves the session id of the current session.
+	 *
+	 * Returns:
+	 *  The session id of the current session.
+	 */
+	abstract public function getSessionId();
+
+
 	/* This function is used to store data in this session object.
 	 *
 	 * Note: You are allowed to store a reference to an object in the
diff --git a/lib/SimpleSAML/SessionHandlerCookie.php b/lib/SimpleSAML/SessionHandlerCookie.php
index 6ddad436e..63b7a3f3a 100644
--- a/lib/SimpleSAML/SessionHandlerCookie.php
+++ b/lib/SimpleSAML/SessionHandlerCookie.php
@@ -48,6 +48,16 @@ extends SimpleSAML_SessionHandler {
 	}
 
 
+	/* This function retrieves the session id of the current session.
+	 *
+	 * Returns:
+	 *  The session id of the current session.
+	 */
+	public function getSessionId() {
+		return $this->session_id;
+	}
+
+
 	/* This static function creates a session id. A session id consists
 	 * of 32 random hexadecimal characters.
 	 *
diff --git a/lib/SimpleSAML/SessionHandlerPHP.php b/lib/SimpleSAML/SessionHandlerPHP.php
index 222312b8e..132918662 100644
--- a/lib/SimpleSAML/SessionHandlerPHP.php
+++ b/lib/SimpleSAML/SessionHandlerPHP.php
@@ -33,6 +33,16 @@ class SimpleSAML_SessionHandlerPHP extends SimpleSAML_SessionHandler {
 	}
 
 
+	/* This function retrieves the session id of the current session.
+	 *
+	 * Returns:
+	 *  The session id of the current session.
+	 */
+	public function getSessionId() {
+		return session_id();
+	}
+
+
 	/* This function is used to store data in this session object.
 	 *
 	 * See the information in SimpleSAML_SessionHandler::set(...) for
-- 
GitLab