summaryrefslogtreecommitdiffstats
path: root/php/Attic/examples/sample-sp
diff options
context:
space:
mode:
Diffstat (limited to 'php/Attic/examples/sample-sp')
-rw-r--r--php/Attic/examples/sample-sp/.cvsignore3
-rw-r--r--php/Attic/examples/sample-sp/Makefile.am17
-rw-r--r--php/Attic/examples/sample-sp/README1
-rw-r--r--php/Attic/examples/sample-sp/admin_user.php205
-rw-r--r--php/Attic/examples/sample-sp/assertionConsumer.php212
-rw-r--r--php/Attic/examples/sample-sp/cancel_federation.php200
-rw-r--r--php/Attic/examples/sample-sp/index.php214
-rw-r--r--php/Attic/examples/sample-sp/log_view.php160
-rw-r--r--php/Attic/examples/sample-sp/login.php94
-rw-r--r--php/Attic/examples/sample-sp/logout.php145
-rw-r--r--php/Attic/examples/sample-sp/metadata_idp1.xml44
-rw-r--r--php/Attic/examples/sample-sp/metadata_sp1.xml42
-rw-r--r--php/Attic/examples/sample-sp/misc.php55
-rw-r--r--php/Attic/examples/sample-sp/register.php92
-rw-r--r--php/Attic/examples/sample-sp/session.php86
-rw-r--r--php/Attic/examples/sample-sp/setup.php419
-rw-r--r--php/Attic/examples/sample-sp/soapEndpoint.php143
-rw-r--r--php/Attic/examples/sample-sp/sp_openssl.cnf19
-rw-r--r--php/Attic/examples/sample-sp/view_session.php88
19 files changed, 0 insertions, 2239 deletions
diff --git a/php/Attic/examples/sample-sp/.cvsignore b/php/Attic/examples/sample-sp/.cvsignore
deleted file mode 100644
index 22a4e729..00000000
--- a/php/Attic/examples/sample-sp/.cvsignore
+++ /dev/null
@@ -1,3 +0,0 @@
-Makefile
-Makefile.in
-
diff --git a/php/Attic/examples/sample-sp/Makefile.am b/php/Attic/examples/sample-sp/Makefile.am
deleted file mode 100644
index cdfc650e..00000000
--- a/php/Attic/examples/sample-sp/Makefile.am
+++ /dev/null
@@ -1,17 +0,0 @@
-EXTRA_DIST = \
- admin_user.php \
- assertionConsumer.php \
- cancel_federation.php \
- index.php \
- login.php \
- logout.php \
- metadata_idp1.xml \
- metadata_sp1.xml \
- misc.php \
- register.php \
- session.php \
- setup.php \
- soapEndpoint.php \
- view_session.php \
- README
-
diff --git a/php/Attic/examples/sample-sp/README b/php/Attic/examples/sample-sp/README
deleted file mode 100644
index a78f9817..00000000
--- a/php/Attic/examples/sample-sp/README
+++ /dev/null
@@ -1 +0,0 @@
-TODO ;0)
diff --git a/php/Attic/examples/sample-sp/admin_user.php b/php/Attic/examples/sample-sp/admin_user.php
deleted file mode 100644
index 72b29659..00000000
--- a/php/Attic/examples/sample-sp/admin_user.php
+++ /dev/null
@@ -1,205 +0,0 @@
-<?php
-/*
- * Service Provider Example -- User Administration
- *
- * Copyright (C) 2004, 2005 Entr'ouvert
- * http://lasso.entrouvert.org
- *
- * Authors: Christophe Nowicki <cnowicki@easter-eggs.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
- $config = unserialize(file_get_contents('config.inc'));
-
- require_once 'Log.php';
- require_once 'DB.php';
-
- // connect to the data base
- $db = &DB::connect($config['dsn']);
- if (DB::isError($db))
- die($db->getMessage());
-
- // create logger
- $conf['db'] = $db;
- $logger = &Log::factory($config['log_handler'], 'log', $_SERVER['PHP_SELF'], $conf);
-
-
- if (!empty($_GET['dump'])) {
- $query = "SELECT identity_dump FROM users WHERE user_id=".$db->quoteSmart($_GET['dump']);
- $res =& $db->query($query);
- if (DB::isError($res))
- print $res->getMessage(). "\n";
- $row = $res->fetchRow();
-
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
-<body>
-<table>
-<caption>Identity Dump</caption>
-<tr>
-<td>
-<textarea rows="15" cols="50">
-<?php
- echo htmlentities($row[0], ENT_QUOTES);
-?>
-</textarea>
-</td>
-</tr>
-<tr>
-<td align="center"><a href="javascript:window.close(self)">Close</a></td>
-</tr>
-</table>
-</body>
-</html>
-<?php
- exit;
- }
-
- if (!empty($_GET['del']))
- {
-
- $query = "DELETE FROM nameidentifiers WHERE user_id=".$db->quoteSmart($_GET['del']);
- $res =& $db->query($query);
- if (DB::isError($res))
- die($res->getMessage());
-
- $query = "DELETE FROM users WHERE user_id=".$db->quoteSmart($_GET['del']);
- $res =& $db->query($query);
- if (DB::isError($res))
- die($res->getMessage());
- }
-
- lasso_init();
-
- // Create Lasso Server
- $server_dump = file_get_contents($config['server_dump_filename']);
- $server = LassoServer::newFromDump($server_dump);
-
- // Lasso User
- $login = new LassoLogin($server);
-
- $query = "SELECT * FROM users";
- $res =& $db->query($query);
- if (DB::isError($res))
- print $res->getMessage(). "\n";
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
-<head>
-<title>Lasso Service Provider Example : Users Management</title>
-<script type="text/javascript">
-
- function openpopup(popurl){
- var winpops=window.open(popurl,"","width=400,height=300")
- }
-
-</script>
-</head>
-<body>
-
-<table border="1" align="center">
-<caption>Users</caption>
-<?php
- $num_col = $res->numCols();
- $tableinfo = $db->tableInfo($res);
-?>
-<thead>
-<tr align="center"><?php
- for ($i = 0; $i < $num_col; $i++) {
- echo "<td><b>" . $tableinfo[$i]['name'] ."</b></td>";
- }
-?><td>&nbsp;</td>
-</tr>
-</thead>
-<tbody>
-<?php
- while ($row =& $res->fetchRow()) {
-?>
-<tr align="center">
-<?php
- for ($i = 0; $i < $num_col; $i++)
- {
- ?>
- <td>
- <?php
- switch ($tableinfo[$i]['name'])
- {
- case "identity_dump":
- echo "<a href=javascript:openpopup('". $PHP_SELF . '?dump=' . $row[0] . "')>view</a>";
- $identity_dump = $row[$i];
- break;
-
- default:
- echo (empty($row[$i])) ? "&nbsp;" : $row[$i];
- }
- ?>
- </td>
- <?php
- }
- ?>
- <td rowspan='2'><a href="<?php echo $PHP_SELF . '?del=' . $row[0]; ?>">delete</a></td>
-</tr>
-<tr>
- <td colspan='<?php echo $num_col; ?>' align='center'>
-<?
- // get all federations for this user
- if (!empty($identity_dump))
- {
- $login->setIdentityFromDump($identity_dump);
- $identity = $login->identity;
- $providerIDs = $identity->providerIds;
-
- for($i = 0; $i < $providerIDs->length() ; $i++)
- {
- if ($i)
- echo "<br>";
- echo $providerIDs->getItem($i);
- }
- }
- else
- echo "Not Federated with an Service Provider.";
-?>
- </td>
-</tr>
-<?php
-}
-?>
-</tbody>
-<tfoot>
-<tr>
-<td colspan="<?php echo $num_col; ?>">&nbsp;</td>
-<td>Total: <?php echo $res->numRows();?> Users</td>
-</tr>
-</tfoot>
-</table>
-
-<br>
-<p align='center'><a href='index.php'>Index</a>
-</p>
-
-<br>
-<p>Copyright &copy; 2004, 2005 Entr'ouvert</p>
-
-</body>
-
-</html>
-<?php
- $db->disconnect();
- lasso_shutdown();
-?>
diff --git a/php/Attic/examples/sample-sp/assertionConsumer.php b/php/Attic/examples/sample-sp/assertionConsumer.php
deleted file mode 100644
index 46bc63a5..00000000
--- a/php/Attic/examples/sample-sp/assertionConsumer.php
+++ /dev/null
@@ -1,212 +0,0 @@
-<?php
-/*
- * Service Provider Example -- AssertionConsumer
- *
- * Copyright (C) 2004, 2005 Entr'ouvert
- * http://lasso.entrouvert.org
- *
- * Authors: Christophe Nowicki <cnowicki@easter-eggs.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
- require_once 'Log.php';
- require_once 'DB.php';
- require_once 'session.php';
- require_once 'misc.php';
-
- $config = unserialize(file_get_contents('config.inc'));
-
- if (!$_GET['SAMLart']) {
- exit(1);
- }
-
- // connect to the data base
- $db = &DB::connect($config['dsn']);
- if (DB::isError($db))
- die($db->getMessage());
-
- // create logger
- $conf['db'] = $db;
- $logger = &Log::factory($config['log_handler'], 'log', $_SERVER['PHP_SELF'], $conf);
-
- // session handler
- session_set_save_handler("open_session", "close_session",
- "read_session", "write_session", "destroy_session", "gc_session");
-
- session_start();
-
- lasso_init();
-
- $server_dump = file_get_contents($config['server_dump_filename']);
-
- $server = LassoServer::newFromDump($server_dump);
-
- $login = new LassoLogin($server);
-
- $logger->info('Request from ' . $_SERVER['REMOTE_ADDR']);
- $login->initRequest($_SERVER['QUERY_STRING'], lassoHttpMethodRedirect);
- $login->buildRequestMsg();
-
- $url = parse_url($login->msgUrl);
-
- $soap = sprintf(
- "POST %s HTTP/1.1\r\nHost: %s:%d\r\nContent-Length: %d\r\nContent-Type: text/xml\r\n\r\n%s\r\n",
- $url['path'], $url['host'], $url['port'], strlen($login->msgBody), $login->msgBody);
-
- $logger->log('Send SOAP Request to '. $url['host'] . ":" .$url['port']. $url['path'], PEAR_LOG_INFO);
- $logger->log('SOAP Request : ' . $soap, PEAR_LOG_DEBUG);
-
- # PHP 4.3.0 with OpenSSL support required
- $fp = fsockopen("ssl://" . $url['host'], $url['port'], $errno, $errstr, 30) or die($errstr ($errno));
- socket_set_timeout($fp, 10);
- fwrite($fp, $soap);
-
- read_http_response($fp, $header, $response);
-
- $logger->log('SOAP Response Header : ' . $header, PEAR_LOG_DEBUG);
- $logger->log('SOAP Response Body : ' . $response, PEAR_LOG_DEBUG);
-
- if (!preg_match("/^HTTP\/1\\.. 200/i", $header)) {
- $logger->log("Wrong Artifact send by " . $_SERVER['REMOTE_ADDR'], PEAR_LOG_ERR);
- die("Wrong Artifact");
- }
-
- $login->processResponseMsg($response);
-
- $query = "SELECT user_id FROM nameidentifiers WHERE name_identifier='" . $login->nameIdentifier . "'";
- $res =& $db->query($query);
-
- $logger->log("Name Identifier : " . $login->nameIdentifier, PEAR_LOG_DEBUG);
-
- if (DB::isError($res))
- {
- $logger->log("DB Error :" . $db->getMessage(), PEAR_LOG_CRIT);
- $logger->log("DB Error :" . $db->getDebugInfo(), PEAR_LOG_DEBUG);
- die($db->getMessage());
- }
-
- if ($res->numRows() > 0)
- {
- // User already exist in the database
- $row =& $res->fetchRow();
- $user_id = $row[0];
-
- # Get Identity Dump from the data base
- $query = "SELECT identity_dump FROM users WHERE user_id='$user_id'";
- $res =& $db->query($query);
-
- if (DB::isError($db))
- {
- $logger->log("DB Error :" . $db->getMessage(), PEAR_LOG_CRIT);
- $logger->log("DB Error :" . $db->getDebugInfo(), PEAR_LOG_DEBUG);
- die($db->getMessage());
- }
-
- $row =& $res->fetchRow();
-
- $login->setIdentityFromDump($row[0]);
-
- $res->free();
-
- $login->acceptSso();
-
- $session = $login->session;
- $identity = $login->identity;
-
- $_SESSION['nameidentifier'] = $login->nameIdentifier;
- $_SESSION['identity_dump'] = $identity->dump();
- $_SESSION['session_dump'] = $session->dump();
- $_SESSION['user_id'] = $user_id;
-
- $url = "index.php";
-
- $logger->log("New session started for user '$user_id'", PEAR_LOG_INFO);
- }
- else
- {
- // New User
- $login->acceptSso();
-
- $identity = $login->identity;
- $identity_dump = $identity->dump();
-
- $session = $login->session;
-
- // Insert into users
- $query = "INSERT INTO users (user_id,identity_dump,created) VALUES(nextval('user_id_seq'),";
- $query .= $db->quoteSmart($identity_dump) . ", NOW())";
-
- $res =& $db->query($query);
- if (DB::isError($res))
- {
- $logger->log("DB Error :" . $db->getMessage(), PEAR_LOG_CRIT);
- $logger->log("DB Error :" . $db->getDebugInfo(), PEAR_LOG_DEBUG);
- die($db->getMessage());
- }
-
-
- // Get UserID
- $query = "SELECT last_value FROM user_id_seq";
- $res =& $db->query($query);
- if (DB::isError($res))
- {
- $logger->log("DB Error :" . $db->getMessage(), PEAR_LOG_CRIT);
- $logger->log("DB Error :" . $db->getDebugInfo(), PEAR_LOG_DEBUG);
- die($db->getMessage());
- }
- $row = $res->fetchRow();
- $user_id = $row[0];
-
- $logger->log("New user($user_id) created", PEAR_LOG_NOTICE);
-
- // Insert into nameidentifiers
- $query = "INSERT INTO nameidentifiers VALUES('".$login->nameIdentifier."', '$user_id')";
- $res =& $db->query($query);
- if (DB::isError($res))
- {
- $logger->log("DB Error :" . $db->getMessage(), PEAR_LOG_CRIT);
- $logger->log("DB Error :" . $db->getDebugInfo(), PEAR_LOG_DEBUG);
- die($db->getMessage());
- }
-
-
- $_SESSION['nameidentifier'] = $login->nameIdentifier;
- $_SESSION['identity_dump'] = $identity->dump();
- $_SESSION['session_dump'] = $session->dump();
- $_SESSION['user_id'] = $user_id;
-
- $logger->log("New session started for user '$user_id', redirect to the registration form", PEAR_LOG_INFO);
-
- $url = "register.php";
- }
-
- // Update last_login
- $query = "UPDATE users SET last_login=NOW() WHERE user_id='$user_id'";
- $res =& $db->query($query);
- if (DB::isError($res))
- {
- $logger->log("DB Error :" . $db->getMessage(), PEAR_LOG_CRIT);
- $logger->log("DB Error :" . $db->getDebugInfo(), PEAR_LOG_DEBUG);
- die($db->getMessage());
- }
- $logger->log("Update last login for user '$user_id'", PEAR_LOG_INFO);
-
- header("Request-URI: $url");
- header("Content-Location: $url");
- header("Location: $url\n\n");
- lasso_shutdown();
- exit();
-?>
diff --git a/php/Attic/examples/sample-sp/cancel_federation.php b/php/Attic/examples/sample-sp/cancel_federation.php
deleted file mode 100644
index 818f2b75..00000000
--- a/php/Attic/examples/sample-sp/cancel_federation.php
+++ /dev/null
@@ -1,200 +0,0 @@
-<?php
-/*
- * Service Provider Example -- Cancel Federation with an Identity Provider
- *
- * Copyright (C) 2004, 2005 Entr'ouvert
- * http://lasso.entrouvert.org
- *
- * Authors: Christophe Nowicki <cnowicki@easter-eggs.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
- require_once 'Log.php';
- require_once 'DB.php';
- require_once 'session.php';
- require_once 'misc.php';
-
- $config = unserialize(file_get_contents('config.inc'));
-
- $methodes = array('redirect' => lassoHttpMethodRedirect, 'soap' => lassoHttpMethodSoap);
-
- // connect to the data base
- $db = &DB::connect($config['dsn']);
- if (DB::isError($db))
- die($db->getMessage());
-
- // create logger
- $conf['db'] = $db;
- $logger = &Log::factory($config['log_handler'], 'log', $_SERVER['PHP_SELF'], $conf);
-
- // session handler
- session_set_save_handler("open_session", "close_session",
- "read_session", "write_session", "destroy_session", "gc_session");
-
- if (empty($_GET['profile']))
- {
- $logger->err("Cancel Federation called without profile.");
- die("Cancel Federation called without profile.");
- }
-
- if (empty($_GET['with']))
- {
- $logger->err("Cancel Federation called without providerID.");
- die("Cancel Federation called without providerID.");
- }
-
- session_start();
-
- lasso_init();
-
- if (empty($_SESSION['user_id']))
- {
- $logger->err("UserID is empty, user is not logged in.");
- die("UserID is empty, user is not logged in.");
- }
-
- if (empty($_SESSION['identity_dump']))
- {
- $logger->err("Identity Dump is empty, user is not federated.");
- die("Identity Dump is empty, user is not federated.");
- }
-
- if (!in_array($_GET['profile'], array_keys($methodes)))
- {
- die("Unknown defederation profile : " . $_GET['profile']);
- $logger->err("Unknown defederation profile : " . $_GET['profile']);
- }
-
- $user_id = $_SESSION['user_id'];
-
- $server_dump = file_get_contents($config['server_dump_filename']);
- $server = LassoServer::newFromDump($server_dump);
-
- $defederation = new LassoDefederation($server, lassoProviderTypeSp);
- $defederation->setIdentityFromDump($_SESSION['identity_dump']);
-
- if (!empty($_SESSION['session_dump']))
- $defederation->setSessionFromDump($_SESSION['session_dump']);
-
- $logger->debug("Create Cancel Federation Notification for User '" . $_SESSION["user_id"] .
- "' with Identity Provider '" . $_GET['with']. "'");
-
- $defederation->initNotification($_GET['with'], $methodes[$_GET['profile']]);
-
- $defederation->buildNotificationMsg();
- $nameIdentifier = $defederation->nameIdentifier;
- if (empty($nameIdentifier))
- {
- $loggery>err("Name Identifier is empty.");
- die("Name Identifier is empty.");
- }
-
- $identity = $defederation->identity;
- if (isset($defederation->identity))
- {
- // Update identity dump
- $identity_dump = $identity->dump();
- $_SESSION['identity_dump'] = $identity_dump;
- $query = "UPDATE users SET identity_dump=".$db->quoteSmart($identity_dump);
- }
- else // Delete identity and session dumps
- $query = "UPDATE users SET identity_dump=''";
- $query .= " WHERE user_id='$user_id'";
-
- $res =& $db->query($query);
- if (DB::isError($res))
- {
- $logger->crit("DB Error :" . $res->getMessage());
- $logger->debug("DB Error :" . $res->getDebugInfo());
- die("Internal Server Error");
- }
- $logger->debug("Update user '$user_id' identity dump in the database");
-
- // Update session dump, if available
- if (!empty($_SESSION['sesion_dump']) && $defederation->isSessionDirty)
- {
- $session = $defederation->session;
- $session_dump = $session->dump();
- $_SESSION['session_dump'] = $session_dump;
-
- $query = "UPDATE users SET session_dump=".$db->quoteSmart($session_dump);
- $query .= " WHERE user_id='$user_id'";
-
- $res =& $db->query($query);
- if (DB::isError($res))
- {
- $logger->crit("DB Error :" . $res->getMessage());
- $logger->debug("DB Error :" . $res->getDebugInfo());
- die("Internal Server Error");
- }
- $logger->debug("Update user '$user_id' session dump in the database");
-}
-
-// Delete Name Identifier
-$query = "DELETE FROM nameidentifiers WHERE user_id='$user_id' ";
-$query .= "AND name_identifier='$nameIdentifier'";
-
-$res =& $db->query($query);
-if (DB::isError($res))
-{
- $logger->crit("DB Error :" . $res->getMessage());
- $logger->debug("DB Error :" . $res->getDebugInfo());
- die("Internal Server Error");
-}
-
-$logger->info("Delete Name Identifier '$nameIdentifier' for User '$user_id'");
-
-switch($_GET['profile'])
-{
- case 'redirect':
- $url = $defederation->msgUrl;
- $logger->info("Redirect user to $url");
-
- header("Request-URI: $url");
- header("Content-Location: $url");
- header("Location: $url\r\n\r\n");
- break;
- case 'soap':
- $url = parse_url($defederation->msgUrl);
- $soap = sprintf(
- "POST %s HTTP/1.1\r\nHost: %s:%d\r\nContent-Length: %d\r\nContent-Type: text/xml\r\n\r\n%s\r\n",
- $url['path'], $url['host'], $url['port'], strlen($defederation->msgBody), $defederation->msgBody);
-
- $logger->info('Send SOAP Request to '. $url['host'] . ":" .$url['port']. $url['path']);
- $logger->debug('SOAP Request : ' . $soap);
-
- $fp = fsockopen("ssl://" . $url['host'], $url['port'], $errno, $errstr, 30) or die($errstr ($errno));
- socket_set_timeout($fp, 10);
- fwrite($fp, $soap);
-
- read_http_response($fp, $header, $reponse);
-
- fclose($fp);
-
- $logger->log('SOAP Response Header : ' . $header, PEAR_LOG_DEBUG);
- $logger->log('SOAP Response Body : ' . $response, PEAR_LOG_DEBUG);
-
- // TODO : check reponse status
-
-
- break;
- }
-
-?>
-
-<?php
- lasso_shutdown();
-?>
diff --git a/php/Attic/examples/sample-sp/index.php b/php/Attic/examples/sample-sp/index.php
deleted file mode 100644
index 6ccd1b8b..00000000
--- a/php/Attic/examples/sample-sp/index.php
+++ /dev/null
@@ -1,214 +0,0 @@
-<?php
-/*
- * Service Provider Example -- Index File
- *
- * Copyright (C) 2004, 2005 Entr'ouvert
- * http://lasso.entrouvert.org
- *
- * Authors: Christophe Nowicki <cnowicki@easter-eggs.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
- require_once 'DB.php';
- require_once 'session.php';
-
- if(!extension_loaded('lasso')) {
- $ret = @dl('lasso.' . PHP_SHLIB_SUFFIX);
- if ($ret == FALSE)
- {
-?>
-<p align='center'><b>The Lasso Extension is not available</b><br>
-Please check your PHP extensions<br>
-You can get more informations about <b>Lasso</b> at <br>
-<a href='http://lasso.entrouvert.org/'>http://lasso.entrouvert.org/</a></p>
-<?php
- exit();
- }
- }
-
- if (!file_exists('config.inc'))
- {
-?>
-<p align='center'><b>Service Provider Configuration file is not available</b><br>
-Please run the setup script :<br>
-<a href='setup.php'>Lasso Service Provider Setup</a><br>
-You can get more informations about <b>Lasso</b> at <br>
-<a href='http://lasso.entrouvert.org/'>http://lasso.entrouvert.org/</a></p>
-<?php
- exit();
- }
-
- $config = unserialize(file_get_contents('config.inc'));
-
- // connect to the data base
- $db = &DB::connect($config['dsn']);
- if (DB::isError($db))
- die($db->getMessage());
-
- // session handler
- session_set_save_handler("open_session", "close_session",
- "read_session", "write_session", "destroy_session", "gc_session");
-
- session_start();
-
-
- lasso_init();
-
- $server_dump = file_get_contents($config['server_dump_filename']);
- $server = LassoServer::newFromDump($server_dump);
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
-<head>
-<title>Lasso Service Provider Example</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" />
-</head>
-
-<body>
-<p align='center'>
-<b>Service Provider Administration</b><br>
-<a href="setup.php">Setup</a><br>
-<a href="admin_user.php">Users Management</a><br>
-<a href="view_session.php">View Online Users</a>
-<?php if ($config['log_handler'] == 'sql') { ?>
- <br><a href="log_view.php">View log</a>
-<?php } ?>
-</p>
-<p align='center'>
- <b>Serice Provider Fonctionnality</b>
-<table align='center'>
-<?php
- if (!isset($_SESSION["nameidentifier"])) {
- ?>
-<tr>
- <td colspan="2">Single SignOn using an Identity Provider</td>
-</tr>
-<tr>
- <td colspan="2">&nbsp;</td>
-</tr>
-<tr>
- <td>Provider</td>
- <td>Profile</td>
-</tr>
-<tr>
- <td><?php echo $config['providerID']; ?></td>
- <td><a href="login.php?profile=post">post</a> | <a href="login.php?profile=artifact">artifact</a></td>
-</tr>
-<?php } else {
- // User is federated with an Service Provider
- if (isset($_SESSION['identity_dump']))
- {
- $login = new LassoLogin($server);
- $login->setIdentityFromDump($_SESSION['identity_dump']);
- if (!empty($_SESSION['session_dump']))
- $login->setSessionFromDump($_SESSION['session_dump']);
- $identity = $login->identity;
- $providerIDs = $identity->providerIds;
-
- if ($providerIDs->length())
- {
-?>
-<tr>
- <td align='center' colspan='2'>Cancel a Federation with :</td>
-</tr>
-<tr>
- <td align='center'>Identity Provider</td><td align='center'>Profile</td>
-</tr>
-<?php
- for($i = 0; $i < $providerIDs->length() ; $i++)
- {
- $providerID = $providerIDs->getItem($i);
-?>
-<tr>
- <td align='center'><?php echo $providerID; ?></td>
- <td align='center'>
- <a href="cancel_federation.php?profile=redirect&with=<?php echo $providerID; ?>">Redirect</a> |
- <a href="cancel_federation.php?profile=soap&with=<?php echo $providerID; ?>">SOAP</a>
- </td>
-</tr>
-<tr>
- <td colspan='2'>&nbsp;</td>
-</tr>
-<?php
- }
- }
- }
-?>
-<tr>
- <td>Single Logout using </td><td><a href="logout.php?profile=soap">SOAP</a></td>
-</tr>
-<?php } ?>
-</table>
-</p>
-
-<p align='center'>
-<table align='center'>
-<caption><b>Status</b></caption>
-<tr>
- <?php
- if (!isset($_SESSION["nameidentifier"]))
- {
- echo "<td>User is <b>not</b> logged in!</td>";
- }
- else
- {
- ?>
- <td colspan='2' align="center">User <b>is</b> logged in!</td>
-</tr>
-<tr>
- <td><b>Name Identifier:</b></td><td><?php echo $_SESSION["nameidentifier"]; ?></td>
-</tr>
-<tr>
- <td><b>UserID:</b></td><td><?php echo $_SESSION["user_id"]; ?></td>
-</tr>
-<?php
-
- $query = "SELECT * FROM users WHERE user_id='". $_SESSION["user_id"] ."'";
-
- $res =& $db->query($query);
- if (DB::isError($res))
- die($res->getMessage());
-
- list($user_id, $identity_dump, $first_name, $last_name, $last_login, $created) = $res->fetchRow();
- ?>
-<tr>
- <td><b>Last Name:</b></td><td><?php echo $last_name; ?></td>
-</tr>
-<tr>
- <td><b>First Name:</b></td><td><?php echo $first_name; ?></td>
-</tr>
-<tr>
- <td><b>PHP Session ID:</b></td><td><?php echo session_id(); ?></td>
-</tr>
-<tr>
- <td><b>Account Created:</b></td><td><?php echo $created; ?></td>
-</tr>
-<tr>
- <td><b>Last Login:</b></td><td><?php echo $last_login; ?></td>
- <?php
- }
- ?>
-</tr>
-</table>
-</p>
-<br>
-<p align='center'>Copyright &copy; 2004, 2005 Entr'ouvert</p>
-</body>
-</html>
-<?php
- lasso_shutdown();
-?>
diff --git a/php/Attic/examples/sample-sp/log_view.php b/php/Attic/examples/sample-sp/log_view.php
deleted file mode 100644
index ccba208c..00000000
--- a/php/Attic/examples/sample-sp/log_view.php
+++ /dev/null
@@ -1,160 +0,0 @@
-<?php
-/*
- * Service Provider Example -- View log
- *
- * Copyright (C) 2004, 2005 Entr'ouvert
- * http://lasso.entrouvert.org
- *
- * Authors: Christophe Nowicki <cnowicki@easter-eggs.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
- require_once 'HTML/QuickForm.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");
-
- if ($config['log_handler'] != 'sql')
- die("Unsupported log handler");
-
- $number_of_msg = 8;
-
- // Count log messages
- $query = "SELECT COUNT(*) FROM log";
- $res =& $db->query($query);
- if (DB::isError($res))
- die($res->getMessage());
-
- $row = $res->fetchRow();
- $count = $row[0];
-
- $startMsg = ((empty($_GET['startMsg'])) ? 0 : $_GET['startMsg']);
-
- $query = "SELECT * FROM log ORDER BY id DESC";
- if (!isset($_GET['show_all']))
- $query .= " OFFSET $startMsg LIMIT " . ($startMsg + $number_of_msg);
-
-
- $res =& $db->query($query);
- if (DB::isError($res))
- die($res->getMessage());
-
- $numRows = $res->numRows();
-
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
-<head>
-<head>
- <title>Lasso Service Provider Example : View Logs</title>
-</head>
-<body>
-<br>
-<table border='1' width='100%'>
-<caption>Logged events</caption>
-<thead>
-<tr>
- <td colspan='4'>
- <?php
- if ($startMsg)
- echo "<a href=$PHP_SELF?startMsg=" . ($startMsg - $number_of_msg) . ">Previous</a>";
- else
- echo "Previous"
- ?>
- |
- <?php
- if ((($count - $startMsg) > $number_of_users) && !isset($_GET['show_all']))
- echo "<a href=\"" . $PHP_SELF . "?startMsg=" . ($startMsg + $number_of_msg) . "\">Next</a>";
- else
- echo "Next";
-
- if (isset($_GET['show_all']))
- echo "| <a href=\"" . $PHP_SELF ."?startMsg=0\">Paginate</a>";
- else
- {
- for ($i = 0; $i < $count; $i += $number_of_msg)
- if ($i == $startMsg)
- echo "| " . ( $i / $number_of_msg);
- else
- echo "| <a href=\"$PHP_SELF?startMsg=$i\">" . ( $i / $number_of_msg) . "</a>";
- if ($count > $number_of_msg)
- echo "| <a href=\"$PHP_SELF?show_all=1\">Show All</a>";
- }
- ?>
- </td>
-</tr>
-<tr>
- <td align='center'>date</td>
- <td align='center'>filename</td>
- <td align='center'>priority</td>
- <td align='center'>message</td>
-</tr>
-</thead>
-<tbody>
-<?php
- if ($numRows)
- {
- $num_col = $res->numCols();
- $tableinfo = $db->tableInfo($res);
-
- $desc = array("emergency", "alert", "critical", "error", "warning", "notice", "informational", "debug");
-
- while($row = $res->fetchRow())
- {
- echo "<tr>";
- for ($i = 0; $i < $num_col; $i++)
- {
- switch ($tableinfo[$i]['name'])
- {
- case "id":
- break;
- case "priority":
- echo "<td align='center'>" . $desc[$row[$i]] . "</td>";
- break;
- case "message":
- echo "<td>" . $row[$i] . "</td>";
- break;
- default:
- echo "<td align='center'>" . $row[$i] . "</td>";
- }
- }
- echo "</tr>";
- }
- }
-?>
-<tr>
-</tr>
-</tbody>
-<tfoot>
-<tr>
- <td colspan='4'>&nbsp;</td>
-</tr>
-</tfoot>
-</table>
-<br>
-<p align='center'><a href='index.php'>Index</a>
-</p>
-<br>
-<p>Copyright &copy; 2004, 2005 Entr'ouvert</p>
-</body>
-</html>
-
diff --git a/php/Attic/examples/sample-sp/login.php b/php/Attic/examples/sample-sp/login.php
deleted file mode 100644
index f04ef8a5..00000000
--- a/php/Attic/examples/sample-sp/login.php
+++ /dev/null
@@ -1,94 +0,0 @@
-<?php
-/*
- * Service Provider Example -- Simple Sing On
- *
- * Copyright (C) 2004, 2005 Entr'ouvert
- * http://lasso.entrouvert.org
- *
- * Authors: Christophe Nowicki <cnowicki@easter-eggs.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
- require_once 'Log.php';
- require_once 'DB.php';
- require_once 'session.php';
-
- $config = unserialize(file_get_contents('config.inc'));
-
- // connect to the data base
- $db = &DB::connect($config['dsn']);
- if (DB::isError($db))
- die($db->getMessage());
-
- // session handler
- session_set_save_handler("open_session", "close_session",
- "read_session", "write_session", "destroy_session", "gc_session");
-
- session_start();
-
- lasso_init();
-
- $server_dump = file_get_contents($config['server_dump_filename']);
-
- $server = LassoServer::newFromdump($server_dump);
-
- $login = new LassoLogin($server);
-
- if ($_GET['profile'] == 'post')
- $login->initAuthnRequest(LASSO_HTTP_METHOD_POST);
- elseif ($_GET['profile'] == 'artifact')
- $login->initAuthnRequest(LASSO_HTTP_METHOD_REDIRECT);
- else
- die('Unknown Single Sign ON Profile');
-
- $request = $login->authnRequest;
-
- $request->isPassive = FALSE;
- $request->nameIdPolicy = LASSO_LIB_NAMEID_POLICY_TYPE_FEDERATED;
- $request->consent = LASSO_LIB_CONSENT_OBTAINED;
-
- $login->buildAuthnRequestMsg($config['providerID']);
-
- $url = $login->msgUrl;
- $msg = $login->msgBody;
- switch ($_GET['profile'])
- {
- case 'post':
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>Authentication Request</title>
- </head>
- <body onLoad="document.forms[0].submit()">
- <form action="<?php echo $url; ?>" method="post">
- <p>You should be automaticaly redirected to an authentication server.</p>
- <p>If this page is still visible after a few seconds, press the <em>Send</em> button below.</p>
- <input type="hidden" name="LAREQ" value="<?php echo $msg; ?>" />
- <input type="submit" name="SendButton" value="Send" />
- </form>
- </body>
-</html>
-<?
- break;
- case 'artifact' :
- header("Request-URI: $url");
- header("Content-Location: $url");
- header("Location: $url\r\n\r\n");
- break;
- }
-?>
diff --git a/php/Attic/examples/sample-sp/logout.php b/php/Attic/examples/sample-sp/logout.php
deleted file mode 100644
index 0c9ba4c9..00000000
--- a/php/Attic/examples/sample-sp/logout.php
+++ /dev/null
@@ -1,145 +0,0 @@
-<?php
-/*
- * Service Provider Example -- Logout
- *
- * Copyright (C) 2004, 2005 Entr'ouvert
- * http://lasso.entrouvert.org
- *
- * Authors: Christophe Nowicki <cnowicki@easter-eggs.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
- require_once 'Log.php';
- require_once 'DB.php';
- require_once 'session.php';
-
- $config = unserialize(file_get_contents('config.inc'));
-
- // connect to the data base
- $db = &DB::connect($config['dsn']);
- if (DB::isError($db))
- die($db->getMessage());
-
- // create logger
- $conf['db'] = $db;
- $logger = &Log::factory($config['log_handler'], 'log', $_SERVER['PHP_SELF'], $conf);
-
- // session handler
- session_set_save_handler("open_session", "close_session",
- "read_session", "write_session", "destroy_session", "gc_session");
-
- session_start();
-
- if (!isset($_SESSION["nameidentifier"])) {
- $logger->log("Not logged in user '" . $_SERVER['REMOTE_ADDR'] , "', try to register.", PEAR_LOG_WARN);
- exit(0);
- }
-
- lasso_init();
-
- $server_dump = file_get_contents($config['server_dump_filename']);
-
- $server = LassoServer::newFromDump($server_dump);
-
- $logout = new LassoLogout($server, lassoProviderTypeSp);
-
- $query = "SELECT identity_dump FROM users WHERE user_id='";
- $query .= $_SESSION['user_id']."'";
-
- $res =& $db->query($query);
-
- if (DB::isError($res))
- {
- $logger->log("DB Error :" . $db->getMessage(), PEAR_LOG_CRIT);
- $logger->log("DB Error :" . $db->getDebugInfo(), PEAR_LOG_DEBUG);
- die($db->getMessage());
- }
-
- $row = $res->fetchRow();
-
- $logout->setIdentityFromDump($row[0]);
- $logout->setSessionFromDump($_SESSION['session_dump']);
-
- $logout->initRequest();
- $logout->buildRequestMsg();
-
- $url = parse_url($logout->msgUrl);
-
- $soap = sprintf(
- "POST %s HTTP/1.1\r\nHost: %s:%d\r\nContent-Length: %d\r\nContent-Type: text/xml\r\n\r\n%s\r\n",
- $url['path'], $url['host'], $url['port'],
- strlen($logout->msgBody), $logout->msgBody);
-
- $logger->log('Send SOAP Request to '. $url['host'] . ":" .$url['port']. $url['path'], PEAR_LOG_INFO);
- $logger->log('SOAP Request : ' . $soap, PEAR_LOG_DEBUG);
-
- # PHP 4.3.0 with OpenSSL support required
- $fp = fsockopen("ssl://" . $url['host'], $url['port'], $errno, $errstr, 30) or die($errstr ($errno));
- socket_set_timeout($fp, 10);
- fwrite($fp, $soap);
-
- // header
- do $header .= fread($fp, 1); while (!preg_match('/\\r\\n\\r\\n$/',$header));
-
- // chunked encoding
- if (preg_match('/Transfer\\-Encoding:\\s+chunked\\r\\n/',$header))
- {
- do {
- $byte = '';
- $chunk_size = '';
-
- do {
- $chunk_size .= $byte;
- $byte = fread($fp, 1);
- } while ($byte != "\\r");
-
- fread($fp, 1);
- $chunk_size = hexdec($chunk_size);
- $response .= fread($fp, $chunk_size);
- fread($fp, 2);
- } while ($chunk_size);
- }
- else
- {
- if (preg_match('/Content\\-Length:\\s+([0-9]+)\\r\\n/', $header, $matches))
- $response = fread($fp, $matches[1]);
- else
- while (!feof($fp)) $response .= fread($fp, 1024);
- }
- fclose($fp);
-
- $logger->log('SOAP Response Header : ' . $header, PEAR_LOG_DEBUG);
- $logger->log('SOAP Response Body : ' . $response, PEAR_LOG_DEBUG);
-
- if (!preg_match("/^HTTP\/1\\.. 200/i", $header)) {
- $logger->log("User is already logged out" . $_SERVER['REMOTE_ADDR'], PEAR_LOG_WARN);
- die("User is already logged out");
- }
-
- # Destroy The PHP Session
- $_SESSION = array();
- $logger->log("Destroy session '".session_id()."' for user '".$_SESSION['username']."'", PEAR_LOG_INFO);
- session_destroy();
-
- lasso_shutdown();
-
- $url = "index.php";
-
- header("Request-URI: $url");
- header("Content-Location: $url");
- header("Location: $url\n\r\n");
- exit;
-?>
diff --git a/php/Attic/examples/sample-sp/metadata_idp1.xml b/php/Attic/examples/sample-sp/metadata_idp1.xml
deleted file mode 100644
index af84f259..00000000
--- a/php/Attic/examples/sample-sp/metadata_idp1.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0"?>
-<EntityDescriptor
- providerID="https://idp1.lasso.lan/metadata"
- xmlns="urn:liberty:metadata:2003-08">
- <IDPDescriptor>
-
- <SingleSignOnServiceURL>https://idp1.lasso.lan:1998/singleSignOn</SingleSignOnServiceURL>
- <SingleSignOnProtocolProfile>http://projectliberty.org/profiles/brws-art</SingleSignOnProtocolProfile>
- <SingleSignOnProtocolProfile>http://projectliberty.org/profiles/brws-post</SingleSignOnProtocolProfile>
-
- <SingleLogoutServiceURL>https://idp1.lasso.lan:1998/singleLogout</SingleLogoutServiceURL>
- <SingleLogoutServiceReturnURL>https://idp1.lasso.lan:1998/singleLogoutReturn</SingleLogoutServiceReturnURL>
- <SingleLogoutProtocolProfile>http://projectliberty.org/profiles/slo-idp-soap</SingleLogoutProtocolProfile>
- <SingleLogoutProtocolProfile>http://projectliberty.org/profiles/slo-idp-http</SingleLogoutProtocolProfile>
- <SingleLogoutProtocolProfile>http://projectliberty.org/profiles/slo-sp-soap</SingleLogoutProtocolProfile>
- <SingleLogoutProtocolProfile>http://projectliberty.org/profiles/slo-sp-http</SingleLogoutProtocolProfile>
-
- <FederationTerminationServiceURL>https://idp1.lasso.lan:1998/federationTermination</FederationTerminationServiceURL>
- <FederationTerminationServiceReturnURL>https://idp1.lasso.lan:1998/federationTerminationReturn</FederationTerminationServiceReturnURL>
- <FederationTerminationNotificationProtocolProfile>http://projectliberty.org/profiles/fedterm-idp-soap</FederationTerminationNotificationProtocolProfile>
- <FederationTerminationNotificationProtocolProfile>http://projectliberty.org/profiles/fedterm-idp-http</FederationTerminationNotificationProtocolProfile>
- <FederationTerminationNotificationProtocolProfile>http://projectliberty.org/profiles/fedterm-sp-soap</FederationTerminationNotificationProtocolProfile>
- <FederationTerminationNotificationProtocolProfile>http://projectliberty.org/profiles/fedterm-sp-http</FederationTerminationNotificationProtocolProfile>
-
- <RegisterNameIdentifierServiceURL>https://idp1.lasso.lan:1998/registerNameIdentifier</RegisterNameIdentifierServiceURL>
- <RegisterNameIdentifierServiceReturnURL>https://idp1.lasso.lan:1998/registerNameIdentifierReturn</RegisterNameIdentifierServiceReturnURL>
- <RegisterNameIdentifierProtocolProfile>http://projectliberty.org/profiles/rni-idp-soap</RegisterNameIdentifierProtocolProfile>
- <RegisterNameIdentifierProtocolProfile>http://projectliberty.org/profiles/rni-idp-http</RegisterNameIdentifierProtocolProfile>
- <RegisterNameIdentifierProtocolProfile>http://projectliberty.org/profiles/rni-sp-soap</RegisterNameIdentifierProtocolProfile>
- <RegisterNameIdentifierProtocolProfile>http://projectliberty.org/profiles/rni-sp-http</RegisterNameIdentifierProtocolProfile>
-
- <NameIdentifierMappingProtocolProfile>http://projectliberty.org/profiles/nim-sp-http</NameIdentifierMappingProtocolProfile>
-
- <SoapEndpoint>https://idp1.lasso.lan:1998/soapEndpoint</SoapEndpoint>
-
-</IDPDescriptor>
-
-<Organization>
- <OrganizationName>Identity Provider idp1.lasso.lan</OrganizationName>
- <OrganizationDisplayName xml:lang="en">Identity Provider 1</OrganizationDisplayName>
- <OrganizationURL xml:lang="en">http://idp1.lasso.lan/</OrganizationURL>
-</Organization>
-
-</EntityDescriptor>
diff --git a/php/Attic/examples/sample-sp/metadata_sp1.xml b/php/Attic/examples/sample-sp/metadata_sp1.xml
deleted file mode 100644
index cf2fad08..00000000
--- a/php/Attic/examples/sample-sp/metadata_sp1.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0"?>
-<EntityDescriptor
- providerID="https://sp1.lasso.lan/metadata"
- xmlns="urn:liberty:metadata:2003-08">
- <SPDescriptor>
-
- <AssertionConsumerServiceURL id="AssertionConsumerServiceURL1" isDefault="true">https://sp1.lasso.lan:2006/assertionConsumer</AssertionConsumerServiceURL>
-
- <SingleLogoutServiceURL>https://sp1.lasso.lan:2006/singleLogout</SingleLogoutServiceURL>
- <SingleLogoutServiceReturnURL>https://sp1.lasso.lan:2006/singleLogoutReturn</SingleLogoutServiceReturnURL>
- <SingleLogoutProtocolProfile>http://projectliberty.org/profiles/slo-idp-soap</SingleLogoutProtocolProfile>
- <SingleLogoutProtocolProfile>http://projectliberty.org/profiles/slo-idp-http</SingleLogoutProtocolProfile>
- <SingleLogoutProtocolProfile>http://projectliberty.org/profiles/slo-sp-soap</SingleLogoutProtocolProfile>
- <SingleLogoutProtocolProfile>http://projectliberty.org/profiles/slo-sp-http</SingleLogoutProtocolProfile>
-
- <FederationTerminationServiceURL>https://sp1.lasso.lan:2006/federationTermination</FederationTerminationServiceURL>
- <FederationTerminationServiceReturnURL>https://sp1.lasso.lan:2006/federationTerminationReturn</FederationTerminationServiceReturnURL>
- <FederationTerminationNotificationProtocolProfile>http://projectliberty.org/profiles/fedterm-idp-soap</FederationTerminationNotificationProtocolProfile>
- <FederationTerminationNotificationProtocolProfile>http://projectliberty.org/profiles/fedterm-idp-http</FederationTerminationNotificationProtocolProfile>
- <FederationTerminationNotificationProtocolProfile>http://projectliberty.org/profiles/fedterm-sp-soap</FederationTerminationNotificationProtocolProfile>
- <FederationTerminationNotificationProtocolProfile>http://projectliberty.org/profiles/fedterm-sp-http</FederationTerminationNotificationProtocolProfile>
-
- <RegisterNameIdentifierServiceURL>https://sp1.lasso.lan:2006/registerNameIdentifier</RegisterNameIdentifierServiceURL>
- <RegisterNameIdentifierServiceReturnURL>https://sp1.lasso.lan:2006/registerNameIdentifierReturn</RegisterNameIdentifierServiceReturnURL>
- <RegisterNameIdentifierProtocolProfile>http://projectliberty.org/profiles/rni-idp-soap</RegisterNameIdentifierProtocolProfile>
- <RegisterNameIdentifierProtocolProfile>http://projectliberty.org/profiles/rni-idp-http</RegisterNameIdentifierProtocolProfile>
- <RegisterNameIdentifierProtocolProfile>http://projectliberty.org/profiles/rni-sp-soap</RegisterNameIdentifierProtocolProfile>
- <RegisterNameIdentifierProtocolProfile>http://projectliberty.org/profiles/rni-sp-http</RegisterNameIdentifierProtocolProfile>
-
- <SoapEndpoint>https://sp1.lasso.lan:2006/soapEndpoint</SoapEndpoint>
-
- <AuthnRequestsSigned>true</AuthnRequestsSigned>
-
- </SPDescriptor>
-
-<Organization>
- <OrganizationName>Service Provider sp1.lasso.lan</OrganizationName>
- <OrganizationDisplayName xml:lang="en">Service Provider 1</OrganizationDisplayName>
- <OrganizationURL xml:lang="en">http://sp1.lasso.lan/</OrganizationURL>
-</Organization>
-
-</EntityDescriptor>
diff --git a/php/Attic/examples/sample-sp/misc.php b/php/Attic/examples/sample-sp/misc.php
deleted file mode 100644
index d1f5107a..00000000
--- a/php/Attic/examples/sample-sp/misc.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-/*
- * Service Provider Example -- Misc functions
- *
- * Copyright (C) 2004, 2005 Entr'ouvert
- * http://lasso.entrouvert.org
- *
- * Authors: Christophe Nowicki <cnowicki@easter-eggs.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-function read_http_response($fp, &$header, &$response)
-{
- // header
- do $header .= fread($fp, 1); while (!preg_match('/\\r\\n\\r\\n$/',$header));
-
- // chunked encoding
- if (preg_match('/Transfer\\-Encoding:\\s+chunked\\r\\n/',$header))
- {
- do {
- $byte = '';
- $chunk_size = '';
-
- do {
- $chunk_size .= $byte;
- $byte = fread($fp, 1);
- } while ($byte != "\\r");
-
- fread($fp, 1);
- $chunk_size = hexdec($chunk_size);
- $response .= fread($fp, $chunk_size);
- fread($fp, 2);
- } while ($chunk_size);
- }
- else
- {
- if (preg_match('/Content\\-Length:\\s+([0-9]+)\\r\\n/', $header, $matches))
- $response = @fread($fp, $matches[1]);
- else
- while (!feof($fp)) $response .= fread($fp, 1024);
- }
-}
diff --git a/php/Attic/examples/sample-sp/register.php b/php/Attic/examples/sample-sp/register.php
deleted file mode 100644
index 2e80e903..00000000
--- a/php/Attic/examples/sample-sp/register.php
+++ /dev/null
@@ -1,92 +0,0 @@
-<?php
-/*
- * Service Provider Example -- Register Form
- *
- * Copyright (C) 2004, 2005 Entr'ouvert
- * http://lasso.entrouvert.org
- *
- * Authors: Christophe Nowicki <cnowicki@easter-eggs.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
- require_once 'DB.php';
- require_once 'session.php';
-
- $config = unserialize(file_get_contents('config.inc'));
-
- // connect to the data base
- $db = &DB::connect($config['dsn']);
- if (DB::isError($db))
- die($db->getMessage());
-
- // session handler
- session_set_save_handler("open_session", "close_session",
- "read_session", "write_session", "destroy_session", "gc_session");
-
- session_start();
-
- if (!isset($_SESSION["nameidentifier"])) {
- print "User is not logged in";
- exit(0);
- }
-
- switch($_POST['action']) {
- case "submit":
- // Update User info
- $query = "UPDATE users SET first_name=" . $db->quoteSmart($_POST['first_name']);
- $query .= ",last_name=" . $db->quoteSmart($_POST['last_name']);
- $query .= " WHERE user_id='".$_SESSION["user_id"]."'";
-
- $res =& $db->query($query);
- if (DB::isError($res))
- print $res->getMessage(). "\n";
-
- $url = "index.php";
- header("Request-URI: $url");
- header("Content-Location: $url");
- header("Location: $url\r\n\r\n");
- exit();
- default:
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
-<head>
-<title>Lasso Service Provider Example : Registration Form</title>
-</head>
-
-<body>
-<form name='frm' action="<?php echo $PHP_SELF; ?>" method='post'>
-<table align="center">
-<caption>Registration Form</caption>
-<tr>
- <td>First Name:</td><td><input type='text' name="first_name" maxlength='50'></td>
-</tr>
-<tr>
- <td>Last Name:</td><td><input type='text' name="last_name" maxlength='50'></td>
-</tr>
-<tr>
- <td>&nbsp;</td><td><input type='submit' value="Ok"></td>
-</tr>
-</table>
-<input type='hidden' name='action' value='submit'>
-</form>
-
-</body>
-</html>
-<?php
-}
-?>
diff --git a/php/Attic/examples/sample-sp/session.php b/php/Attic/examples/sample-sp/session.php
deleted file mode 100644
index b51bb893..00000000
--- a/php/Attic/examples/sample-sp/session.php
+++ /dev/null
@@ -1,86 +0,0 @@
-<?php
-/*
- * Pear::DB session handler
- *
- * Copyright (C) 2004, 2005 Entr'ouvert
- * http://lasso.entrouvert.org
- *
- * Authors: Christophe Nowicki <cnowicki@easter-eggs.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-function open_session ($save_path, $session_name) {
- return(true);
-}
-
-function close_session() {
- global $db;
- $db->disconnect();
- return(true);
-}
-
-function read_session ($id) {
- global $db;
-
- $query = "SELECT * FROM sessions WHERE id='$id'";
- $res =& $db->query($query);
- if (DB::isError($res))
- {
- exit;
- die($res->getMessage());
- }
-
- if ($res->numRows() == 1)
- {
- $row = $res->fetchRow();
- return ($row[2]);
- } else {
- return("");
- }
-}
-
-function write_session ($id, $sess_data) {
- global $db;
-
- $query = "DELETE FROM sessions WHERE id='$id'";
- $res =& $db->query($query);
- if (DB::isError($res))
- die($res->getMessage());
-
- $query = "INSERT INTO sessions(id, lastupdate, data) VALUES('$id', NOW(),";
- $query .= $db->quoteSmart($sess_data).")";
- $res =& $db->query($query);
- if (DB::isError($res))
- die($res->getMessage());
-}
-
-function destroy_session ($id) {
- global $db;
-
- $query = "DELETE FROM sessions WHERE id='$id'";
- $res =& $db->query($query);
- if (DB::isError($res))
- die($res->getMessage());
-
- return true;
-}
-
-function gc_session ($maxlifetime) {
- return true;
-}
-
-?>
diff --git a/php/Attic/examples/sample-sp/setup.php b/php/Attic/examples/sample-sp/setup.php
deleted file mode 100644
index ab4b1399..00000000
--- a/php/Attic/examples/sample-sp/setup.php
+++ /dev/null
@@ -1,419 +0,0 @@
-<?php
-/*
- *
- * Service Provider Example -- Installation Script
- *
- * Copyright (C) 2004, 2005 Entr'ouvert
- * http://lasso.entrouvert.org
- *
- * Authors: Christophe Nowicki <cnowicki@easter-eggs.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
- require_once 'DB.php';
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<?php
- if(!extension_loaded('lasso')) {
- $ret = @dl('lasso.' . PHP_SHLIB_SUFFIX);
- if ($ret == FALSE)
- {
- print "<p align='center'><b>The Lasso Extension is not available</b><br>";
- print "Please check your PHP extensions<br>";
- print "You can get more informations about <b>Lasso</b> at <br>";
- print "<a href='http://lasso.entrouvert.org/'>http://lasso.entrouvert.org/</a></p>";
- exit();
- }
- }
-
-
- # default config
- if (!file_exists('config.inc'))
- {
- $cwd = getcwd();
- $config = array(
- 'dsn' => "pgsql://sp:sp@localhost/sp",
- 'server_dump_filename' => "lasso_server_dump.xml",
- 'log_handler' => "sql",
- 'sp-metadata' => $cwd . "/metadata_sp1.xml",
- 'sp-private_key' => $cwd . "/private-key-raw_sp1.pem",
- 'sp-secret_key' => "",
- 'sp-ca' => $cwd . "/certificate_sp1.pem",
- 'providerID' => "https://idp1/metadata",
- 'idp-metadata' => $cwd . "/metadata_idp1.xml",
- 'idp-public_key' => $cwd . "/public-key_idp1.pem",
- 'idp-ca' => $cwd . "/certificate_idp1.pem",
- );
-
- $config_ser = serialize($config);
-
- if (($fd = fopen("config.inc", "w")))
- {
- fwrite($fd, $config_ser);
- fclose($fd);
- }
- else
- die("Could not write default config file,
- if you get a \"permission denied\" error, check the owner of the
- sample directory. (it must be www-data).");
- }
- else
- {
- $config = unserialize(file_get_contents('config.inc'));
- }
-
- if ($_POST['action'] == 'setup')
- {
- ob_start();
-
- $setup = FALSE;
-
- print "<b>Lasso Service Provider Setup</b><br>";
-
- unset($_POST['action']);
-
- $diff = array_diff($_POST, $config);
-
- foreach($diff as $key => $value) {
- $config[$key] = $value;
- }
-
- print "Check Data base : ";
-
- $db = &DB::connect($config['dsn']);
-
- if (DB::isError($db)) {
- die("Failed (" . $db->getMessage() . ")");
- }
- else
- print "OK";
-
- print "<br>Create sequence 'user_id_seq' : ";
-
- $query = "DROP SEQUENCE user_id_seq";
- $res =& $db->query($query);
-
- $query = "CREATE SEQUENCE user_id_seq";
- $res =& $db->query($query);
- if (DB::isError($res))
- die($res->getMessage());
-
- print "OK";
-
- print "<br>Create table 'users' : ";
- $query = "DROP TABLE users CASCADE";
- $res =& $db->query($query);
-
- $query = "CREATE TABLE users (
- user_id varchar(100) primary key,
- identity_dump text,
- first_name varchar(50),
- last_name varchar(50),
- last_login timestamp,
- created timestamp)";
- $res =& $db->query($query);
- if (DB::isError($res))
- die($res->getMessage());
-
- print "OK";
-
- print "<br>Create table 'nameidentifiers' : ";
-
- $query = "DROP TABLE nameidentifiers CASCADE";
- $res =& $db->query($query);
-
- $query = "CREATE TABLE nameidentifiers (
- name_identifier varchar(100) primary key,
- user_id varchar(100),
- FOREIGN KEY (user_id) REFERENCES users (user_id))";
- $res =& $db->query($query);
- if (DB::isError($res))
- die($res->getMessage());
-
- print "OK";
-
- print "<br>Create table 'log' : ";
- $query = "DROP TABLE log CASCADE";
- $res =& $db->query($query);
-
- $query = "CREATE TABLE log (
- id integer primary key,
- logtime timestamp,
- ident varchar(16),
- priority integer,
- message text)";
-
- $res =& $db->query($query);
- if (DB::isError($res))
- die($res->getMessage());
-
- print "OK";
-
-
- print "<br>Create table 'sessions' : ";
- $query = "DROP TABLE sessions CASCADE";
- $res =& $db->query($query);
-
- $query = "CREATE TABLE sessions (
- id varchar(32) primary key,
- lastupdate timestamp,
- data text)";
-
- $res =& $db->query($query);
- if (DB::isError($res))
- die($res->getMessage());
-
- print "OK";
-
- print "<br>Create table 'sso_sessions' : ";
- $query = "DROP TABLE sso_sessions CASCADE";
- $res =& $db->query($query);
-
- $query = "CREATE TABLE sso_sessions (
- name_identifier character varying(100),
- session_id character varying(32)
- )";
-
- $res =& $db->query($query);
- if (DB::isError($res))
- die($res->getMessage());
-
- print "OK";
-
-
- $db->disconnect();
-
- $keys = array_keys($config);
- $files = preg_grep("/(sp|idp)/", $keys);
-
-
- foreach($files as $file)
- {
- print "<br>Check file " . $config[$file] . " : ";
- if (!file_exists($config[$file]))
- if ($file == 'sp-secret_key')
- print "not found (optional)";
- else
- die("Failed (file does not exist)");
- else
- print "OK";
- }
-
- lasso_init();
-
- print "<br>Create Server : ";
-
- /*
- $server = new LassoServer(
- $config['sp-metadata'],
- $config['sp-public_key'],
- $config['sp-private_key'],
- $config['sp-ca']); */
-
- $server = new LassoServer(
- $config['sp-metadata'],
- $config['sp-private_key'],
- $config['sp-secret_key'],
- $config['sp-ca']);
-
- if (empty($server))
- {
- die("Failed");
- }
- else
- print "OK";
-
- print "<br>Add provider : ";
-
- $ret = $server->addProvider(
- LASSO_PROVIDER_ROLE_IDP,
- $config['idp-metadata'],
- $config['idp-public_key'],
- $config['idp-ca']);
-
- /* FIXME : check addProvider return value
- if ($ret != TRUE)
- {
- print "Failed";
- break;
- }
- else */
- print "OK";
-
- print "<br>Write XML Server Dump : ";
-
- $dump = $server->dump();
-
- if (($fd = fopen($config['server_dump_filename'], "w")))
- {
- fwrite($fd, $dump);
- fclose($fd);
- print "OK";
- }
- else
- die("Failed");
-
- lasso_shutdown();
-
- print "<br>Save configuration file : ";
-
- # Save configuration file
- $config_ser = serialize($config);
- if (($fd = fopen("config.inc", "w")))
- {
- fwrite($fd, $config_ser);
- fclose($fd);
- print "OK";
- }
- else
- {
- print("Failed");
- break;
- }
- $setup = TRUE;
- }
- ob_start();
-?>
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
-<head>
-<title>Setup script for Lasso (Liberty Alliance Single Sign On)</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" />
-<?php
- if ($setup == TRUE) {
-?>
-<meta http-equiv="Refresh" CONTENT="3; URL=index.php">
-<?php } ?>
-</head>
-<body>
-<?php
- ob_end_flush();
- ob_end_flush();
- ?>
-</body>
-</html>
-<?php
- if (empty($setup))
- {
-?>
-
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
-<head>
-<title>Setup script for Lasso (Liberty Alliance Single Sign On)</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" />
-</head>
-<body>
-<form name='frm' action='<?php echo $PHP_SELF ?>' method='POST'>
-<table>
-<caption>Lasso Service Provider Setup</caption>
-<tr>
- <td colspan='3' align='center'>Database Configuration</td>
-</tr>
-<tr>
- <td>DSN (Data Source Name) :</td><td><input type='text' name='dsn' size='50' value='<?php echo $config['dsn']; ?>' maxlength='100'></td><td><a href='http://pear.php.net/manual/en/package.database.db.intro-dsn.php' target='_new'>Help</a></td>
-</tr>
-<tr>
- <td>Server XML Dump :</td><td><input type='text' name='server_dump_filename' size='50' value='<?php echo $config['server_dump_filename']; ?>' maxlength='100'></td><td>&nbsp;</td>
-
-</tr>
-<tr>
- <td colspan='3' align='center'>Logging</td>
-</tr>
-<tr>
- <td>Handler :</td>
- <td>
- <select name='log_handler'>
- <option value="null" <?php if ($config['log_handler'] == 'null') echo 'selected="selected"'; ?>>NULL (disabled)</option>
- <option value="sql" <?php if ($config['log_handler'] == 'sql') echo 'selected="selected"'; ?>>Database</option>
- <option value="syslog" <?php if ($config['log_handler'] == 'syslog') echo 'selected="selected"'; ?>>Syslog</option>
- </select>
- </td><td>&nbsp;</td>
-</tr>
-
-<tr>
- <td colspan='3' align='center'>Service Provider</td>
-</tr>
-
-<tr>
- <td>Metadata :</td>
- <td><input type='text' name='sp-metadata' size='50' value='<?php echo $config['sp-metadata']; ?>'></td>
- <td>&nbsp;</td>
-
-</tr>
-
-
-<tr>
- <td>Private Key :</td>
- <td><input type='text' name='sp-private_key' size='50' value='<?php echo $config['sp-private_key']; ?>'></td>
- <td>&nbsp;</td>
-</tr>
-
-<tr>
- <td>Secret Key (optional) :</td>
- <td><input type='text' name='sp-secret_key' size='50' value='<?php echo $config['sp-secret_key']; ?>'></td>
- <td>&nbsp;</td>
-</tr>
-
-<tr>
- <td>Certificate :</td>
- <td><input type='text' name='sp-ca' size='50' value='<?php echo $config['sp-ca']; ?>'></td>
- <td>&nbsp;</td>
-</tr>
-
-<tr>
- <td colspan='3' align='center'>Identity Provider</td>
-</tr>
-
-<tr>
- <td>ProviderID :</td>
- <td><input type='text' name='providerID' size='50' value='<?php echo $config['providerID']; ?>'></td>
- <td>&nbsp;</td>
-</tr>
-
-<tr>
- <td>Metadata :</td>
- <td><input type='text' name='idp-metadata' size='50' value='<?php echo $config['idp-metadata']; ?>'></td>
- <td>&nbsp;</td>
-</tr>
-
-<tr>
- <td>Public Key :</td>
- <td><input type='text' name='idp-public_key' size='50' value='<?php echo $config['idp-public_key']; ?>'>
- </td><td>&nbsp;</td>
-</tr>
-<tr>
- <td>Certificate :</td>
- <td><input type='text' name='idp-ca' size='50' value='<?php echo $config['idp-ca']; ?>'></td>
- <td>&nbsp;</td>
-</tr>
-
-<tr>
- <td colspan='3'>&nbsp;</td>
-</tr>
-
-<tr>
- <td align='center' colspan='3'><input type='submit' value='setup'></td>
-</tr>
-</table>
-<input type='hidden' name='action' value='setup'>
-</form>
-<p align='center'><a href='index.php'>Index</a>
-</p>
-<p>Copyright &copy; 2004, 2005 Entr'ouvert</p>
-</body>
-</html>
-<?php
- }
-?>
diff --git a/php/Attic/examples/sample-sp/soapEndpoint.php b/php/Attic/examples/sample-sp/soapEndpoint.php
deleted file mode 100644
index 068dae18..00000000
--- a/php/Attic/examples/sample-sp/soapEndpoint.php
+++ /dev/null
@@ -1,143 +0,0 @@
-<?php
-/*
- * Identity Provider Example -- SOAP Endpoint
- *
- * Copyright (C) 2004, 2005 Entr'ouvert
- * http://lasso.entrouvert.org
- *
- * Authors: Christophe Nowicki <cnowicki@easter-eggs.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
- require_once 'Log.php';
- require_once 'DB.php';
- require_once 'session.php';
-
-
- $config = unserialize(file_get_contents('config.inc'));
-
- $server_dump = file_get_contents($config['server_dump_filename']);
-
- header("Content-Type: text/xml\r\n");
-
- // connect to the data base
- $db = &DB::connect($config['dsn']);
- if (DB::isError($db))
- {
- header("HTTP/1.0 500 Internal Server Error");
- exit;
- }
-
- // create logger
- $conf['db'] = $db;
- $logger = &Log::factory($config['log_handler'], 'log', $_SERVER['PHP_SELF'], $conf);
-
- // session handler
- session_set_save_handler("open_session", "close_session",
- "read_session", "write_session", "destroy_session", "gc_session");
-
- session_start();
-
- if (empty($HTTP_RAW_POST_DATA))
- {
- $logger->log("HTTP_RAW_POST_DATA is empty", PEAR_LOG_WARNING);
- die("HTTP_RAW_POST_DATA is empty!");
- }
-
- lasso_init();
-
- $requestype = lasso_getRequestTypeFromSoapMsg($HTTP_RAW_POST_DATA);
- $server = LassoServer::newFromDump($server_dump);
-
- switch ($requestype)
- {
- case lassoRequestTypeLogout:
- $logger->info("SOAP Logout Request from " . $_SERVER['REMOTE_ADDR']);
-
- break;
- case lassoRequestTypeDefederation:
- $logger->info("SOAP Defederation Request from " . $_SERVER['REMOTE_ADDR']);
-
- $defederation = new LassoDefederation($server, lassoProviderTypeSp);
- $defederation->processNotificationMsg($HTTP_RAW_POST_DATA, lassoHttpMethodSoap);
-
- $nameIdentifier = $defederation->nameIdentifier;
- if (empty($nameIdentifier))
- {
- header("HTTP/1.0 500 Internal Server Error");
- $logger->err("Name Identifier is empty");
- exit;
- }
-
- $query = "SELECT user_id FROM nameidentifiers WHERE name_identifier='$nameIdentifier'";
- $res =& $db->query($query);
- if (DB::isError($res))
- {
- header("HTTP/1.0 500 Internal Server Error");
- $logger->crit("DB Error :" . $res->getMessage());
- $logger->debug("DB Error :" . $res->getDebugInfo());
- exit;
- }
- if (!$res->numRows())
- {
- header("HTTP/1.0 500 Internal Server Error");
- $logger->err("Name identifier '$nameIdentifier' doesn't correspond to any user");
- exit;
- }
-
- $row = $res->fetchRow();
- $user_id = $row[0];
- $logger->debug("UserID is '$user_id");
-
- $query = "SELECT identity_dump FROM users WHERE user_id='$user_id'";
- $res =& $db->query($query);
-
- if (DB::isError($res))
- {
- header("HTTP/1.0 500 Internal Server Error");
- $logger->crit("DB Error :" . $res->getMessage());
- $logger->debug("DB Error :" . $res->getDebugInfo());
- exit;
- }
-
- if (!$res->numRows())
- {
- header("HTTP/1.0 500 Internal Server Error");
- $logger->err("User is not federated.");
- exit;
- }
- $row = $res->fetchRow();
- $identity_dump = $row[0];
-
- $defederation->setIdentityFromDump($identity_dump);
-
- // TODO : Get Session
-
- $defederation->validateNotification();
-
- $identity = $defederation->identity;
-
- if (!isset($identity->dump))
- {
- $identity_dump = $identity->dump;
- }
-
- break;
- default:
- header("HTTP/1.0 500 Internal Server Error");
- $logger->crit("Unknown or unsupported SOAP request");
- }
-
-?>
diff --git a/php/Attic/examples/sample-sp/sp_openssl.cnf b/php/Attic/examples/sample-sp/sp_openssl.cnf
deleted file mode 100644
index f0b622d7..00000000
--- a/php/Attic/examples/sample-sp/sp_openssl.cnf
+++ /dev/null
@@ -1,19 +0,0 @@
-[ req ]
-default_bits = 2048
-encrypt_key = yes
-distinguished_name = req_dn
-x509_extensions = cert_type
-prompt = no
-
-[ req_dn ]
-C=FR
-ST=Ile de France
-L=Paris
-O=Entrouvert
-OU=Automatically-generated SSL key
-CN=sp1
-emailAddress=webmaster@domain.com
-
-[ cert_type ]
-nsCertType = server
-
diff --git a/php/Attic/examples/sample-sp/view_session.php b/php/Attic/examples/sample-sp/view_session.php
deleted file mode 100644
index 056e5bb1..00000000
--- a/php/Attic/examples/sample-sp/view_session.php
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-/*
- * Service Provider Example -- Online User Viewer
- *
- * Copyright (C) 2004, 2005 Entr'ouvert
- * http://lasso.entrouvert.org
- *
- * Authors: Christophe Nowicki <cnowicki@easter-eggs.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
- require_once 'DB.php';
-
- if (!file_exists('config.inc'))
- {
-?>
-<p align='center'><b>Service Provider Configuration file is not available</b><br>
-Please run the setup script :<br>
-<a href='setup.php'>Lasso Service Provider Setup</a><br>
-You can get more informations about <b>Lasso</b> at <br>
-<a href='http://lasso.entrouvert.org/'>http://lasso.entrouvert.org/</a></p>
-<?php
- exit();
- }
- $config = unserialize(file_get_contents('config.inc'));
-
- $db = &DB::connect($config['dsn']);
-
- if (DB::isError($db))
- die($db->getMessage());
-
- $query = "SELECT * FROM sessions";
-
- $res =& $db->query($query);
- if (DB::isError($res))
- die($res->getMessage());
-
- $numRows = $res->numRows();
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
-<head>
-<title>Lasso Service Provider Example : View Online Users</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" />
-</head>
-<body>
-
-<p align='center'>
-<table align='center' width='95%'>
-<caption>Online Users</caption>
-<thead>
-<tr>
- <td>&nbsp;</td>
-</tr>
-</thead>
-<tbody>
-
-</tbody>
-<tfoot>
-<tr>
- <td>&nbsp;</td>
-</tr>
-</tfoot>
-</table>
-</p>
-
-<br>
-<p align='center'><a href='index.php'>Index</a>
-</p>
-<br>
-<p align='center'>Copyright &copy; 2004, 2005 Entr'ouvert</p>
-
-</body>
-</html>