added edit sp metadata to the setup system

This commit is contained in:
Christophe Nowicki 2004-09-08 15:43:51 +00:00
parent a0e6291fb2
commit 070e552257
4 changed files with 102 additions and 37 deletions

View File

@ -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
}
?>

View File

@ -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>&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>Private Key</td><td><input type='text' name='idp-private_key' size='50' value='<?php echo $config['idp-private_key']; ?>'></td><td>&nbsp;</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>&nbsp;</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>&nbsp;</td>

View File

@ -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)

View File

@ -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 &copy; 2004 Entr'ouvert</p>
</body>
</html>
<?php
}
?>