API / Minn\Rest / ApplicationPasswordsController

ApplicationPasswordsController final readonly class

Minn\Rest\ApplicationPasswordsController · public/minn/src/Minn/Rest/ApplicationPasswordsController.php · 177 lines

wp/v2/users/{id}/application-passwords: list, create, rename, delete, and introspect the password that authenticated the call. Refusals and shapes follow the reference: 501 when passwords are unavailable (no HTTPS), 401 anonymous, 404 for an unknown user or password, arguments checked before permissions.

Used by 1

Constants and properties

privateNAME_SCHEMA = array ( 'type' => 'string', 'minLength' => 1, 'pattern' => '.*\\S.*', )
privateAPP_ID_SCHEMA = array ( 'type' => 'string', 'oneOf' => array ( 0 => array ( 'type' => 'string', 'format' => 'uuid', ), 1 => array ( 'type' => 'string', 'enum' => array ( 0 => '', ), ), ), )
privatereadonly Minn\Content\Users $users

Promoted from the constructor.

privatereadonly Minn\Content\Site $site

Promoted from the constructor.

privatereadonly Minn\Auth\ApplicationPasswords $passwords

Promoted from the constructor.

privatereadonly Minn\Rest\RestUrl $url

Promoted from the constructor.

privatereadonly Minn\Rest\Caller $caller

Promoted from the constructor.

privatereadonly Minn\Rest\Schema $schema

Promoted from the constructor.

Public

new__construct(Minn\Content\Users $users, Minn\Content\Site $site, Minn\Auth\ApplicationPasswords $passwords, Minn\Rest\RestUrl $url, Minn\Rest\Caller $caller, Minn\Rest\Schema $schema)#
methodlist(Minn\Http\Request $request, string $userId): Minn\Http\ResponseGET /wp/v2/users/{user_id:(?:[\d]+|me)}/application-passwords (cap edit_user on {user_id}; user {user_id} must exist)#

The user's application passwords.

methodcreate(Minn\Http\Request $request, string $userId): Minn\Http\ResponsePOST /wp/v2/users/{user_id:(?:[\d]+|me)}/application-passwords (cap edit_user on {user_id}; user {user_id} must exist)#

Mints one; the plain password is in this answer only.

methoddeleteAll(Minn\Http\Request $request, string $userId): Minn\Http\ResponseDELETE /wp/v2/users/{user_id:(?:[\d]+|me)}/application-passwords (cap edit_user on {user_id}; user {user_id} must exist)#

Removes every one.

methodintrospect(Minn\Http\Request $request, string $userId): Minn\Http\ResponseGET /wp/v2/users/{user_id:(?:[\d]+|me)}/application-passwords/introspect (cap edit_user on {user_id}; user {user_id} must exist)#

The password the current Basic auth session used.

methodsingle(Minn\Http\Request $request, string $userId, string $uuid): Minn\Http\ResponseGET /wp/v2/users/{user_id:(?:[\d]+|me)}/application-passwords/{uuid:[\w\-]+} (cap edit_user on {user_id}; user {user_id} must exist)#

One password by uuid.

methodupdate(Minn\Http\Request $request, string $userId, string $uuid): Minn\Http\ResponsePOST /wp/v2/users/{user_id:(?:[\d]+|me)}/application-passwords/{uuid:[\w\-]+} (cap edit_user on {user_id}; user {user_id} must exist)PUT /wp/v2/users/{user_id:(?:[\d]+|me)}/application-passwords/{uuid:[\w\-]+} (cap edit_user on {user_id}; user {user_id} must exist)PATCH /wp/v2/users/{user_id:(?:[\d]+|me)}/application-passwords/{uuid:[\w\-]+} (cap edit_user on {user_id}; user {user_id} must exist)#

Renames one.

methoddelete(Minn\Http\Request $request, string $userId, string $uuid): Minn\Http\ResponseDELETE /wp/v2/users/{user_id:(?:[\d]+|me)}/application-passwords/{uuid:[\w\-]+} (cap edit_user on {user_id}; user {user_id} must exist)#

Removes one.

Internals 5

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatesubject(Minn\Http\Request $request, string $id, string $code, string $message): Minn\Content\UserRecord#

The user the route names, after the availability, identity, and permission checks the reference makes. @return array<string, mixed>

@return array<string, mixed>
privateexisting(Minn\Content\UserRecord $user, string $uuid): array#
$userarray<string, mixed>@return array<string, mixed>
privatevalidate(string $name, mixed $value, array $schema): void#
privateitem(Minn\Content\UserRecord $user, array $record, ?string $plain = NULL): array#
$userarray<string, mixed>@param array<string, mixed> $record @return array<string, mixed>
privatewhen(mixed $unix): ?string#

A stored unix time as the site-local ISO stamp the reference prints, without an offset.