PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-beta
Jetpack – WP Security, Backup, Speed, & Growth v16.3-beta
16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 All 507 releases
← All changes | jetpack_vendor/automattic/jetpack-connection/src/class-rest-authentication.php +16 -0 13.7.2 → 16.3-beta View file →
@@ -118,8 +118,11 @@
118 118 // Nothing to do for this authentication method.
119 119 return null;
120 120 }
121 121
122 + // These `rest_invalid_request` errors occur before `verify_xml_rpc_signature()`,
123 + // so the request has not been authenticated as WP.com. Do not report them to
124 + // Error_Handler: they are malformed unauthenticated requests, not connection errors.
122 125 if ( ! isset( $_SERVER['REQUEST_METHOD'] ) ) {
123 126 $this->rest_authentication_status = new WP_Error(
124 127 'rest_invalid_request',
125 128 __( 'The request method is missing.', 'jetpack-connection' ),
@@ -217,6 +220,19 @@
217 220 public static function is_signed_with_blog_token() {
218 221 $instance = self::init();
219 222
220 223 return true === $instance->rest_authentication_status && 'blog' === $instance->rest_authentication_type;
224 + }
225 +
226 + /**
227 + * Whether the request was signed with a user token.
228 + *
229 + * @since 6.7.0
230 + *
231 + * @return bool True if the request was signed with a valid user token, false otherwise.
232 + */
233 + public static function is_signed_with_user_token() {
234 + $instance = self::init();
235 +
236 + return true === $instance->rest_authentication_status && 'user' === $instance->rest_authentication_type;
221 237 }
222 238 }