/**
* Authenticate a user with Symfony Security
*
* @param Boolean $reAuthenticate
* @return null
*/
protected function authenticateUser(User $user, $reAuthenticate = false)
{
$token = new UsernamePasswordToken($user, null, $user->getRoles());
if (true === $reAuthenticate) {
$token->setAuthenticated(false);
}
$this->get('security.context')->setToken($token);
}