fail early and always return $response as fallback
This commit is contained in:
parent
c42edfce68
commit
96953dfc7e
1 changed files with 19 additions and 15 deletions
|
@ -80,24 +80,28 @@ class Server {
|
||||||
*/
|
*/
|
||||||
public static function authorize_activitypub_requests( $response, $handler, $request ) {
|
public static function authorize_activitypub_requests( $response, $handler, $request ) {
|
||||||
$route = $request->get_route();
|
$route = $request->get_route();
|
||||||
if ( str_starts_with( $route, '/activitypub' ) ) {
|
if ( ! str_starts_with( $route, '/activitypub' ) ) {
|
||||||
if ( 'POST' === $request->get_method() ) {
|
return $response;
|
||||||
$verified_request = Signature::verify_http_signature( $request );
|
}
|
||||||
if ( \is_wp_error( $verified_request ) ) {
|
|
||||||
return $verified_request;
|
if ( 'POST' === $request->get_method() ) {
|
||||||
}
|
$verified_request = Signature::verify_http_signature( $request );
|
||||||
} else {
|
if ( \is_wp_error( $verified_request ) ) {
|
||||||
if ( '/activitypub/1.0/webfinger' !== $route ) {
|
return $verified_request;
|
||||||
// SecureMode/Authorized fetch.
|
}
|
||||||
$secure_mode = \get_option( 'activitypub_use_secure_mode', '0' );
|
} else {
|
||||||
if ( $secure_mode ) {
|
if ( '/activitypub/1.0/webfinger' !== $route ) {
|
||||||
$verified_request = Signature::verify_http_signature( $request );
|
// SecureMode/Authorized fetch.
|
||||||
if ( \is_wp_error( $verified_request ) ) {
|
$secure_mode = \get_option( 'activitypub_use_secure_mode', '0' );
|
||||||
return $verified_request;
|
if ( $secure_mode ) {
|
||||||
}
|
$verified_request = Signature::verify_http_signature( $request );
|
||||||
|
if ( \is_wp_error( $verified_request ) ) {
|
||||||
|
return $verified_request;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue