Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions CASAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,14 @@ function casLogin($user, &$result) {

$lg = Language::factory($wgLanguageCode);

if ($_REQUEST["title"] == $lg->specialPage("Userlogin")) {
if ($_REQUEST["title"] == $lg->specialPage("Userlogin")) {
if(!$casIsSetUp){
error_log("CASAuth.php:casLogin - casSetup() was not called");
return false;
}
// Setup for a web request
require_once("$IP/includes/WebStart.php");

// Load phpCAS
require_once($CASAuth["phpCAS"]."/CAS.php");
if(!$casIsSetUp)
return false;

//Will redirect to CAS server if not logged in
phpCAS::forceAuthentication();

Expand Down Expand Up @@ -179,8 +178,10 @@ function casLogout() {
global $CASAuth;
global $casIsSetUp;
global $wgUser, $wgRequest, $wgLanguageCode;

require_once($CASAuth["phpCAS"]."/CAS.php");
if(!$casIsSetUp){
error_log("CASAuth.php:casLogout - casSetup() was not called");
return false;
}

// Logout from MediaWiki
$wgUser->logout();
Expand All @@ -195,9 +196,6 @@ function casLogout() {
}
}

if(!$casIsSetUp)
return false;

// Logout from CAS (will redirect user to CAS server)

if (isset($redirecturl)) {
Expand Down Expand Up @@ -254,8 +252,11 @@ function casPostAuth($ticket2logout) {
function casSingleSignOut($ticket2logout) {
global $CASAuth;
global $IP;

require_once($CASAuth["phpCAS"]."/CAS.php");
global $casIsSetUp;
if(!$casIsSetUp){
error_log("CASAuth.php:casSingleSignOut - casSetup() was not called");
return false;
}

$session_id = preg_replace('/[^\w]/','',$ticket2logout);

Expand Down