Skip to content
Snippets Groups Projects
Commit 1fd623b4 authored by Tim Steiner's avatar Tim Steiner
Browse files

Handle CAS logouts.

git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x@72 20a16fea-79d4-4915-8869-1ea9d5ebf173
parent 3a670f18
No related branches found
No related tags found
No related merge requests found
......@@ -5,24 +5,29 @@ function unl_cas_init()
require_once dirname(__FILE__) . '/lib/CAS/CAS.php';
phpCAS::client(CAS_VERSION_2_0,'login.unl.edu',443,'/cas');
phpCAS::setNoCasServerValidation();
phpCAS::handleLogoutRequests();
if (!array_key_exists('last_sso_check', $_SESSION)) {
$_SESSION['unl']['last_sso_check'] = 0;
}
$auth = FALSE;
if (array_key_exists('unl_sso', $_COOKIE)) {
$auth = phpCAS::checkAuthentication();
if ($auth) {
$username = phpCAS::getUser();
$user = user_load_by_name($username);
if (!$user) {
$user = unl_cas_import_user($username);
}
if ($GLOBALS['user']->uid != $user->uid) {
$GLOBALS['user'] = $user;
user_login_finalize();
}
}
if ($auth) {
$username = phpCAS::getUser();
$user = user_load_by_name($username);
if (!$user) {
$user = unl_cas_import_user($username);
}
if ($GLOBALS['user']->uid != $user->uid) {
$GLOBALS['user'] = $user;
user_login_finalize();
}
} else if (!user_is_anonymous()) {
$GLOBALS['user'] = drupal_anonymous_user();
user_login_finalize();
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment