Skip to content

Commit

Permalink
Updated Zend_Service_GitHub to use BasicAuth instead of sending raw c…
Browse files Browse the repository at this point in the history
…redentials via GET parameters
  • Loading branch information
adamlundrigan committed Aug 7, 2011
1 parent 8323ad4 commit 2235571
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions Zend/Service/GitHub.php
Expand Up @@ -360,13 +360,11 @@ protected function _get($path, array $query = null, $addApiEntryPath = true)
$this->_prepare($path, $addApiEntryPath);
$this->_localHttpClient->setParameterGet($query);

if ($this->_authorizationInitialized && $query !== null) {
$_query = array_merge($this->_getAuthorizationCredentials(), $query);
$this->_localHttpClient->setParameterGet($_query);
} elseif (!$this->_authorizationInitialized && $query !== null) {
$this->_localHttpClient->setParameterGet($query);
} elseif ($this->_authorizationInitialized && $query == null) {
$this->_localHttpClient->setParameterGet($this->_getAuthorizationCredentials());
if ( $this->_authorizationCredentials ) {
$this->_localHttpClient->setAuth(
$this->getLogin() . "/token",
$this->getToken()
);
}
return $this->_localHttpClient->request('GET');
}
Expand All @@ -381,15 +379,14 @@ protected function _get($path, array $query = null, $addApiEntryPath = true)
protected function _post($path, $data = null)
{
$this->_prepare($path);
if ($this->_authorizationInitialized && $data !== null) {
$_data = array_merge($this->_getAuthorizationCredentials(), $data);
} elseif ($this->_authorizationInitialized && $data == null) {
$_data = $this->_getAuthorizationCredentials();
} elseif (!$this->_authorizationInitialized && $data !== null) {
$_data = $data;
if ( $this->_authorizationCredentials ) {
$this->_localHttpClient->setAuth(
$this->getLogin() . "/token",
$this->getToken()
);
}
return $this->_performPost('POST', $_data);
}
return $this->_performPost('POST', $data);
}
/**
* Perform a POST or PUT
*
Expand Down

0 comments on commit 2235571

Please sign in to comment.