mirror of
https://framagit.org/hubzilla/core.git
synced 2026-06-21 00:52:33 -04:00
add logging and catch exception
This commit is contained in:
@@ -13,6 +13,8 @@ use Zotlabs\Lib\Webfinger;
|
||||
use Zotlabs\Lib\Zotfinger;
|
||||
use Zotlabs\Lib\Libzot;
|
||||
use HttpSignature\HttpMessageSigner;
|
||||
use HttpSignature\UnProcessableSignatureException;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Implements HTTP Signatures per draft-cavage-http-signatures-10.
|
||||
@@ -135,7 +137,17 @@ class HTTPSig {
|
||||
$messageSigner->setCreated(preg_match('/created=([0-9]+)/', $headers['signature-input'], $matches) ? $matches[1] : '');
|
||||
$messageSigner->setExpires(preg_match('/expires=([0-9]+)/', $headers['signature-input'], $matches) ? $matches[1] : '');
|
||||
|
||||
$verified = $messageSigner->verifyRequest(App::$request);
|
||||
try {
|
||||
$verified = $messageSigner->verifyRequest(App::$request);
|
||||
if (!$verified) {
|
||||
btlogger('RFC9421: Unable to verify request: ' . print_r($headers, true), LOGGER_DATA);
|
||||
}
|
||||
}
|
||||
catch (\Exception $exception) {
|
||||
btlogger($exception->getMessage(), LOGGER_DATA);
|
||||
$verified = false;
|
||||
}
|
||||
|
||||
logger('verified (RFC9421): ' . (($verified) ? 'true' : 'false'), LOGGER_DEBUG);
|
||||
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user