diff options
| author | Christophe Nowicki <cnowicki@easter-eggs.com> | 2004-09-08 15:43:51 +0000 |
|---|---|---|
| committer | Christophe Nowicki <cnowicki@easter-eggs.com> | 2004-09-08 15:43:51 +0000 |
| commit | 070e552257daeb15c24dce902b6d9d1a17d7b15d (patch) | |
| tree | be1686d42f4db2c70b682c6b1390b8e04e979485 /php | |
| parent | a0e6291fb2482f5c926ab2599c2d85a80f9f59ab (diff) | |
| download | lasso-070e552257daeb15c24dce902b6d9d1a17d7b15d.tar.gz lasso-070e552257daeb15c24dce902b6d9d1a17d7b15d.tar.xz lasso-070e552257daeb15c24dce902b6d9d1a17d7b15d.zip | |
added edit sp metadata to the setup system
Diffstat (limited to 'php')
| -rw-r--r-- | php/Attic/examples/sample-idp/edit_metadata.php | 59 | ||||
| -rw-r--r-- | php/Attic/examples/sample-idp/setup.php | 12 | ||||
| -rw-r--r-- | php/Attic/examples/sample-idp/singleSignOn.php | 16 | ||||
| -rw-r--r-- | php/Attic/examples/sample-idp/user_add.php | 52 |
4 files changed, 102 insertions, 37 deletions
diff --git a/php/Attic/examples/sample-idp/edit_metadata.php b/php/Attic/examples/sample-idp/edit_metadata.php new file mode 100644 index 00000000..8d8927e7 --- /dev/null +++ b/php/Attic/examples/sample-idp/edit_metadata.php @@ -0,0 +1,59 @@ +<?php +/* + * Identity Provider Example -- Setup + * + * Copyright (C) 2004 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 + */ + + $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? :', ''); +?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> + <title>Edit Metadata</title> +</head> +<body> +<?php + $form->display(); +?> +</body> +</html> +<?php + } +?> diff --git a/php/Attic/examples/sample-idp/setup.php b/php/Attic/examples/sample-idp/setup.php index 75cf9fc6..5acdde45 100644 --- a/php/Attic/examples/sample-idp/setup.php +++ b/php/Attic/examples/sample-idp/setup.php @@ -1,6 +1,5 @@ <?php /* - * * Identity Provider Example -- Setup * * Copyright (C) 2004 Entr'ouvert @@ -209,7 +208,7 @@ $query = "CREATE TABLE users ( user_id varchar(100) primary key, - username varchar(255), + username varchar(255) unique, password varchar(255), user_dump text, session_dump text)"; @@ -369,7 +368,7 @@ function openpopup(popurl) { - var winpops=window.open(popurl,"","width=600,height=400") + var winpops=window.open(popurl,"","width=745,height=600") } //--> </script> @@ -396,17 +395,14 @@ <tr> <td>Metadata</td><td><input type='text' name='idp-metadata' size='50' value='<?php echo $config['idp-metadata']; ?>'></td><td> </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> </td> - </tr> <tr> <td>Private Key</td><td><input type='text' name='idp-private_key' size='50' value='<?php echo $config['idp-private_key']; ?>'></td><td> </td> - </tr> <tr> @@ -424,8 +420,8 @@ <caption>Service Provider <b><?php echo $sp ?></caption> <tr> - <td>Metadata</td><td><input type='text' name='sp^<?php echo $sp; ?>^metadata' size='50' value='<?php echo $config['sp'][$sp]['metadata']; ?>'></td><td> </td> - + <td>Metadata</td><td><input type='text' name='sp^<?php echo $sp; ?>^metadata' size='50' value='<?php echo $config['sp'][$sp]['metadata']; ?>'></td> + <td><a href="javascript:openpopup('edit_metadata.php?filename=<?php echo $config['sp'][$sp]['metadata']; ?>')">Edit Metadata</a></td> </tr> <tr> <td>Public Key</td><td><input type='text' name='sp^<?php echo $sp; ?>^public_key' size='50' value='<?php echo $config['sp'][$sp]['public_key']; ?>'></td><td> </td> diff --git a/php/Attic/examples/sample-idp/singleSignOn.php b/php/Attic/examples/sample-idp/singleSignOn.php index 27ae27b6..93d040f7 100644 --- a/php/Attic/examples/sample-idp/singleSignOn.php +++ b/php/Attic/examples/sample-idp/singleSignOn.php @@ -88,16 +88,12 @@ } else { - // Save name identifier - if (!$res->numRows()) - { - $query = "INSERT INTO nameidentifiers (name_identifier, user_id) "; - $query .= "VALUES ('" . $login->nameIdentifier . "','$user_id')"; - $res =& $db->query($query); - if (DB::isError($res)) - die($res->getMessage()); - $name_identifier = $login->nameIdentifier; - } + $query = "INSERT INTO nameidentifiers (name_identifier, user_id) "; + $query .= "VALUES ('" . $login->nameIdentifier . "','$user_id')"; + $res =& $db->query($query); + if (DB::isError($res)) + die($res->getMessage()); + $name_identifier = $login->nameIdentifier; } if ($login->isIdentityDirty) diff --git a/php/Attic/examples/sample-idp/user_add.php b/php/Attic/examples/sample-idp/user_add.php index ff363f28..c763d3de 100644 --- a/php/Attic/examples/sample-idp/user_add.php +++ b/php/Attic/examples/sample-idp/user_add.php @@ -22,9 +22,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -?> -<?php require_once 'HTML/QuickForm.php'; require_once 'DB.php'; @@ -38,38 +35,52 @@ $form->addRule('username', 'Please enter the Username', 'required', null, 'client'); $form->addRule('password', 'Please enter the Password', 'required', null, 'client'); - if ($form->validate()) { - - $config = unserialize(file_get_contents('config.inc')); + if ($form->validate()) + { + $config = unserialize(file_get_contents('config.inc')); - $db = &DB::connect($config['dsn']); - if (DB::isError($db)) + $db = &DB::connect($config['dsn']); + if (DB::isError($db)) die($db->getMessage()); - $query = "INSERT INTO users (user_id, username, password) VALUES(nextval('user_id_seq'),'"; - $query .= $form->exportValue('username') . "','" . $form->exportValue('password') . "')"; + $query = "INSERT INTO users (user_id, username, password) VALUES(nextval('user_id_seq'),'"; + $query .= $form->exportValue('username') . "','" . $form->exportValue('password') . "')"; - $res =& $db->query($query); - if (DB::isError($db)) - die($db->getMessage()); - - $db->disconnect(); + $res =& $db->query($query); + if (DB::isError($res)) + die("username exist!"); + $db->disconnect(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> -<body onLoad="window.close()"> +<script type="text/javascript"> +<!-- + function reload_and_close() + { + opener.document.location.reload(); + window.close(); + } + +// --> +</script> +</head> +<body onLoad="reload_and_close();"> </body> </html> <?php - exit; - } + } + else + { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> -<body> +<head> + <title>Add User</title> +</head> +<body onLoad="window.focus();"> <?php $form->display(); ?> @@ -77,3 +88,6 @@ <p>Copyright © 2004 Entr'ouvert</p> </body> </html> +<?php + } +?> |
