summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlav Morken <olav.morken@uninett.no>2010-10-25 12:27:55 +0000
committerOlav Morken <olav.morken@uninett.no>2010-10-25 12:27:55 +0000
commit06a06f751e7bf43dc42b8e8802133cfadb3e076e (patch)
treeaa8ed37732c4995a3c37eb968a5e3bd81378027f
parent54d400d47439ad671600b802d8a2d5522c8435f5 (diff)
downloadsimplesamlphp-06a06f751e7bf43dc42b8e8802133cfadb3e076e.zip
simplesamlphp-06a06f751e7bf43dc42b8e8802133cfadb3e076e.tar.gz
simplesamlphp-06a06f751e7bf43dc42b8e8802133cfadb3e076e.tar.bz2
oauth: Change to use SimpleSAML_Auth_Simple.
git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2600 44740490-163a-0410-bde0-09ae8108e29a
-rw-r--r--modules/oauth/www/authorize.php8
-rw-r--r--modules/oauth/www/registry.edit.php17
-rw-r--r--modules/oauth/www/registry.php17
3 files changed, 17 insertions, 25 deletions
diff --git a/modules/oauth/www/authorize.php b/modules/oauth/www/authorize.php
index e0a9bb0..3b700f6 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 b028319..ed6a835 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 51bd0e8..31c3216 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']))