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);
49 define(
'AUTH_CAPTCHA_INVALID', -604);
52 include_once
'./Services/Authentication/classes/class.ilAuthFactory.php';
53 require_once(
'Services/Authentication/classes/class.ilSessionControl.php');
77 $user_auth_mode =
false;
78 $ilBench->start(
'Auth',
'initAuth');
83 define (
"AUTH_DEFAULT", $ilSetting->get(
"auth_mode") ? $ilSetting->get(
"auth_mode") :
AUTH_LOCAL);
89 (!isset(
$_SESSION[
'_authsession'][
'registered']) ||
90 $_SESSION[
'_authsession'][
'registered'] !==
true))
93 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']))
97 if ($user_auth_mode ==
AUTH_CAS && $ilSetting->get(
"cas_allow_local"))
101 if ($user_auth_mode ==
AUTH_SOAP && $ilSetting->get(
"soap_auth_allow_local"))
105 if ($user_auth_mode ==
AUTH_SHIBBOLETH && $ilSetting->get(
"shib_auth_allow_local"))
117 if (!$ilSetting->get(
"soap_auth_active") && $user_auth_mode ==
AUTH_SOAP)
122 if($ilSetting->get(
"cas_active") &&
$_GET[
'forceCASLogin'])
128 if($ilSetting->get(
"apache_active") && $user_auth_mode ==
AUTH_APACHE)
154 if (($ilSetting->get(
"soap_auth_active") && !empty(
$_GET[
"ext_uid"])
162 else if ( $ilSetting->get(
"shib_active")
163 && $_SERVER[$ilSetting->get(
"shib_login")])
169 define (
"AUTH_CURRENT", $user_auth_mode);
186 $authmode = AUTH_CURRENT;
190 if ($authmode == null && AUTH_DEFAULT ==
AUTH_APACHE)
197 include_once
'./Services/LDAP/classes/class.ilAuthContainerLDAP.php';
203 include_once
'./Services/Radius/classes/class.ilAuthContainerRadius.php';
209 $auth_params = array();
210 $auth_params[
'sessionName'] =
"_authhttp".md5($realm);
211 $ilAuth =
new ShibAuth($auth_params,
true);
216 include_once
'./Services/CAS/classes/class.ilAuthContainerCAS.php';
222 include_once
'./Services/SOAPAuth/classes/class.ilAuthContainerSOAP.php';
228 include_once
'./Services/Authentication/classes/class.ilAuthContainerMultiple.php';
233 include_once
'./Services/WebServices/ECS/classes/class.ilAuthContainerECS.php';
239 include_once
'./Services/OpenId/classes/class.ilAuthContainerOpenId.php';
244 require_once(
'./Services/Authentication/classes/class.ilAuthInactive.php');
249 include_once
'./Services/AuthApache/classes/class.ilAuthContainerApache.php';
257 include_once
'./Services/Database/classes/class.ilAuthContainerMDB2.php';
265 foreach(self::getAuthPlugins() as $pl)
267 $container = $pl->getContainer($authmode);
270 $GLOBALS[
'ilLog']->write(__METHOD__.
' Using plugin authentication with auth_mode '.$authmode);
276 #$GLOBALS['ilLog']->write(__METHOD__.' Using default authentication');
278 include_once
'./Services/Database/classes/class.ilAuthContainerMDB2.php';
291 $ilAuth->setExpire(0);
293 ini_set(
"session.cookie_lifetime",
"0");
299 $ilBench->stop(
'Auth',
'initAuth');
306 if(isset(
$_GET[
'ecs_hash']) or isset(
$_GET[
'ecs_hash_url']))
311 if(isset(
$_POST[
'auth_mode']))
313 return (
int)
$_POST[
'auth_mode'];
315 if(isset(
$_POST[
'oid_username']) or
$_GET[
'oid_check_status'])
317 $GLOBALS[
'ilLog']->write(__METHOD__.
' set context to open id');
322 include_once(
'./Services/Authentication/classes/class.ilAuthModeDetermination.php');
325 if(!$det->isManualSelection() and $det->getCountActiveAuthModes() > 1)
333 if ($a_db_handler !=
'')
335 $db =& $a_db_handler;
340 $q =
"SELECT auth_mode FROM usr_data WHERE ".
341 "login = ".$ilDB->quote($a_username);
351 return in_array($auth_mode,self::_getActiveAuthModes()) ? $auth_mode :
AUTH_INACTIVE;
360 if ($a_db_handler !=
'')
362 $db =& $a_db_handler;
365 switch ($a_auth_mode)
405 return $ilSetting->get(
"auth_mode");
464 'default' => $ilSetting->get(
"auth_mode"),
467 include_once(
'Services/LDAP/classes/class.ilLDAPServer.php');
472 if ($ilSetting->get(
"radius_active")) $modes[
'radius'] =
AUTH_RADIUS;
473 if ($ilSetting->get(
"shib_active")) $modes[
'shibboleth'] =
AUTH_SHIBBOLETH;
474 if ($ilSetting->get(
"script_active")) $modes[
'script'] =
AUTH_SCRIPT;
475 if ($ilSetting->get(
"cas_active")) $modes[
'cas'] =
AUTH_CAS;
476 if ($ilSetting->get(
"soap_auth_active")) $modes[
'soap'] =
AUTH_SOAP;
477 if ($ilSetting->get(
"apache_active")) $modes[
'apache'] =
AUTH_APACHE;
479 include_once
'./Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
485 include_once
'./Services/OpenId/classes/class.ilOpenIdSettings.php';
492 foreach(self::getAuthPlugins() as $pl)
494 foreach($pl->getAuthIds() as $auth_id)
496 if($pl->isAuthActive($auth_id))
498 $modes[$pl->getAuthName($auth_id)] = $auth_id;
535 $r = $ilDB->query(
"SELECT login FROM usr_data WHERE login = ".
536 $ilDB->quote($c_login));
537 if ($r->numRows() > 0)
540 $c_login = $a_login.$postfix;
553 include_once(
'Services/Radius/classes/class.ilRadiusSettings.php');
556 if($rad_settings->isActive())
560 include_once(
'Services/LDAP/classes/class.ilLDAPServer.php');
567 if ($ilSetting->get(
'apache_active')) {
574 foreach($pl->getAuthIds() as $auth_id)
576 if($pl->getMultipleAuthModeOptions($auth_id))
593 include_once(
'Services/LDAP/classes/class.ilLDAPServer.php');
603 include_once(
'Services/Radius/classes/class.ilRadiusSettings.php');
605 if($rad_settings->isActive())
610 if ($ilSetting->get(
'apache_active'))
613 $apache_settings =
new ilSetting(
'apache_auth');
631 $default = $ilSetting->get(
'default_auth_mode',$default);
639 $auths = $pl->getAuthIds();
640 foreach($auths as $auth_id)
642 $pl_auth_option = $pl->getMultipleAuthModeOptions($auth_id);
651 $options[$default][
'checked'] =
true;
669 if($ilSetting->get(
"cas_active"))
673 if($ilSetting->get(
"soap_auth_active"))
677 if($ilSetting->get(
"shib_active"))
681 if($ilSetting->get(
'radius_active'))
685 include_once(
'Services/LDAP/classes/class.ilLDAPServer.php');
690 include_once
'./Services/OpenId/classes/class.ilOpenIdSettings.php';
697 foreach(self::getAuthPlugins() as $pl)
699 foreach($pl->getAuthIds() as $auth_id)
701 if($pl->isAuthActive($auth_id) and $pl->isExternalAccountNameRequired($auth_id))
763 if($ilSetting->get(
'usr_settings_hide_password') or $ilSetting->get(
'usr_settings_disable_password'))
785 return $ilSetting->get(
"shib_auth_allow_local");
787 return $ilSetting->get(
"soap_auth_allow_local");
789 return $ilSetting->get(
"cas_allow_local");
832 $pls =
$GLOBALS[
'ilPluginAdmin']->getActivePluginsForSlot(
840 $pl_objs[] =
$GLOBALS[
'ilPluginAdmin']->getPluginObject(