/** * @param string $name * @param IQuarkAuthorizableModel $user * @param QuarkDTO $input * @param bool $http * * @return bool */ public function Input($name, IQuarkAuthorizableModel $user, QuarkDTO $input, $http) { $this->_name = $name; $session = $http ? $input->GetCookieByName($this->_cookie) : ($input->AuthorizationProvider() != null ? $input->AuthorizationProvider()->ToCookie() : null); if (!$session) { return false; } $session->value = trim($session->value); if (!$session->value) { return false; } $storage = self::_storage($name, $session->value); try { $json = json_decode($storage->Load()->Content()); if (!$json || QuarkObject::isIterative($json)) { return false; } $this->_sid = $session->value; $this->_user = $json->user; $this->_signature = $json->signature; $this->_ttl = $json->ttl; $this->_output = new QuarkDTO(); $this->_output->AuthorizationProvider(new QuarkKeyValuePair($this->_name, $this->_sid)); return true; } catch (\Exception $e) { return false; } }