1
1
<?php
2
2
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.
8
6
*
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.
11
11
*
12
12
* If this is not the case or you just want to try ILIAS, you'll find
13
13
* us at:
14
- * https://www.ilias.de
15
- * https://github.com/ILIAS-eLearning
14
+ * https://www.ilias.de
15
+ * https://github.com/ILIAS-eLearning
16
16
*
17
- *****************************************************************************/
17
+ *********************************************************************/
18
+
19
+ declare (strict_types=1 );
18
20
19
21
/**
20
22
* CAS authentication provider
@@ -40,27 +42,37 @@ public function doAuthentication(ilAuthStatus $status): bool
40
42
$ this ->getLogger ()->debug ('Starting cas authentication attempt... ' );
41
43
42
44
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... ' );
45
52
phpCAS::client (
46
53
CAS_VERSION_2_0 ,
47
54
$ this ->getSettings ()->getServer (),
48
55
$ this ->getSettings ()->getPort (),
49
- $ this ->getSettings ()->getUri ()
56
+ $ this ->getSettings ()->getUri (),
57
+ ilUtil::_getHttpPath ()
50
58
);
51
59
52
60
phpCAS::setNoCasServerValidation ();
61
+ $ this ->getLogger ()->debug ('Fore CAS auth... ' );
53
62
phpCAS::forceAuthentication ();
63
+ $ this ->getLogger ()->debug ('Fore CAS auth done. ' );
54
64
} catch (Exception $ e ) {
55
65
$ this ->getLogger ()->error ('Cas authentication failed with message: ' . $ e ->getMessage ());
56
66
$ this ->handleAuthenticationFail ($ status , 'err_wrong_login ' );
57
67
return false ;
58
68
}
59
69
60
70
if (phpCAS::getUser () === '' ) {
71
+ $ this ->getLogger ()->debug ('CAS user is empty. ' );
61
72
return $ this ->handleAuthenticationFail ($ status , 'err_wrong_login ' );
62
73
}
63
74
$ this ->getCredentials ()->setUsername (phpCAS::getUser ());
75
+ $ this ->getLogger ()->debug ('user name set to CAS user. ' );
64
76
65
77
// check and handle ldap data sources
66
78
if (ilLDAPServer::isDataSourceActive (ilAuthUtils::AUTH_CAS )) {
0 commit comments