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.
Constants and properties
| private | NAME_SCHEMA = array ( 'type' => 'string', 'minLength' => 1, 'pattern' => '.*\\S.*', ) | |
| private | APP_ID_SCHEMA = array ( 'type' => 'string', 'oneOf' => array ( 0 => array ( 'type' => 'string', 'format' => 'uuid', ), 1 => array ( 'type' => 'string', 'enum' => array ( 0 => '', ), ), ), ) | |
| private | readonly Minn\Content\Users $users | Promoted from the constructor. |
| private | readonly Minn\Content\Site $site | Promoted from the constructor. |
| private | readonly Minn\Auth\ApplicationPasswords $passwords | Promoted from the constructor. |
| private | readonly Minn\Rest\RestUrl $url | Promoted from the constructor. |
| private | readonly Minn\Rest\Caller $caller | Promoted from the constructor. |
| private | readonly 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)# | |
| method | list(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. |
| method | create(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. |
| method | deleteAll(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. |
| method | introspect(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. |
| method | single(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. |
| method | update(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. |
| method | delete(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.
| private | subject(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> | |||
| private | existing(Minn\Content\UserRecord $user, string $uuid): array# |
| |||
| private | validate(string $name, mixed $value, array $schema): void# | ||||
| private | item(Minn\Content\UserRecord $user, array $record, ?string $plain = NULL): array# |
| |||
| private | when(mixed $unix): ?string# | A stored unix time as the site-local ISO stamp the reference prints, without an offset. |
Nothing matches.