diff -Nur -x '*.orig' -x '*.rej' jappix/php/desktop.php mezzanine_patched_jappix/php/desktop.php --- jappix/php/desktop.php 2012-01-16 22:51:37.000000000 +0100 +++ mezzanine_patched_jappix/php/desktop.php 2012-07-13 14:23:02.625826144 +0200 @@ -16,6 +16,31 @@ // Someone is trying to hack us? if(!defined('JAPPIX_BASE')) exit; +if (AUTH_CAS == 'on'){ + ini_set('include_path', ini_get('include_path').PATH_SEPARATOR.'/usr/share/pear'); + require_once('CAS.php'); + if (DEVELOPER == 'on'){ + phpCAS::setDebug(session_save_path() . '/cas.log'); + } + phpCAS::proxy(CAS_VERSION_2_0,CAS_SERVER,443,CAS_URI); + phpCAS::setPGTStorageFile(session_save_path()); + if (CAS_CACERT != '' && file_exists (CAS_CACERT)){ + phpCAS::setCasServerCACert(CAS_CACERT); + } else { + phpCAS::setNoCasServerValidation(); + } + phpCAS::forceAuthentication(); + $user=phpCAS::getUser(); + $pt=phpCAS::retrievePT('xmpp://'.HOST_MAIN,$err_code,$output); + + if(preg_match('/^PT\-/', $pt)){ + $js="doLogin('" . $user . "', '".HOST_MAIN."', '" . $pt . "', '".JAPPIX_RESOURCE."', '80',false)"; + } else{ + $js=""; + } + // Destroy PHP Session now, so that the user will be able to reconnect later + session_destroy(); +} ?> @@ -40,7 +65,7 @@ } ?> - + 'off', 'compression' => 'off', 'multi_files' => 'off', - 'developer' => 'off' + 'developer' => 'off', + 'auth_cas' => 'off', + 'cas_server' => 'https://cas.domain.tld', + 'cas_uri' => '', + 'cas_cacert' => '' ); // Define a default values array @@ -73,5 +77,10 @@ define('COMPRESSION', $main_conf['compression']); define('MULTI_FILES', $main_conf['multi_files']); define('DEVELOPER', $main_conf['developer']); +define('AUTH_CAS', $main_conf['auth_cas']); +define('CAS_SERVER', $main_conf['cas_server']); +define('CAS_URI', $main_conf['cas_uri']); +define('CAS_CACERT', $main_conf['cas_cacert']); + ?>