34 $this->auth_session = $session;
82 $this->
getStatus()->setAuthenticatedUserId(0);
106 $this->
getLogger()->warning(
'Desired user account is not authenticated');
109 include_once
'./Services/Object/classes/class.ilObjectFactory.php';
111 $user = $user_factory->getInstanceByObjId($session->
getUserId(),
false);
115 $this->
getLogger()->info(
'Cannot instanitate user account for account migration: ' . $session->
getUserId());
123 $user->setExternalAccount(
ilSession::get(static::MIG_EXTERNAL_ACCOUNT));
130 $this->logger->warning(
'Provider: ' . get_class($provider) .
' does not support account migration.');
134 $provider->migrateAccount($this->
getStatus());
154 $this->logger->warning(
'Provider: ' . get_class($provider) .
' does not support account migration.');
157 $provider->createNewAccount($this->
getStatus());
180 $this->
getLogger()->debug(
'Trying authentication against: ' . get_class($provider));
182 $provider->doAuthentication($this->
getStatus());
184 $this->
getLogger()->debug(
'Authentication user id: ' . $this->
getStatus()->getAuthenticatedUserId());
192 $this->
getLogger()->notice(
"Account migration required.");
197 $this->
getLogger()->debug(
'Authentication failed against: ' . get_class($provider));
214 $this->
getStatus()->setAuthenticatedUserId(ANONYMOUS_USER_ID);
215 #$this->getStatus()->setStatus(ilAuthStatus::STATUS_AUTHENTICATED); 232 include_once
'./Services/Object/classes/class.ilObjectFactory.php';
234 $user = $factory->getInstanceByObjId($this->
getStatus()->getAuthenticatedUserId(),
false);
241 $this->
getLogger()->error(
'Cannot instatiate user account with id: ' . $this->
getStatus()->getAuthenticatedUserId());
243 $this->
getStatus()->setAuthenticatedUserId(0);
244 $this->
getStatus()->setReason(
'auth_err_invalid_user_account');
250 $this->
getLogger()->info(
'Authentication failed for inactive user with id and too may login attempts: ' . $this->
getStatus()->getAuthenticatedUserId());
252 $this->
getStatus()->setAuthenticatedUserId(0);
253 $this->
getStatus()->setReason(
'err_inactive_login_attempts');
259 $this->
getLogger()->info(
'Authentication failed for inactive user with id: ' . $this->
getStatus()->getAuthenticatedUserId());
261 $this->
getStatus()->setAuthenticatedUserId(0);
262 $this->
getStatus()->setReason(
'err_inactive');
269 $this->
getLogger()->info(
'Authentication failed (time limit restriction) for user with id: ' . $this->
getStatus()->getAuthenticatedUserId());
271 if(
$GLOBALS[
'ilSetting']->
get(
'user_reactivate_code'))
273 $this->
getLogger()->debug(
'Accout reactivation codes are active');
278 $this->
getLogger()->debug(
'Accout reactivation codes are inactive');
280 $this->
getStatus()->setAuthenticatedUserId(0);
282 $this->
getStatus()->setReason(
'time_limit_reached');
289 $this->
getLogger()->info(
'Authentication failed (wrong ip) for user with id: ' . $this->
getStatus()->getAuthenticatedUserId());
291 $this->
getStatus()->setAuthenticatedUserId(0);
303 $this->
getLogger()->debug(
'Check simutaneous login');
306 $this->
getLogger()->info(
'Authentication failed: simultaneous logins forbidden for user: ' . $this->
getStatus()->getAuthenticatedUserId());
308 $this->
getStatus()->setAuthenticatedUserId(0);
309 $this->
getStatus()->setReason(
'simultaneous_login_detected');
314 include_once
"Services/User/classes/class.ilUserProfile.php";
318 $user->setProfileIncomplete(
true);
327 include_once
'Services/Tracking/classes/class.ilOnlineTracking.php';
328 ilOnlineTracking::addUser($user->getId());
331 include_once
'Modules/Forum/classes/class.ilObjForum.php';
332 ilObjForum::_updateOldAccess($user->getId());
334 require_once
'Services/PrivacySecurity/classes/class.ilSecuritySettings.php';
341 $security_settings->isPasswordChangeOnFirstLoginEnabled() &&
342 $user->getLastLogin() == null
345 $user->resetLastPasswordChange();
347 $user->refreshLogin();
356 include_once
'./Services/Init/classes/class.ilInitialisation.php';
357 ilInitialisation::initUserAccount();
360 $user->hasToAcceptTermsOfServiceInSession(
true);
365 'logged in as '. $user->getLogin() .
371 global $ilAppEventHandler;
372 $ilAppEventHandler->raise(
373 'Services/Authentication',
376 'username' => $user->getLogin())
398 if(in_array($user->
getId(),
array(ANONYMOUS_USER_ID)))
409 require_once
'Services/PrivacySecurity/classes/class.ilSecuritySettings.php';
411 $maxLoginAttempts = $security->getLoginMaxAttempts();
413 if(!(
int)$maxLoginAttempts)
420 return $numLoginAttempts < $maxLoginAttempts;
439 if (trim($clientip) !=
"")
441 $clientip = preg_replace(
"/[^0-9.?*,:]+/",
"",$clientip);
442 $clientip = str_replace(
".",
"\\.",$clientip);
443 $clientip = str_replace(Array(
"?",
"*",
","), Array(
"[0-9]",
"[0-9]*",
"|"), $clientip);
447 if (!preg_match(
"/^".$clientip.
"$/", $_SERVER[
"REMOTE_ADDR"]))
461 $this->
getLogger()->debug(
'Setting prevent simultaneous session is: ' . (
string)
$GLOBALS[
'ilSetting']->
get(
'ps_prevent_simultaneous_logins'));
463 $GLOBALS[
'ilSetting']->
get(
'ps_prevent_simultaneous_logins') &&
477 $this->
getLogger()->debug(
'Authentication failed for all authentication methods.');
480 if(!in_array($user_id,
array(ANONYMOUS_USER_ID)))
487 include_once
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php';
489 $max_attempts = $security->getLoginMaxAttempts();
491 if((
int) $max_attempts && $login_attempts >= $max_attempts)
493 $this->
getStatus()->setReason(
'auth_err_login_attempts_deactivation');
494 $this->
getLogger()->warning(
'User account set to inactive due to exceeded login attempts.');
static _lookupLogin($a_user_id)
lookup login
static isProfileIncomplete($a_user, $a_include_udf=true, $a_personal_data_only=true)
Check if all required personal data fields are set.
migrateAccount(ilAuthSession $session)
Migrate Account to existing user account.
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
getProviders()
Get providers.
getActive()
get user active state public
checkIp(ilObjUser $user)
Check ip.
Interface of auth credentials.
Description of class interface.
Description of class class.
static hasActiveSession($a_user_id, $a_session_id)
Check for simultaneous login.
checkExceededLoginAttempts(\ilObjUser $user)
const STATUS_AUTHENTICATION_FAILED
handleAuthenticationSuccess(ilAuthProviderInterface $provider)
Handle successful authentication.
static _incrementLoginAttempts($a_usr_id)
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static get($a_var)
Get a value.
checkSimultaneousLogins(ilObjUser $user)
Check simultaneous logins.
static set($a_var, $a_val)
Set a value.
isAuthenticated()
Check if session is authenticated.
static _lookupId($a_user_str)
Lookup id by login.
handleAccountMigration(ilAuthProviderAccountMigrationInterface $provider)
Handle account migration.
resetStatus()
Reset status.
static _resetLoginAttempts($a_usr_id)
getCredentials()
Get auth credentials.
static _getLoginAttempts($a_usr_id)
migrateAccountNew()
Create new user account.
getUserId()
Get authenticated user id.
Standard interface for auth provider implementations.
authenticate()
Try to authenticate user.
checkTimeLimit(ilObjUser $user)
Check time limit.
handleAuthenticationFail()
Handle failed authenication.
getId()
get object id public
checkActivation(ilObjUser $user)
Check activation.
getTriggerAuthMode()
Get auth mode which triggered the account migration 2_1 for ldap account migration with server id 1 1...
Create styles array
The data for the language used.
const STATUS_AUTHENTICATED
const MIG_EXTERNAL_ACCOUNT
static _setUserInactive($a_usr_id)
const STATUS_CODE_ACTIVATION_REQUIRED
__construct(ilAuthSession $session, ilAuthStatus $status, ilAuthCredentials $credentials, array $providers)
Constructor.
static getLogger($a_component_id)
Get component logger.
const MIG_DESIRED_AUTHMODE
getAuthSession()
Get auth session.
getClientIP()
get client ip number public
static handleLoginEvent($a_login, ilAuthSession $auth_session)
when current session is allowed to be created it marks it with type regarding to the sessions user co...
getExternalAccountName()
Get external account name.
const MIG_TRIGGER_AUTHMODE
Auth status implementation.
static _getInstance()
Get instance of ilSecuritySettings.
const STATUS_ACCOUNT_MIGRATION_REQUIRED
getUserAuthModeName()
Get user auth mode name ldap_1 for ldap account migration with server id 1 apache for apache auth...