found some nice way:
create a custom password encoder into my userbundle extending the FOSuserbundle.
namespace Sdz\UserBundle\Security\Encoder;
use Symfony\Component\Security\Core\Encoder\BasePasswordEncoder;
class CustomEncoder extends BasePasswordEncoder {
public function encodePassword($raw, $salt) {
// do doctrine stuff to get the user info
return $hashed;
}
public function isPasswordValid($encoded, $raw, $salt) {
return $this->comparePasswords($encoded, $this->encodePassword($raw, $salt));
}
}
register the encoder as a service of myuserbundle, inject it the doctrine service.
services:
sdz_user.custom_encoder:
class: "Sdz\UserBundle\Security\Encoder\CustomEncoder"
arguments: [ @Doctrine]
configure the global security.yml
security:
encoders:
# encodeur de password selon l'ancienne façon
FOS\UserBundle\Model\UserInterface:
id: sdz_user.custom_encoder