/**
  * @return array|bool
  */
 public function getUserData()
 {
     if (!$this->isValid()) {
         return false;
     }
     return $this->authenticationSession->getUserData();
 }
Exemplo n.º 2
0
 /**
  *
  * Forces a successful logout.
  *
  * @param Auth $auth An authentication tracker.
  *
  * @param string $status The status after logout.
  *
  * @return string The new authentication status.
  *
  */
 public function forceLogout(Auth $auth, $status = Status::ANON)
 {
     $this->session->regenerateId();
     $auth->set($status, null, null, null, array());
     return $status;
 }
Exemplo n.º 3
0
 /**
  *
  * Sets the user timeout status, and logs out if expired.
  *
  * @param Auth $auth An authentication tracker.
  *
  * @return bool
  *
  */
 protected function timedOut(Auth $auth)
 {
     if ($auth->isAnon()) {
         return false;
     }
     $timeout_status = $this->timer->getTimeoutStatus($auth->getFirstActive(), $auth->getLastActive());
     if ($timeout_status) {
         $auth->setStatus($timeout_status);
         $this->logout_service->logout($auth, $timeout_status);
         return true;
     }
     return false;
 }
Exemplo n.º 4
0
 /**
  *
  * Forces a successful login.
  *
  * @param Auth $auth The authentication tracking object.
  *
  * @param string $name The authenticated user name.
  *
  * @param string $data Additional arbitrary user data.
  *
  * @param string $status The new authentication status.
  *
  * @return string|false The authentication status on success, or boolean
  * false on failure.
  *
  */
 public function forceLogin(Auth $auth, $name, array $data = array(), $status = Status::VALID)
 {
     $started = $this->session->resume() || $this->session->start();
     if (!$started) {
         return false;
     }
     $this->session->regenerateId();
     $auth->set($status, time(), time(), $name, $data);
     return $status;
 }
Exemplo n.º 5
0
 public function __invoke()
 {
     return $this->user->isValid();
 }