Symfony2 custom Password Encoder (bcrypt)

前端 未结 3 595
谎友^
谎友^ 2021-02-05 19:49

I\'ve written my own password encoder which implements the PasswordEncoderInterface:

class BCryptPasswordEncoder implements PasswordEncoderInterface         


        
3条回答
  •  旧巷少年郎
    2021-02-05 19:58

    Starting from Symfony 2.2, BCrypt is natively supported, so you can configure it easily as such:

    security:
        encoders:
            Symfony\Component\Security\Core\User\User:
                algorithm: bcrypt
                cost: 7
    

    You may want to adjust the cost upwards if you have a fast enough server though.

提交回复
热议问题