25 define (
"AUTH_LOCAL",1);
26 define (
"AUTH_LDAP",2);
27 define (
"AUTH_RADIUS",3);
28 define (
"AUTH_SCRIPT",4);
29 define (
"AUTH_SHIBBOLETH",5);
30 define (
"AUTH_CAS",6);
31 define (
"AUTH_SOAP",7);
33 define (
"AUTH_HTTP",8);
35 define (
"AUTH_ECS",9);
38 define (
"AUTH_INACTIVE",18);
40 define(
'AUTH_MULTIPLE',20);
42 define(
'AUTH_SOAP_NO_ILIAS_USER', -100);
43 define(
'AUTH_LDAP_NO_ILIAS_USER',-200);
44 define(
'AUTH_RADIUS_NO_ILIAS_USER',-300);
46 define(
'AUTH_MODE_INACTIVE',-1000);
51 define(
'AUTH_SOAP_NO_ILIAS_USER_BUT_EMAIL', -101);
52 define(
'AUTH_CAS_NO_ILIAS_USER', -90);
54 include_once
'./Services/Authentication/classes/class.ilAuthFactory.php';
74 $ilBench->start(
'Auth',
'initAuth');
77 if (!is_object($ilSetting))
79 die (
"Fatal Error: ilAuthUtils::_initAuth called without ilSetting.");
83 if (!is_object($ilDB))
85 die (
"Fatal Error: ilAuthUtils::_initAuth called without ilDB.");
89 if (!is_object($ilClientIniFile))
91 die (
"Fatal Error: ilAuthUtils::_initAuth called without ilClientIniFile.");
96 define (
"AUTH_DEFAULT", $ilSetting->get(
"auth_mode") ? $ilSetting->get(
"auth_mode") :
AUTH_LOCAL);
108 (!isset(
$_SESSION[
'_authsession'][
'registered']) ||
109 $_SESSION[
'_authsession'][
'registered'] !==
true))
112 if (
$_POST[
'username'] !=
'' and
$_POST[
'password'] !=
'' or isset(
$_GET[
'ecs_hash']))
116 if ($user_auth_mode ==
AUTH_CAS && $ilSetting->get(
"cas_allow_local"))
120 if ($user_auth_mode ==
AUTH_SOAP && $ilSetting->get(
"soap_auth_allow_local"))
124 if ($user_auth_mode ==
AUTH_SHIBBOLETH && $ilSetting->get(
"shib_auth_allow_local"))
132 if (!$ilSetting->get(
"soap_auth_active") && $user_auth_mode ==
AUTH_SOAP)
137 if($ilSetting->get(
"cas_active") &&
$_GET[
'forceCASLogin'])
163 if (($ilSetting->get(
"soap_auth_active") && !empty(
$_GET[
"ext_uid"])
171 else if ( $ilSetting->get(
"shib_active")
172 && $_SERVER[$ilSetting->get(
"shib_login")])
179 define (
"AUTH_CURRENT", $user_auth_mode);
196 $authmode = AUTH_CURRENT;
202 include_once
'./Services/LDAP/classes/class.ilAuthContainerLDAP.php';
208 include_once
'./Services/Radius/classes/class.ilAuthContainerRadius.php';
214 $auth_params = array();
215 $auth_params[
'sessionName'] =
"_authhttp".md5($realm);
216 $ilAuth =
new ShibAuth($auth_params,
true);
221 include_once
'./Services/CAS/classes/class.ilAuthContainerCAS.php';
227 include_once
'./Services/SOAPAuth/classes/class.ilAuthContainerSOAP.php';
233 include_once
'./Services/Authentication/classes/class.ilAuthContainerMultiple.php';
238 include_once
'./Services/WebServices/ECS/classes/class.ilAuthContainerECS.php';
243 require_once(
'./Services/Authentication/classes/class.ilAuthInactive.php');
252 include_once
'./Services/Database/classes/class.ilAuthContainerMDB2.php';
296 $ilAuth->setIdle($ilClientIniFile->readVariable(
"session",
"expire"),
false);
298 $ilAuth->setExpire(0);
300 ini_set(
"session.cookie_lifetime",
"0");
304 $ilBench->stop(
'Auth',
'initAuth');
311 if(isset(
$_GET[
'ecs_hash']))
316 if(isset(
$_POST[
'auth_mode']))
318 return (
int)
$_POST[
'auth_mode'];
321 include_once(
'./Services/Authentication/classes/class.ilAuthModeDetermination.php');
324 if(!$det->isManualSelection() and $det->getCountActiveAuthModes() > 1)
332 if ($a_db_handler !=
'')
334 $db =& $a_db_handler;
339 $q =
"SELECT auth_mode FROM usr_data WHERE ".
340 "login = ".$ilDB->quote($a_username);
350 return in_array($auth_mode,self::_getActiveAuthModes()) ? $auth_mode :
AUTH_INACTIVE;
359 if ($a_db_handler !=
'')
361 $db =& $a_db_handler;
364 switch ($a_auth_mode)
398 return $ilSetting->get(
"auth_mode");
451 'default' => $ilSetting->get(
"auth_mode"),
454 include_once(
'Services/LDAP/classes/class.ilLDAPServer.php');
459 if ($ilSetting->get(
"radius_active")) $modes[
'radius'] =
AUTH_RADIUS;
460 if ($ilSetting->get(
"shib_active")) $modes[
'shibboleth'] =
AUTH_SHIBBOLETH;
461 if ($ilSetting->get(
"script_active")) $modes[
'script'] =
AUTH_SCRIPT;
462 if ($ilSetting->get(
"cas_active")) $modes[
'cas'] =
AUTH_CAS;
463 if ($ilSetting->get(
"soap_auth_active")) $modes[
'soap'] =
AUTH_SOAP;
465 include_once(
'./Services/WebServices/ECS/classes/class.ilECSSettings.php');
500 $r = $ilDB->query(
"SELECT login FROM usr_data WHERE login = ".
501 $ilDB->quote($c_login));
502 if ($r->numRows() > 0)
505 $c_login = $a_login.$postfix;
518 include_once(
'Services/Radius/classes/class.ilRadiusSettings.php');
521 if($rad_settings->isActive())
525 include_once(
'Services/LDAP/classes/class.ilLDAPServer.php');
534 include_once(
'Services/LDAP/classes/class.ilLDAPServer.php');
542 $options[
AUTH_LDAP][
'txt'] = $ldap_server->getName();
544 include_once(
'Services/Radius/classes/class.ilRadiusSettings.php');
546 if($rad_settings->isActive())
548 $options[
AUTH_RADIUS][
'txt'] = $rad_settings->getName();
564 $default = $ilSetting->get(
'default_auth_mode',$default);
565 $default = (int) $_REQUEST[
'auth_mode'] ? (
int) $_REQUEST[
'auth_mode'] : $default;
567 $options[$default][
'checked'] =
true;
568 return $options ? $options : array();
584 if($ilSetting->get(
"cas_active"))
588 if($ilSetting->get(
"soap_auth_active"))
592 if($ilSetting->get(
"shib_active"))
596 if($ilSetting->get(
'radius_active'))
600 include_once(
'Services/LDAP/classes/class.ilLDAPServer.php');