false, 'message' => __('Unknown error.', 'easy-basic-authentication'), ]; if (!isset($_SERVER['PHP_AUTH_USER'])) { $response['message'] = __('Authorization header not received. It may have been blocked by the browser or the server (especially on HTTP).', 'easy-basic-authentication'); } else { // Qui la "password" e un nonce alfanumerico generato da noi, quindi a // differenza del percorso di autenticazione vero si puo sanitizzare. $received_user = sanitize_text_field( wp_unslash( $_SERVER['PHP_AUTH_USER'] ) ); $received_token = isset( $_SERVER['PHP_AUTH_PW'] ) ? sanitize_text_field( wp_unslash( $_SERVER['PHP_AUTH_PW'] ) ) : ''; if ( $received_user === 'eba-compat-test' && wp_verify_nonce($received_token, 'eba_compat_test') ) { $response['success'] = true; $response['message'] = __('Authentication received successfully. Basic Auth is compatible!', 'easy-basic-authentication'); } else { $response['message'] = __('Authorization header received but could not be verified. Please try again.', 'easy-basic-authentication'); } } echo json_encode($response); exit; } public static function render_button_html() { $test_nonce = wp_create_nonce('eba_compat_test'); ?>