19 declare(strict_types=1);
51 if (!$this->
settings->get(
'apache_enable_auth',
'0')) {
52 $this->
getLogger()->info(
'Apache auth disabled.');
58 !$this->
settings->get(self::ENV_APACHE_AUTH_INDICATOR_NAME,
'') ||
59 !$this->
settings->get(
'apache_auth_indicator_value',
'')
61 $this->
getLogger()->warning(
'Apache auth indicator match failure.');
66 $validIndicatorValues = array_filter(
array_map(
68 str_getcsv($this->
settings->get(
'apache_auth_indicator_value',
''))
72 !isset(
$_SERVER[$this->
settings->get(self::ENV_APACHE_AUTH_INDICATOR_NAME,
'')]) ||
73 !in_array(
$_SERVER[$this->
settings->get(self::ENV_APACHE_AUTH_INDICATOR_NAME,
'')], $validIndicatorValues,
true)
75 $this->
getLogger()->warning(
'Apache authentication failed (indicator name <-> value');
87 $this->
getLogger()->info(
'No username given');
93 if ($this->
settings->get(self::APACHE_ENABLE_LDAP,
'0')) {
100 $this->
getLogger()->info(
'Cannot find user id for external account: ' . $this->
getCredentials()->getUsername());
112 $this->force_new_account =
true;
113 if ($this->
settings->get(self::APACHE_ENABLE_LDAP,
'0')) {
120 $this->force_new_account =
true;
121 if ($this->
settings->get(self::APACHE_ENABLE_LDAP,
'0')) {
133 $this->migration_account = $name;
143 if ($this->
settings->get(self::APACHE_LDAP_SID,
'0')) {
144 return 'ldap_' . $this->
settings->get(self::APACHE_LDAP_SID,
'');
153 (
int) $this->
settings->get(self::APACHE_LDAP_SID,
'0')
156 $this->
getLogger()->debug(
'Using ldap data source with server configuration: ' .
$server->getName());
160 $sync->setUserData([]);
161 $sync->forceCreation($this->force_new_account);
162 $sync->forceReadLdapData(
true);
165 $internal_account = $sync->sync();
166 $this->
getLogger()->debug(
'Internal account: ' . $internal_account);
168 $this->
getLogger()->info(
'Login failed with message: ' . $e->getMessage());
175 $this->
getLogger()->info(
'Login failed with message: ' . $e->getMessage());
180 $this->
getLogger()->info(
'Authentication failed: account migration required for external account: ' . $this->
getCredentials()->getUsername());
string $migration_account
migrateAccount(ilAuthStatus $status)
Create new account.
const ENV_APACHE_AUTH_INDICATOR_NAME
Interface of auth credentials.
static getInstanceByServerId(int $a_server_id)
Get instance by server id.
doAuthentication(ilAuthStatus $status)
Thrown in case of failed synchronisation settings.
handleLDAPDataSource(ilAuthStatus $status)
Synchronization of user accounts used in auth container ldap, cas,...
static _lookupId($a_user_str)
createNewAccount(ilAuthStatus $status)
Create new ILIAS account for external_account.
static _checkExternalAuthAccount(string $a_auth, string $a_account, bool $tryFallback=true)
check whether external account and authentication method matches with a user
handleAuthenticationFail(ilAuthStatus $status, string $a_reason)
Handle failed authentication.
Base class for authentication providers (ldap, apache, ...)
setExternalAccount(string $a_ext)
Set external account (unique for each auth mode)
getTriggerAuthMode()
Get auth mode which triggered the account migration 2_1 for ldap account migration with server id 1 1...
setExternalAccountName(string $name)
setStatus(int $a_status)
Set auth status.
const APACHE_AUTH_TYPE_DIRECT_MAPPING
static isLogin(string $a_login)
ilAuthCredentials $credentials
getExternalAccountName()
Get external account name.
readonly ilSetting $settings
__construct(ilAuthCredentials $credentials)
getUserAuthModeName()
Get user auth mode name ldap_1 for ldap account migration with server id 1 apache for apache auth...
const STATUS_AUTHENTICATED
__construct(Container $dic, ilPlugin $plugin)
const APACHE_AUTH_TYPE_BY_FUNCTION
const APACHE_AUTH_TYPE_EXTENDED_MAPPING
setAuthenticatedUserId(int $a_id)
const STATUS_ACCOUNT_MIGRATION_REQUIRED