Revision: 2189
Author: olavmrk
Date: Wed Feb 24 01:52:44 2010
Log: Session: Add support for transient sessions.
http://code.google.com/p/simplesamlphp/source/detail?r=2189

Modified:
 /trunk/lib/SimpleSAML/Session.php

=======================================
--- /trunk/lib/SimpleSAML/Session.php   Wed Jan 27 23:41:07 2010
+++ /trunk/lib/SimpleSAML/Session.php   Wed Feb 24 01:52:44 2010
@@ -99,11 +99,18 @@
        /**
         * private constructor restricts instantiaton to getInstance()
         */
-       private function __construct() {
+       private function __construct($transient = FALSE) {
+

                $configuration = SimpleSAML_Configuration::getInstance();
$this->sessionduration = $configuration->getInteger('session.duration', 8*60*60);

+
+               if ($transient) {
+                       $this->trackid = 'XXXXXXXXXX';
+                       return;
+               }
+
                $this->trackid = SimpleSAML_Utilities::generateTrackID();

                $this->dirty = TRUE;
@@ -150,6 +157,23 @@

                return self::$instance;
        }
+
+
+       /**
+        * Use a transient session.
+        *
+        * Create a session that should not be saved at the end of the request.
+        * Subsequent calls to getInstance() will return this transient session.
+        */
+       public static function useTransientSession() {
+
+               if (isset(self::$instance)) {
+                       /* We already have a session. Don't bother with a 
transient session. */
+                       return;
+               }
+
+               self::$instance = new SimpleSAML_Session(TRUE);
+       }


        /**

--
You received this message because you are subscribed to the Google Groups 
"simpleSAMLphp commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/simplesamlphp-commits?hl=en.

Reply via email to