3

Possible Duplicate:
Automatic post-registration user authentication

I made an authentication using my database users and using my own form. The password is encrypted using md5. It worked PERFECTLY.

What i need is authenticate a user by my code on a controller or elsewhere... something like that:

$x = $this->get('security.context');
$x->getToken()->setUser($user)->authenticate();

If you see, the setUser exists, but i need a really authenticate method.

Thanks

Community
  • 1
  • 1
Thiago Festa
  • 1,132
  • 1
  • 8
  • 14
  • 1
    i found a way, here is the code: $token = new \Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken($user, null, 'secured_area', $user->getRoles()); $x = $this->get('security.context'); $x->setToken($token); The secured_area parameter is the name of your firewall that do the authentication. – Thiago Festa Oct 25 '11 at 18:47
  • 3
    http://stackoverflow.com/questions/5886713/automatic-post-registration-user-authentication – Problematic Oct 25 '11 at 19:44

0 Answers0