New Plugin Release 4.3.1
The version 4.3.1 has been released today on WordPress.
This release adds more wp jwt commands and changes how Protect Endpoints handles the REST API index (/wp-json/).
Protect Endpoints no longer blocks the REST API index (/wp-json/) unless a rule targets it, also when the default action is Require a valid JWT. To keep it protected, add a rule for /wp-json/. See Breaking changes.
New Features
New WP-CLI commands
wp jwt webhook add|remove|enable|disable- manage webhooks. Seewp jwt webhook.wp jwt api-key get|update|delete-updatekeeps the options you don't pass, and--expires-at=neverremoves the expiration. Seewp jwt api-key.wp jwt rule list|add|remove- manage JWT Rules. Keys are never listed, and a random key is generated when none is given. Seewp jwt rule.wp jwt integration list|enable|disable- turn OAuth providers and 3rd-party integrations on or off. Seewp jwt integration.wp jwt refresh-token list <user>- list a user's active refresh tokens, without their values. Seewp jwt refresh-token.wp jwt key status- show the algorithm, the key source and the old keys kept bykey rotate. The keys themselves are never printed. Seewp jwt key.wp jwt config reset <section>...|--all- reset settings to their defaults. Secrets are kept unless you pass--include-secrets. Seewp jwt config reset.wp jwt log list --all- list every matching entry, for example--all --format=csvto export the log. Seewp jwt log.
wp jwt call
wp jwt call <method> <route> --as=<user> calls a REST endpoint over HTTP with a new 5-minute JWT for the user. No refresh token is stored. Use it to check protected endpoints, CORS and JWT Rules the same way a real client sees them. See wp jwt call.
wp jwt call GET /wp/v2/users/me --as=admin
Tab completion
wp jwt completion prints a completion script for the wp jwt commands and options. WP-CLI's own completion doesn't know about plugin commands. See Tab completion.
wp jwt completion >> ~/.bashrc
wp jwt completion --shell=zsh >> ~/.zshrc
Breaking changes
Protect Endpoints no longer blocks the REST API index (/wp-json/, the discovery endpoint) unless a rule targets it. This applies also when the Default Action is Require a valid JWT (#105).
To keep the index protected, add an endpoint rule for /wp-json/. It matches the index only, never the other routes. See Protect Endpoints.
Bug Fixes
wp jwt key rotateandwp jwt setup: a JWT issued in the same second as the rotation was rejected right away instead of being kept until it expires. The rotation now waits for the next second (at most one second).wp jwt validatenow reports an expired token signed with a rotated or changed key as expired, instead of only "Signature verification failed". The token is still reported as not valid (exit code1).- Webhooks with a JSON body (the default payload or a JSON payload template) are now sent with
Content-Type: application/jsoninstead ofapplication/x-www-form-urlencoded. AContent-Typeheader set on the webhook is still used as is. See Webhooks.
If you encounter any issues after updating, please open an issue on GitHub.
