升级到symfony 4.4后,发现网站上的授权被破坏了。当我尝试登录时,出现错误:
There is no user provider for user "App\Security\UserIdentity". Shouldn't the "supportsClass()" method of your user provider return true for this classname?
UserProvider 类中的 supportsClass() 方法如下所示:
namespace App\Security;
use App\ReadModel\User\AuthView;
use App\ReadModel\User\UserFetcher;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\UserProviderInterface;
class UserProvider implements UserProviderInterface
{
...
public function supportsClass($class): bool
{
dump($class);
return $class instanceof UserIdentity;
//return true;
}
使用转储函数,我在探查器中看到 $class 参数如下所示:
"App\Security\UserIdentity"
告诉我,错在哪里?
尝试与绝对类名进行比较: