WpHttpKernel
extends HttpKernel
in package
WordPress-flavored HTTP kernel.
Extends the framework's host-agnostic HttpKernel (route matching,
middleware pipeline, #[Auth]/#[Middleware] attributes, argument
resolution) to apply the WordPress-specific Nonce attribute after
the framework Auth attribute has been processed — the counterpart of the
Moodle adapter's MoodleHttpKernel/#[Sesskey].
Table of Contents
Methods
- applyPlatformAuth() : void
- Reads the `#[Nonce]` attribute (method wins over class) and rejects the request when the nonce it names is missing or invalid.
- nonceFromRequest() : string|null
- The nonce value carried by the current request: the named request field first (WordPress form convention), then the `X-WP-Nonce` header (REST / XHR convention). Superglobals are read here because this hook runs at the host boundary, mirroring how `check_admin_referer()` resolves them.
Methods
applyPlatformAuth()
Reads the `#[Nonce]` attribute (method wins over class) and rejects the request when the nonce it names is missing or invalid.
protected
applyPlatformAuth(ControllerInterface $controller, string $method) : void
The nonce value is resolved from the request field named by the
attribute (default _wpnonce), falling back to the X-WP-Nonce
header. Fail-closed: a required nonce that cannot be verified aborts
dispatch with a 403.
Parameters
- $controller : ControllerInterface
- $method : string
Tags
nonceFromRequest()
The nonce value carried by the current request: the named request field first (WordPress form convention), then the `X-WP-Nonce` header (REST / XHR convention). Superglobals are read here because this hook runs at the host boundary, mirroring how `check_admin_referer()` resolves them.
private
nonceFromRequest(string $param) : string|null
Parameters
- $param : string