Google_Auth_Simple

Simple API access implementation.

Defined (1)

The class is defined in the following location(s).

/src/Google/Auth/Simple.php  
  1. class Google_Auth_Simple extends Google_Auth_Abstract 
  2. private $key = null; 
  3. private $client; 
  4.  
  5. public function __construct(Google_Client $client, $config = null) 
  6. $this->client = $client; 
  7.  
  8. /** 
  9. * Perform an authenticated / signed apiHttpRequest. 
  10. * This function takes the apiHttpRequest, calls apiAuth->sign on it 
  11. * (which can modify the request in what ever way fits the auth mechanism) 
  12. * and then calls apiCurlIO::makeRequest on the signed request 
  13. * @param Google_Http_Request $request 
  14. * @return Google_Http_Request The resulting HTTP response including the 
  15. * responseHttpCode, responseHeaders and responseBody. 
  16. */ 
  17. public function authenticatedRequest(Google_Http_Request $request) 
  18. $request = $this->sign($request); 
  19. return $this->io->makeRequest($request); 
  20.  
  21. public function sign(Google_Http_Request $request) 
  22. $key = $this->client->getClassConfig($this, 'developer_key'); 
  23. if ($key) { 
  24. $this->client->getLogger()->debug( 
  25. 'Simple API Access developer key authentication' 
  26. ); 
  27. $request->setQueryParam('key', $key); 
  28. return $request;