gpt4 book ai didi

Symfony/FOSuserBundle : salt are null?

转载 作者:行者123 更新时间:2023-12-01 22:10:14 25 4
gpt4 key购买 nike

我正在使用:

  • 交响乐 3.4
  • FOSUserBundle 2

FOSuserbundle 安装良好,运行起来非常棒。我注意到在我的数据库中,在用户表中,“salt”列始终为空:

enter image description here

以下是我的 security.yml 文件的摘录:

security:
encoders:
FOS\UserBundle\Model\UserInterface: bcrypt

作为记录,我使用命令“fos:user:create”添加了 2 个用户。

这正常吗?

最佳答案

是的,这是正常的,因为使用 bcrypt 时,盐包含在散列密码中。

引用:https://php.net/manual/password.constants.php#constant.password-bcrypt

salt (string) - to manually provide a salt to use when hashing the password. Note that this will override and prevent a salt from being automatically generated.

If omitted, a random salt will be generated by password_hash() for each password hashed. This is the intended mode of operation and as of PHP 7.0.0 the salt option has been deprecated.


您可以在 source 中看到行为:

// FOSUserBundle/Util/PasswordUpdater.php [Line 43]

if ($encoder instanceof BCryptPasswordEncoder) {
$user->setSalt(null);
}

关于Symfony/FOSuserBundle : salt are null?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48382979/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com