Skip to content

Commit

Permalink
ARLO-2: Fixing Webhookket setting definition
Browse files Browse the repository at this point in the history
  • Loading branch information
ojnadjarm committed Nov 13, 2023
1 parent 2e824e1 commit bbe4bde
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion classes/input/webhook_handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function __construct() {
$config = get_config('enrol_arlo');
$this->platform = !empty($config->platform) ? $config->platform : false;
$this->contact = !empty($config->apiusername) ? $config->apiusername : false;
$this->webhooksecretkey = !empty($config->webhooksecretkey) ? $config->webhooksecretkey : false;
$this->webhooksecretkey = !empty($config->webhooksecret) ? $config->webhooksecret : false;
$this->webhookid = !empty($config->webhookid) ? $config->webhookid : false;
$webhookapipath = !empty($config->webhookapipath) ? $config->webhookapipath : false;
$this->webhookapiurl = $this->get_webhookapiurl($webhookapipath);
Expand Down Expand Up @@ -145,6 +145,8 @@ public function validatesignature($signature, $body, $webhooksecretkey = false)
$hmacsignature = hash_hmac('sha512', $body, $secretkeystring, true);
// Base64 encode the signature
$hmacsignaturebase64 = base64_encode($hmacsignature);
var_dump($webhooksecretkey);

return hash_equals($signature, $hmacsignaturebase64);
}

Expand Down
1 change: 1 addition & 0 deletions webhook_endpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
}
$requestbody = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_ARLO_SIGNATURE'];
var_dump($signature);
if (!$webhookhandler->validatesignature($signature, $requestbody)) {
http_response_code(401);
echo 'Unauthorized';
Expand Down

0 comments on commit bbe4bde

Please sign in to comment.