1
votes

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?

1

1 Answers

1
votes

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