From 917a2059b059ea3946bb4fd07e8d7a74f131cf92 Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Tue, 27 Oct 2009 12:51:50 +0000
Subject: [PATCH] SimpleSAML_Auth_State: Add $rawId parameter to saveState.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1923 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SimpleSAML/Auth/State.php | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/SimpleSAML/Auth/State.php b/lib/SimpleSAML/Auth/State.php
index f890c00cd..32afe3620 100644
--- a/lib/SimpleSAML/Auth/State.php
+++ b/lib/SimpleSAML/Auth/State.php
@@ -87,11 +87,13 @@ class SimpleSAML_Auth_State {
 	 *
 	 * @param array &$state  The login request state.
 	 * @param string $stage  The current stage in the login process.
+	 * @param bool $rawId  Return a raw ID, without a restart URL.
 	 * @return string  Identifier which can be used to retrieve the state later.
 	 */
-	public static function saveState(&$state, $stage) {
+	public static function saveState(&$state, $stage, $rawId = FALSE) {
 		assert('is_array($state)');
 		assert('is_string($stage)');
+		assert('is_bool($rawId)');
 
 		/* Save stage. */
 		$state[self::STAGE] = $stage;
@@ -103,7 +105,7 @@ class SimpleSAML_Auth_State {
 		$id = $state[self::ID];
 
 		/* Embed the restart URL in the state identifier, if it is available. */
-		if (array_key_exists(self::RESTART, $state)) {
+		if (array_key_exists(self::RESTART, $state) && !$rawId) {
 			assert('is_string($state[self::RESTART])');
 			$return = $id . ':' . $state[self::RESTART];
 		} else {
-- 
GitLab