fix rest api endpoint

This commit is contained in:
Django Doucet 2023-04-21 09:18:24 -06:00
parent d23ff46073
commit 1631f1c7dc

View file

@ -112,12 +112,14 @@ class Signature {
public static function verify_http_signature( $request ) {
$headers = $request->get_headers();
$actor = isset( json_decode( $request->get_body() )->actor ) ? json_decode( $request->get_body() )->actor : '';
$headers['(request-target)'][0] = strtolower( $request->get_method() ) . ' /wp-json' . $request->get_route();
if ( ! $headers ) {
$headers = self::default_server_headers();
return false;
}
$actor = isset( json_decode( $request->get_body() )->actor ) ? json_decode( $request->get_body() )->actor : '';
$headers['(request-target)'][0] = strtolower( $request->get_method() ) . ' /' . rest_get_url_prefix() . $request->get_route();
if ( array_key_exists( 'signature', $headers ) ) {
$signature_block = self::parse_signature_header( $headers['signature'] );
} elseif ( array_key_exists( 'authorization', $headers ) ) {