diff --git a/core/modules/basic_auth/src/Authentication/Provider/BasicAuth.php b/core/modules/basic_auth/src/Authentication/Provider/BasicAuth.php
index c72e3f0..ad6fe5e 100644
--- a/core/modules/basic_auth/src/Authentication/Provider/BasicAuth.php
+++ b/core/modules/basic_auth/src/Authentication/Provider/BasicAuth.php
@@ -70,7 +70,12 @@ public function __construct(ConfigFactoryInterface $config_factory, UserAuthInte
   public function applies(Request $request) {
     $username = $request->headers->get('PHP_AUTH_USER');
     $password = $request->headers->get('PHP_AUTH_PW');
-    return isset($username) && isset($password);
+
+    if (isset($username) && isset($password)) {
+      return (bool) $this->entityTypeManager->getStorage('user')->loadByProperties(['name' => $username, 'status' => 1]);
+    }
+
+    return FALSE;
   }

   /**
