HEX
Server: nginx
System: Linux pool195-106-36.bur.atomicsites.net 6.12.57+deb12-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.57-1~bpo12+1 (2025-11-17) x86_64
User: (0)
PHP: 8.3.32
Disabled: pcntl_fork
Upload Files
File: /wordpress/plugins/wp-cloud-client/1.1.7/src/Auth/AuthMiddleware.php
<?php

declare(strict_types=1);

namespace VPlugins\WPCloudClient\Auth;

use WP_Error;
use WP_REST_Request;

final readonly class AuthMiddleware {

	/**
	 * Construct the authentication middleware.
	 *
	 * @param ApiKeyAuthenticator $authenticator API key authenticator instance.
	 */
	public function __construct(
		private ApiKeyAuthenticator $authenticator,
	) {}

	/**
	 * Check whether the incoming request passes authentication.
	 *
	 * @param WP_REST_Request $request The incoming REST request.
	 * @return true|WP_Error True if authenticated, WP_Error on failure.
	 */
	public function check( WP_REST_Request $request ): true|WP_Error {
		return $this->authenticator->validate( $request );
	}
}