This commit is contained in:
Marco Palladino
2012-06-05 16:51:25 +02:00
parent 27970d5667
commit d11faed835

View File

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