wp_validate_application_password() – Validates the application password credentials passed via Basic Authentication.

You appear to be a bot. Output may be restricted

Description

Validates the application password credentials passed via Basic Authentication.

Usage

$int|false = wp_validate_application_password( $input_user );

Parameters

$input_user
( int|false ) required – User ID if one has been determined, false otherwise.

Returns

int|false The authenticated user ID if successful, false otherwise.

Source

File name: wordpress/wp-includes/user.php
Lines:

1 to 24 of 24
function wp_validate_application_password( $input_user ) {
  // Don't authenticate twice.
  if ( ! empty( $input_user ) ) {
    return $input_user;
  }

  if ( ! wp_is_application_passwords_available() ) {
    return $input_user;
  }

  // Both $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'] must be set in order to attempt authentication.
  if ( ! isset( $_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'] ) ) {
    return $input_user;
  }

  $authenticated = wp_authenticate_application_password( null, $_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'] );

  if ( $authenticated instanceof WP_User ) {
    return $authenticated->ID;
  }

  // If it wasn't a user what got returned, just pass on what we had received originally.
  return $input_user;
}
 

 View on GitHub View on Trac