Skip to content
Snippets Groups Projects
Commit f6819645 authored by Olav Morken's avatar Olav Morken
Browse files

consentSimpleAdmin: Change to use SimpleSAML_Auth_Simple.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2603 44740490-163a-0410-bde0-09ae8108e29a
parent e22817e6
No related branches found
No related tags found
No related merge requests found
...@@ -20,28 +20,26 @@ $consentconfig = SimpleSAML_Configuration::getConfig('module_consentSimpleAdmin. ...@@ -20,28 +20,26 @@ $consentconfig = SimpleSAML_Configuration::getConfig('module_consentSimpleAdmin.
$session = SimpleSAML_Session::getInstance(); $session = SimpleSAML_Session::getInstance();
$as = $consentconfig->getValue('auth'); $as = $consentconfig->getValue('auth');
if (!$session->isValid($as)) { $as = new SimpleSAML_Auth_Simple($as);
SimpleSAML_Auth_Default::initLogin($as, SimpleSAML_Utilities::selfURL()); $as->requireAuth();
}
// Get all attributes
$attributes = $session->getAttributes();
// Get user ID // Get user ID
$userid_attributename = $consentconfig->getValue('userid', 'eduPersonPrincipalName'); $userid_attributename = $consentconfig->getValue('userid', 'eduPersonPrincipalName');
$userids = ($session->getAttribute($userid_attributename)); if (empty($attributes[$userid_attributename])) {
if (empty($userids)) {
throw new Exception('Could not generate useridentifier for storing consent. Attribute [' . throw new Exception('Could not generate useridentifier for storing consent. Attribute [' .
$userid_attributename . '] was not available.'); $userid_attributename . '] was not available.');
} }
$userid = $userids[0]; $userid = $attributes[$userid_attributename][0];
// Get metadata storage handler // Get metadata storage handler
$metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
// Get all attributes
$attributes = $session->getAttributes();
/* /*
* Get IdP id and metadata * Get IdP id and metadata
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment