summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2019-07-05 00:15:41 -0100
committerMaxence Lange <maxence@artificial-owl.com>2019-07-09 10:39:52 -0100
commit6f549f0b64b2210c3472941a52b542cf4fba101f (patch)
tree76def2a6cdbcba123fe92e9b02cf566cb8bb8ee0 /lib
parentb3514342f7e9787e072371995a3c0c01b245bd47 (diff)
compat pleroma
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Service/SignatureService.php12
-rw-r--r--lib/webfinger.php10
2 files changed, 13 insertions, 9 deletions
diff --git a/lib/Service/SignatureService.php b/lib/Service/SignatureService.php
index dc7c1452..d918270b 100644
--- a/lib/Service/SignatureService.php
+++ b/lib/Service/SignatureService.php
@@ -191,6 +191,7 @@ class SignatureService {
* @throws ItemUnknownException
* @throws RequestResultNotJsonException
* @throws DateTimeException
+ * @throws UnauthorizedFediverseException
*/
public function checkRequest(IRequest $request, int &$time = 0): string {
try {
@@ -310,6 +311,7 @@ class SignatureService {
* @throws RequestContentException
* @throws RequestResultSizeException
* @throws RequestResultNotJsonException
+ * @throws UnauthorizedFediverseException
*/
private function checkRequestSignature(IRequest $request): string {
$signatureHeader = $request->getHeader('Signature');
@@ -351,10 +353,11 @@ class SignatureService {
} catch (Exception $e) {
}
- $estimated = "(request-target): " . $target;
+ $estimated = '';
foreach ($keys as $key) {
if ($key === '(request-target)') {
+ $estimated .= "(request-target): " . $target;
continue;
}
@@ -363,10 +366,10 @@ class SignatureService {
$value = $this->configService->getCloudAddress(true);
}
- $estimated .= "\n" . $key . ': ' . $value;
+ $estimated .= $key . ': ' . $value . "\n";
}
- return $estimated;
+ return trim($estimated, "\n");
}
@@ -449,6 +452,9 @@ class SignatureService {
case 'rsa-sha512':
return 'sha512';
+ case 'rsa-sha256':
+ return 'sha256';
+
default:
return 'sha256';
}
diff --git a/lib/webfinger.php b/lib/webfinger.php
index 8ccbb26d..4271f3cc 100644
--- a/lib/webfinger.php
+++ b/lib/webfinger.php
@@ -46,14 +46,12 @@ if (!array_key_exists('resource', $_GET)) {
$subject = $_GET['resource'];
$urlGenerator = OC::$server->getURLGenerator();
-
-list($type, $account) = explode(':', $subject, 2);
-if ($type !== 'acct') {
- echo 'no acct';
- exit();
+if (strpos($subject, 'acct:') === 0) {
+ list($type, $account) = explode(':', $subject, 2);
+} else {
+ $account = $subject;
}
-
list($username, $instance) = explode('@', $account);
try {
$cacheActorService = OC::$server->query(CacheActorService::class);