diff --git a/lib/SimpleSAML/Session.php b/lib/SimpleSAML/Session.php
index 2947d32ec133d78c1ebb48a5bdbf40e3edc993a2..a33740ca4a412f49236a3af6110287658312df2f 100644
--- a/lib/SimpleSAML/Session.php
+++ b/lib/SimpleSAML/Session.php
@@ -99,11 +99,18 @@ class SimpleSAML_Session {
 	/**
 	 * 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;
@@ -152,6 +159,23 @@ class SimpleSAML_Session {
 	}
 
 
+	/**
+	 * 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);
+	}
+
+
 	/**
 	 * Initializes a session with the specified authentication state.
 	 *