Linux 软件免费装

Application Passwords

开发者 georgestephanis
valendesigns
kraftbj
kasparsd
passoniate
更新时间 2021年5月7日 14:59
PHP版本: 4.4 及以上
WordPress版本: 5.5
版权: GPLv2 or later
版权网址: 版权信息

标签

security authentication xml-rpc rest api application-passwords

下载

详情介绍:

⚠️ IMPORTANT: This plugin has been merged into WordPress core version 5.6 and doesn't have to be installed separately. View the integration guide → Use Application Passwords to authenticate users without providing their passwords directly. Instead, a unique password is generated for each application without revealing the user's main password. Application passwords can be revoked for each application individually. Important: Application Passwords can be used only for authenticating API requests such as REST API and XML-RPC, and they won't work for regular site logins. Contribute Creating Application Password Manually
  1. Go the User Profile page of the user that you want to generate a new application password for. To do so, click Users on the left side of the WordPress admin, then click on the user that you want to manage.
  2. Scroll down until you see the Application Passwords section. This is typically at the bottom of the page.
  3. Within the input field, type in a name for your new application password, then click Add New. Note: The application password name is only used to describe your password for easy management later. It will not affect your password in any way. Be descriptive, as it will lead to easier management if you ever need to change it later.
  4. Once the Add New button is clicked, your new application password will appear. Be sure to keep this somewhere safe, as it will not be displayed to you again. If you lose this password, it cannot be obtained again.
Two Factor Support Application Passwords can be used together with the Two Factor plugin as long as you bypass the API acccess restrictions added by the Two Factor plugin. Those protections disable API requests with password authentication for users with Two Factor enabled. Use the two_factor_user_api_login_enable filter to allow API requests authenticated using an application passwords: add_filter( 'two_factor_user_api_login_enable', function( $enable ) { // Allow API login when using an application password even with 2fa enabled. if ( did_action( 'application_password_did_authenticate' ) ) { return true; } return $enable; } ); This is not required if the user associated with the application password doesn't have any of the Two Factor methods enabled. Requesting Password for Application To request a password for your application, redirect users to: https://example.com/wp-admin/admin.php?page=auth_app and use the following GET request parameters to specify: Testing an Application Password We use curl to send HTTP requests to the API endpoints in the examples below. WordPress REST API Make a REST API call to update a post. Because you are performing a POST request, you will need to authorize the request using your newly created base64 encoded access token. If authorized correctly, you will see the post title update to "New Title." curl --user "USERNAME:APPLICATION_PASSWORD" -X POST -d "title=New Title" https://LOCALHOST/wp-json/wp/v2/posts/POST_ID When running this command, be sure to replace USERNAME and APPLICATION_PASSWORD with your credentials (curl takes care of base64 encoding and setting the Authorization header), LOCALHOST with the hostname of your WordPress installation, and POST_ID with the ID of the post that you want to edit. XML-RPC Unlike the WordPress REST API, XML-RPC does not require your username and password to be base64 encoded. Send an XML-RPC request to list all users: curl -H 'Content-Type: text/xml' -d 'wp.getUsers1USERNAMEPASSWORD' https://LOCALHOST/xmlrpc.php In the above example, replace USERNAME with your username, PASSWORD with your new application password, and LOCALHOST with the hostname of your WordPress installation. This should output a response containing all users on your site. Plugin History This is a feature plugin that is a spinoff of the main Two-Factor Authentication plugin.

安装:

Search for "Application Passwords" under "Plugins" → "Add New" in your WordPress dashboard to install the plugin. Or install it manually:
  1. Download the plugin zip file.
  2. Go to PluginsAdd New in your WordPress admin.
  3. Click on the Upload Plugin button.
  4. Select the file you downloaded.
  5. Click Install Plugin.
  6. Activate.
Using Composer Add this plugin as a Composer dependency from Packagist: composer require georgestephanis/application-passwords

屏幕截图:

  • New application passwords has been created.
  • After at least one Application Password for you account exists, you'll see a table displaying them, allowing you to view usage and revoke them as desired.

更新日志:

See the release notes on GitHub.