summaryrefslogtreecommitdiffstats
path: root/php/Attic/examples/sample-idp/singleSignOn.php
diff options
context:
space:
mode:
authorChristophe Nowicki <cnowicki@easter-eggs.com>2004-09-16 15:57:55 +0000
committerChristophe Nowicki <cnowicki@easter-eggs.com>2004-09-16 15:57:55 +0000
commit40940b95aaefd87f9af96439669cc6cb184d69ef (patch)
treef0d65eaa1369aeaca88f5774f2ca2cba4932ca27 /php/Attic/examples/sample-idp/singleSignOn.php
parent7ea2275ca076a880c27448cdbdfe09ffa9f15db8 (diff)
downloadlasso-40940b95aaefd87f9af96439669cc6cb184d69ef.tar.gz
lasso-40940b95aaefd87f9af96439669cc6cb184d69ef.tar.xz
lasso-40940b95aaefd87f9af96439669cc6cb184d69ef.zip
New logging system with a web interface.
Diffstat (limited to 'php/Attic/examples/sample-idp/singleSignOn.php')
-rw-r--r--php/Attic/examples/sample-idp/singleSignOn.php40
1 files changed, 10 insertions, 30 deletions
diff --git a/php/Attic/examples/sample-idp/singleSignOn.php b/php/Attic/examples/sample-idp/singleSignOn.php
index 45970fd2..9623e32c 100644
--- a/php/Attic/examples/sample-idp/singleSignOn.php
+++ b/php/Attic/examples/sample-idp/singleSignOn.php
@@ -23,13 +23,20 @@
*/
require_once 'HTML/QuickForm.php';
+ require_once 'Log.php';
require_once 'DB.php';
$config = unserialize(file_get_contents('config.inc'));
+ // connect to the data base
+ $db = &DB::connect($config['dsn']);
+ if (DB::isError($db))
+ die("Could not connect to the database");
+
// create logger
- $logger = &Log::factory($config['log_handler'], '', $config['log_name']."::".$_SERVER['PHP_SELF']);
-
+ $conf['db'] = $db;
+ $logger = &Log::factory($config['log_handler'], 'log', $_SERVER['PHP_SELF'], $conf);
+
session_start();
lasso_init();
@@ -55,15 +62,7 @@
updateDumpsFromSession($login);
initFromAuthnRequest($login);
- // connect to the data base
- $db = &DB::connect($config['dsn']);
- if (DB::isError($db))
- {
- $logger->log("DB Error :" . $db->getMessage(), PEAR_LOG_ALERT);
- $logger->log("DB Error :" . $db->getDebugInfo(), PEAR_LOG_DEBUG);
- die("Could not connect to the database");
- }
-
+
// User must *NOT* Authenticate with the IdP
if (!$login->mustAuthenticate())
@@ -385,16 +384,6 @@
die("Login dump is not registred");
}
- // connect to the data base
- $db = &DB::connect($config['dsn']);
-
- if (DB::isError($db))
- {
- $logger->log("DB Error :" . $db->getMessage(), PEAR_LOG_ALERT);
- $logger->log("DB Error :" . $db->getDebugInfo(), PEAR_LOG_DEBUG);
- die("Could not connect to the database");
- }
-
$login = LassoLogin::newFromDump($server, $_SESSION['login_dump']);
if (($user_id = authentificateUser($db, $form->exportValue('username'),
@@ -430,15 +419,6 @@
// User must NOT Authenticate with the IdP
if (!$login->mustAuthenticate())
{
- // conect to the data base
- $db = &DB::connect($config['dsn']);
- if (DB::isError($db))
- {
- $logger->log("DB Error :" . $db->getMessage(), PEAR_LOG_ALERT);
- $logger->log("DB Error :" . $db->getDebugInfo(), PEAR_LOG_DEBUG);
- die("Could not connect to the database");
- }
-
$user_id = getUserIDFromNameIdentifier($db, $login->nameIdentifier);
if (!$user_id)