4include_once
'./Services/Authentication/classes/Provider/class.ilAuthProvider.php';
5include_once
'./Services/Authentication/interfaces/interface.ilAuthProviderInterface.php';
6include_once
'./Services/Authentication/interfaces/interface.ilAuthProviderAccountMigrationInterface.php';
34 include_once
'./Services/Administration/classes/class.ilSetting.php';
53 if(!$this->
getSettings()->
get(
'apache_enable_auth'))
55 $this->
getLogger()->info(
'Apache auth disabled.');
61 !$this->
getSettings()->
get(
'apache_auth_indicator_name') ||
62 !$this->
getSettings()->
get(
'apache_auth_indicator_value')
65 $this->
getLogger()->warning(
'Apache auth indicator match failure.');
73 array_filter(array_map(
'trim', str_getcsv($this->
getSettings()->
get(
'apache_auth_indicator_value'))))
77 $this->
getLogger()->warning(
'Apache authentication failed (indicator name <-> value');
82 include_once
'./Services/Utilities/classes/class.ilUtil.php';
92 $this->
getLogger()->info(
'No username given');
98 include_once
'./Services/LDAP/classes/class.ilLDAPServer.php';
113 $this->
getLogger()->info(
'Cannot find user id for external account: ' . $this->
getCredentials()->getUsername());
119 $status->setAuthenticatedUserId($usr_id);
131 $this->force_new_account =
true;
132 if($this->
getSettings()->
get(
'apache_enable_ldap'))
144 $this->force_new_account =
true;
145 if($this->
getSettings()->
get(
'apache_enable_ldap'))
151 $this->
getSettings()->
get(
'apache_enable_local') &&
152 $this->
getSettings()->
get(
'apache_local_autocreate')
155 $this->
getLogger()->info(
'Creating new apache auth account');
156 include_once
'./Services/User/classes/class.ilObjUser.php';
160 $user->setLogin($login);
161 $user->setExternalAccount($this->
getCredentials()->getUsername());
162 $user->setProfileIncomplete(
true);
164 $user->setAuthMode(
'apache');
167 $user->setLastPasswordChangeTS(time());
168 $user->setTimeLimitUnlimited(1);
174 $GLOBALS[
'DIC']->rbac()->admin()->assignUser(
175 $this->
getSettings()->
get(
'apache_default_role', 4),
179 $status->setAuthenticatedUserId($user->getId());
201 $this->migration_account = $a_name;
219 return 'ldap_'.(string) $this->
getSettings()->get(
'apache_ldap_sid');
231 include_once
'./Services/LDAP/classes/class.ilLDAPServer.php';
236 $this->
getLogger()->debug(
'Using ldap data source with server configuration: ' .
$server->getName());
238 include_once
'./Services/LDAP/classes/class.ilLDAPUserSynchronisation.php';
240 $sync->setExternalAccount($this->
getCredentials()->getUsername());
241 $sync->setUserData(array());
242 $sync->forceCreation($this->force_new_account);
243 $sync->forceReadLdapData(
true);
246 $internal_account = $sync->sync();
247 $this->
getLogger()->debug(
'Internal account: ' . $internal_account);
249 catch(UnexpectedValueException $e) {
250 $this->
getLogger()->info(
'Login failed with message: ' . $e->getMessage());
256 $this->
getLogger()->info(
'Login failed with message: ' . $e->getMessage());
263 $this->
getLogger()->info(
'Authentication failed: account migration required for external account: ' . $this->
getCredentials()->getUsername());
An exception for terminatinating execution or to throw for unit testing.
getTriggerAuthMode()
Get auth mode of current authentication type.
getSettings()
Get setings.
getExternalAccountName()
Get external account name.
createNewAccount(\ilAuthStatus $status)
Create new account for account migration.
const APACHE_AUTH_TYPE_BY_FUNCTION
handleLDAPDataSource(ilAuthStatus $status)
Handle ldap as data source.
const APACHE_AUTH_TYPE_EXTENDED_MAPPING
__construct(\ilAuthCredentials $credentials)
Constructor.
doAuthentication(\ilAuthStatus $status)
const APACHE_AUTH_TYPE_DIRECT_MAPPING
getUserAuthModeName()
Get user auth mode name.
migrateAccount(\ilAuthStatus $status)
Migrate existing account Maybe ldap sync has to be performed here.
setExternalAccountName($a_name)
Set external account name.
Base class for authentication providers (radius, ldap, apache, ...)
handleAuthenticationFail(ilAuthStatus $status, $a_reason)
Handle failed authentication.
Auth status implementation.
const STATUS_AUTHENTICATED
const STATUS_ACCOUNT_MIGRATION_REQUIRED
static _generateLogin($a_login)
generate free login by starting with a default string and adding postfix numbers
Description of ilLDAPAccountMigrationRequiredException.
static getInstanceByServerId($a_server_id)
Get instance by server id.
Description of ilLDAPSyncronisationException.
Synchronization of user accounts used in auth container ldap, radius , cas,...
static _lookupId($a_user_str)
Lookup id by login.
static _checkExternalAuthAccount($a_auth, $a_account)
check whether external account and authentication method matches with a user
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Interface of auth credentials.
Description of class interface.
Standard interface for auth provider implementations.
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']