Skip to content
Permalink
Browse files

changes option names to camelCase and adds a throw mention in doc block

  • Loading branch information...
TheFRedFox committed May 27, 2016
1 parent 19f72bd commit 12a0760fe69dac3cd4d3e9abe1c129e2598a966d
Showing with 8 additions and 9 deletions.
  1. +8 −9 src/Network/Http/Auth/Oauth.php
@@ -40,10 +40,7 @@ class Oauth
*/
public function authentication(Request $request, array $credentials)
{
$hasKeys = isset(
$credentials['consumerKey']
);
if (!$hasKeys) {
if (!isset($credentials['consumerKey'])) {
return;
}
if (empty($credentials['method'])) {
@@ -160,6 +157,8 @@ protected function _hmacSha1($request, $credentials)
* @param \Cake\Network\Http\Request $request The request object.
* @param array $credentials Authentication credentials.
* @return string
*
* @throws \RuntimeException
*/
protected function _rsaSha1($request, $credentials)
{
@@ -192,15 +191,15 @@ protected function _rsaSha1($request, $credentials)
}
$credentials += [
'private_key_passphrase' => null,
'privateKeyPassphrase' => null,
];
if (is_resource($credentials['private_key_passphrase'])) {
$resource = $credentials['private_key_passphrase'];
if (is_resource($credentials['privateKeyPassphrase'])) {
$resource = $credentials['privateKeyPassphrase'];
$passphrase = stream_get_line($resource, 0, PHP_EOL);
rewind($resource);
$credentials['private_key_passphrase'] = $passphrase;
$credentials['privateKeyPassphrase'] = $passphrase;
}
$privateKey = openssl_pkey_get_private(file_get_contents($credentials['private_key_file']), $credentials['private_key_passphrase']);
$privateKey = openssl_pkey_get_private(file_get_contents($credentials['privateKeyFile']), $credentials['privateKeyPassphrase']);
$signature = '';
openssl_sign($baseString, $signature, $privateKey);
openssl_free_key($privateKey);

0 comments on commit 12a0760

Please sign in to comment.
You can’t perform that action at this time.