mirror of
https://github.com/friendica/friendica
synced 2025-04-22 17:50:11 +00:00
Relocated AP signature functions, reduced magic auth functions
This commit is contained in:
parent
0866fbaf8c
commit
11310f4cf0
6 changed files with 192 additions and 309 deletions
|
@ -8,6 +8,7 @@ use Friendica\BaseModule;
|
|||
use Friendica\Protocol\ActivityPub;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Util\HTTPSignature;
|
||||
|
||||
/**
|
||||
* ActivityPub Inbox
|
||||
|
@ -24,7 +25,7 @@ class Inbox extends BaseModule
|
|||
System::httpExit(400);
|
||||
}
|
||||
|
||||
if (ActivityPub::verifySignature($postdata, $_SERVER)) {
|
||||
if (HTTPSignature::verifyAP($postdata, $_SERVER)) {
|
||||
$filename = 'signed-activitypub';
|
||||
} else {
|
||||
$filename = 'failed-activitypub';
|
||||
|
|
|
@ -76,13 +76,9 @@ class Magic extends BaseModule
|
|||
|
||||
// Create a header that is signed with the local users private key.
|
||||
$headers = HTTPSignature::createSig(
|
||||
'',
|
||||
$headers,
|
||||
$user['prvkey'],
|
||||
'acct:' . $user['nickname'] . '@' . $a->get_hostname() . ($a->urlpath ? '/' . $a->urlpath : ''),
|
||||
false,
|
||||
true,
|
||||
'sha512'
|
||||
'acct:' . $user['nickname'] . '@' . $a->get_hostname() . ($a->urlpath ? '/' . $a->urlpath : '')
|
||||
);
|
||||
|
||||
// Try to get an authentication token from the other instance.
|
||||
|
|
|
@ -54,7 +54,7 @@ class Owa extends BaseModule
|
|||
if (DBA::isResult($contact)) {
|
||||
// Try to verify the signed header with the public key of the contact record
|
||||
// we have found.
|
||||
$verified = HTTPSignature::verify('', $contact['pubkey']);
|
||||
$verified = HTTPSignature:verifyMagic($contact['pubkey']);
|
||||
|
||||
if ($verified && $verified['header_signed'] && $verified['header_valid']) {
|
||||
logger('OWA header: ' . print_r($verified, true), LOGGER_DATA);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue