Exemplo n.º 1
0
 /**
  *
  * Resumes any previous session, logging out the user as idled or
  * expired if needed.
  *
  * @param Auth $auth An authentication tracker.
  *
  * @return bool Whether or not a session still exists.
  *
  */
 public function resume(Auth $auth)
 {
     $this->session->resume();
     if (!$this->timedOut($auth)) {
         $auth->setLastActive(time());
         $this->adapter->resume($auth);
     }
 }
Exemplo n.º 2
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.º 3
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;
 }