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);
41 define(
'AUTH_SOAP_NO_ILIAS_USER_BUT_EMAIL', -101);
42 define(
'AUTH_CAS_NO_ILIAS_USER', -90);
45 define(
'AUTH_USER_WRONG_IP', -600);
46 define(
'AUTH_USER_INACTIVE', -601);
47 define(
'AUTH_USER_TIME_LIMIT_EXCEEDED', -602);
48 define(
'AUTH_USER_SIMULTANEOUS_LOGIN', -603);
51 include_once
'./Services/Authentication/classes/class.ilAuthFactory.php';
52 require_once(
'Services/Authentication/classes/class.ilSessionControl.php');
76 $user_auth_mode =
false;
77 $ilBench->start(
'Auth',
'initAuth');
82 define (
"AUTH_DEFAULT", $ilSetting->get(
"auth_mode") ? $ilSetting->get(
"auth_mode") :
AUTH_LOCAL);
88 (!isset(
$_SESSION[
'_authsession'][
'registered']) ||
89 $_SESSION[
'_authsession'][
'registered'] !==
true))
92 if (isset(
$_POST[
'username']) and
$_POST[
'username'] !=
'' and
$_POST[
'password'] !=
'' or isset(
$_GET[
'ecs_hash']) or isset(
$_GET[
'ecs_hash_url']) or isset(
$_POST[
'oid_username']) or isset(
$_GET[
'oid_check_status']))
96 if ($user_auth_mode ==
AUTH_CAS && $ilSetting->get(
"cas_allow_local"))
100 if ($user_auth_mode ==
AUTH_SOAP && $ilSetting->get(
"soap_auth_allow_local"))
104 if ($user_auth_mode ==
AUTH_SHIBBOLETH && $ilSetting->get(
"shib_auth_allow_local"))
116 if (!$ilSetting->get(
"soap_auth_active") && $user_auth_mode ==
AUTH_SOAP)
121 if($ilSetting->get(
"cas_active") &&
$_GET[
'forceCASLogin'])
127 if($ilSetting->get(
"apache_active") && $user_auth_mode ==
AUTH_APACHE)
153 if (($ilSetting->get(
"soap_auth_active") && !empty(
$_GET[
"ext_uid"])
161 else if ( $ilSetting->get(
"shib_active")
162 && $_SERVER[$ilSetting->get(
"shib_login")])
168 define (
"AUTH_CURRENT", $user_auth_mode);
185 $authmode = AUTH_CURRENT;
189 if ($authmode == null && AUTH_DEFAULT ==
AUTH_APACHE)
196 include_once
'./Services/LDAP/classes/class.ilAuthContainerLDAP.php';
202 include_once
'./Services/Radius/classes/class.ilAuthContainerRadius.php';
208 $auth_params = array();
209 $auth_params[
'sessionName'] =
"_authhttp".md5($realm);
210 $ilAuth =
new ShibAuth($auth_params,
true);
215 include_once
'./Services/CAS/classes/class.ilAuthContainerCAS.php';
221 include_once
'./Services/SOAPAuth/classes/class.ilAuthContainerSOAP.php';
227 include_once
'./Services/Authentication/classes/class.ilAuthContainerMultiple.php';
232 include_once
'./Services/WebServices/ECS/classes/class.ilAuthContainerECS.php';
238 include_once
'./Services/OpenId/classes/class.ilAuthContainerOpenId.php';
243 require_once(
'./Services/Authentication/classes/class.ilAuthInactive.php');
248 include_once
'./Services/AuthApache/classes/class.ilAuthContainerApache.php';
258 include_once
'./Services/Database/classes/class.ilAuthContainerMDB2.php';
270 $ilAuth->setExpire(0);
272 ini_set(
"session.cookie_lifetime",
"0");
278 $ilBench->stop(
'Auth',
'initAuth');
285 if(isset(
$_GET[
'ecs_hash']) or isset(
$_GET[
'ecs_hash_url']))
290 if(isset(
$_POST[
'auth_mode']))
292 return (
int)
$_POST[
'auth_mode'];
294 if(isset(
$_POST[
'oid_username']) or
$_GET[
'oid_check_status'])
296 $GLOBALS[
'ilLog']->write(__METHOD__.
' set context to open id');
301 include_once(
'./Services/Authentication/classes/class.ilAuthModeDetermination.php');
304 if(!$det->isManualSelection() and $det->getCountActiveAuthModes() > 1)
312 if ($a_db_handler !=
'')
314 $db =& $a_db_handler;
319 $q =
"SELECT auth_mode FROM usr_data WHERE ".
320 "login = ".$ilDB->quote($a_username);
330 return in_array($auth_mode,self::_getActiveAuthModes()) ? $auth_mode :
AUTH_INACTIVE;
339 if ($a_db_handler !=
'')
341 $db =& $a_db_handler;
344 switch ($a_auth_mode)
384 return $ilSetting->get(
"auth_mode");
443 'default' => $ilSetting->get(
"auth_mode"),
446 include_once(
'Services/LDAP/classes/class.ilLDAPServer.php');
451 if ($ilSetting->get(
"radius_active")) $modes[
'radius'] =
AUTH_RADIUS;
452 if ($ilSetting->get(
"shib_active")) $modes[
'shibboleth'] =
AUTH_SHIBBOLETH;
453 if ($ilSetting->get(
"script_active")) $modes[
'script'] =
AUTH_SCRIPT;
454 if ($ilSetting->get(
"cas_active")) $modes[
'cas'] =
AUTH_CAS;
455 if ($ilSetting->get(
"soap_auth_active")) $modes[
'soap'] =
AUTH_SOAP;
456 if ($ilSetting->get(
"apache_active")) $modes[
'apache'] =
AUTH_APACHE;
458 include_once
'./Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
464 include_once
'./Services/OpenId/classes/class.ilOpenIdSettings.php';
502 $r = $ilDB->query(
"SELECT login FROM usr_data WHERE login = ".
503 $ilDB->quote($c_login));
504 if ($r->numRows() > 0)
507 $c_login = $a_login.$postfix;
520 include_once(
'Services/Radius/classes/class.ilRadiusSettings.php');
523 if($rad_settings->isActive())
527 include_once(
'Services/LDAP/classes/class.ilLDAPServer.php');
534 if ($ilSetting->get(
'apache_active')) {
545 include_once(
'Services/LDAP/classes/class.ilLDAPServer.php');
553 $options[
AUTH_LDAP][
'txt'] = $ldap_server->getName();
555 include_once(
'Services/Radius/classes/class.ilRadiusSettings.php');
557 if($rad_settings->isActive())
559 $options[
AUTH_RADIUS][
'txt'] = $rad_settings->getName();
562 if ($ilSetting->get(
'apache_active'))
565 $apache_settings =
new ilSetting(
'apache_auth');
566 $options[
AUTH_APACHE][
'txt'] = $apache_settings->get(
'name', $lng->txt(
'apache_auth'));
583 $default = $ilSetting->get(
'default_auth_mode',$default);
586 $options[$default][
'checked'] =
true;
587 return $options ? $options : array();
603 if($ilSetting->get(
"cas_active"))
607 if($ilSetting->get(
"soap_auth_active"))
611 if($ilSetting->get(
"shib_active"))
615 if($ilSetting->get(
'radius_active'))
619 include_once(
'Services/LDAP/classes/class.ilLDAPServer.php');
624 include_once
'./Services/OpenId/classes/class.ilOpenIdSettings.php';
683 if($ilSetting->get(
'usr_settings_hide_password') or $ilSetting->get(
'usr_settings_disable_password'))
705 return $ilSetting->get(
"shib_auth_allow_local");
707 return $ilSetting->get(
"soap_auth_allow_local");
709 return $ilSetting->get(
"cas_allow_local");