Skip to content

Commit b78f18b

Browse files
RillkemjansenDatabay
authored andcommitted
42733: Restore CAS auth functionality (ILIAS-eLearning#8434)
* 42733: Restore CAS auth functionality - do not use deprecated setDebug() - fix call to phpCAS::client() by providing ILIAS base URL - Add more debug logging https://mantis.ilias.de/view.php?id=42733 (cherry picked from commit d3f5f0d)
1 parent 553f142 commit b78f18b

File tree

1 file changed

+25
-13
lines changed

1 file changed

+25
-13
lines changed

Services/CAS/classes/class.ilAuthProviderCAS.php

+25-13
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
<?php
22

3-
declare(strict_types=1);
4-
5-
/******************************************************************************
6-
*
7-
* This file is part of ILIAS, a powerful learning management system.
3+
/**
4+
* This file is part of ILIAS, a powerful learning management system
5+
* published by ILIAS open source e-Learning e.V.
86
*
9-
* ILIAS is licensed with the GPL-3.0, you should have received a copy
10-
* of said license along with the source code.
7+
* ILIAS is licensed with the GPL-3.0,
8+
* see https://www.gnu.org/licenses/gpl-3.0.en.html
9+
* You should have received a copy of said license along with the
10+
* source code, too.
1111
*
1212
* If this is not the case or you just want to try ILIAS, you'll find
1313
* us at:
14-
* https://www.ilias.de
15-
* https://github.com/ILIAS-eLearning
14+
* https://www.ilias.de
15+
* https://github.com/ILIAS-eLearning
1616
*
17-
*****************************************************************************/
17+
*********************************************************************/
18+
19+
declare(strict_types=1);
1820

1921
/**
2022
* CAS authentication provider
@@ -40,27 +42,37 @@ public function doAuthentication(ilAuthStatus $status): bool
4042
$this->getLogger()->debug('Starting cas authentication attempt... ');
4143

4244
try {
43-
phpCAS::setDebug(false);
44-
phpCAS::setVerbose(true);
45+
// Uncomment the following line to get trace-level loggin by CAS
46+
//phpCAS::setLogger($this->getLogger());
47+
// Caution: If you set this to "true", there might be output
48+
// and the redirect won't work and you get an ILIAS Whoopsy
49+
// Though, you may need to for debugging other issues.
50+
phpCAS::setVerbose(false);
51+
$this->getLogger()->debug('Create client... ');
4552
phpCAS::client(
4653
CAS_VERSION_2_0,
4754
$this->getSettings()->getServer(),
4855
$this->getSettings()->getPort(),
49-
$this->getSettings()->getUri()
56+
$this->getSettings()->getUri(),
57+
ilUtil::_getHttpPath()
5058
);
5159

5260
phpCAS::setNoCasServerValidation();
61+
$this->getLogger()->debug('Fore CAS auth... ');
5362
phpCAS::forceAuthentication();
63+
$this->getLogger()->debug('Fore CAS auth done.');
5464
} catch (Exception $e) {
5565
$this->getLogger()->error('Cas authentication failed with message: ' . $e->getMessage());
5666
$this->handleAuthenticationFail($status, 'err_wrong_login');
5767
return false;
5868
}
5969

6070
if (phpCAS::getUser() === '') {
71+
$this->getLogger()->debug('CAS user is empty.');
6172
return $this->handleAuthenticationFail($status, 'err_wrong_login');
6273
}
6374
$this->getCredentials()->setUsername(phpCAS::getUser());
75+
$this->getLogger()->debug('user name set to CAS user.');
6476

6577
// check and handle ldap data sources
6678
if (ilLDAPServer::isDataSourceActive(ilAuthUtils::AUTH_CAS)) {

0 commit comments

Comments
 (0)