From acafd6b03f4b92587f3e4ec0af0c46cb3d037ba6 Mon Sep 17 00:00:00 2001
From: Christophe Nowicki
Date: Tue, 25 Jan 2005 15:31:39 +0000
Subject: Remove php samples from the lasso repository I'm still working on it.
I will release an independant Pear package for Lasso 0.6.
The pear package repository is here:
https://meuh.dyndns.org/cgi-bin/viewcvs.cgi/lasso_pear/
---
php/Attic/examples/.cvsignore | 3 -
php/Attic/examples/Makefile.am | 1 -
php/Attic/examples/README | 180 ------
php/Attic/examples/gen_keys.sh | 25 -
php/Attic/examples/sample-idp/.cvsignore | 3 -
php/Attic/examples/sample-idp/Makefile.am | 21 -
php/Attic/examples/sample-idp/README | 0
php/Attic/examples/sample-idp/admin_user.php | 306 -----------
.../examples/sample-idp/cancel_federation.php | 225 --------
php/Attic/examples/sample-idp/create_metadata.php | 144 -----
php/Attic/examples/sample-idp/defederate.php | 32 --
php/Attic/examples/sample-idp/edit_metadata.php | 61 ---
php/Attic/examples/sample-idp/federate.php | 32 --
php/Attic/examples/sample-idp/idp_openssl.cnf | 19 -
php/Attic/examples/sample-idp/index.php | 193 -------
php/Attic/examples/sample-idp/log_view.php | 160 ------
php/Attic/examples/sample-idp/login.php | 182 -------
php/Attic/examples/sample-idp/logout.php | 55 --
php/Attic/examples/sample-idp/metadata_idp1.xml | 44 --
php/Attic/examples/sample-idp/metadata_sp1.xml | 42 --
php/Attic/examples/sample-idp/misc.php | 68 ---
php/Attic/examples/sample-idp/session.php | 86 ---
php/Attic/examples/sample-idp/setup.php | 604 ---------------------
php/Attic/examples/sample-idp/singleSignOn.php | 494 -----------------
php/Attic/examples/sample-idp/soapEndpoint.php | 393 --------------
php/Attic/examples/sample-idp/user_add.php | 111 ----
php/Attic/examples/sample-idp/view_session.php | 121 -----
php/Attic/examples/sample-sp/.cvsignore | 3 -
php/Attic/examples/sample-sp/Makefile.am | 17 -
php/Attic/examples/sample-sp/README | 1 -
php/Attic/examples/sample-sp/admin_user.php | 205 -------
php/Attic/examples/sample-sp/assertionConsumer.php | 212 --------
php/Attic/examples/sample-sp/cancel_federation.php | 200 -------
php/Attic/examples/sample-sp/index.php | 214 --------
php/Attic/examples/sample-sp/log_view.php | 160 ------
php/Attic/examples/sample-sp/login.php | 94 ----
php/Attic/examples/sample-sp/logout.php | 145 -----
php/Attic/examples/sample-sp/metadata_idp1.xml | 44 --
php/Attic/examples/sample-sp/metadata_sp1.xml | 42 --
php/Attic/examples/sample-sp/misc.php | 55 --
php/Attic/examples/sample-sp/register.php | 92 ----
php/Attic/examples/sample-sp/session.php | 86 ---
php/Attic/examples/sample-sp/setup.php | 419 --------------
php/Attic/examples/sample-sp/soapEndpoint.php | 143 -----
php/Attic/examples/sample-sp/sp_openssl.cnf | 19 -
php/Attic/examples/sample-sp/view_session.php | 88 ---
46 files changed, 5844 deletions(-)
delete mode 100644 php/Attic/examples/.cvsignore
delete mode 100644 php/Attic/examples/Makefile.am
delete mode 100644 php/Attic/examples/README
delete mode 100755 php/Attic/examples/gen_keys.sh
delete mode 100644 php/Attic/examples/sample-idp/.cvsignore
delete mode 100644 php/Attic/examples/sample-idp/Makefile.am
delete mode 100644 php/Attic/examples/sample-idp/README
delete mode 100644 php/Attic/examples/sample-idp/admin_user.php
delete mode 100644 php/Attic/examples/sample-idp/cancel_federation.php
delete mode 100644 php/Attic/examples/sample-idp/create_metadata.php
delete mode 100644 php/Attic/examples/sample-idp/defederate.php
delete mode 100644 php/Attic/examples/sample-idp/edit_metadata.php
delete mode 100644 php/Attic/examples/sample-idp/federate.php
delete mode 100644 php/Attic/examples/sample-idp/idp_openssl.cnf
delete mode 100644 php/Attic/examples/sample-idp/index.php
delete mode 100644 php/Attic/examples/sample-idp/log_view.php
delete mode 100644 php/Attic/examples/sample-idp/login.php
delete mode 100644 php/Attic/examples/sample-idp/logout.php
delete mode 100644 php/Attic/examples/sample-idp/metadata_idp1.xml
delete mode 100644 php/Attic/examples/sample-idp/metadata_sp1.xml
delete mode 100644 php/Attic/examples/sample-idp/misc.php
delete mode 100644 php/Attic/examples/sample-idp/session.php
delete mode 100644 php/Attic/examples/sample-idp/setup.php
delete mode 100644 php/Attic/examples/sample-idp/singleSignOn.php
delete mode 100644 php/Attic/examples/sample-idp/soapEndpoint.php
delete mode 100644 php/Attic/examples/sample-idp/user_add.php
delete mode 100644 php/Attic/examples/sample-idp/view_session.php
delete mode 100644 php/Attic/examples/sample-sp/.cvsignore
delete mode 100644 php/Attic/examples/sample-sp/Makefile.am
delete mode 100644 php/Attic/examples/sample-sp/README
delete mode 100644 php/Attic/examples/sample-sp/admin_user.php
delete mode 100644 php/Attic/examples/sample-sp/assertionConsumer.php
delete mode 100644 php/Attic/examples/sample-sp/cancel_federation.php
delete mode 100644 php/Attic/examples/sample-sp/index.php
delete mode 100644 php/Attic/examples/sample-sp/log_view.php
delete mode 100644 php/Attic/examples/sample-sp/login.php
delete mode 100644 php/Attic/examples/sample-sp/logout.php
delete mode 100644 php/Attic/examples/sample-sp/metadata_idp1.xml
delete mode 100644 php/Attic/examples/sample-sp/metadata_sp1.xml
delete mode 100644 php/Attic/examples/sample-sp/misc.php
delete mode 100644 php/Attic/examples/sample-sp/register.php
delete mode 100644 php/Attic/examples/sample-sp/session.php
delete mode 100644 php/Attic/examples/sample-sp/setup.php
delete mode 100644 php/Attic/examples/sample-sp/soapEndpoint.php
delete mode 100644 php/Attic/examples/sample-sp/sp_openssl.cnf
delete mode 100644 php/Attic/examples/sample-sp/view_session.php
(limited to 'php')
diff --git a/php/Attic/examples/.cvsignore b/php/Attic/examples/.cvsignore
deleted file mode 100644
index 22a4e729..00000000
--- a/php/Attic/examples/.cvsignore
+++ /dev/null
@@ -1,3 +0,0 @@
-Makefile
-Makefile.in
-
diff --git a/php/Attic/examples/Makefile.am b/php/Attic/examples/Makefile.am
deleted file mode 100644
index 79505f8d..00000000
--- a/php/Attic/examples/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS = sample-sp sample-idp
diff --git a/php/Attic/examples/README b/php/Attic/examples/README
deleted file mode 100644
index 6c58ac9b..00000000
--- a/php/Attic/examples/README
+++ /dev/null
@@ -1,180 +0,0 @@
-Lasso Exemples
-----------------------------------
-
-SOFTWARE
- This directory include a Liberty Alliance Service Provider (sample-sp)
- and a Liverty Alliance Identity Provider (sample-idp) written in PHP
- with the Lasso extension.
-
-INSTALLATION
- You need the fallowing components :
- - The Apache Web Server with SSL support (http://www.apache.org)
- - OpenSSL (http://www.openssl.org)
- - PHP4 version 4.3 with OpenSSL support enabled (http://www.php.net)
- - The Lasso Extension for PHP (http://lasso.entrouvert.org)
- - A PostgreSQL database server (http://www.postgresql.org/)
- - PHP Pear modules : DB, HTML_QuickForm, Log (http://pear.php.net)
-
- Debian packages for the Lasso extension are available, they are included
- in the current development version (sid) and packages for the current stable
- version (sarge) are available in the entr'ouvert's apt repository:
-
- deb http://www.entrouvert.org ./debian/lasso/
-
- Add this line in your /etc/apt/sources.list and install the fallow packages :
-
- apt-get install apache-ssl php4 php4-lasso php4-pgsql php4-pear postgresql
-
- Pear packages can be installed with the pear command :
-
- # pear install DB HTML_Common HTML_Form HTML_QuickForm Log
-
-CONFIGURATION
-
- PostgreSQL
-
- Change user "postgres" password to access the database.
- You can do this by executing in a shell :
-
- # su - postgres
- $ psql template1
- template1=# ALTER USER postgres password 'new_pass';
- ALTER USER
- template1=# \q
-
- Change your PostgreSQL server configuration to use passwords to
- authenticate users writing in your /etc/postgresql/pg_hba.conf file:
-
- local all all password
- host all all 127.0.0.1 255.255.255.255 password
-
- Then, restart the postmaster with /etc/init.d/postgresql restart.
-
- # /etc/init.d/postgresql restart
-
- Now you can create users idp and sp in postgres. Thoses users can create
- database.
-
- $ createuser -A -d -P idp
- Enter password for new user:
- Enter it again:
- Password: <-- postgres's password used to access the database
- CREATE USER
-
- $ createuser -A -d -P sp
- [ ... ]
-
- Create databases for idp and sp.
-
- $ createdb -U idp idp
- Password: <-- idp's password
- CREATE DATABASE
-
- $ createdb -U sp sp
- [ ... ]
-
- Database setup is finished.
-
- Copy example source code in /var/lib/www :
-
- # cp -r sample-idp /var/www/idp
- # cp -r sample-sp /var/www/sp
- # chown -R www-data: /var/www/idp /var/www/sp
-
- OpenSSL
-
- To generate SSL certificat for the Identity Provider and the Service
- Provider you need the openssl command line utility.
- You need to create a certificate, a public and private key for the idp
- and the sp. In order to proceed, you can run the gen_keys.sh script or use
- the openssl command line utility :
-
- # cd /var/www/sp
- # openssl req -out certificate_sp1.pem -keyout private-key-raw_sp1.pem -x509 -nodes -newkey rsa:2048
- [ ... ]
- Common Name (eg, YOUR name) []:sp1
- [ ... ]
- # openssl x509 -in certificate_sp1.pem -noout -pubkey > public-key_sp1.pem
- # chown www-data: *.pem
-
- # cd /var/www/idp
- # openssl req -out certificate_idp1.pem -keyout private-key-raw_idp1.pem -x509 -nodes -newkey rsa:2048
- [ ... ]
- Common Name (eg, YOUR name) []:idp1
- [ ... ]
- # openssl x509 -in certificate_idp1.pem -noout -pubkey > public-key_idp1.pem
- # chown www-data: *.pem
-
- Then, copy the IdP's certificate and public key in the SP directory :
-
- # cd /var/www
- # cp -p idp/certificate_idp1.pem idp/public-key_idp1.pem sp/
-
- Copy the SP's certificate and public key in the IdP directory :
-
- # cd /var/www
- # cp -p sp/certificate_sp1.pem sp/public-key_sp1.pem idp/
-
- Enable PHP in Apache
-
- Change you Apache's configuration file to load PHP as module in your
- /etc/apache-ssl/modules.conf file :
-
- LoadModule php4_module /usr/lib/apache/1.3/libphp4.so
-
- Add Type Mime for PHP
-
- In /etc/apache-ssl/httpd.conf write :
-
- #
- # And for PHP 4.x, use:
- #
- AddType application/x-httpd-php .php
-
- PHP 4
-
- Edit PHP 4 configuration file to enable the Lasso and Postgres extension
- at the end of /etc/php4/apache/php.ini file :
-
- extension=pgsql.so
- extension=lasso.so
-
- Configure Virtual Host in Apache
-
- With a two virtual hosts setup, one for the IdP and another for the SP,
- you can try Lasso on one physical machine.
-
- At first we need to add two hosts in the /etc/hosts file :
-
- 127.0.0.2 idp1 idp1.lasso.lan
- 127.0.0.3 sp1 sp1.lasso.lan
-
- In the Apache configuration file add two lines :
-
- Listen idp1:1998
- Listen sp1:2006
-
-
- DocumentRoot /var/www/idp
- ServerName idp1
- SSLCertificateFile /var/www/idp/certificate_idp1.pem
- SSLCertificateKeyFile /var/www/idp/private-key-raw_idp1.pem
-
-
-
- DocumentRoot /var/www/sp
- ServerName sp1
- SSLCertificateFile /var/www/sp/certificate_sp1.pem
- SSLCertificateKeyFile /var/www/sp/private-key-raw_sp1.pem
-
-
-
-SETUP
-
- Now launch your favorite web browser and go to :
-
- https://idp1:1998/setup.php
-
- or
-
- https://sp1:2006/setup.php
diff --git a/php/Attic/examples/gen_keys.sh b/php/Attic/examples/gen_keys.sh
deleted file mode 100755
index cb674a30..00000000
--- a/php/Attic/examples/gen_keys.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-#
-# Generate OpenSSL certificats for PHP IdP and SP Lasso samples
-#
-
-SP=sample-sp
-SP_CFG=$SP/sp_openssl.cnf
-SP_PRV=$SP/private-key-raw_sp1.pem
-SP_CRT=$SP/certificate_sp1.pem
-SP_PUB=$SP/public-key_sp1.pem
-
-IDP=sample-idp
-IDP_CFG=$IDP/idp_openssl.cnf
-IDP_PRV=$IDP/private-key-raw_idp1.pem
-IDP_CRT=$IDP/certificate_idp1.pem
-IDP_PUB=$IDP/public-key_idp1.pem
-
-openssl req -config $SP_CFG -out $SP_CRT -keyout $SP_PRV -x509 -nodes -newkey -batch
-openssl x509 -in $SP_CRT -noout -pubkey > $SP_PUB
-
-openssl req -config $IDP_CFG -out $IDP_CRT -keyout $IDP_PRV -x509 -nodes -newkey -batch
-openssl x509 -in $IDP_CRT -noout -pubkey > $IDP_PUB
-
-cp -p $IDP_CRT $IDP_PUB $SP
-cp -p $SP_CRT $SP_PUB $IDP
diff --git a/php/Attic/examples/sample-idp/.cvsignore b/php/Attic/examples/sample-idp/.cvsignore
deleted file mode 100644
index 22a4e729..00000000
--- a/php/Attic/examples/sample-idp/.cvsignore
+++ /dev/null
@@ -1,3 +0,0 @@
-Makefile
-Makefile.in
-
diff --git a/php/Attic/examples/sample-idp/Makefile.am b/php/Attic/examples/sample-idp/Makefile.am
deleted file mode 100644
index 5f2818fb..00000000
--- a/php/Attic/examples/sample-idp/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-EXTRA_DIST = \
- admin_user.php \
- cancel_federation.php \
- create_metadata.php \
- defederate.php \
- edit_metadata.php \
- federate.php \
- index.php \
- log_view.php \
- login.php \
- logout.php \
- metadata_idp1.xml \
- metadata_sp1.xml \
- misc.php \
- session.php \
- setup.php \
- singleSignOn.php \
- soapEndpoint.php \
- user_add.php \
- view_session.php \
- README
diff --git a/php/Attic/examples/sample-idp/README b/php/Attic/examples/sample-idp/README
deleted file mode 100644
index e69de29b..00000000
diff --git a/php/Attic/examples/sample-idp/admin_user.php b/php/Attic/examples/sample-idp/admin_user.php
deleted file mode 100644
index 05767f14..00000000
--- a/php/Attic/examples/sample-idp/admin_user.php
+++ /dev/null
@@ -1,306 +0,0 @@
-
- *
- * 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'));
-
- $number_of_users = 5;
-
- // connect to the data base
- $db = &DB::connect($config['dsn']);
- if (DB::isError($db))
- die("Could not connect to the database");
-
- // 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");
-
- // Show XML dump
- if (!empty($_GET['dump']) && !empty($_GET['type']))
- {
- $query = "SELECT " . ($_GET['type'] == 'identity' ? 'identity' : 'session') .
- $query .= "_dump FROM users WHERE user_id=".$db->quoteSmart($_GET['dump']);
- $res =& $db->query($query);
- if (DB::isError($res))
- die($res->getMessage());
-
- $row = $res->fetchRow();
-?>
-
-
-
-
- Dump
-
- |
-
- |
-
-
-| Close |
-
-
-
-
-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());
-
- $logger->log("Delete User '".$_GET['del']."'", PEAR_LOG_NOTICE);
- }
-
- 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);
-
- // Count users
- $query = "SELECT COUNT(*) FROM users";
- $res =& $db->query($query);
- if (DB::isError($res))
- die($res->getMessage());
-
- $row = $res->fetchRow();
- $count = $row[0];
-
-
- $startUser = ((empty($_GET['startUser'])) ? 0 : $_GET['startUser']);
-
- $query = "SELECT * FROM users";
-
- if (!isset($_GET['show_all']))
- $query .= " OFFSET $startUser LIMIT " . ($startUser + $number_of_users);
- $res =& $db->query($query);
-
- if (DB::isError($db))
- die($db->getMessage());
-?>
-
-
-
-Lasso Identity Provider Example : Users Management
-
-
-
-
-
-
-
-
-Index
-
-
-
-Copyright © 2004, 2005 Entr'ouvert
-
-
-
-
-
diff --git a/php/Attic/examples/sample-idp/cancel_federation.php b/php/Attic/examples/sample-idp/cancel_federation.php
deleted file mode 100644
index 9593d957..00000000
--- a/php/Attic/examples/sample-idp/cancel_federation.php
+++ /dev/null
@@ -1,225 +0,0 @@
-
- *
- * 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'));
-
- $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, lassoProviderTypeIdp);
- $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 Service 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);
-
- // 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);
-
- // TODO : check reponse status
-
-
- break;
- }
-
-?>
-
-
diff --git a/php/Attic/examples/sample-idp/create_metadata.php b/php/Attic/examples/sample-idp/create_metadata.php
deleted file mode 100644
index e55e79ab..00000000
--- a/php/Attic/examples/sample-idp/create_metadata.php
+++ /dev/null
@@ -1,144 +0,0 @@
-
- *
- * 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';
-
- $form = new HTML_QuickForm('frm');
-
- $form->setDefaults(array(
- 'providerID' => 'https://',
- 'AssertionConsumerService' => 'https://',
- 'SoapEndpoint' => 'https://',
- 'SingleLogoutService' => 'https://',
- 'RegisterNameIdentifierService' => 'https://',
- 'AuthnRequestsSigned' => 1,
- 'filename' => getcwd().'/metadata.xml'
- ));
-
- $form->addElement('header', null, 'Create Liberty Alliance Metadata for an Service Provider');
- $form->addElement('text', 'providerID', 'providerID:', array('size' => 60, 'maxlength' => 255));
-
- $form->addElement('text', 'AssertionConsumerService', 'AssertionConsumerService:', array('size' => 60, 'maxlength' => 255));
-
- $form->addElement('text', 'SingleLogoutService', 'SingleLogoutService:', array('size' => 60, 'maxlength' => 255));
- $form->addElement('select', 'SingleLogoutProtocolProfile', 'SingleLogoutProtocolProfile:', array('http://projectliberty.org/profiles/slo-idp-soap'));
-
- $form->addElement('text', 'RegisterNameIdentifierService', 'RegisterNameIdentifierService:', array('size' => 60, 'maxlength' => 255));
- $form->addElement('select', 'RegisterNameIdentifierProtocolProfile', 'RegisterNameIdentifierProtocolProfile:', array('http://projectliberty.org/profiles/rni-sp-soap'));
-
- $form->addElement('text', 'SoapEndpoint', 'SoapEndpoint:', array('size' => 60, 'maxlength' => 255));
- $form->addElement('checkbox', 'AuthnRequestsSigned', 'Authn Requests must be signed? :', '');
-
- $form->addElement('textarea', 'metadata', 'Metadata:', array('cols' => 60, 'rows' => 15));
- $form->addElement('text', 'filename', 'Filename:', array('size' => 60, 'maxlength' => 255));
-
- $button[] = &HTML_QuickForm::createElement('button', null, 'Preview', array('onclick' => "write_metadata_preview();"));
- $button[] = &HTML_QuickForm::createElement('submit', null, 'Write Metadata');
-
- $form->addGroup($button, null, null, ' ', false);
-
- if ($form->validate()) {
-
- $xml = "
-exportValue('providerID') ."\" xmlns=\"urn:liberty:metadata:2003-08\">
-
- " . $form->exportValue('AssertionConsumerService') . "\n
- " . $form->exportValue('SingleLogoutService') . "
- " . $form->exportValue('SingleLogoutProtocolProfile') . "\n
- " . $form->exportValue('RegisterNameIdentifierService') . "
- " . $form->exportValue('RegisterNameIdentifierProtocolProfile') . "\n
- " . $form->exportValue('SoapEndpoint') . "\n
- " . (($form->exportValue('AuthnRequestsSigned')) ? 'true' : 'false') . "
-
-";
-
-
- if (($fd = fopen($form->exportValue('filename'), "w")))
- {
- fwrite($fd, $xml);
- fclose($fd);
- }
- else
- die("Could not write metadata file :" . $form->exportValue('filename'));
-?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-display();
-?>
-
-Copyright © 2004, 2005 Entr'ouvert
-
-
diff --git a/php/Attic/examples/sample-idp/defederate.php b/php/Attic/examples/sample-idp/defederate.php
deleted file mode 100644
index e2c107e8..00000000
--- a/php/Attic/examples/sample-idp/defederate.php
+++ /dev/null
@@ -1,32 +0,0 @@
-
- *
- * 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
- */
-
- session_start();
-
- if (!isset($_SESSION['user_id']))
- {
- die("User is not logged in!\n");
- }
-
-?>
diff --git a/php/Attic/examples/sample-idp/edit_metadata.php b/php/Attic/examples/sample-idp/edit_metadata.php
deleted file mode 100644
index 78795c57..00000000
--- a/php/Attic/examples/sample-idp/edit_metadata.php
+++ /dev/null
@@ -1,61 +0,0 @@
-
- *
- * 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
- */
-
- $filename = $_GET['filename'];
- if (!empty($filename) && file_exists($filename))
- {
- require_once 'HTML/QuickForm.php';
-
- $form = new HTML_QuickForm('frm');
-
- $form->addElement('header', null, 'Edit Liberty Alliance Metadata for an Service Provider');
- $form->addElement('text', 'providerID', 'providerID:', array('size' => 60, 'maxlength' => 255));
-
- $form->addElement('text', 'AssertionConsumerService', 'AssertionConsumerService:', array('size' => 60, 'maxlength' => 255));
-
- $form->addElement('text', 'SingleLogoutService', 'SingleLogoutService:', array('size' => 60, 'maxlength' => 255));
- $form->addElement('select', 'SingleLogoutProtocolProfile', 'SingleLogoutProtocolProfile:', array('http://projectliberty.org/profiles/slo-idp-soap'));
-
- $form->addElement('text', 'RegisterNameIdentifierService', 'RegisterNameIdentifierService:', array('size' => 60, 'maxlength' => 255));
- $form->addElement('select', 'RegisterNameIdentifierProtocolProfile', 'RegisterNameIdentifierProtocolProfile:', array('http://projectliberty.org/profiles/rni-sp-soap'));
-
- $form->addElement('text', 'SoapEndpoint', 'SoapEndpoint:', array('size' => 60, 'maxlength' => 255));
- $form->addElement('checkbox', 'AuthnRequestsSigned', 'Authn Requests must be signed? :', '');
-?>
-
-
-
- Edit Metadata
-
-
-display();
-?>
-
-Copyright © 2004, 2005 Entr'ouvert
-
-
-
diff --git a/php/Attic/examples/sample-idp/federate.php b/php/Attic/examples/sample-idp/federate.php
deleted file mode 100644
index 46da3fc9..00000000
--- a/php/Attic/examples/sample-idp/federate.php
+++ /dev/null
@@ -1,32 +0,0 @@
-
- *
- * 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
- */
-
- session_start();
-
- if (!isset($_SESSION['user_id']))
- {
- die("User is not logged in!\n");
- }
-
-?>
diff --git a/php/Attic/examples/sample-idp/idp_openssl.cnf b/php/Attic/examples/sample-idp/idp_openssl.cnf
deleted file mode 100644
index 7336057c..00000000
--- a/php/Attic/examples/sample-idp/idp_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=idp1
-emailAddress=webmaster@domain.com
-
-[ cert_type ]
-nsCertType = server
-
diff --git a/php/Attic/examples/sample-idp/index.php b/php/Attic/examples/sample-idp/index.php
deleted file mode 100644
index 3fda8a13..00000000
--- a/php/Attic/examples/sample-idp/index.php
+++ /dev/null
@@ -1,193 +0,0 @@
-
- *
- * 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)
- {
-?>
-The Lasso Extension is not available
-Please check your PHP extensions
-You can get more informations about Lasso at
-http://lasso.entrouvert.org/
-
-Identity Provider Configuration file is not available
-Please run the setup script :
-Lasso Service Provider Setup
-You can get more informations about Lasso at
-http://lasso.entrouvert.org/
-getMessage());
-
- // session handler
- session_set_save_handler("open_session", "close_session",
- "read_session", "write_session", "destroy_session", "gc_session");
-
- session_start();
-
- lasso_init();
-
- // Create Lasso Server
- $server_dump = file_get_contents($config['server_dump_filename']);
- $server = LassoServer::newFromDump($server_dump);
-?>
-
-
-
-Lasso Identity Provider Example
-
-
-
-
-
- Identity Provider Administration
- Setup
- Users Management
- View Online Users
-
-
View log
-
-
-
- Identity Provider Fonctionnality
-
-
-
- Local Login
-setIdentityFromDump($_SESSION['identity_dump']);
- if (!empty($_SESSION['session_dump']))
- $login->setSessionFromDump($_SESSION['sesion_dump']);
- $identity = $login->identity;
- $providerIDs = $identity->providerIds;
-
- if ($providerIDs->length())
- {
-?>
-Cancel a Federation with :
-
-
-
-
- | Service Provider |
- Profile |
-
-
-
-length() ; $i++)
- {
- $providerID = $providerIDs->getItem($i);
-?>
-
- |
-
- Redirect |
- SOAP
- |
-
-
-
-
-
-
-Your are not Federated with an Service Provider.
-
-
-Local Logout
-
-
-
-
-Status
-
- User is not logged in!";
- }
- else
- {
- ?>
- | User is logged in! |
-
-
- | UserID: | |
-
-
- | User Name: | |
-
-
- | PHP Session ID: | |
-
-
-
-
-
-Copyright © 2004, 2005 Entr'ouvert
-
-
-
-
-
diff --git a/php/Attic/examples/sample-idp/log_view.php b/php/Attic/examples/sample-idp/log_view.php
deleted file mode 100644
index 40f2025d..00000000
--- a/php/Attic/examples/sample-idp/log_view.php
+++ /dev/null
@@ -1,160 +0,0 @@
-
- *
- * 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();
-
-?>
-
-
-
-
- Lasso Identity Provider Example : View Logs
-
-
-
-
-Logged events
-
-
- |
- Previous";
- else
- echo "Previous"
- ?>
- |
- $number_of_users) && !isset($_GET['show_all']))
- echo "Next";
- else
- echo "Next";
-
- if (isset($_GET['show_all']))
- echo "| Paginate";
- else
- {
- for ($i = 0; $i < $count; $i += $number_of_msg)
- if ($i == $startMsg)
- echo "| " . ( $i / $number_of_msg);
- else
- echo "| " . ( $i / $number_of_msg) . "";
- if ($count > $number_of_msg)
- echo "| Show All";
- }
- ?>
- |
-
-
- | date |
- filename |
- priority |
- message |
-
-
-
-numCols();
- $tableinfo = $db->tableInfo($res);
-
- $desc = array("emergency", "alert", "critical", "error", "warning", "notice", "informational", "debug");
-
- while($row = $res->fetchRow())
- {
- echo "";
- for ($i = 0; $i < $num_col; $i++)
- {
- switch ($tableinfo[$i]['name'])
- {
- case "id":
- break;
- case "priority":
- echo "| " . $desc[$row[$i]] . " | ";
- break;
- case "message":
- echo "" . $row[$i] . " | ";
- break;
- default:
- echo "" . $row[$i] . " | ";
- }
- }
- echo "
";
- }
- }
-?>
-
-
-
-
-
- | |
-
-
-
-
-Index
-
-
-Copyright © 2004, 2005 Entr'ouvert
-
-
-
diff --git a/php/Attic/examples/sample-idp/login.php b/php/Attic/examples/sample-idp/login.php
deleted file mode 100644
index 7c4d3c3d..00000000
--- a/php/Attic/examples/sample-idp/login.php
+++ /dev/null
@@ -1,182 +0,0 @@
-
- *
- * 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 '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("Could not connect to the database");
-
- // 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();
-
- /*
- *
- */
- function sendHTTPBasicAuth()
- {
- global $logger;
-
- header('WWW-Authenticate: Basic realm="Lasso Identity Provider One"');
- header('HTTP/1.0 401 Unauthorized');
- echo "Acces Denied";
- $logger->log("User from '" . $_SERVER['REMOTE_ADDR'] . "' pressed the cancel button during HTTP basic authentication request", PEAR_LOG_NOTICE);
- }
-
- function startLocalSession($user_id, $username)
- {
- global $db, $logger;
-
- $_SESSION['user_id'] = $user_id;
- $_SESSION['username'] = $username;
-
- $query = "SELECT identity_dump,session_dump FROM users WHERE user_id='$user_id'";
-
- $res =& $db->query($query);
-
- if (DB::isError($res))
- {
- $logger->log("DB Error :" . $res->getMessage(), PEAR_LOG_CRIT);
- $logger->log("DB Error :" . $res->getDebugInfo(), PEAR_LOG_DEBUG);
- die("Could not fetch identity and session dump");
- }
- if ($res->numRows())
- {
- $row = $res->fetchRow();
- if (!empty($row[0]))
- $_SESSION['identity_dump'] = $row[0];
- if (!empty($row[1]))
- $_SESSION['session_dump'] = $row[1];
- }
-
- $logger->log("User '$username' ($user_id) authenticated, local session started", PEAR_LOG_NOTICE);
-
- $url = 'index.php';
- header("Request-URI: $url");
- header("Content-Location: $url");
- header("Location: $url\r\n\r\n");
- exit;
- }
-
- /*
- * This function authentificate the user against the Users Database
- */
- function authentificateUser($db, $username, $password)
- {
- global $logger;
-
- $query = "SELECT user_id FROM users WHERE username=".$db->quoteSmart($username);
- $query .= " AND password=".$db->quoteSmart($password);
-
- $res =& $db->query($query);
- if (DB::isError($res))
- {
- $logger->log("DB Error :" . $res->getMessage(), PEAR_LOG_CRIT);
- $logger->log("DB Error :" . $res->getDebugInfo(), PEAR_LOG_DEBUG);
- die("Internal Server Error");
- }
-
- if ($res->numRows())
- {
- $row = $res->fetchRow();
- return ($row[0]);
- }
- return (0);
- }
-
- if ($config['auth_type'] == 'auth_basic')
- {
- if (!isset($_SERVER['PHP_AUTH_USER']))
- {
- sendHTTPBasicAuth();
- exit;
- }
- else
- {
- // Check Login and Password
- if (!($user_id = authentificateUser($db, $_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])))
- {
- $logger->warning("Authentication failure with login '". $_SERVER['PHP_AUTH_USER'] . " password '"
- . $_SERVER['PHP_AUTH_PW'] ."' IP " . $_SERVER['REMOTE_ADDR']);
- sendHTTPBasicAuth();
- exit;
- }
- else
- startLocalSession($user_id, $_SERVER['PHP_AUTH_USER']);
- }
- }
- else if ($config['auth_type'] == 'auth_form')
- {
-
- $form = new HTML_QuickForm('frm');
-
- $form->addElement('header', null, 'Login on the Lasso Identity Provider Example');
-
- $form->addElement('text', 'username', 'Username:', array('size' => 50, 'maxlength' => 255));
- $form->addElement('password', 'password', 'Password:', array('size' => 50, 'maxlength' => 255));
- $form->addElement('submit', null, 'Ok');
-
- $form->addRule('username', 'Please enter the Username', 'required', null, 'client');
- $form->addRule('password', 'Please enter the Password', 'required', null, 'client');
-
- if ($form->validate())
- {
- if (($user_id = authentificateUser($db, $form->exportValue('username'), $form->exportValue('password'))))
- {
- startLocalSession($user_id, $form->exportValue('username'));
- }
- else
- $logger->log("Authentication failure with login '".$form->exportValue('username')." password '". $form->exportValue('password') ."' IP '" . $_SERVER['REMOTE_ADDR']."'", PEAR_LOG_WARNING);
- }
-?>
-
-
-
-display();
-?>
-
-
-log("Unknown authentification type '". $config['auth_type'] ."', check IdP setup", PEAR_LOG_ALERT);
- die('Unknown authentification type');
- }
-?>
diff --git a/php/Attic/examples/sample-idp/logout.php b/php/Attic/examples/sample-idp/logout.php
deleted file mode 100644
index 4089c8dd..00000000
--- a/php/Attic/examples/sample-idp/logout.php
+++ /dev/null
@@ -1,55 +0,0 @@
-
- *
- * 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("Could not connect to the database");
-
- // 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();
-
- // Destroy The PHP Session
- $_SESSION = array();
- session_destroy();
-
- $url = "index.php";
- header("Request-URI: $url");
- header("Content-Location: $url");
- header("Location: $url\r\n\r\n");
- exit;
-?>
diff --git a/php/Attic/examples/sample-idp/metadata_idp1.xml b/php/Attic/examples/sample-idp/metadata_idp1.xml
deleted file mode 100644
index af84f259..00000000
--- a/php/Attic/examples/sample-idp/metadata_idp1.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
- https://idp1.lasso.lan:1998/singleSignOn
- http://projectliberty.org/profiles/brws-art
- http://projectliberty.org/profiles/brws-post
-
- https://idp1.lasso.lan:1998/singleLogout
- https://idp1.lasso.lan:1998/singleLogoutReturn
- http://projectliberty.org/profiles/slo-idp-soap
- http://projectliberty.org/profiles/slo-idp-http
- http://projectliberty.org/profiles/slo-sp-soap
- http://projectliberty.org/profiles/slo-sp-http
-
- https://idp1.lasso.lan:1998/federationTermination
- https://idp1.lasso.lan:1998/federationTerminationReturn
- http://projectliberty.org/profiles/fedterm-idp-soap
- http://projectliberty.org/profiles/fedterm-idp-http
- http://projectliberty.org/profiles/fedterm-sp-soap
- http://projectliberty.org/profiles/fedterm-sp-http
-
- https://idp1.lasso.lan:1998/registerNameIdentifier
- https://idp1.lasso.lan:1998/registerNameIdentifierReturn
- http://projectliberty.org/profiles/rni-idp-soap
- http://projectliberty.org/profiles/rni-idp-http
- http://projectliberty.org/profiles/rni-sp-soap
- http://projectliberty.org/profiles/rni-sp-http
-
- http://projectliberty.org/profiles/nim-sp-http
-
- https://idp1.lasso.lan:1998/soapEndpoint
-
-
-
-
- Identity Provider idp1.lasso.lan
- Identity Provider 1
- http://idp1.lasso.lan/
-
-
-
diff --git a/php/Attic/examples/sample-idp/metadata_sp1.xml b/php/Attic/examples/sample-idp/metadata_sp1.xml
deleted file mode 100644
index cf2fad08..00000000
--- a/php/Attic/examples/sample-idp/metadata_sp1.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
-
- https://sp1.lasso.lan:2006/assertionConsumer
-
- https://sp1.lasso.lan:2006/singleLogout
- https://sp1.lasso.lan:2006/singleLogoutReturn
- http://projectliberty.org/profiles/slo-idp-soap
- http://projectliberty.org/profiles/slo-idp-http
- http://projectliberty.org/profiles/slo-sp-soap
- http://projectliberty.org/profiles/slo-sp-http
-
- https://sp1.lasso.lan:2006/federationTermination
- https://sp1.lasso.lan:2006/federationTerminationReturn
- http://projectliberty.org/profiles/fedterm-idp-soap
- http://projectliberty.org/profiles/fedterm-idp-http
- http://projectliberty.org/profiles/fedterm-sp-soap
- http://projectliberty.org/profiles/fedterm-sp-http
-
- https://sp1.lasso.lan:2006/registerNameIdentifier
- https://sp1.lasso.lan:2006/registerNameIdentifierReturn
- http://projectliberty.org/profiles/rni-idp-soap
- http://projectliberty.org/profiles/rni-idp-http
- http://projectliberty.org/profiles/rni-sp-soap
- http://projectliberty.org/profiles/rni-sp-http
-
- https://sp1.lasso.lan:2006/soapEndpoint
-
- true
-
-
-
-
- Service Provider sp1.lasso.lan
- Service Provider 1
- http://sp1.lasso.lan/
-
-
-
diff --git a/php/Attic/examples/sample-idp/misc.php b/php/Attic/examples/sample-idp/misc.php
deleted file mode 100644
index 9f305b13..00000000
--- a/php/Attic/examples/sample-idp/misc.php
+++ /dev/null
@@ -1,68 +0,0 @@
-
- *
- * 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);
- }
-}
-
-function isDBError($res)
-{
- global $logger;
-
- if (DB::isError($res))
- {
- $logger->log("DB Error :" . $res->getMessage(), PEAR_LOG_CRIT);
- $logger->log("DB Error :" . $res->getDebugInfo(), PEAR_LOG_DEBUG);
- die("Internal Server Error");
- }
-}
-
diff --git a/php/Attic/examples/sample-idp/session.php b/php/Attic/examples/sample-idp/session.php
deleted file mode 100644
index b51bb893..00000000
--- a/php/Attic/examples/sample-idp/session.php
+++ /dev/null
@@ -1,86 +0,0 @@
-
- *
- * 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-idp/setup.php b/php/Attic/examples/sample-idp/setup.php
deleted file mode 100644
index ddc956a5..00000000
--- a/php/Attic/examples/sample-idp/setup.php
+++ /dev/null
@@ -1,604 +0,0 @@
-
- *
- * 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
- */
-?>
-
-The Lasso Extension is not available
";
- print "Please check your PHP extensions
";
- print "You can get more informations about Lasso at
";
- print "http://lasso.entrouvert.org/";
- exit();
- }
- }
-
- /*
- * This callback function is called by array_walk and
- * add an service provider to the identity provider.
- */
- function add_service_provider(&$item, $key, $server)
- {
- print "
$key : ";
-
- $ret = $server->addProvider(LASSO_PROVIDER_ROLE_SP,
- $item['metadata'],
- $item['public_key'],
- $item['ca']);
-
- /* FIXME : check addProvider return value
- if ($ret != TRUE)
- {
- print "Failed";
- break;
- }
- else */
- print "OK";
- }
-
- function write_config_inc($config)
- {
- $config_ser = serialize($config);
- $filename = "config.inc";
-
- if ($fd = fopen($filename, "w"))
- {
- fwrite($fd, $config_ser);
- fclose($fd);
- return TRUE;
- }
- return FALSE;
- }
-
- require_once 'DB.php';
-
- # default config
- if (!file_exists('config.inc'))
- {
- $cwd = getcwd();
- $config = array(
- 'dsn' => "pgsql://idp:idp@localhost/idp",
- 'server_dump_filename' => "lasso_server_dump.xml",
- 'log_handler' => 'sql',
- 'auth_type' => 'auth_form',
- 'idp-metadata' => $cwd . "/metadata_idp1.xml",
- 'idp-private_key' => $cwd . "/private-key-raw_idp1.pem",
- 'idp-secret_key' => "",
- 'idp-ca' => $cwd . "/certificate_idp1.pem",
- 'sp' => array(
- 'sp1' => array(
- 'metadata' => $cwd . "/metadata_sp1.xml",
- 'public_key' => $cwd . "/public-key_sp1.pem",
- 'ca' => $cwd . "/certificate_sp1.pem")
- /* another service provider
- 'sp2' => array(
- 'metadata' => "/home/cnowicki/mcvs/lasso/tests/data/sp2-la/metadata.xml",
- 'public_key' => "/home/cnowicki/mcvs/lasso/tests/data/sp2-la/public-key.pem",
- 'ca' => "/home/cnowicki/mcvs/lasso/tests/data/ca1-la/certificate.pem") */
- ));
-
- $config_ser = serialize($config);
- if (!write_config_inc($config))
- 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'));
- }
-
- $keys = array_keys($_POST);
-
- $to_del = preg_grep('/delete_(\w)/', $keys);
-
- if (!empty($to_del))
- {
- $keys = array_values($to_del);
- foreach($keys as $key)
- {
- $name = substr($key, 7);
- unset($config['sp'][$name]);
- write_config_inc($config);
- }
- }
-
- $to_update = preg_grep('/update_(\w)/', $keys);
-
- if (!empty($to_update))
- {
- $keys = array_values($to_update);
- foreach($keys as $key)
- {
- $name = substr($key, 7);
- $config['sp'][$name]['metadata'] = $_POST['sp^'.$name.'^metadata'];
- $config['sp'][$name]['public_key'] = $_POST['sp^'.$name.'^public_key'];
- $config['sp'][$name]['ca'] = $_POST['sp^'.$name.'^ca'];
- write_config_inc($config);
- }
- }
-
-
- if (array_key_exists('new', $_POST))
- {
- $form = array('sp' => 'Name',
- 'metadata' => 'Metadata',
- 'public_key' => 'Public Key',
- 'ca' => 'Certificate');
-
- foreach ($form as $input => $name)
- if (empty($_POST[$input]))
- die("Field $name is empty");
-
- $config['sp'][$_POST['sp']] = array(
- 'metadata' => $_POST['metadata'],
- 'public_key' => $_POST['public_key'],
- 'ca' => $_POST['ca']);
-
- write_config_inc($config);
- }
-
- if (array_key_exists('setup', $_POST))
- {
- ob_start();
-
- $setup = FALSE;
-
- print "Lasso Identity Provider Setup
";
-
- unset($_POST['setup'], $_POST['metadata'], $_POST['public_key'], $_POST['ca'], $_POST['sp']);
-
- $sps = array_values(preg_grep("/sp\^/", array_keys($_POST)));
-
-
- $_POST['sp'] = array();
-
- foreach ($sps as $sp) {
- list($null, $name, $type) = split("\^", $sp, 3);
- $_POST['sp'][$name][$type] = $_POST[$sp];
- unset($_POST[$sp]);
- }
-
- $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 "
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 "
Create table 'users' : ";
- $query = "DROP TABLE users CASCADE";
- $res =& $db->query($query);
-
- $query = "CREATE TABLE users (
- user_id varchar(100) primary key,
- username varchar(255) unique,
- password varchar(255),
- identity_dump text,
- session_dump text,
- created timestamp)";
- $res =& $db->query($query);
- if (DB::isError($res))
- die($res->getMessage());
-
- print "OK";
-
- print "
Insert user 'test' into 'users' : ";
-
- $query = "INSERT INTO users(user_id, username, password, created) ";
- $query .= "VALUES (nextval('user_id_seq'), 'test', 'test', NOW())";
-
- $res =& $db->query($query);
- if (DB::isError($res))
- die($res->getMessage());
- print "OK";
-
- print "
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 "
Create table 'assertions' : ";
- $query = "DROP TABLE assertions CASCADE";
- $res =& $db->query($query);
-
- $query = "CREATE TABLE assertions (
- assertion text,
- response_dump text,
- created timestamp)";
-
- $res =& $db->query($query);
- if (DB::isError($res))
- die($res->getMessage());
-
- print "OK";
-
- print "
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 "
Create sequence 'log_id' : ";
-
- $query = "DROP SEQUENCE log_id";
- $res =& $db->query($query);
-
- $query = "CREATE SEQUENCE log_id";
- $res =& $db->query($query);
- if (DB::isError($res))
- die($res->getMessage());
-
- print "OK";
-
- print "
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 "
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),
- ip integer
- )";
-
- $res =& $db->query($query);
- if (DB::isError($res))
- die($res->getMessage());
-
- print "OK";
-
- $db->disconnect();
-
- // Check if IdP files does exists
- $keys = array_keys($config);
- $files = preg_grep("/idp/", $keys);
-
- foreach($files as $file)
- {
- print "
Check file " . $config[$file] . " : ";
- if (!file_exists($config[$file]))
- {
- if ($file == 'idp-secret_key')
- print "not found (optional)";
- else
- die("Failed (file does not exist)");
- }
- else
- print "OK";
- }
-
-
- foreach($config['sp'] as $key)
- {
- foreach ($key as $file)
- {
- print "
Check file " . $file . " : ";
- if (!file_exists($file))
- {
- die("Failed (file does not exist)");
- }
- else
- print "OK";
-
- }
- }
-
- lasso_init();
-
- print "
Create Server : ";
-
- /*
- $server = new LassoServer(
- $config['idp-metadata'],
- $config['idp-public_key'],
- $config['idp-private_key'],
- $config['idp-ca']);
- */
-
- $server = new LassoServer(
- $config['idp-metadata'],
- $config['idp-private_key'],
- $config['idp-secret_key'],
- $config['idp-ca']);
-
- if (empty($server))
- die("Failed");
- else
- print "OK";
-
-
- print "
Add Service Provider(s) :";
-
- array_walk($config['sp'], 'add_service_provider', $server);
-
- print "
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 "
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;
- }
- $setup_log = ob_get_contents();
- ob_end_clean();
-?>
-
-
-Setup script for Lasso (Liberty Alliance Single Sign On)
-
-
-
-
-
-
-Back to Index
-
-
-
-
-
-
-
-Index
-
-Copyright © 2004, 2005 Entr'ouvert
-
-