19 declare(strict_types=1);
99 $query_wrapper = $DIC->http()->wrapper()->query();
100 return $query_wrapper->has(
'ecs_hash') || $query_wrapper->has(
'ecs_hash_url');
106 $query_wrapper = $DIC->http()->wrapper()->query();
107 $string_refinery = $DIC->refinery()->kindlyTo()->string();
108 if ($query_wrapper->has(
'ecs_hash') || $query_wrapper->has(
'ecs_hash_url')) {
110 $credentials->setUsername($query_wrapper->retrieve(
'ecs_login', $string_refinery));
111 $credentials->setAuthMode((
string) self::AUTH_ECS);
114 $providers = $provider_factory->getProviders($credentials);
120 $frontend = $frontend_factory->getFrontend(
127 $frontend->authenticate();
129 switch ($status->getStatus()) {
149 if (
null === $a_auth_mode) {
153 if (strpos($a_auth_mode,
'_') !==
false) {
154 $auth_arr = explode(
'_', $a_auth_mode);
155 $auth_switch = $auth_arr[0];
157 $auth_switch = $a_auth_mode;
159 switch ($auth_switch) {
161 return self::AUTH_LOCAL;
171 return self::AUTH_SCRIPT;
175 return self::AUTH_SHIBBOLETH;
179 return self::AUTH_OPENID_CONNECT;
186 return self::AUTH_CAS;
190 return self::AUTH_SOAP;
194 return self::AUTH_ECS;
197 return self::AUTH_APACHE;
210 switch ((
int) $a_auth_key) {
211 case self::AUTH_LOCAL:
215 case self::AUTH_LDAP:
220 case self::AUTH_PROVIDER_LTI:
227 case self::AUTH_SCRIPT:
231 case self::AUTH_SHIBBOLETH:
235 case self::AUTH_SAML:
238 case self::AUTH_SOAP:
245 case self::AUTH_APACHE:
248 case self::AUTH_OPENID_CONNECT:
269 'local' => self::AUTH_LOCAL
273 $modes[
'ldap_' . $sid] = (self::AUTH_LDAP .
'_' . $sid);
277 $modes[
'lti_' . $sid] = (self::AUTH_PROVIDER_LTI .
'_' . $sid);
281 $modes[
'oidc'] = self::AUTH_OPENID_CONNECT;
285 $modes[
'shibboleth'] = self::AUTH_SHIBBOLETH;
288 $modes[
'script'] = self::AUTH_SCRIPT;
291 $modes[
'cas'] = self::AUTH_CAS;
294 $modes[
'soap'] = self::AUTH_SOAP;
297 $modes[
'apache'] = self::AUTH_APACHE;
301 $modes[
'ecs'] = self::AUTH_ECS;
305 $idpId = $idp->getIdpId();
306 $modes[
'saml_' . $idpId] = self::AUTH_SAML .
'_' . $idpId;
310 foreach (self::getAuthPlugins() as $pl) {
311 foreach ($pl->getAuthIds() as $auth_id) {
312 if ($pl->isAuthActive($auth_id)) {
313 $modes[$pl->getAuthName($auth_id)] = $auth_id;
329 self::AUTH_SHIBBOLETH,
334 self::AUTH_PROVIDER_LTI,
335 self::AUTH_OPENID_CONNECT,
339 foreach ($modes as $mode) {
340 if ($mode === self::AUTH_PROVIDER_LTI) {
342 $id = self::AUTH_PROVIDER_LTI .
'_' . $sid;
343 $ret[
$id] = self::_getAuthModeName(
$id);
349 if ($mode === self::AUTH_LDAP) {
351 $id = self::AUTH_LDAP .
'_' . $ldap_id;
352 $ret[
$id] = self::_getAuthModeName(
$id);
357 if ($mode === self::AUTH_SAML) {
359 $id = self::AUTH_SAML .
'_' . $idp->getIdpId();
360 $ret[
$id] = self::_getAuthModeName(
$id);
364 $ret[$mode] = self::_getAuthModeName($mode);
377 $ilDB = $DIC[
'ilDB'];
384 $r =
$ilDB->query(
"SELECT login FROM usr_data WHERE login = " .
385 $ilDB->quote($c_login));
386 if (
$r->numRows() > 0) {
388 $c_login = $a_login . $postfix;
412 foreach (self::getAuthPlugins() as $pl) {
413 foreach ($pl->getAuthIds() as $auth_id) {
414 if ($pl->getMultipleAuthModeOptions($auth_id)) {
437 $options[self::AUTH_LOCAL][
'txt'] = $lng->
txt(
'authenticate_ilias');
442 $options[self::AUTH_LDAP .
'_' . $sid][
'txt'] =
$server->getName();
449 $apache_settings =
new ilSetting(
'apache_auth');
450 $options[self::AUTH_APACHE][
'txt'] = $apache_settings->get(
'name', $lng->
txt(
'apache_auth'));
451 $options[self::AUTH_APACHE][
'hide_in_ui'] =
true;
454 if (
$ilSetting->get(
'auth_mode', (
string) self::AUTH_LOCAL) === (string) self::AUTH_LDAP) {
455 $default = self::AUTH_LDAP;
457 $default = self::AUTH_LOCAL;
460 $default =
$ilSetting->get(
'default_auth_mode', (
string) $default);
463 $pls = self::getAuthPlugins();
464 foreach ($pls as $pl) {
465 $auths = $pl->getAuthIds();
466 foreach ($auths as $auth_id) {
467 $pl_auth_option = $pl->getMultipleAuthModeOptions($auth_id);
468 if ($pl_auth_option) {
469 $options += $pl_auth_option;
475 if (array_key_exists($default, $options)) {
476 $options[$default][
'checked'] =
true;
518 foreach (self::getAuthPlugins() as $pl) {
519 foreach ($pl->getAuthIds() as $auth_id) {
520 if ($pl->isAuthActive($auth_id) && $pl->isExternalAccountNameRequired($auth_id)) {
536 switch ((
int) $a_auth_mode) {
537 case self::AUTH_LDAP:
539 case self::AUTH_PROVIDER_LTI:
540 case self::AUTH_OPENID_CONNECT:
554 switch ($a_auth_mode) {
555 case self::AUTH_LOCAL:
556 case self::AUTH_APACHE:
566 public static function isPasswordModificationHidden():
bool 573 return $ilSetting->get(
'usr_settings_hide_password') ||
$ilSetting->get(
'usr_settings_disable_password');
587 switch ((
int) $a_authmode) {
589 case self::AUTH_LOCAL:
590 case self::AUTH_APACHE:
594 case self::AUTH_LDAP:
596 case self::AUTH_SCRIPT:
597 case self::AUTH_PROVIDER_LTI:
598 case self::AUTH_OPENID_CONNECT:
601 case self::AUTH_SAML:
603 return $idp->isActive() && $idp->allowLocalAuthentication();
605 case self::AUTH_SHIBBOLETH:
606 return (
bool)
$ilSetting->get(
"shib_auth_allow_local",
'0');
607 case self::AUTH_SOAP:
608 return (
bool)
$ilSetting->get(
"soap_auth_allow_local",
'0');
610 return (
bool)
$ilSetting->get(
"cas_allow_local",
'0');
623 if (self::isPasswordModificationHidden()) {
627 return self::isLocalPasswordEnabledForAuthMode($a_authmode);
637 switch ((
int) $a_authmode) {
638 case self::AUTH_LDAP:
639 case self::AUTH_LOCAL:
640 return self::LOCAL_PWV_FULL;
642 case self::AUTH_SHIBBOLETH:
643 case self::AUTH_OPENID_CONNECT:
644 case self::AUTH_SAML:
645 case self::AUTH_SOAP:
647 if (!self::isPasswordModificationEnabled($a_authmode)) {
648 return self::LOCAL_PWV_NO;
650 return self::LOCAL_PWV_USER;
652 case self::AUTH_PROVIDER_LTI:
654 case self::AUTH_SCRIPT:
655 case self::AUTH_APACHE:
657 return self::LOCAL_PWV_USER;
666 return $GLOBALS[
'DIC'][
'component.factory']->getActivePluginsInSlot(
'authhk');
676 switch ((
int) $a_auth_key) {
677 case self::AUTH_LDAP:
681 case self::AUTH_PROVIDER_LTI:
686 case self::AUTH_SAML:
691 $lng->loadLanguageModule(
'auth');
692 if (!empty($auth_name)) {
693 return $lng->txt(
'auth_' . $auth_name);
696 return $lng->txt(
'auth_' . self::_getAuthModeName($a_auth_key));
const AUTH_OPENID_CONNECT
static getAuthModeByKey(string $a_auth_key)
Get auth mode by key.
static _generateLogin(string $a_login)
generate free login by starting with a default string and adding postfix numbers
const CONTEXT_STANDARD_FORM
static getAuthModeTranslation(string $a_auth_key, string $auth_name='')
static _getAuthMode(?string $a_auth_mode)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _hasMultipleAuthenticationMethods()
static _getServerList()
Get list of all configured servers.
static getInstanceByServerId(int $a_server_id)
Get instance by server id.
const AUTH_USER_SIMULTANEOUS_LOGIN
const STATUS_AUTHENTICATION_FAILED
static getInstance()
Get singleton instance.
static getKeyByAuthMode(string $a_auth_mode)
Get auth id by auth mode.
Factory for auth frontend classes.
static getServerIdByAuthMode(string $a_auth_mode)
Get auth id by auth mode.
static isAuthenticationForced()
Check if authentication is should be forced.
static goToPublicSection()
go to public section
static supportsLocalPasswordValidation($a_authmode)
Check if local password validation is supported.
static _getActiveAuthModes()
static lookupConsumer(int $a_sid)
Lookup consumer title.
static _getActiveServerList()
Get active server list.
static _needsExternalAccountByAuthMode($a_auth_mode)
Check if chosen auth mode needs an external account entry.
static getInstanceByIdpId(int $a_idp_id)
static getIdpIdByAuthMode(string $a_auth_mode)
static _getAuthModeName($a_auth_key)
static _allowPasswordModificationByAuthMode($a_auth_mode)
Allow password modification.
const AUTH_SOAP_NO_ILIAS_USER_BUT_EMAIL
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static getServerIdByAuthMode(string $a_auth_mode)
Get auth id by auth mode.
const AUTH_USER_TIME_LIMIT_EXCEEDED
static getAuthPlugins()
Get active enabled auth plugins.
static handleForcedAuthentication()
static getActiveAuthModes()
get all active authmode server ids
static getKeyByAuthMode(string $a_auth_mode)
Get auth id by auth mode.
static _isExternalAccountEnabled()
Check if an external account name is required.
static getKeyByAuthMode(string $a_auth_mode)
const STATUS_AUTHENTICATED
const AUTH_CAS_NO_ILIAS_USER
static isLocalPasswordEnabledForAuthMode($a_authmode)
Check if local password validation is enabled for a specific auth_mode.
static _getAllAuthModes()
static getAuthModeByKey(string $a_auth_key)
static getInstance()
Get status instance.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static _getMultipleAuthModeOptions(ilLanguage $lng)
static getActiveIdpList()
static isPasswordModificationEnabled($a_authmode)
Check if password modification is enabled.
const AUTH_LDAP_NO_ILIAS_USER
const AUTH_SOAP_NO_ILIAS_USER
static getAuthModeByKey(string $a_auth_key)
get auth mode by key