setFixedServiceURL() public static method

Set the fixed URL that will be set as the CAS service parameter. When this method is not called, a phpCAS script uses its own URL.
public static setFixedServiceURL ( string $url ) : void
$url string the URL
return void
Ejemplo n.º 1
0
function toggle_auth_checked_in_redirect()
{
    $url = phpCAS::getServiceURL();
    $without_auth_checked = removeParameterFromUrl('auth_checked', $url);
    if ($url == $without_auth_checked) {
        $url .= (strpos($url, '?') === false ? '?' : '&') . 'auth_checked=true';
    } else {
        $url = $without_auth_checked;
        debug_msg("removing auth_checked from url to have a clean final url: {$url}");
    }
    phpCAS::setFixedServiceURL($url);
}
 protected function initializeCASClient()
 {
     if (!phpCAS::isInitialized()) {
         // Set debug mode
         phpCAS::setDebug(false);
         //Initialize phpCAS
         phpCAS::client(CAS_VERSION_2_0, Configure::read('user_config.cas.hostname'), Configure::read('user_config.cas.port'), Configure::read('user_config.cas.uri'), true);
         phpCAS::setFixedServiceURL($this->loginRedirectURL());
         // No SSL validation for the CAS server
         phpCAS::setNoCasServerValidation();
     }
     return true;
 }
Ejemplo n.º 3
0
 public static function InitCAS()
 {
     if (!self::$_InitCAS) {
         $aliasName = OCP\Config::getAppValue('user_cas', 'cas_aliasName', '');
         $casVersion = OCP\Config::getAppValue('user_cas', 'cas_server_version', '2.0');
         $casHostname = OCP\Config::getAppValue('user_cas', 'cas_server_hostname', 'ident.domain.fr');
         $casPort = OCP\Config::getAppValue('user_cas', 'cas_server_port', '443');
         $casPath = OCP\Config::getAppValue('user_cas', 'cas_server_path', '/cas');
         phpCAS::client($casVersion, $casHostname, (int) $casPort, $casPath, false);
         if ($aliasName) {
             phpCAS::setFixedServiceURL($aliasName);
         }
         phpCAS::setNoCasServerValidation();
         self::$_InitCAS = true;
     }
     return self::$_InitCAS;
 }
Ejemplo n.º 4
0
 public function triggerAuth($service_url = null)
 {
     self::buildClient($this->config->get('cas-hostname'), $this->config->get('cas-port'), $this->config->get('cas-context'));
     // Force set the CAS service URL to the osTicket login page.
     if ($service_url) {
         phpCAS::setFixedServiceURL($service_url);
     }
     // Verify the CAS server's certificate, if configured.
     if ($this->config->get('cas-ca-cert-path')) {
         phpCAS::setCasServerCACert($this->config->get('cas-ca-cert-path'));
     } else {
         phpCAS::setNoCasServerValidation();
     }
     // Trigger authentication and set the user fields when validated.
     if (!phpCAS::isAuthenticated()) {
         phpCAS::forceAuthentication();
     } else {
         $this->setUser();
         $this->setEmail();
         $this->setName();
     }
 }
Ejemplo n.º 5
0
<?php

include_once 'phpCAS/CAS.php';
phpCAS::setDebug("/tmp/cas.log");
phpCAS::client(CAS_VERSION_2_0, 'fed.princeton.edu', 443, 'cas');
// force CAS authentication
phpCAS::setNoCasServerValidation();
phpCAS::setFixedServiceURL(BASE_URL . "admin");
if (!phpCAS::checkAuthentication()) {
    phpCAS::forceAuthentication();
}
if (isset($_REQUEST['logout'])) {
    phpCAS::logout();
}
$loginUsername = phpCAS::getUser();
//$loginUsername = "******";
#mysql_select_db($database_Locator, $Locator);
$LoginRS__query = sprintf("SELECT username_usr, level_usr FROM lctr_User_usr WHERE username_usr='******'", get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername));
$LoginRS = $dbconnects["stage"]->query($LoginRS__query) or die(mysql_error());
$loginFoundUser = $LoginRS->num_rows;
if (!$loginFoundUser) {
    header("Location: denied.php");
}
Ejemplo n.º 6
0
function RWSPCReqs()
{
    global $RWSESL3;
    global $RWSCRURL;
    $r_rwc = RWSGSOpt("rwscas", PARAM_ALPHANUM);
    if ($r_rwc === false || strlen($r_rwc) == 0) {
        return;
    }
    if ($r_rwc != "1" && $r_rwc != "2" && $r_rwc != "3") {
        return;
    }
    $r_ver = RWSGSOpt("version", PARAM_ALPHANUMEXT);
    if ($r_ver === false || strlen($r_ver) == 0) {
        return;
    }
    $r_rwu = RWSGSOpt("rwsuser", PARAM_RAW);
    if ($r_rwu === false || strlen($r_rwu) == 0) {
        unset($r_rwu);
    }
    $r_rwp = RWSGSOpt("rwspass", PARAM_RAW);
    if ($r_rwp === false || strlen($r_rwp) == 0) {
        unset($r_rwp);
    }
    $r_tkt = RWSGSOpt("ticket", PARAM_RAW);
    if ($r_tkt === false || strlen($r_tkt) == 0) {
        unset($r_tkt);
    }
    $r_pid = RWSGSOpt("pgtId", PARAM_RAW);
    if ($r_pid === false || strlen($r_pid) == 0) {
        unset($r_pid);
    }
    $r_piou = RWSGSOpt("pgtIou", PARAM_RAW);
    if ($r_piou === false || strlen($r_piou) == 0) {
        unset($r_piou);
    }
    $r_aus = get_enabled_auth_plugins();
    foreach ($r_aus as $r_aun) {
        $r_aup = get_auth_plugin($r_aun);
        if (strcasecmp($r_aup->authtype, RWSCAS) == 0) {
            $r_csp = $r_aup;
            break;
        }
    }
    if (!isset($r_csp)) {
        return;
    }
    if (empty($r_csp->config->hostname)) {
        return;
    }
    list($r_v1, $r_v2, $r_v3) = explode(".", phpCAS::getVersion());
    $r_csp->connectCAS();
    if ($r_rwc == "1") {
        if (isset($r_tkt)) {
            RWSRHXml();
            echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n";
            echo "<rwscas>\r\n";
            echo "\t<st>";
            echo utf8_encode(htmlspecialchars(trim($r_tkt)));
            echo "\t</st>\r\n";
            echo "</rwscas>\r\n";
            exit;
        } else {
            if ($_SERVER['REQUEST_METHOD'] == "GET") {
                $r_ok = phpCAS::checkAuthentication();
                if (!isset($r_rwu)) {
                    $r_rwu = phpCAS::getUser();
                }
                if (!isset($r_rwp)) {
                    $r_rwp = "passwdCas";
                }
                RWSLIMUser($r_rwu, $r_rwp, $r_ok);
            } else {
                if ($_SERVER['REQUEST_METHOD'] == "POST") {
                    $r_psd = urldecode(file_get_contents("php://input"));
                    if (stripos($r_psd, "<samlp:LogoutRequest ") !== false) {
                        RWSAOLog();
                    }
                }
            }
        }
    } else {
        if ($r_rwc == "2") {
            if (isset($r_pid) && isset($r_piou)) {
                if ($r_csp->config->proxycas) {
                    phpCAS::checkAuthentication();
                }
            } else {
                if ($_SERVER['REQUEST_METHOD'] == "POST") {
                    $r_psd = urldecode(file_get_contents("php://input"));
                    if (stripos($r_psd, "<samlp:LogoutRequest ") !== false) {
                        RWSAOLog();
                    }
                }
            }
        } else {
            if ($r_rwc == "3") {
                if (isset($r_tkt)) {
                    if (strlen($RWSCRURL) > 0) {
                        $r_svu = $RWSCRURL;
                    } else {
                        $r_svu = RWSGSUrl(false, false);
                    }
                    $r_svu .= "?rwscas=1";
                    if (isset($r_ver)) {
                        $r_svu .= "&version=";
                        $r_svu .= urlencode($r_ver);
                    }
                    if (isset($r_rwu)) {
                        $r_svu .= "&rwsuser="******"&rwspass="******"?rwscas=2";
                        if (isset($r_ver)) {
                            $r_cbu .= "&version=";
                            $r_cbu .= urlencode($r_ver);
                        }
                        if (isset($r_rwu)) {
                            $r_cbu .= "&rwsuser="******"&rwspass="******"2008");
}
Ejemplo n.º 7
0
 public static function initialized_php_cas()
 {
     if (!self::$_initialized_php_cas) {
         $casVersion = OCP\Config::getAppValue('user_cas', 'cas_server_version', '2.0');
         $casHostname = OCP\Config::getAppValue('user_cas', 'cas_server_hostname', $_SERVER['SERVER_NAME']);
         $casPort = OCP\Config::getAppValue('user_cas', 'cas_server_port', 443);
         $casPath = OCP\Config::getAppValue('user_cas', 'cas_server_path', '/cas');
         $casDebugFile = OCP\Config::getAppValue('user_cas', 'cas_debug_file', '');
         $casCertPath = OCP\Config::getAppValue('user_cas', 'cas_cert_path', '');
         $php_cas_path = OCP\Config::getAppValue('user_cas', 'cas_php_cas_path', 'CAS.php');
         $cas_service_url = OCP\Config::getAppValue('user_cas', 'cas_service_url', '');
         if (!class_exists('phpCAS')) {
             if (empty($php_cas_path)) {
                 $php_cas_path = 'CAS.php';
             }
             \OCP\Util::writeLog('cas', "Try to load phpCAS library ({$php_cas_path})", \OCP\Util::DEBUG);
             include_once $php_cas_path;
             if (!class_exists('phpCAS')) {
                 \OCP\Util::writeLog('cas', 'Fail to load phpCAS library !', \OCP\Util::ERROR);
                 return false;
             }
         }
         if ($casDebugFile !== '') {
             phpCAS::setDebug($casDebugFile);
         }
         phpCAS::client($casVersion, $casHostname, (int) $casPort, $casPath, false);
         if (!empty($cas_service_url)) {
             phpCAS::setFixedServiceURL($cas_service_url);
         }
         if (!empty($casCertPath)) {
             phpCAS::setCasServerCACert($casCertPath);
         } else {
             phpCAS::setNoCasServerValidation();
         }
         self::$_initialized_php_cas = true;
     }
     return self::$_initialized_php_cas;
 }
Ejemplo n.º 8
0
    /**
     * Initialize CAS client
     * 
     */
    private function cas_init() {
        if (!$this->cas_inited) {
            // retrieve configurations
            $cfg = rcmail::get_instance()->config->all();

            // include phpCAS
			require_once('/usr/share/php/CAS/CAS.php');
			phpCAS::setDebug('/var/log/lcs/casdebug.log');
            
            // initialize CAS client
            if ($cfg['cas_proxy']) {
                phpCAS::proxy(CAS_VERSION_2_0, $cfg['cas_hostname'], $cfg['cas_port'], $cfg['cas_uri'], false);

                // set URL for PGT callback
                phpCAS::setFixedCallbackURL($this->generate_url(array('action' => 'pgtcallback')));
                
                // set PGT storage
                #phpCAS::setPGTStorageFile('xml', $cfg['cas_pgt_dir']);
				phpCAS::setPGTStorageFile($cfg['cas_pgt_dir']);
            }
            else {
                phpCAS::client(CAS_VERSION_2_0, $cfg['cas_hostname'], $cfg['cas_port'], $cfg['cas_uri'], false);
            }

            // set service URL for authorization with CAS server
            phpCAS::setFixedServiceURL($this->generate_url(array('action' => 'login', 'task' => 'mail')));

            // set SSL validation for the CAS server
            if ($cfg['cas_validation'] == 'self') {
                phpCAS::setCasServerCert($cfg['cas_cert']);
            }
            else if ($cfg['cas_validation'] == 'ca') {
                phpCAS::setCasServerCACert($cfg['cas_cert']);
            }
            else {
                phpCAS::setNoCasServerValidation();
            }

            // set login and logout URLs of the CAS server
            phpCAS::setServerLoginURL($cfg['cas_login_url']);
            phpCAS::setServerLogoutURL($cfg['cas_logout_url']);

            $this->cas_inited = true;
        }
    }
 function __buildAuth()
 {
     if (!is_object($this->db)) {
         require_once "./Services/Database/classes/class.ilDBWrapperFactory.php";
         $ilDB = ilDBWrapperFactory::getWrapper();
         $ilDB->initFromIniFile();
         $ilDB->connect();
         $this->db = $ilDB;
     }
     $GLOBALS["ilDB"] = $this->db;
     $this->init->initSettings();
     $this->init->buildHTTPPath();
     include_once './Services/Administration/classes/class.ilSetting.php';
     $set = new ilSetting();
     /*$query = "SELECT * FROM sett ings WHERE ".
     			" keyword = ".$this->db->quote("cas_server")." OR ".
     			" keyword = ".$this->db->quote("cas_port")." OR ".
     			" keyword = ".$this->db->quote("cas_uri");
     		$res = $this->db->query($query);
     		$cas_set = array();
     		while ($rec = $res->fetchRow(DB_FETCHMODE_ASSOC))
     		{
     			$cas_set[$rec["keyword"]] = $rec["value"];
     		}*/
     $cas_set["cas_server"] = $set->get("cas_server");
     $cas_set["cas_port"] = $set->get("cas_port");
     $cas_set["cas_uri"] = $set->get("cas_uri");
     $auth_params = array("server_version" => CAS_VERSION_2_0, "server_hostname" => $cas_set["cas_server"], "server_port" => $cas_set["cas_port"], "server_uri" => $cas_set["cas_uri"]);
     include_once "Services/CAS/classes/class.ilCASAuth.php";
     $this->auth = new ilCASAuth($auth_params);
     // HTTP path will return full path to server.php directory
     phpCAS::setFixedServiceURL(ILIAS_HTTP_PATH . "/webservice/soap/server.php");
     return true;
 }
Ejemplo n.º 10
0
 public function logIn()
 {
     global $QUERY;
     $login_url = DOKU_URL . 'doku.php?id=' . $QUERY;
     phpCAS::setFixedServiceURL($login_url);
     phpCAS::forceAuthentication();
 }
Ejemplo n.º 11
0
 /**
  * Method to setup Purdue CAS params and redirect to pucas auth URL
  *
  * @param   object  $view  view object
  * @param   object  $tpl   template object
  * @return  void
  */
 public function display($view, $tpl)
 {
     if (Config::get('debug')) {
         $debug_location = $this->params->get('debug_location', '/var/log/apache2/php/phpCAS.log');
         phpCAS::setDebug($debug_location);
     }
     $this->initialize();
     $return = '';
     if ($view->return) {
         $return = '&return=' . $view->return;
     }
     if ($this->isBoilerkeyRequired()) {
         $loginUrl = 'https://www.purdue.edu/apps/account/cas/login?boilerkeyRequired=true&service=';
         $loginUrl .= urlencode(self::getRedirectUri('pucas') . $return);
         phpCAS::setServerLoginURL($loginUrl);
     } else {
         phpCAS::setFixedServiceURL(self::getRedirectUri('pucas') . $return);
     }
     phpCAS::forceAuthentication();
     App::redirect(self::getRedirectUri('pucas') . $return);
 }
Ejemplo n.º 12
0
 public function setFixedServiceURL($url)
 {
     \phpCAS::setFixedServiceURL($url);
 }
Ejemplo n.º 13
0
  	<body>
  		Authenticating with CAS, please wait...
	</body>
	<script>
//-------------------- PHPCAS SECTION ----------------------------	
<?php 
require_once '../resources/CASAuthentication/CAS.php';
//PHPCAS Library Import
phpCAS::client(CAS_VERSION_2_0, 'cas.byu.edu', 443, '/cas');
//Setup the phpCAS client
//------------------------------------------------------------
phpCAS::setNoCasServerValidation();
//Don't validate with SSL
$url = 'http://128.187.104.23:1337/demeter/CASLogic.php';
//Return url after validation
phpCAS::setFixedServiceURL($url);
//Set the return URL
if (isset($_REQUEST['logout'])) {
    //If wanting to log out
    echo "Logging Out.";
    $_SESSION['AUTH'] = false;
    //Make user unable to call backend functions
    $_SESSION['AUTH_USER'] = '';
    //Removed stored user
    $url = "http://128.187.104.23:1337/demeter/index.html";
    //url to return to after completion
    phpCAS::logoutWithRedirectServiceAndUrl($url, '');
    //set return url
} else {
    $auth = phpCAS::checkAuthentication();
    //Go to CAS and verify
Ejemplo n.º 14
0
 protected function iniciar_pedido_cas()
 {
     $this->instanciar_cliente_cas();
     phpCAS::setExtraCurlOption(CURLOPT_SSLVERSION, 3);
     // Se genera la URL de servicio
     $param = array();
     if (isset($this->parametros_url) && is_array($this->parametros_url)) {
         $param = $this->parametros_url;
     }
     $url = $this->generar_url($param);
     phpCAS::setFixedServiceURL($url);
     // Tipo de auth
     if (toba::instalacion()->es_produccion()) {
         phpCAS::setCasServerCACert($this->archivo_certificado, $this->validar_cn);
     } else {
         phpCAS::setNoCasServerValidation();
     }
     phpCAS::setServerLoginURL('');
     /** Llamada principal al authentificación de CAS, si no estás
     		autenticado te redirecciona ahí adentro y no sigue ejecutando
     		Si pasa está función significa que estás autenticado **/
     phpCAS::forceAuthentication();
 }
Ejemplo n.º 15
0
// dans un répertoire correspondant a l'include_path du php.ini (exemple : /var/lib/php)
include_once dirname(__FILE__) . '/CAS/CAS.php';
// cas.sso est le fichier d'informations de connexions au serveur cas
// Le fichier cas.sso doit etre stocké dans un sous-répertoire « CAS »
// dans un répertoire correspondant a l'include_path du php.ini (exemple : /var/lib/php)
include dirname(__FILE__) . '/CAS/cas.sso';
/* declare le script comme un client CAS
 Si le dernier argument est à true, cela donne la possibilité à phpCAS d'ouvrir une session php.
*/
phpCAS::client(CAS_VERSION_2_0, $serveurSSO, $serveurSSOPort, $serveurSSORacine, true);
phpCAS::setLang(PHPCAS_LANG_FRENCH);
//            phpCAS::setCasServerCACert();
//Set the fixed URL that will be set as the CAS service parameter. When this method is not called, a phpCAS script uses its own URL.
//Le paramètre $Url_CAS_setFixedServiceURL est défini dans le fichier config.inc.php
if (isset($Url_CAS_setFixedServiceURL) && $Url_CAS_setFixedServiceURL != '') {
    phpCAS::setFixedServiceURL($Url_CAS_setFixedServiceURL);
}
/*
Commentez la ligne suivante si vous avez une erreur du type
PHP Fatal error:  Call to undefined method phpCAS::setnocasservervalidation() in /var/www/html/grr/include/cas.inc.php
Nécessite une version de phpCAS supérieure ou égale à 1.0.0.
*/
phpCAS::setNoCasServerValidation();
/*
Gestion du single sign-out (version 1.0.0 de phpcas)
Commentez la ligne suivante si vous avez une erreur du type
PHP Fatal error:  Call to undefined method phpCAS::handlelogoutrequests() in /var/www/html/grr/include/cas.inc.php
*/
phpCAS::handleLogoutRequests(false);
if (phpCAS::checkAuthentication()) {
    // L'utilisateur est déjà authentifié, on continue
Ejemplo n.º 16
0
	function validate_user_cas(&$user, $checkOnly = false)
	{
		global $tikilib, $prefs, $base_url;

		// just make sure we're supposed to be here
		if (!$this->_init_cas_client()) {
			return false;
		}

		// Redirect to this URL after authentication
		if ( !empty($prefs['cas_extra_param']) && basename($_SERVER['SCRIPT_NAME']) == 'tiki-login.php' ) {
			phpCAS::setFixedServiceURL($base_url . 'tiki-login.php?cas=y&' . $prefs['cas_extra_param']);
		}

		// check CAS authentication
		phpCAS::setNoCasServerValidation();
		if ( $checkOnly ) {
			unset($_SESSION['phpCAS']['auth_checked']);
			$auth = phpCAS::checkAuthentication();
		} else {
			$auth = phpCAS::forceAuthentication();
		}
		$_SESSION['cas_validation_time'] = $tikilib->now;

		// at this step, the user has been authenticated by the CAS server
		// and the user's login name can be read with phpCAS::getUser().
		if ( $auth && ($user = strtolower(phpCAS::getUser())) ) {
			return USER_VALID;
		} else {
			$user = null;
			return PASSWORD_INCORRECT;
		}

	}
Ejemplo n.º 17
0
function xcas_auth($groupid, $ruleid)
{
    Debuglogs("Rule:{$ruleid} Groupid:{$groupid} Testing source groups...", __FUNCTION__, __LINE__);
    if (!isMustAuth($ruleid)) {
        Debuglogs("Rule:{$ruleid} Groupid:{$groupid} From groups not match rule.", __FUNCTION__, __LINE__);
        return;
    }
    Debuglogs("Rule:{$ruleid} Groupid:{$groupid} From groups match rule.", __FUNCTION__, __LINE__);
    if (isset($_SESSION["AUTH_GROUP_DATA"][$groupid])) {
        if ($_SESSION["AUTH_GROUP_DATA"][$groupid]["params"] == null) {
            unset($_SESSION["AUTH_GROUP_DATA"][$groupid]);
        }
    }
    if (!isset($_SESSION["AUTH_GROUP_DATA"][$groupid])) {
        if (!isset($GLOBALS["Q"])) {
            $GLOBALS["Q"] = new mysql_squid_builder();
        }
        Debuglogs("Rule:{$ruleid} Groupid:{$groupid} Run MySQL query", __FUNCTION__, __LINE__);
        $ligne = mysql_fetch_array($GLOBALS["Q"]->QUERY_SQL("SELECT groupname,group_type,params FROM authenticator_auth WHERE ID='{$groupid}'"));
        if (!$GLOBALS["Q"]->ok) {
            Debuglogs("Rule:{$_GET["ruleid"]} Groupid:{$groupid} {$GLOBALS["Q"]->mysql_error}", __FUNCTION__, __LINE__);
        }
        $_SESSION["AUTH_GROUP_DATA"][$groupid]["groupname"] = $ligne["groupname"];
        $_SESSION["AUTH_GROUP_DATA"][$groupid]["group_type"] = $ligne["group_type"];
        $_SESSION["AUTH_GROUP_DATA"][$groupid]["params"] = unserialize(base64_decode($ligne["params"]));
    }
    $groupname = $_SESSION["AUTH_GROUP_DATA"][$groupid]["groupname"];
    $group_type = $_SESSION["AUTH_GROUP_DATA"][$groupid]["group_type"];
    $params = $_SESSION["AUTH_GROUP_DATA"][$groupid]["params"];
    include_once dirname(__FILE__) . "/ressources/externals/jasigcas/CAS.php";
    Debuglogs("Rule:{$ruleid} Groupid:{$groupid} checking group:{$groupname} type:{$group_type}", __FUNCTION__, __LINE__);
    if (!preg_match("#\\?ticket=(.+)#", $_GET["uri"], $re)) {
        Debuglogs("Not ticket found in `{$_GET["uri"]}`", __FUNCTION__, __LINE__);
        return false;
    }
    //$_SESSION["USER"]=$user;
    //$_SESSION["CASTIME"]=time();
    if (preg_match("#\\?ticket=(.+)#", $_GET["uri"], $re)) {
        $ticket = $re[1];
        Debuglogs("{$_GET["uri"]} -> {$ticket}", __FUNCTION__, __LINE__);
        $uriToSend = "https://auth.u-cergy.fr/serviceValidate?ticket={$ticket}&service=http://{$_GET["servername"]}";
        Debuglogs("{$uriToSend}", __FUNCTION__, __LINE__);
        @unlink("/tmp/toto.txt");
        exec("wget \"{$uriToSend}\" -O /tmp/toto.txt");
        $tr = explode("\n", @file_get_contents("/tmp/toto.txt"));
        while (list($index, $alias) = each($tr)) {
            Debuglogs("{$alias}", __FUNCTION__, __LINE__);
        }
    } else {
        Debuglogs("{$_GET["uri"]} no pregmatch", __FUNCTION__, __LINE__);
    }
    if ($GLOBALS["DEBUG"]) {
        Debuglogs("Rule:{$ruleid} Groupid:{$groupid} checking group:{$groupname} set to debug", __FUNCTION__, __LINE__);
        phpCAS::setDebug("/var/log/apache2/cas.debug.log");
    }
    phpCAS::setDebug("/var/log/apache2/cas.debug.log");
    Debuglogs("for debug purpose cmdline should be \"" . __FILE__ . " --cas {$groupid} {$ruleid}\"", __FUNCTION__, __LINE__);
    $cas_host = $params["CAS_HOST"];
    $cas_port = intval($params["CAS_PORT"]);
    $cas_context = $params["CAS_CONTEXT"];
    $certificate = $params["CAS_CERT"];
    Debuglogs("Using certificate: {$certificate} ", __FUNCTION__, __LINE__);
    Debuglogs("Rule:{$ruleid} Groupid:{$groupid} checking group:{$groupname} Initialize phpCAS host:{$cas_host} Port:\"{$cas_port}\" context={$cas_context}", __FUNCTION__, __LINE__);
    phpCAS::client(CAS_VERSION_2_0, $cas_host, intval($cas_port), $cas_context);
    //phpCAS::proxy(CAS_VERSION_2_0, $cas_host, intval($cas_port), $cas_context);
    // For quick testing you can disable SSL validation of the CAS server.
    // THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
    // VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
    if (is_file($certificate)) {
        //Debuglogs("Using certificate: $certificate ",__FUNCTION__,__LINE__);
        //phpCAS::setCasServerCACert($certificate);
    } else {
        Debuglogs(" {$certificate} no such file", __FUNCTION__, __LINE__);
    }
    unset($_SESSION["AUTH_GROUP_DATA"]);
    Debuglogs("Rule:{$ruleid} Groupid:{$groupid} checking group:{$groupname} Initialize phpCAS setNoCasServerValidation()", __FUNCTION__, __LINE__);
    phpCAS::setNoCasServerValidation();
    phpCAS::setFixedServiceURL("http://biblioweb.u-cergy.org");
    //https://auth.u-cergy.fr/is/cas/serviceValidate?ticket=ST-956-Lyg0BdLkgdrBO9W17bXS&service=http://localhost/bling
    //phpCAS::forceAuthentication();
    if (!phpCAS::checkAuthentication()) {
        Debuglogs("Rule:{$ruleid} Groupid:{$groupid} checking group:{$groupname} Initialize phpCAS, not authenticated", __FUNCTION__, __LINE__);
        return false;
    }
    // force CAS authentication
    //phpCAS::forceAuthentication();
    return true;
}