7 define (
"AUTH_LOCAL",1);
8 define (
"AUTH_LDAP",2);
9 define (
"AUTH_RADIUS",3);
10 define (
"AUTH_SCRIPT",4);
11 define (
"AUTH_SHIBBOLETH",5);
12 define (
"AUTH_CAS",6);
13 define (
"AUTH_SOAP",7);
15 define (
"AUTH_HTTP",8);
17 define (
"AUTH_ECS",9);
18 define(
'AUTH_OPENID',10);
20 define (
"AUTH_APACHE",11);
22 define (
"AUTH_INACTIVE",18);
24 define(
'AUTH_MULTIPLE',20);
26 define(
'AUTH_SOAP_NO_ILIAS_USER', -100);
27 define(
'AUTH_LDAP_NO_ILIAS_USER',-200);
28 define(
'AUTH_RADIUS_NO_ILIAS_USER',-300);
29 define(
'AUTH_OPENID_NO_ILIAS_USER',-400);
34 define(
'AUTH_APACHE_FAILED', -500);
37 define(
'AUTH_MODE_INACTIVE',-1000);
42 define(
'AUTH_SOAP_NO_ILIAS_USER_BUT_EMAIL', -101);
43 define(
'AUTH_CAS_NO_ILIAS_USER', -90);
45 include_once
'./Services/Authentication/classes/class.ilAuthFactory.php';
46 require_once(
'Services/Authentication/classes/class.ilSessionControl.php');
70 $user_auth_mode =
false;
71 $ilBench->start(
'Auth',
'initAuth');
76 define (
"AUTH_DEFAULT", $ilSetting->get(
"auth_mode") ? $ilSetting->get(
"auth_mode") :
AUTH_LOCAL);
82 (!isset(
$_SESSION[
'_authsession'][
'registered']) ||
83 $_SESSION[
'_authsession'][
'registered'] !==
true))
86 if (isset(
$_POST[
'username']) and
$_POST[
'username'] !=
'' and
$_POST[
'password'] !=
'' or isset(
$_GET[
'ecs_hash']) or isset(
$_POST[
'oid_username']) or isset(
$_GET[
'oid_check_status']))
90 if ($user_auth_mode ==
AUTH_CAS && $ilSetting->get(
"cas_allow_local"))
94 if ($user_auth_mode ==
AUTH_SOAP && $ilSetting->get(
"soap_auth_allow_local"))
98 if ($user_auth_mode ==
AUTH_SHIBBOLETH && $ilSetting->get(
"shib_auth_allow_local"))
109 if (!$ilSetting->get(
"soap_auth_active") && $user_auth_mode ==
AUTH_SOAP)
114 if($ilSetting->get(
"cas_active") &&
$_GET[
'forceCASLogin'])
120 if($ilSetting->get(
"apache_active") && $user_auth_mode ==
AUTH_APACHE)
146 if (($ilSetting->get(
"soap_auth_active") && !empty(
$_GET[
"ext_uid"])
154 else if ( $ilSetting->get(
"shib_active")
155 && $_SERVER[$ilSetting->get(
"shib_login")])
161 define (
"AUTH_CURRENT", $user_auth_mode);
178 $authmode = AUTH_CURRENT;
182 if ($authmode == null && AUTH_DEFAULT ==
AUTH_APACHE)
189 include_once
'./Services/LDAP/classes/class.ilAuthContainerLDAP.php';
195 include_once
'./Services/Radius/classes/class.ilAuthContainerRadius.php';
201 $auth_params = array();
202 $auth_params[
'sessionName'] =
"_authhttp".md5($realm);
203 $ilAuth =
new ShibAuth($auth_params,
true);
208 include_once
'./Services/CAS/classes/class.ilAuthContainerCAS.php';
214 include_once
'./Services/SOAPAuth/classes/class.ilAuthContainerSOAP.php';
220 include_once
'./Services/Authentication/classes/class.ilAuthContainerMultiple.php';
225 include_once
'./Services/WebServices/ECS/classes/class.ilAuthContainerECS.php';
231 include_once
'./Services/OpenId/classes/class.ilAuthContainerOpenId.php';
236 require_once(
'./Services/Authentication/classes/class.ilAuthInactive.php');
241 include_once
'./Services/AuthApache/classes/class.ilAuthContainerApache.php';
251 include_once
'./Services/Database/classes/class.ilAuthContainerMDB2.php';
260 $ilAuth->setIdle($ilClientIniFile->readVariable(
"session",
"expire"),
false);
262 $ilAuth->setExpire(0);
264 ini_set(
"session.cookie_lifetime",
"0");
270 $ilBench->stop(
'Auth',
'initAuth');
277 if(isset(
$_GET[
'ecs_hash']))
282 if(isset(
$_POST[
'auth_mode']))
284 return (
int)
$_POST[
'auth_mode'];
286 if(isset(
$_POST[
'oid_username']) or
$_GET[
'oid_check_status'])
288 $GLOBALS[
'ilLog']->write(__METHOD__.
' set context to open id');
293 include_once(
'./Services/Authentication/classes/class.ilAuthModeDetermination.php');
296 if(!$det->isManualSelection() and $det->getCountActiveAuthModes() > 1)
304 if ($a_db_handler !=
'')
306 $db =& $a_db_handler;
311 $q =
"SELECT auth_mode FROM usr_data WHERE ".
312 "login = ".$ilDB->quote($a_username);
322 return in_array($auth_mode,self::_getActiveAuthModes()) ? $auth_mode :
AUTH_INACTIVE;
331 if ($a_db_handler !=
'')
333 $db =& $a_db_handler;
336 switch ($a_auth_mode)
376 return $ilSetting->get(
"auth_mode");
435 'default' => $ilSetting->get(
"auth_mode"),
438 include_once(
'Services/LDAP/classes/class.ilLDAPServer.php');
443 if ($ilSetting->get(
"radius_active")) $modes[
'radius'] =
AUTH_RADIUS;
444 if ($ilSetting->get(
"shib_active")) $modes[
'shibboleth'] =
AUTH_SHIBBOLETH;
445 if ($ilSetting->get(
"script_active")) $modes[
'script'] =
AUTH_SCRIPT;
446 if ($ilSetting->get(
"cas_active")) $modes[
'cas'] =
AUTH_CAS;
447 if ($ilSetting->get(
"soap_auth_active")) $modes[
'soap'] =
AUTH_SOAP;
448 if ($ilSetting->get(
"apache_active")) $modes[
'apache'] =
AUTH_APACHE;
450 include_once(
'./Services/WebServices/ECS/classes/class.ilECSSettings.php');
456 include_once
'./Services/OpenId/classes/class.ilOpenIdSettings.php';
494 $r = $ilDB->query(
"SELECT login FROM usr_data WHERE login = ".
495 $ilDB->quote($c_login));
496 if ($r->numRows() > 0)
499 $c_login = $a_login.$postfix;
512 include_once(
'Services/Radius/classes/class.ilRadiusSettings.php');
515 if($rad_settings->isActive())
519 include_once(
'Services/LDAP/classes/class.ilLDAPServer.php');
526 if ($ilSetting->get(
'apache_active')) {
537 include_once(
'Services/LDAP/classes/class.ilLDAPServer.php');
545 $options[
AUTH_LDAP][
'txt'] = $ldap_server->getName();
547 include_once(
'Services/Radius/classes/class.ilRadiusSettings.php');
549 if($rad_settings->isActive())
551 $options[
AUTH_RADIUS][
'txt'] = $rad_settings->getName();
554 if ($ilSetting->get(
'apache_active')) {
556 $apache_settings =
new ilSetting(
'apache_auth');
557 $options[
AUTH_APACHE][
'txt'] = $apache_settings->get(
'name', $lng->txt(
'apache_auth'));
573 $default = $ilSetting->get(
'default_auth_mode',$default);
576 $options[$default][
'checked'] =
true;
577 return $options ? $options : array();
593 if($ilSetting->get(
"cas_active"))
597 if($ilSetting->get(
"soap_auth_active"))
601 if($ilSetting->get(
"shib_active"))
605 if($ilSetting->get(
'radius_active'))
609 include_once(
'Services/LDAP/classes/class.ilLDAPServer.php');
614 include_once
'./Services/OpenId/classes/class.ilOpenIdSettings.php';
672 if($ilSetting->get(
'usr_settings_hide_password') or $ilSetting->get(
'usr_settings_disable_password'))
693 return $ilSetting->get(
"shib_auth_allow_local");
695 return $ilSetting->get(
"soap_auth_allow_local");
697 return $ilSetting->get(
"cas_allow_local");