Skip to content

Commit

Permalink
add cert validation option
Browse files Browse the repository at this point in the history
  • Loading branch information
gpspake committed Oct 25, 2015
1 parent b984b1d commit 70f27ef
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cas-maestro.php
Expand Up @@ -69,6 +69,7 @@ function __construct() {
'server_hostname' => 'yourschool.edu',
'server_port' => '443',
'server_path' => '',
'cert_path' => '',
'e-mail_registration' => 1,
'global_sender'=>get_bloginfo('admin_email'),
'full_name' => '',
Expand Down Expand Up @@ -140,10 +141,11 @@ function init($run_cas=true) {
// function added in phpCAS v. 0.6.0
// checking for static method existance is frustrating in php4
$phpCas = new phpCas();
if (method_exists($phpCas, 'setNoCasServerValidation'))
if (method_exists($phpCas, 'setCasServerCACert') && $this->settings['cert_path'])
phpCAS::setCasServerCACert($this->settings['cert_path']);
elseif (method_exists($phpCas, 'setNoCasServerValidation'))
phpCAS::setNoCasServerValidation();
unset($phpCas);
// if you want to set a cert, replace the above few lines

if(defined('CAS_MAESTRO_DEBUG_ON') && CAS_MAESTRO_DEBUG_ON == true)
phpCAS::setDebug(CAS_MAESTRO_PLUGIN_PATH . 'debug.log');
Expand Down Expand Up @@ -584,6 +586,7 @@ function save_settings() {
'server_hostname' => $_POST['server_hostname'],
'server_port' => $_POST['server_port'],
'server_path' => $_POST['server_path'],
'cert_path' => $_POST['cert_path'],
//LDAP Settings
'ldap_protocol'=>$_POST['ldap_protocol'],
'ldap_server'=>$_POST['ldap_server'],
Expand Down
15 changes: 15 additions & 0 deletions views/metaboxes/general.php
Expand Up @@ -31,6 +31,21 @@
</tr>
</tbody>
</table>
<h2><?php _e('Certificate validation','CAS_Maestro'); ?></h2>
<fieldset class="options">
<p><?php _e("Path to certificat for validation of the legitimacy of the cas server. Recommended for production use.", 'CAS_Maestro'); ?></p>
<p class="grey_text"><?php _e("No certificate validation will be used if path is left blank", 'CAS_Maestro'); ?></p>
<p class="grey_text"><?php _e("", 'CAS_Maestro'); ?></p>
<table width="700px" cellspacing="2" cellpadding="5" class="editform">
<tbody>
<tr>
<th width="150px" scope="row"><label for="cert_path_inp"><?php _e('Cert path', 'CAS_Maestro'); ?></label></th>
<td>
<input type="text" name="cert_path" id="cert_path_inp" value="<?php echo $this->settings['cert_path']; ?>" size="25" />
</td>
</tr>
</tbody>
</table>
<div class='availability_result' id="username_availability_result"></div>
<h2><?php _e('Menu localization', 'CAS_Maestro'); ?></h2>
<p>
Expand Down

0 comments on commit 70f27ef

Please sign in to comment.