Make WordPress Core


Ignore:
Timestamp:
12/04/2020 09:46:42 PM (3 years ago)
Author:
helen
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.
Reviewed by TimothyBlynJacobs, helen.
Merges [49752] to the 5.6 branch.
Fixes #51939.

Location:
branches/5.6
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.6

  • branches/5.6/src/wp-includes/user.php

    r49627 r49754  
    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.