From c304c3d58151407c69448a94abe90afde33290bb Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Fri, 2 Dec 2011 10:47:36 +0000
Subject: [PATCH] core:UserPassOrgBase: Add selected organization to auth data.

Thanks to Ryan Panning for implementing this!

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2992 44740490-163a-0410-bde0-09ae8108e29a
---
 modules/core/lib/Auth/UserPassOrgBase.php | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/modules/core/lib/Auth/UserPassOrgBase.php b/modules/core/lib/Auth/UserPassOrgBase.php
index 6583d34e1..e07eccb43 100644
--- a/modules/core/lib/Auth/UserPassOrgBase.php
+++ b/modules/core/lib/Auth/UserPassOrgBase.php
@@ -27,6 +27,12 @@ abstract class sspmod_core_Auth_UserPassOrgBase extends SimpleSAML_Auth_Source {
 	const AUTHID = 'sspmod_core_Auth_UserPassOrgBase.AuthId';
 
 
+	/**
+	 * The key of the OrgId field in the state, identifies which org was selected.
+	 */
+	const ORGID = 'sspmod_core_Auth_UserPassOrgBase.SelectedOrg';
+
+
 	/**
 	 * What way do we handle the organization as part of the username.
 	 * Three values:
@@ -194,6 +200,10 @@ abstract class sspmod_core_Auth_UserPassOrgBase extends SimpleSAML_Auth_Source {
 			return $e->getErrorCode();
 		}
 
+		// Add the selected Org to the state
+		$state[self::ORGID] = $organization;
+		$state['PersistentAuthData'][] = self::ORGID;
+
 		$state['Attributes'] = $attributes;
 		SimpleSAML_Auth_Source::completeAuth($state);
 	}
-- 
GitLab