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

oauth: Change to use SimpleSAML_Auth_Simple.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2600 44740490-163a-0410-bde0-09ae8108e29a
parent 54d400d4
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
......@@ -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']))
......
......@@ -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']))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment