【问题标题】:How does FOSUserBundle matches the password from database in symfony2 DoctrineFOSUserBundle 如何匹配 symfony2 Doctrine 中数据库中的密码
【发布时间】:2012-07-27 02:20:26
【问题描述】:

我正在阅读 FOSUserbundle 的各种文件,他们在 UserManager 中使用此功能

public function loadUserByUsername($username)
    {
        $user = $this->findUserByUsername($username);

        if (!$user) {
            throw new UsernameNotFoundException(sprintf('No user with name "%s" was found.', $username));
        }

        return $user;
    }


public function findUserBy(array $criteria)
    {
        return $this->repository->findOneBy($criteria);
    }

现在这两个函数在UserManager.php 中,但它们只根据密码或电子邮件返回用户。我没有找到任何完成密码匹配的代码。

是 symfony 还是 FOSUserBundle 完成的

【问题讨论】:

    标签: php symfony fosuserbundle


    【解决方案1】:

    FOSUserBundle 实际上是一个具有用户管理功能的用户提供者。密码匹配是在 Symfony 的核心安全组件中完成的。见here

    【讨论】:

      【解决方案2】:

      密码匹配由 Validator/PasswordValidator.php 中的 FOSUserBundle 完成

      【讨论】:

      • 这是定义类,但我想看看它在哪里调用 isValid() 函数
      猜你喜欢
      • 1970-01-01
      • 2023-04-07
      • 2014-12-29
      • 1970-01-01
      • 2012-03-17
      • 2014-09-27
      • 2013-10-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多