19 declare(strict_types=1);
76 $query_wrapper = $DIC->http()->wrapper()->query();
77 return $query_wrapper->has(
'ecs_hash') || $query_wrapper->has(
'ecs_hash_url');
83 $query_wrapper = $DIC->http()->wrapper()->query();
84 $string_refinery = $DIC->refinery()->kindlyTo()->string();
85 if ($query_wrapper->has(
'ecs_hash') || $query_wrapper->has(
'ecs_hash_url')) {
87 $credentials->setUsername($query_wrapper->retrieve(
'ecs_login', $string_refinery));
88 $credentials->setAuthMode((
string) self::AUTH_ECS);
91 $providers = $provider_factory->getProviders($credentials);
97 $frontend = $frontend_factory->getFrontend(
103 $frontend->authenticate();
105 switch ($status->getStatus()) {
125 if ($a_auth_mode ===
null) {
129 if (str_contains($a_auth_mode,
'_')) {
130 $auth_arr = explode(
'_', $a_auth_mode);
131 $auth_switch = $auth_arr[0];
133 $auth_switch = $a_auth_mode;
135 switch ($auth_switch) {
137 return self::AUTH_LOCAL;
147 return self::AUTH_SCRIPT;
151 return self::AUTH_SHIBBOLETH;
155 return self::AUTH_OPENID_CONNECT;
162 return self::AUTH_SOAP;
166 return self::AUTH_ECS;
169 return self::AUTH_APACHE;
182 switch ((
int) $a_auth_key) {
183 case self::AUTH_LOCAL:
187 case self::AUTH_LDAP:
192 case self::AUTH_PROVIDER_LTI:
195 case self::AUTH_SCRIPT:
199 case self::AUTH_SHIBBOLETH:
203 case self::AUTH_SAML:
206 case self::AUTH_SOAP:
213 case self::AUTH_APACHE:
216 case self::AUTH_OPENID_CONNECT:
237 'local' => self::AUTH_LOCAL
241 $modes[
'ldap_' . $sid] = (self::AUTH_LDAP .
'_' . $sid);
245 $modes[
'lti_' . $sid] = (self::AUTH_PROVIDER_LTI .
'_' . $sid);
249 $modes[
'oidc'] = self::AUTH_OPENID_CONNECT;
253 $modes[
'shibboleth'] = self::AUTH_SHIBBOLETH;
256 $modes[
'script'] = self::AUTH_SCRIPT;
259 $modes[
'soap'] = self::AUTH_SOAP;
262 $modes[
'apache'] = self::AUTH_APACHE;
266 $modes[
'ecs'] = self::AUTH_ECS;
270 $idpId = $idp->getIdpId();
271 $modes[
'saml_' . $idpId] = self::AUTH_SAML .
'_' . $idpId;
275 foreach (self::getAuthPlugins() as $pl) {
276 foreach ($pl->getAuthIds() as $auth_id) {
277 if ($pl->isAuthActive($auth_id)) {
278 $modes[$pl->getAuthName($auth_id)] = $auth_id;
294 self::AUTH_SHIBBOLETH,
298 self::AUTH_PROVIDER_LTI,
299 self::AUTH_OPENID_CONNECT,
303 foreach ($modes as $mode) {
304 if ($mode === self::AUTH_PROVIDER_LTI) {
306 $id = self::AUTH_PROVIDER_LTI .
'_' . $sid;
307 $ret[
$id] = self::_getAuthModeName(
$id);
313 if ($mode === self::AUTH_LDAP) {
315 $id = self::AUTH_LDAP .
'_' . $ldap_id;
316 $ret[
$id] = self::_getAuthModeName(
$id);
321 if ($mode === self::AUTH_SAML) {
323 $id = self::AUTH_SAML .
'_' . $idp->getIdpId();
324 $ret[
$id] = self::_getAuthModeName(
$id);
328 $ret[$mode] = self::_getAuthModeName($mode);
341 $ilDB = $DIC[
'ilDB'];
349 'SELECT login FROM usr_data WHERE login = ' .
350 $ilDB->quote($c_login)
352 if (
$r->numRows() > 0) {
354 $c_login = $a_login . $postfix;
378 foreach (self::getAuthPlugins() as $pl) {
379 foreach ($pl->getAuthIds() as $auth_id) {
380 if ($pl->getMultipleAuthModeOptions($auth_id)) {
401 $options[self::AUTH_LOCAL][
'txt'] = $lng->
txt(
'authenticate_ilias');
406 $options[self::AUTH_LDAP .
'_' . $sid][
'txt'] =
$server->getName();
413 $apache_settings =
new ilSetting(
'apache_auth');
414 $options[self::AUTH_APACHE][
'txt'] = $apache_settings->get(
'name', $lng->
txt(
'apache_auth'));
415 $options[self::AUTH_APACHE][
'hide_in_ui'] =
true;
418 if (
$ilSetting->get(
'auth_mode', (
string) self::AUTH_LOCAL) === (string) self::AUTH_LDAP) {
419 $default = self::AUTH_LDAP;
421 $default = self::AUTH_LOCAL;
424 $default =
$ilSetting->get(
'default_auth_mode', (
string) $default);
427 $pls = self::getAuthPlugins();
428 foreach ($pls as $pl) {
429 $auths = $pl->getAuthIds();
430 foreach ($auths as $auth_id) {
431 $pl_auth_option = $pl->getMultipleAuthModeOptions($auth_id);
432 if ($pl_auth_option) {
433 $options += $pl_auth_option;
439 if (array_key_exists($default, $options)) {
440 $options[$default][
'checked'] =
true;
479 foreach (self::getAuthPlugins() as $pl) {
480 foreach ($pl->getAuthIds() as $auth_id) {
481 if ($pl->isAuthActive($auth_id) && $pl->isExternalAccountNameRequired($auth_id)) {
497 switch ((
int) $a_auth_mode) {
498 case self::AUTH_LDAP:
500 case self::AUTH_PROVIDER_LTI:
501 case self::AUTH_OPENID_CONNECT:
515 switch ($a_auth_mode) {
516 case self::AUTH_LOCAL:
517 case self::AUTH_APACHE:
524 public static function isPasswordModificationHidden():
bool 531 return $ilSetting->get(
'usr_settings_hide_password') ||
$ilSetting->get(
'usr_settings_disable_password');
544 switch ((
int) $a_authmode) {
546 case self::AUTH_LOCAL:
547 case self::AUTH_APACHE:
551 case self::AUTH_LDAP:
553 case self::AUTH_SCRIPT:
554 case self::AUTH_PROVIDER_LTI:
555 case self::AUTH_OPENID_CONNECT:
558 case self::AUTH_SAML:
560 return $idp->isActive() && $idp->allowLocalAuthentication();
562 case self::AUTH_SHIBBOLETH:
563 return (
bool)
$ilSetting->get(
'shib_auth_allow_local',
'0');
564 case self::AUTH_SOAP:
565 return (
bool)
$ilSetting->get(
'soap_auth_allow_local',
'0');
577 if (self::isPasswordModificationHidden()) {
581 return self::isLocalPasswordEnabledForAuthMode($a_authmode);
591 switch ((
int) $a_authmode) {
592 case self::AUTH_LDAP:
593 case self::AUTH_LOCAL:
594 return self::LOCAL_PWV_FULL;
596 case self::AUTH_SHIBBOLETH:
597 case self::AUTH_OPENID_CONNECT:
598 case self::AUTH_SAML:
599 case self::AUTH_SOAP:
600 if (!self::isPasswordModificationEnabled($a_authmode)) {
601 return self::LOCAL_PWV_NO;
603 return self::LOCAL_PWV_USER;
604 case self::AUTH_PROVIDER_LTI:
606 case self::AUTH_SCRIPT:
607 case self::AUTH_APACHE:
609 return self::LOCAL_PWV_USER;
618 return $GLOBALS[
'DIC'][
'component.factory']->getActivePluginsInSlot(
'authhk');
628 switch ((
int) $a_auth_key) {
629 case self::AUTH_LDAP:
633 case self::AUTH_PROVIDER_LTI:
638 case self::AUTH_SAML:
643 $lng->loadLanguageModule(
'auth');
644 if (!empty($auth_name)) {
645 return $lng->txt(
'auth_' . $auth_name);
648 return $lng->txt(
'auth_' . self::_getAuthModeName($a_auth_key));
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 int AUTH_APACHE_FAILED
const int AUTH_SHIBBOLETH
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.
const int AUTH_MODE_INACTIVE
static getInstanceByServerId(int $a_server_id)
Get instance by server id.
static getInstance()
Get singleton instance.
static getKeyByAuthMode(string $a_auth_mode)
Get auth id by auth mode.
static getServerIdByAuthMode(string $a_auth_mode)
Get auth id by auth mode.
const int STATUS_AUTHENTICATED
static isAuthenticationForced()
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.
const int AUTH_USER_INACTIVE
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)
const int AUTH_USER_WRONG_IP
static getIdpIdByAuthMode(string $a_auth_mode)
static _getAuthModeName($a_auth_key)
const array REGEX_DELIMITERS
static _allowPasswordModificationByAuthMode($a_auth_mode)
Allow password modification.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static getServerIdByAuthMode(string $a_auth_mode)
Get auth id by auth mode.
static handleForcedAuthentication()
static getActiveAuthModes()
get all active authmode server ids
const int AUTH_USER_TIME_LIMIT_EXCEEDED
static getKeyByAuthMode(string $a_auth_mode)
Get auth id by auth mode.
const int AUTH_SOAP_NO_ILIAS_USER_BUT_EMAIL
const int AUTH_LDAP_NO_ILIAS_USER
const int STATUS_AUTHENTICATION_FAILED
static _isExternalAccountEnabled()
Check if an external account name is required.
static getKeyByAuthMode(string $a_auth_mode)
const int AUTH_SAML_FAILED
const int AUTH_PROVIDER_LTI
const int AUTH_SOAP_NO_ILIAS_USER
const int AUTH_USER_SIMULTANEOUS_LOGIN
static isLocalPasswordEnabledForAuthMode($a_authmode)
Check if local password validation is enabled for a specific auth_mode.
static _getAllAuthModes()
const int CONTEXT_STANDARD_FORM
Authentication with id and password.
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.
static getAuthModeByKey(string $a_auth_key)
get auth mode by key
const int AUTH_OPENID_CONNECT