* @license New BSD License - See LICENSE file in the tiqr library for details * @copyright (C) 2010-2011 SURFnet BV * */ $state = NULL; $userId = NULL; $displayName = NULL; $errorcode = NULL; $mayCreate = true; $sessionId = $_REQUEST['sessionId']; $session = SimpleSAML_Session::getSessionFromRequest($sessionId); if (isset($_REQUEST['AuthState'])) { $authState = $_REQUEST['AuthState']; $state = SimpleSAML_Auth_State::loadState($authState, sspmod_authTiqr_Auth_Tiqr::STAGEID); if (is_array($state)) { $config = sspmod_authTiqr_Auth_Tiqr::getAuthSourceConfig($authState); if (isset($config["enroll.authsource"])) { $mayCreate = false; if ($session->isValid($config["enroll.authsource"])) { $attributes = $session->getAuthData($config["enroll.authsource"], 'Attributes'); // Check if userid exists $uidAttribute = $config["enroll.uidAttribute"]; $displayNameAttribute = $config["enroll.cnAttribute"]; if (!isset($attributes[$uidAttribute])) { throw new Exception('User ID is missing'); } $state["tiqrUser"]["userId"] = $attributes[$uidAttribute][0]; $state["tiqrUser"]["displayName"] = $attributes[$displayNameAttribute][0]; } else { SimpleSAML_Auth_Default::initLogin($config["enroll.authsource"], SimpleSAML_Utilities::selfURL(), NULL, $_REQUEST); }