Documentation

RequestAuthenticatorInterface

Resolves the WordPress user behind an inbound REST request.

This is the injected seam a controller's permission callbacks depend on, in place of the old static auth middleware. The library ships a WordPress-session binding (WpSessionAuthenticator); a product that also accepts API bearer tokens composes its own binding (e.g. one backed by a JWT token service) and injects that instead — the library itself carries no product token logic.

Table of Contents

Methods

isAdmin()  : bool
Whether the user behind the request is a site administrator.
resolveUser()  : null|WP_Error|WP_User
Resolve the user behind the request.

Methods

resolveUser()

Resolve the user behind the request.

public resolveUser(WP_REST_Request $request) : null|WP_Error|WP_User
Parameters
$request : WP_REST_Request
Return values
null|WP_Error|WP_User —

a WP_User when authenticated; a WP_Error when a presented credential was rejected (the error is surfaced to the caller as-is); null when the request is simply anonymous

On this page

Search results