Make WordPress Core


Ignore:
Timestamp:
12/04/2020 09:42:52 PM (4 years ago)
Author:
TimothyBlynJacobs
Message:

App Passwords: Prevent conflicts when Basic Auth is already used by the site.

Application Passwords uses Basic Authentication to transfer authentication details. If the site is already using Basic Auth, for instance to implement a private staging environment, then the REST API will treat this as an authentication attempt and would end up generating an error for any REST API request.

Now, Application Password authentication will only be attempted if Application Passwords is in use by a site. This is flagged by setting an option whenever an Application Password is created. An upgrade routine is added to set this option if any App Passwords already exist.

Lastly, creating an Application Password will be prevented if the site appears to already be using Basic Authentication.

Props chexwarrior, georgestephanis, adamsilverstein, helen, Clorith, marybaum, TimothyBlynJacobs.
Fixes #51939.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/user.php

    r49693 r49752  
    311311function wp_authenticate_application_password( $input_user, $username, $password ) {
    312312    if ( $input_user instanceof WP_User ) {
     313        return $input_user;
     314    }
     315
     316    if ( ! WP_Application_Passwords::is_in_use() ) {
    313317        return $input_user;
    314318    }
Note: See TracChangeset for help on using the changeset viewer.