This commit is contained in:
Marco Palladino
2012-06-05 16:46:59 +02:00
parent f989ad8bac
commit 27970d5667
11 changed files with 71 additions and 9 deletions

8
main/mashape/http/AuthUtil.php Normal file → Executable file
View File

@@ -27,8 +27,12 @@
class AuthUtil {
public static function generateAuthenticationHeader($publicKey, $privateKey) {
$hash = hash_hmac("sha1", $publicKey, $privateKey);
$header = "Proxy-Authorization: " . base64_encode($publicKey . ":" . $hash) . "\r\n";
$header = "";
if (!($publicKey == null || $privateKey == null)) {
$uuid = uniqid();
$hash = hash_hmac("sha1", $uuid, $privateKey);
$header = "X-Mashape-Authorization: " . base64_encode($publicKey . ":" . $hash . $uuid) . "\r\n";
}
return $header;
}