/**
  * Checks whether the maximum inactivity time has been exceeded.
  *
  * Returns TRUE in case the maximum inactivity time has not been exceeded.
  * Otherwise returns FALSE.
  *
  * @see \Ableron\Core\Session\Validators\ValidatorInterface::isValid()
  */
 public function isValid(SessionEntity $session)
 {
     // get setting key for the timeout to use
     $settingKeySessionInactivityTimeout = Application::getRequestHandler()->isFrontendRequest() ? 'session.frontend.inactivityTimeoutValidator.timeout' : 'session.backend.inactivityTimeoutValidator.timeout';
     // return whether session has timed out
     return $session->getLastActivityTime() > DateUtil::getCurrentUtcDateTime()->sub(Application::getConfig()->get($settingKeySessionInactivityTimeout));
 }
 /**
  * Updates a session.
  *
  * Sets the last activity time to "now".
  * Updates the validation data.
  *
  * @param \Ableron\Modules\Core\Model\Entities\SessionEntity $session The session to update
  * @return void
  */
 protected function update(SessionEntity $session)
 {
     // update last activity time
     $session->setLastActivityTime(DateUtil::getCurrentUtcDateTime());
     // update validation data
     foreach ($this->getValidators() as $validator) {
         $validator->setValidationData($session);
     }
 }
 /**
  * @see \Ableron\Modules\Core\Services\Authentication\AuthenticationInterface::logout()
  */
 public static function logout(SessionEntity $session)
 {
     $session->setUser(null);
 }
Ejemplo n.º 4
0
 /**
  * @see \Ableron\Core\Session\Validators\ValidatorInterface::setValidationData()
  */
 public function setValidationData(SessionEntity $session)
 {
     $session->setData('sessionValidation.lastAccessUserAgent', EnvironmentUtil::getEnvironmentVariable('HTTP_USER_AGENT'));
 }
Ejemplo n.º 5
0
 /**
  * @see \Ableron\Core\Session\Validators\ValidatorInterface::setValidationData()
  */
 public function setValidationData(SessionEntity $session)
 {
     $session->setData('sessionValidation.lastAccessIpAddress', EnvironmentUtil::getEnvironmentVariable('REMOTE_ADDR'));
 }