This method handles logout requests.
public handleLogoutRequests ( boolean $check_client = true, boolean $allowed_clients = false ) : void | ||
$check_client | boolean | true to check the client bofore handling the request, false not to perform any access control. True by default. |
$allowed_clients | boolean | an array of host names allowed to send logout requests. |
return | void |
private function initializeCAS() { $casClient = new \CAS_Client(CAS_VERSION_2_0, true, Config::get('cas.hostname'), Config::get('cas.port'), Config::get('cas.context')); $casClient->setNoCasServerValidation(); if (true === Config::get('pgtservice.enabled', false)) { $casClient->setCallbackURL(Config::get('pgtservice.callback')); $casClient->setPGTStorage(new ProxyTicketServiceStorage($casClient)); } else { if (false !== Config::get('redis.hostname', false)) { $casClient->setCallbackURL($this->url->getURL() . '/callback.php'); $redis = new \Redis(); $redis->connect(Config::get('redis.hostname'), Config::get('redis.port', 6379), 2, null, 100); $redis->setOption(\Redis::OPT_SERIALIZER, \Redis::SERIALIZER_PHP); $redis->setOption(\Redis::OPT_PREFIX, Config::get('application.project_name') . ':PHPCAS_TICKET_STORAGE:'); $redis->select((int) Config::get('redis.hostname', 2)); $casClient->setPGTStorage(new RedisTicketStorage($casClient, $redis)); } else { $casClient->setCallbackURL($this->url->getURL() . '/callback.php'); $casClient->setPGTStorageFile(session_save_path()); // Handle logout requests but do not validate the server $casClient->handleLogoutRequests(false); } } // Accept all proxy chains $casClient->getAllowedProxyChains()->allowProxyChain(new \CAS_ProxyChain_Any()); return $casClient; }
/** * Handle logout requests. * * @param bool $check_client additional safety check * @param array $allowed_clients array of allowed clients * * @return void */ public static function handleLogoutRequests($check_client = true, $allowed_clients = false) { phpCAS::_validateClientExists(); return self::$_PHPCAS_CLIENT->handleLogoutRequests($check_client, $allowed_clients); }