Exemplo n.º 1
0
 /**
  *
  */
 public function authenticateByToken($authToken)
 {
     list($identifier, $token) = explode(':', $authToken);
     $now = time();
     $theLogin = $this->getByIdentifierAndToken($identifier, $token);
     if (!$theLogin) {
         \Lib\AppFactory::log()->error(new \Exception('Could not find a login for the given token.'));
         return false;
     } elseif ($theLogin['timeout'] < $now) {
         \Lib\AppFactory::log()->error(new \Exception('Authentication timeout.'));
         return false;
     }
     $authToken = $this->generateAuthenticationToken($theLogin);
     return array('token' => $authToken, 'timeout' => $theLogin['timeout'], 'loginId' => $theLogin['loginId']);
 }