1

I want to chain two user providers (FosUserBundle and a custom DB user provider over propel) with two distinct encoding password methods

app/config/security.yml

security:  

    encoders:
        FOS\UserBundle\Model\UserInterface: sha512
        My\AuthBundle\Model\User: sha1

    providers:
        my_chain_providers:
            chain:
                providers: ["fos_userbundle", "db_user"]
        fos_userbundle:
            id: fos_user.user_provider.username_email
        db_user:
            propel:
                class: My\AuthBundle\Model\User
                property: username

    firewalls:
        main:
            pattern: ^/
            form_login:
                provider: my_chain_providers
            logout:       true
            anonymous:    true

my problem: password's hashs follow $password.'{'.$salt.'}' in fos_user table and $salt.$password in my custom DB user provider

this gist https://gist.github.com/1243080 show how to custom mergePasswordAndSalt method, but is it possible to have one mergePasswordAndSalt method per user provider?

Elnur Abdurrakhimov
  • 44,533
  • 10
  • 148
  • 133
mazenovi
  • 486
  • 5
  • 7

1 Answers1

1

You should use multiple encoders in combination with the FOSAdvancedEncoderBundle. I had the same problem, and answered it pretty thurougly over here

Community
  • 1
  • 1
Thomas K
  • 6,076
  • 5
  • 39
  • 56