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

metaedit: Use SimpleSAML_Auth_Simple.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2601 44740490-163a-0410-bde0-09ae8108e29a
parent 06a06f75
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
/* Load simpleSAMLphp, configuration and metadata */ /* Load simpleSAMLphp, configuration and metadata */
$config = SimpleSAML_Configuration::getInstance(); $config = SimpleSAML_Configuration::getInstance();
$session = SimpleSAML_Session::getInstance();
$metaconfig = SimpleSAML_Configuration::getConfig('module_metaedit.php'); $metaconfig = SimpleSAML_Configuration::getConfig('module_metaedit.php');
$mdh = new SimpleSAML_Metadata_MetaDataStorageHandlerSerialize($metaconfig->getValue('metahandlerConfig', NULL)); $mdh = new SimpleSAML_Metadata_MetaDataStorageHandlerSerialize($metaconfig->getValue('metahandlerConfig', NULL));
...@@ -10,15 +9,13 @@ $mdh = new SimpleSAML_Metadata_MetaDataStorageHandlerSerialize($metaconfig->getV ...@@ -10,15 +9,13 @@ $mdh = new SimpleSAML_Metadata_MetaDataStorageHandlerSerialize($metaconfig->getV
$authsource = $metaconfig->getValue('auth', 'login-admin'); $authsource = $metaconfig->getValue('auth', 'login-admin');
$useridattr = $metaconfig->getValue('useridattr', 'eduPersonPrincipalName'); $useridattr = $metaconfig->getValue('useridattr', 'eduPersonPrincipalName');
if ($session->isValid($authsource)) { $as = new SimpleSAML_Auth_Simple($authsource);
$attributes = $session->getAttributes(); $as->requireAuth();
// Check if userid exists $attributes = $as->getAttributes();
if (!isset($attributes[$useridattr])) // Check if userid exists
throw new Exception('User ID is missing'); if (!isset($attributes[$useridattr]))
$userid = $attributes[$useridattr][0]; throw new Exception('User ID is missing');
} else { $userid = $attributes[$useridattr][0];
SimpleSAML_Auth_Default::initLogin($authsource, SimpleSAML_Utilities::selfURL());
}
function requireOwnership($metadata, $userid) { function requireOwnership($metadata, $userid) {
if (!isset($metadata['owner'])) if (!isset($metadata['owner']))
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
/* Load simpleSAMLphp, configuration and metadata */ /* Load simpleSAMLphp, configuration and metadata */
$config = SimpleSAML_Configuration::getInstance(); $config = SimpleSAML_Configuration::getInstance();
$session = SimpleSAML_Session::getInstance();
$metaconfig = SimpleSAML_Configuration::getConfig('module_metaedit.php'); $metaconfig = SimpleSAML_Configuration::getConfig('module_metaedit.php');
$mdh = new SimpleSAML_Metadata_MetaDataStorageHandlerSerialize($metaconfig->getValue('metahandlerConfig', NULL)); $mdh = new SimpleSAML_Metadata_MetaDataStorageHandlerSerialize($metaconfig->getValue('metahandlerConfig', NULL));
...@@ -10,15 +9,13 @@ $mdh = new SimpleSAML_Metadata_MetaDataStorageHandlerSerialize($metaconfig->getV ...@@ -10,15 +9,13 @@ $mdh = new SimpleSAML_Metadata_MetaDataStorageHandlerSerialize($metaconfig->getV
$authsource = $metaconfig->getValue('auth', 'login-admin'); $authsource = $metaconfig->getValue('auth', 'login-admin');
$useridattr = $metaconfig->getValue('useridattr', 'eduPersonPrincipalName'); $useridattr = $metaconfig->getValue('useridattr', 'eduPersonPrincipalName');
if ($session->isValid($authsource)) { $as = new SimpleSAML_Auth_Simple($authsource);
$attributes = $session->getAttributes(); $as->requireAuth();
// Check if userid exists $attributes = $as->getAttributes();
if (!isset($attributes[$useridattr])) // Check if userid exists
throw new Exception('User ID is missing'); if (!isset($attributes[$useridattr]))
$userid = $attributes[$useridattr][0]; throw new Exception('User ID is missing');
} else { $userid = $attributes[$useridattr][0];
SimpleSAML_Auth_Default::initLogin($authsource, SimpleSAML_Utilities::selfURL());
}
function requireOwnership($metadata, $userid) { function requireOwnership($metadata, $userid) {
if (!isset($metadata['owner'])) if (!isset($metadata['owner']))
......
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