/** * Is User Authenticated * * @param BackendUser $user */ protected function loginUser(BackendUser $user) { $token = new UsernamePasswordToken($user, null, 'main', $user->getRoles()); $this->get('security.context')->setToken($token); $this->get('session')->set('user_backend', serialize($token)); }