public function logout($params)
{
phpCAS::traceBegin();
$cas_url = $this->getServerLogoutURL();
$paramSeparator = '?';
if (isset($params['url'])) {
$cas_url = $cas_url . $paramSeparator . "url=" . urlencode($params['url']);
$paramSeparator = '&';
}
if (isset($params['service'])) {
$cas_url = $cas_url . $paramSeparator . "service=" . urlencode($params['service']);
}
header('Location: ' . $cas_url);
phpCAS::trace("Prepare redirect to : " . $cas_url);
phpCAS::trace("Destroying session : " . session_id());
session_unset();
session_destroy();
if (session_status() === PHP_SESSION_NONE) {
phpCAS::trace("Session terminated");
} else {
phpCAS::error("Session was not terminated");
phpCAS::trace("Session was not terminated");
}
$lang = $this->getLangObj();
$this->printHTMLHeader($lang->getLogout());
printf('<p>' . $lang->getShouldHaveBeenRedirected() . '</p>', $cas_url);
$this->printHTMLFooter();
phpCAS::traceExit();
throw new CAS_GracefullTerminationException();
}
/** * This method is used to logout from CAS. Halts by redirecting to the CAS * server. * * @param string $service a URL that will be transmitted to the CAS server * @param string $url a URL that will be transmitted to the CAS server * * @return void * * @deprecated The url parameter has been removed from the CAS server as of * version 3.3.5.1 */ public static function logoutWithRedirectServiceAndUrl($service, $url) { trigger_error('Function deprecated for cas servers >= 3.3.5.1', E_USER_DEPRECATED); phpCAS::traceBegin(); phpCAS::_validateClientExists(); if (!is_string($service)) { phpCAS::error('type mismatched for parameter $service (should be `string\')'); } if (!is_string($url)) { phpCAS::error('type mismatched for parameter $url (should be `string\')'); } self::$_PHPCAS_CLIENT->logout(array("service" => $service, "url" => $url)); // never reached phpCAS::traceEnd(); }