public function logUser(\Perso\UserBundle\Entity\User $user)
 {
     // Here, "main" is the name of the firewall in your security.yml
     $token = new UsernamePasswordToken($user, null, 'main', $user->getRoles());
     $this->get('security.context')->setToken($token);
     // Fire the login event
     $this->get('event_dispatcher')->dispatch(AuthenticationEvents::AUTHENTICATION_SUCCESS, new AuthenticationEvent($token));
 }