Projet

Général

Profil

Télécharger (5,67 ko) Statistiques
| Branche: | Tag: | Révision:

univnautes / usr / local / www / services_captiveportal_saml_idp.php @ 69f21f64

1
<?php
2
/*
3
	services_captiveportal_saml_idp.php
4
	part of m0n0wall (http://m0n0.ch/wall)
5

    
6
	Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
7
	Copyright (C) 2014 Entr'ouvert <info@entrouvert.com>.
8
	All rights reserved.
9

    
10
	Redistribution and use in source and binary forms, with or without
11
	modification, are permitted provided that the following conditions are met:
12

    
13
	1. Redistributions of source code must retain the above copyright notice,
14
	   this list of conditions and the following disclaimer.
15

    
16
	2. Redistributions in binary form must reproduce the above copyright
17
	   notice, this list of conditions and the following disclaimer in the
18
	   documentation and/or other materials provided with the distribution.
19

    
20
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
24
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
	POSSIBILITY OF SUCH DAMAGE.
30
*/
31
/*
32
	pfSense_MODULE:	captiveportal
33
*/
34

    
35
##|+PRIV
36
##|*IDENT=page-services-captiveportal-saml-idp
37
##|*NAME=Services: Captive portal SAML IdP page
38
##|*DESCR=Allow access to the 'Services: Captive portal SAML IdP' page.
39
##|*MATCH=services_captiveportal_saml_idp.php*
40
##|-PRIV
41

    
42
require_once("guiconfig.inc");
43
require_once("functions.inc");
44
require_once("filter.inc");
45
require_once("shaper.inc");
46
require_once("captiveportal.inc");
47
require_once("captiveportal_saml.inc");
48

    
49
if (!is_array($config['captiveportal']))
50
	$config['captiveportal'] = array();
51
$a_cp =& $config['captiveportal'];
52

    
53
$a_cert =& $config['cert'];
54

    
55
if (!is_array($config['univnautes']))
56
	$config['univnautes'] = array();
57
$a_un =& $config['univnautes'];
58

    
59
if (!is_array($a_un['idp']))
60
	$a_un['idp'] = array();
61
$a_idp =& $a_un['idp'];
62

    
63
$pconfig['certref'] = $a_idp['certref'];
64
$pconfig['enable'] = isset($a_idp['enable']);
65

    
66
$pgtitle = array(gettext("Services"),gettext("Captive portal"), "SAML 2.0 Identity provider");
67
$shortcut_section = "captiveportal";
68

    
69
if ($_POST) {
70

    
71
	unset($input_errors);
72
	$pconfig = $_POST;
73

    
74
	/* input validation */
75
        $reqdfields = array("certref");
76
	$reqdfieldsn = array(gettext("IdP SAML 2.0 Certificate"));
77

    
78
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
79

    
80
        /* if this is an AJAX caller then handle via JSON */
81
        if (isAjax() && is_array($input_errors)) {
82
                input_errors2Ajax($input_errors);
83
                exit;
84
        }
85

    
86
	if (!$input_errors) {
87
		if ($_POST['enable'])
88
			$a_idp['enable'] = true;
89
		else
90
			unset($a_idp['enable']);
91
		$a_idp['certref'] = $pconfig['certref'];
92
		/* write config.xml */
93
		write_config();
94

    
95
		/* relaunch IdP */
96
		mwexec_bg("/usr/local/univnautes/idp/rc.sh restart");
97

    
98
		/* back to the page */
99
		pfSenseHeader("services_captiveportal_saml_idp.php");
100
	}
101
}
102
include("head.inc");
103
?>
104
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
105
<?php include("fbegin.inc"); ?>
106
<?php if ($input_errors) print_input_errors($input_errors); ?>
107
<?php if ($savemsg) print_info_box($savemsg); ?>
108

    
109
<form action="services_captiveportal_saml_idp.php" method="post" enctype="multipart/form-data" name="iform" id="iform">
110

    
111
<table width="100%" border="0" cellpadding="0" cellspacing="0">
112
  <tr><td class="tabnavtbl"><?php display_saml_tabs(basename(__FILE__)); ?></td></tr>
113
  <tr>
114
  <td class="tabcont">
115
  <table width="100%" border="0" cellpadding="6" cellspacing="0">
116

    
117
	<tr>
118
		<td colspan="2" class="list" height="12"></td>
119
	</tr>
120
	<tr>
121
		<td colspan="2" valign="top" class="listtopic"><?=gettext("Identity Provider SAML 2.0");?></td>
122
	</tr>
123

    
124
	<tr>
125
		<td width="22%" valign="top" class="vtable">&nbsp;</td>
126
		<td width="78%" class="vtable">
127
		<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?>><strong><?=gettext("Enable"); ?> </strong></td>
128
	</tr>
129

    
130
	<tr>
131
		<td width="22%" valign="top" class="vncell"><?=gettext("IdP SAML 2.0 Certificate"); ?></td>
132
		<td width="78%" class="vtable">
133
			<?php if (count($a_cert)): ?>
134
			<select name="certref" id="certref" class="formselect">
135
                        <option value="__none__">None</option>
136
				<?php
137
					foreach($a_cert as $cert):
138
						$selected = "";
139
						if ($pconfig['certref'] == $cert['refid'])
140
							$selected = "selected";
141
				?>
142
				<option value="<?=$cert['refid'];?>"<?=$selected;?>><?=$cert['descr'];?></option>
143
			<?php endforeach; ?>
144
			</select>
145
                                (go to <a href="system_certmanager.php">System &gt; Cert Manager</a> to create a new one)
146
			<?php else: ?>
147
				<b><?=gettext("No Certificates defined."); ?></b> <br/>Create one under <a href="system_certmanager.php">System &gt; Cert Manager</a>.
148
			<?php endif; ?>
149
		</td>
150
	</tr>
151
	<tr>
152
		<td colspan="2" class="list" height="12"></td>
153
	</tr>
154

    
155
	<tr>
156
	  <td width="22%" valign="top">&nbsp;</td>
157
	  <td width="78%">
158
		<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" onClick="enable_change(true)">
159
		<a href="services_captiveportal_zones.php"><input name="Cancel" type="button" class="formbtn" value="<?=gettext("Cancel"); ?>" onClick="enable_change(true)"></a>
160
	  </td>
161
	</tr>
162
  </table>
163
  </td>
164
  </tr>
165
  </table>
166
</form>
167

    
168
<p>
169
See also: <a href="system_usermanager.php">User Manager</a>.
170
</p>
171

    
172
<script language="JavaScript">
173
<!--
174
enable_change(false);
175
//-->
176
</script>
177
<?php include("fend.inc"); ?>
178
</body>
179
</html>
(146-146/251)