From 42e6495ad11c6b6a4265e7ad378ba4dfde0e6df8 Mon Sep 17 00:00:00 2001 From: Christophe Nowicki Date: Fri, 20 Aug 2004 09:45:38 +0000 Subject: new setup system --- php/Attic/examples/sample-sp/admin_user.php | 4 +- php/Attic/examples/sample-sp/assertionConsumer.php | 6 +- php/Attic/examples/sample-sp/config.php.inc | 27 ---- php/Attic/examples/sample-sp/index.php | 43 ++++--- php/Attic/examples/sample-sp/login.php | 5 +- php/Attic/examples/sample-sp/logout.php | 6 +- php/Attic/examples/sample-sp/register.php | 6 +- php/Attic/examples/sample-sp/setup.php | 140 ++++++++++++++++++--- 8 files changed, 162 insertions(+), 75 deletions(-) delete mode 100644 php/Attic/examples/sample-sp/config.php.inc (limited to 'php') diff --git a/php/Attic/examples/sample-sp/admin_user.php b/php/Attic/examples/sample-sp/admin_user.php index 83e9b7b1..6893ad72 100644 --- a/php/Attic/examples/sample-sp/admin_user.php +++ b/php/Attic/examples/sample-sp/admin_user.php @@ -22,12 +22,12 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - include "config.php.inc"; + $config = unserialize(file_get_contents('config.inc')); require_once 'DB.php'; - $db = &DB::connect($dsn); + $db = &DB::connect($config['dsn']); if (DB::isError($db)) die($db->getMessage()); diff --git a/php/Attic/examples/sample-sp/assertionConsumer.php b/php/Attic/examples/sample-sp/assertionConsumer.php index 7f19994a..2f434e24 100644 --- a/php/Attic/examples/sample-sp/assertionConsumer.php +++ b/php/Attic/examples/sample-sp/assertionConsumer.php @@ -22,7 +22,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - include "config.php.inc"; + $config = unserialize(file_get_contents('config.inc')); require_once 'DB.php'; @@ -35,7 +35,7 @@ lasso_init(); - $server_dump = file_get_contents($server_dump_filename); + $server_dump = file_get_contents($config['server_dump_filename']); $server = lasso_server_new_from_dump($server_dump); @@ -81,7 +81,7 @@ $options = array( 'debug' => 2, ); - $db = &DB::connect($dsn, $options); + $db = &DB::connect($config['dsn'], $options); if (DB::isError($db)) die($db->getMessage()); diff --git a/php/Attic/examples/sample-sp/config.php.inc b/php/Attic/examples/sample-sp/config.php.inc deleted file mode 100644 index baf26b4a..00000000 --- a/php/Attic/examples/sample-sp/config.php.inc +++ /dev/null @@ -1,27 +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 - */ - $server_dump_filename = "lasso_server_dump.xml"; - - $dsn = "pgsql://sp:sp@localhost/sp"; -?> diff --git a/php/Attic/examples/sample-sp/index.php b/php/Attic/examples/sample-sp/index.php index 0b36a188..b0e82797 100644 --- a/php/Attic/examples/sample-sp/index.php +++ b/php/Attic/examples/sample-sp/index.php @@ -26,15 +26,28 @@ $ret = @dl('lasso.' . PHP_SHLIB_SUFFIX); if ($ret == FALSE) { - print "

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(); +?> +

The Lasso Extension is not available
+Please check your PHP extensions
+You can get more informations about Lasso at
+http://lasso.entrouvert.org/

+ +

Service 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/

+ Service Provider Administration - Setup - - Users Management - + Serice Provider Fonctionnality @@ -109,7 +115,7 @@ UserID: getMessage()); @@ -144,9 +150,6 @@

-

Lasso Version :


diff --git a/php/Attic/examples/sample-sp/login.php b/php/Attic/examples/sample-sp/login.php index 4b70c095..b1594fae 100644 --- a/php/Attic/examples/sample-sp/login.php +++ b/php/Attic/examples/sample-sp/login.php @@ -23,11 +23,12 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - include "config.php.inc"; + + $config = unserialize(file_get_contents('config.inc')); lasso_init(); - $server_dump = file_get_contents($server_dump_filename); + $server_dump = file_get_contents($config['server_dump_filename']); $server = lasso_server_new_from_dump($server_dump); diff --git a/php/Attic/examples/sample-sp/logout.php b/php/Attic/examples/sample-sp/logout.php index e55b6ba1..7662bbc6 100644 --- a/php/Attic/examples/sample-sp/logout.php +++ b/php/Attic/examples/sample-sp/logout.php @@ -22,7 +22,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - include "config.php.inc"; + $config = unserialize(file_get_contents('config.inc')); require_once 'DB.php'; @@ -38,12 +38,12 @@ lasso_init(); - $db = &DB::connect($dsn); + $db = &DB::connect($config['dsn']); if (DB::isError($db)) die($db->getMessage()); - $server_dump = file_get_contents($server_dump_filename); + $server_dump = file_get_contents($config['server_dump_filename']); $server = lasso_server_new_from_dump($server_dump); diff --git a/php/Attic/examples/sample-sp/register.php b/php/Attic/examples/sample-sp/register.php index 76b43380..427fefb5 100644 --- a/php/Attic/examples/sample-sp/register.php +++ b/php/Attic/examples/sample-sp/register.php @@ -22,8 +22,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - include "config.php.inc"; - + $config = unserialize(file_get_contents('config.inc')); + require_once 'DB.php'; session_start(); @@ -35,7 +35,7 @@ switch($_POST['action']) { case "submit": - $db = &DB::connect($dsn); + $db = &DB::connect($config['dsn']); if (DB::isError($db)) die($db->getMessage()); diff --git a/php/Attic/examples/sample-sp/setup.php b/php/Attic/examples/sample-sp/setup.php index e475d74a..ea0fd03c 100644 --- a/php/Attic/examples/sample-sp/setup.php +++ b/php/Attic/examples/sample-sp/setup.php @@ -22,7 +22,9 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - +?> + + "pgsql://sp:sp@localhost/sp", + 'server_dump_filename' => "lasso_server_dump.xml", + 'sp-metadata' => "/home/cnowicki/mcvs/lasso/tests/data/sp1-la/metadata.xml", + 'sp-public_key' => "/home/cnowicki/mcvs/lasso/tests/data/sp1-la/public-key.pem", + 'sp-private_key' => "/home/cnowicki/mcvs/lasso/tests/data/sp1-la/private-key-raw.pem", + 'sp-ca' => "/home/cnowicki/mcvs/lasso/tests/data/sp1-la/certificate.pem", + 'idp-metadata' => "/home/cnowicki/mcvs/lasso/tests/data/idp1-la/metadata.xml", + 'idp-public_key' => "/home/cnowicki/mcvs/lasso/tests/data/idp1-la/public-key.pem", + 'idp-ca' => "/home/cnowicki/mcvs/lasso/tests/data/ca1-la/certificate.pem", + ); + + $config_ser = serialize($config); + + if (($fd = fopen(getcwd()."/config.inc", "w"))) + { + fwrite($fd, $config_ser); + fclose($fd); + } + else + die("Could not write default config file"); + } + else + { + $config = unserialize(file_get_contents('config.inc')); + } - switch($_POST['action']) + if ($_POST['action'] == 'setup') { - case 'setup' : + ob_start(); + + $setup = FALSE; + print "Lasso Service Provider Setup
"; unset($_POST['action']); @@ -83,6 +117,7 @@ identity_dump text, first_name varchar(50), last_name varchar(50), + last_login timestamp, created timestamp)"; $res =& $db->query($query); if (DB::isError($res)) @@ -131,8 +166,7 @@ if (empty($server)) { - print "Failed"; - break; + die("Failed"); } else print "OK"; @@ -161,23 +195,51 @@ print "OK"; } else - print "Failed"; + 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; } - - break; - default: + $setup = TRUE; + } + ob_start(); +?> + + +Setup script for Lasso (Liberty Alliance Single Sign On) + + + + + + + + + + - Setup script for Lasso (Liberty Alliance Single Sign On) @@ -188,16 +250,64 @@ - + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - +
Lasso Service Provider Setup
DSN:' maxlength='100'>Database Configuration
DSN (Data Source Name) :' maxlength='100'>Help
Server XML Dump:' maxlength='100'> 
Service Provider
Metadata'> 
Public Key'> 
Server XML Dump:' maxlength='100'>Private Key'> 
Certificate'> 
Identity Provider
Metadata'> 
Public Key'> 
Certificate'> 
 
+ -- cgit