idp: management interface

This commit is contained in:
Thomas NOËL 2015-01-22 15:26:20 +01:00
parent 9344d387ed
commit 69f21f641b
3 changed files with 48 additions and 26 deletions

View File

@ -3,10 +3,10 @@
function display_saml_tabs($file_name) {
$tab_array = array();
$tab_array[] = array(gettext("Service provider"), false, "services_captiveportal_saml_sp.php");
# $tab_array[] = array(gettext("Identity provider"), false, "services_captiveportal_saml_idp.php");
$tab_array[] = array(gettext("Identity provider"), false, "services_captiveportal_saml_idp.php");
$tab_array[] = array(gettext("Federations"), false, "services_captiveportal_saml_federation.php");
$tab_array[] = array(gettext("Whitelists"), false, "services_captiveportal_saml_whitelist.php");
$tab_array[] = array(gettext("Blacklists"), false, "services_captiveportal_saml_blacklist.php");
$tab_array[] = array(gettext("SP Whitelists"), false, "services_captiveportal_saml_whitelist.php");
$tab_array[] = array(gettext("SP Blacklists"), false, "services_captiveportal_saml_blacklist.php");
for ($i = 0; $i < sizeof($tab_array); $i++) {
if ($tab_array[$i][2] == $file_name) {
$tab_array[$i][1] = true;

View File

@ -44,6 +44,7 @@ require_once("functions.inc");
require_once("filter.inc");
require_once("shaper.inc");
require_once("captiveportal.inc");
require_once("captiveportal_saml.inc");
if (!is_array($config['captiveportal']))
$config['captiveportal'] = array();
@ -56,10 +57,11 @@ if (!is_array($config['univnautes']))
$a_un =& $config['univnautes'];
if (!is_array($a_un['idp']))
$a_un['idp'] = array();
$a_un['idp'] = array();
$a_idp =& $a_un['idp'];
$pconfig['certref'] = $a_idp['certref'];
$pconfig['enable'] = isset($a_idp['enable']);
$pgtitle = array(gettext("Services"),gettext("Captive portal"), "SAML 2.0 Identity provider");
$shortcut_section = "captiveportal";
@ -71,7 +73,7 @@ if ($_POST) {
/* input validation */
$reqdfields = array("certref");
$reqdfieldsn = array(gettext("IdP SAML 2.0 Certificate"));
$reqdfieldsn = array(gettext("IdP SAML 2.0 Certificate"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
@ -81,17 +83,21 @@ if ($_POST) {
exit;
}
if (!$input_errors) {
$a_idp['certref'] = $pconfig['certref'];
/* write config.xml */
write_config();
if (!$input_errors) {
if ($_POST['enable'])
$a_idp['enable'] = true;
else
unset($a_idp['enable']);
$a_idp['certref'] = $pconfig['certref'];
/* write config.xml */
write_config();
/* relaunch IdP */
/* back to the page */
pfSenseHeader("services_captiveportal_saml_idp.php");
}
/* relaunch IdP */
mwexec_bg("/usr/local/univnautes/idp/rc.sh restart");
/* back to the page */
pfSenseHeader("services_captiveportal_saml_idp.php");
}
}
include("head.inc");
?>
@ -103,23 +109,30 @@ include("head.inc");
<form action="services_captiveportal_saml_idp.php" method="post" enctype="multipart/form-data" name="iform" id="iform">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td class="tabnavtbl">
<?php
$tab_array = array();
$tab_array[] = array(gettext("Service provider"), false, "services_captiveportal_saml_sp.php");
$tab_array[] = array(gettext("Identity provider"), true, "services_captiveportal_saml_idp.php");
$tab_array[] = array(gettext("Federations"), false, "services_captiveportal_saml_federation.php");
display_top_tabs($tab_array, true);
?> </td></tr>
<tr><td class="tabnavtbl"><?php display_saml_tabs(basename(__FILE__)); ?></td></tr>
<tr>
<td class="tabcont">
<table width="100%" border="0" cellpadding="6" cellspacing="0">
<tr>
<td colspan="2" class="list" height="12"></td>
</tr>
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("Identity Provider SAML 2.0");?></td>
</tr>
<tr>
<td width="22%" valign="top" class="vtable">&nbsp;</td>
<td width="78%" class="vtable">
<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?>><strong><?=gettext("Enable"); ?> </strong></td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("IdP SAML 2.0 Certificate"); ?></td>
<td width="78%" class="vtable">
<?php if (count($a_cert)): ?>
<select name="certref" id="certref" class="formselect">
<option value="__none__">None</option>
<option value="__none__">None</option>
<?php
foreach($a_cert as $cert):
$selected = "";
@ -129,16 +142,19 @@ include("head.inc");
<option value="<?=$cert['refid'];?>"<?=$selected;?>><?=$cert['descr'];?></option>
<?php endforeach; ?>
</select>
(go to <a href="system_certmanager.php">System &gt; Cert Manager</a> to create a new one)
<?php else: ?>
<b><?=gettext("No Certificates defined."); ?></b> <br/>Create one under <a href="system_certmanager.php">System &gt; Cert Manager</a>.
<?php endif; ?>
</td>
</tr>
<tr>
<td colspan="2" class="list" height="12"></td>
</tr>
<tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
<?php echo "<input name='zone' id='zone' type='hidden' value='" . htmlspecialchars($cpzone) . "'/>"; ?>
<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" onClick="enable_change(true)">
<a href="services_captiveportal_zones.php"><input name="Cancel" type="button" class="formbtn" value="<?=gettext("Cancel"); ?>" onClick="enable_change(true)"></a>
</td>
@ -148,6 +164,11 @@ include("head.inc");
</tr>
</table>
</form>
<p>
See also: <a href="system_usermanager.php">User Manager</a>.
</p>
<script language="JavaScript">
<!--
enable_change(false);

View File

@ -114,9 +114,10 @@ include("head.inc");
<div><span class="pgtitle"><a href="services_captiveportal_saml_sp.php">SAML 2.0 Configuration</a></span>
<p>
<a href="services_captiveportal_saml_sp.php">Service provider</a> |
<a href="services_captiveportal_saml_idp.php">Identity provider</a> |
<a href="services_captiveportal_saml_federation.php">Federations</a> |
<a href="services_captiveportal_saml_whitelist.php">Whitelists</a> |
<a href="services_captiveportal_saml_blacklist.php">Blacklists</a>
<a href="services_captiveportal_saml_whitelist.php">SP whitelists</a> |
<a href="services_captiveportal_saml_blacklist.php">SP blacklists</a>
</p>
</div>