Esempio n. 1
0
 /**
  * This is a universal method all client types must implement to
  * take a Cosmos_Api_Request object and make the call via the
  * underlying client object.
  * 
  * @param Cosmos_Api_Request $request
  * @return Cosmos_Api_Response
  */
 public function cosmosRequest(Cosmos_Api_Request $request)
 {
     $apiKey = Cosmos_Api::getApiKey($request->getOauthParam('oauth_consumer_key'));
     if (!$apiKey) {
         Zend_Debug::dump($apiKey);
         //			throw new Cosmos_Api_Exception('Unauthorized - Bad consumer key provided', 401);
     }
     $this->_server->setRequest($request);
     $response = $this->_server->handle();
     return $response;
     //        return $response->getResponseValue();
 }
Esempio n. 2
0
 protected function _validateOauthRequest()
 {
     $apiKey = Cosmos_Api::getApiKey($this->_oauthParams['oauth_consumer_key']);
     if (!$apiKey) {
         throw new Cosmos_Api_Exception('Unauthorized - Bad consumer key provided', 401);
     }
     $this->setOauthConsumerSecret($apiKey['private_key']);
     $signature = $this->_generateOauthSignature('POST');
     if ($signature !== $this->_oauthSignature) {
         throw new Cosmos_Api_Server_Exception('Unauthorized - Bad signature provided', 401);
     }
     return true;
 }