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';
263 $ilAuth->setExpire(0);
265 ini_set(
"session.cookie_lifetime",
"0");
271 $ilBench->stop(
'Auth',
'initAuth');
278 if(isset(
$_GET[
'ecs_hash']))
283 if(isset(
$_POST[
'auth_mode']))
285 return (
int)
$_POST[
'auth_mode'];
287 if(isset(
$_POST[
'oid_username']) or
$_GET[
'oid_check_status'])
289 $GLOBALS[
'ilLog']->write(__METHOD__.
' set context to open id');
294 include_once(
'./Services/Authentication/classes/class.ilAuthModeDetermination.php');
297 if(!$det->isManualSelection() and $det->getCountActiveAuthModes() > 1)
305 if ($a_db_handler !=
'')
307 $db =& $a_db_handler;
312 $q =
"SELECT auth_mode FROM usr_data WHERE ".
313 "login = ".$ilDB->quote($a_username);
323 return in_array($auth_mode,self::_getActiveAuthModes()) ? $auth_mode :
AUTH_INACTIVE;
332 if ($a_db_handler !=
'')
334 $db =& $a_db_handler;
337 switch ($a_auth_mode)
377 return $ilSetting->get(
"auth_mode");
436 'default' => $ilSetting->get(
"auth_mode"),
439 include_once(
'Services/LDAP/classes/class.ilLDAPServer.php');
444 if ($ilSetting->get(
"radius_active")) $modes[
'radius'] =
AUTH_RADIUS;
445 if ($ilSetting->get(
"shib_active")) $modes[
'shibboleth'] =
AUTH_SHIBBOLETH;
446 if ($ilSetting->get(
"script_active")) $modes[
'script'] =
AUTH_SCRIPT;
447 if ($ilSetting->get(
"cas_active")) $modes[
'cas'] =
AUTH_CAS;
448 if ($ilSetting->get(
"soap_auth_active")) $modes[
'soap'] =
AUTH_SOAP;
449 if ($ilSetting->get(
"apache_active")) $modes[
'apache'] =
AUTH_APACHE;
451 include_once
'./Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
457 include_once
'./Services/OpenId/classes/class.ilOpenIdSettings.php';
495 $r = $ilDB->query(
"SELECT login FROM usr_data WHERE login = ".
496 $ilDB->quote($c_login));
497 if ($r->numRows() > 0)
500 $c_login = $a_login.$postfix;
513 include_once(
'Services/Radius/classes/class.ilRadiusSettings.php');
516 if($rad_settings->isActive())
520 include_once(
'Services/LDAP/classes/class.ilLDAPServer.php');
527 if ($ilSetting->get(
'apache_active')) {
538 include_once(
'Services/LDAP/classes/class.ilLDAPServer.php');
546 $options[
AUTH_LDAP][
'txt'] = $ldap_server->getName();
548 include_once(
'Services/Radius/classes/class.ilRadiusSettings.php');
550 if($rad_settings->isActive())
552 $options[
AUTH_RADIUS][
'txt'] = $rad_settings->getName();
555 if ($ilSetting->get(
'apache_active'))
558 $apache_settings =
new ilSetting(
'apache_auth');
559 $options[
AUTH_APACHE][
'txt'] = $apache_settings->get(
'name', $lng->txt(
'apache_auth'));
576 $default = $ilSetting->get(
'default_auth_mode',$default);
579 $options[$default][
'checked'] =
true;
580 return $options ? $options : array();
596 if($ilSetting->get(
"cas_active"))
600 if($ilSetting->get(
"soap_auth_active"))
604 if($ilSetting->get(
"shib_active"))
608 if($ilSetting->get(
'radius_active'))
612 include_once(
'Services/LDAP/classes/class.ilLDAPServer.php');
617 include_once
'./Services/OpenId/classes/class.ilOpenIdSettings.php';
675 if($ilSetting->get(
'usr_settings_hide_password') or $ilSetting->get(
'usr_settings_disable_password'))
696 return $ilSetting->get(
"shib_auth_allow_local");
698 return $ilSetting->get(
"soap_auth_allow_local");
700 return $ilSetting->get(
"cas_allow_local");