How to use password hashing with salt in security.yml

Go To StackoverFlow.com

0

I need random salt to hash password with users in file security.yml, not database. What i need to declare in "encoder" section to use salt in password hashing?

2012-04-04 01:55
by Neka
I think the phrase "random salt" might need some explanation. It sounds like if you're randomly generating the salt, you'll never be able to validate a password.

Are you generating a single random salt that's stored in security.yml and you want to use that against all passwords in your system - Asa Ayers 2012-04-04 06:13

no, it's randomly once - at generation. You can remove word "random" from my message if you wan - Neka 2012-04-05 09:52


0

I think you shoud implement your own encoder logic by providing a service

services:
   custom_encoder:
       class: Acme\TestBundle\Service\CustomEncoder

It must implement Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface

After that add this class to security.yml

security:
   encoders:
      Acme\TestBundle\Entity\User:
         id: custom_encoder
2012-04-04 07:11
by Julien Rollin
Ads