19declare(strict_types=1);
63 if (!$this->
settings->get(
'apache_enable_auth',
'0')) {
64 $this->
getLogger()->info(
'Apache auth disabled.');
69 if (!$this->
settings->get(self::ENV_APACHE_AUTH_INDICATOR_NAME,
'') ||
70 !$this->settings->get(self::ENV_APACHE_AUTH_INDICATOR_VALUE,
'')) {
71 $this->
getLogger()->warning(
'Apache auth indicator match failure.');
76 $validIndicatorValues = array_filter(
79 str_getcsv($this->
settings->get(self::ENV_APACHE_AUTH_INDICATOR_VALUE,
''),
',',
'"',
'\\')
84 if (!isset(
$_SERVER[$this->
settings->get(self::ENV_APACHE_AUTH_INDICATOR_NAME,
'')]) ||
87 $validIndicatorValues,
90 $this->
getLogger()->warning(
'Apache authentication failed (indicator name <-> value');
102 $this->
getLogger()->info(
'No username given');
108 if ($this->
settings->get(self::APACHE_ENABLE_LDAP,
'0')) {
116 'Cannot find user id for external account: ' . $this->
getCredentials()->getUsername()
129 $this->force_new_account =
true;
130 if ($this->
settings->get(self::APACHE_ENABLE_LDAP,
'0')) {
137 $this->force_new_account =
true;
138 if ($this->
settings->get(self::APACHE_ENABLE_LDAP,
'0')) {
150 $this->migration_account = $name;
160 if ($this->
settings->get(self::APACHE_LDAP_SID,
'0')) {
161 return 'ldap_' . $this->
settings->get(self::APACHE_LDAP_SID,
'');
170 (
int) $this->
settings->get(self::APACHE_LDAP_SID,
'0')
173 $this->
getLogger()->debug(
'Using ldap data source with server configuration: ' .
$server->getName());
176 $sync->setExternalAccount($this->
getCredentials()->getUsername());
177 $sync->setUserData([]);
178 $sync->forceCreation($this->force_new_account);
179 $sync->forceReadLdapData(
true);
182 $internal_account = $sync->sync();
183 $this->
getLogger()->debug(
'Internal account: ' . $internal_account);
184 }
catch (\UnexpectedValueException
$e) {
185 $this->
getLogger()->info(
'Login failed with message: ' . $e->getMessage());
192 $this->
getLogger()->info(
'Login failed with message: ' . $e->getMessage());
198 'Authentication failed: account migration required for external account: %s',
const int APACHE_AUTH_TYPE_EXTENDED_MAPPING
getTriggerAuthMode()
Get auth mode which triggered the account migration 2_1 for ldap account migration with server id 1 1...
const string APACHE_LDAP_SID
const string ERR_WRONG_LOGIN
doAuthentication(ilAuthStatus $status)
handleLDAPDataSource(ilAuthStatus $status)
readonly ilSetting $settings
const int APACHE_AUTH_TYPE_DIRECT_MAPPING
getExternalAccountName()
Get external account name.
getUserAuthModeName()
Get user auth mode name ldap_1 for ldap account migration with server id 1 apache for apache auth.
const int APACHE_AUTH_TYPE_BY_FUNCTION
migrateAccount(ilAuthStatus $status)
Create new account.
createNewAccount(ilAuthStatus $status)
Create new ILIAS account for external_account.
const string ENV_APACHE_AUTH_INDICATOR_NAME
const string APACHE_ENABLE_LDAP
string $migration_account
__construct(ilAuthCredentials $credentials)
setExternalAccountName(string $name)
const string ENV_APACHE_AUTH_INDICATOR_VALUE
handleAuthenticationFail(ilAuthStatus $status, string $a_reason)
ilAuthCredentials $credentials
const int STATUS_ACCOUNT_MIGRATION_REQUIRED
setAuthenticatedUserId(int $a_id)
setStatus(int $a_status)
Set auth status.
const int STATUS_AUTHENTICATED
static getInstanceByServerId(int $a_server_id)
Get instance by server id.
Thrown in case of failed synchronisation settings.
Synchronization of user accounts used in auth container ldap, ,...
static _lookupId(string|array $a_user_str)
static _checkExternalAuthAccount(string $a_auth, string $a_account, bool $tryFallback=true)
check whether external account and authentication method matches with a user
Util class various functions, usage as namespace.
static isLogin(string $a_login)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc