protected function getConsumer(&$request)
    {
        $consumer_key = @$request->getParameter("oauth_consumer_key");
        if (!$consumer_key) {
            throw new OAuthException("Invalid consumer key");
        }
        
        $consumer = $this->data_store->lookupConsumer($consumer_key);
        if (!$consumer) {
            throw new OAuthException("Invalid consumer");
        }
        
        return $consumer;
    }