diff --git a/modules/oauth/www/authorize.php b/modules/oauth/www/authorize.php index e0a9bb0f226928885f8e3d0a8e4c41ccd3577525..3b700f61f0a0aa5d218c9ba96c9a354a875e0444 100644 --- a/modules/oauth/www/authorize.php +++ b/modules/oauth/www/authorize.php @@ -25,11 +25,9 @@ $config = SimpleSAML_Configuration::getInstance(); $session = SimpleSAML_Session::getInstance(); $as = $oauthconfig->getString('auth'); -if (!$session->isValid($as)) { - SimpleSAML_Auth_Default::initLogin($as, SimpleSAML_Utilities::selfURL()); -} - -$attributes = $session->getAttributes(); +$as = new SimpleSAML_Auth_Simple($as); +$as->requireAuth(); +$attributes = $as->getAttributes(); #print_r($attributes); diff --git a/modules/oauth/www/registry.edit.php b/modules/oauth/www/registry.edit.php index b0283198d5b9b13fe45eaf9dde2aa20fc92a8100..ed6a835aac518db0b19fab6d71c2d6b683675125 100644 --- a/modules/oauth/www/registry.edit.php +++ b/modules/oauth/www/registry.edit.php @@ -2,7 +2,6 @@ /* Load simpleSAMLphp, configuration and metadata */ $config = SimpleSAML_Configuration::getInstance(); -$session = SimpleSAML_Session::getInstance(); $oauthconfig = SimpleSAML_Configuration::getOptionalConfig('module_oauth.php'); $store = new sspmod_core_Storage_SQLPermanentStorage('oauth'); @@ -10,15 +9,13 @@ $store = new sspmod_core_Storage_SQLPermanentStorage('oauth'); $authsource = $oauthconfig->getValue('auth', 'admin'); $useridattr = $oauthconfig->getValue('useridattr', 'user'); -if ($session->isValid($authsource)) { - $attributes = $session->getAttributes(); - // Check if userid exists - if (!isset($attributes[$useridattr])) - throw new Exception('User ID is missing'); - $userid = $attributes[$useridattr][0]; -} else { - SimpleSAML_Auth_Default::initLogin($authsource, SimpleSAML_Utilities::selfURL()); -} +$as = new SimpleSAML_Auth_Simple($authsource); +$as->requireAuth(); +$attributes = $as->getAttributes(); +// Check if userid exists +if (!isset($attributes[$useridattr])) + throw new Exception('User ID is missing'); +$userid = $attributes[$useridattr][0]; function requireOwnership($entry, $userid) { if (!isset($entry['owner'])) diff --git a/modules/oauth/www/registry.php b/modules/oauth/www/registry.php index 51bd0e8a2f6670c6d4ba2766a1be55083c561e63..31c32166ad046cedeed223e5a17d47894f052832 100644 --- a/modules/oauth/www/registry.php +++ b/modules/oauth/www/registry.php @@ -2,7 +2,6 @@ /* Load simpleSAMLphp, configuration and metadata */ $config = SimpleSAML_Configuration::getInstance(); -$session = SimpleSAML_Session::getInstance(); $oauthconfig = SimpleSAML_Configuration::getOptionalConfig('module_oauth.php'); $store = new sspmod_core_Storage_SQLPermanentStorage('oauth'); @@ -10,15 +9,13 @@ $store = new sspmod_core_Storage_SQLPermanentStorage('oauth'); $authsource = $oauthconfig->getValue('auth', 'admin'); $useridattr = $oauthconfig->getValue('useridattr', 'user'); -if ($session->isValid($authsource)) { - $attributes = $session->getAttributes(); - // Check if userid exists - if (!isset($attributes[$useridattr])) - throw new Exception('User ID is missing'); - $userid = $attributes[$useridattr][0]; -} else { - SimpleSAML_Auth_Default::initLogin($authsource, SimpleSAML_Utilities::selfURL()); -} +$as = new SimpleSAML_Auth_Simple($authsource); +$as->requireAuth(); +$attributes = $as->getAttributes(); +// Check if userid exists +if (!isset($attributes[$useridattr])) + throw new Exception('User ID is missing'); +$userid = $attributes[$useridattr][0]; function requireOwnership($entry, $userid) { if (!isset($entry['owner']))