public function loginAttempt($username, Password $password)
    {
        $userData = $this->storage->getUserByName($username);
        $encoder = $this->getPasswordEncoder($userData);

        $dummy = bin2hex(\random_bytes(32));
        $dummyHash = $encoder->encode($dummy);

        if (!$userData) {
            // The user doesn't exist, dummy call is performed to prevent time analysis
            $encoder->isValid($dummyHash, $password);
            return false;
        }
        
        return $encoder->isValid($userData['pwhash'], $password->get());
    }