public function getAuthToken($user, $plainPassword, $firewall, $roles = array())
    {
        // Here, "public" is the name of the firewall in your security.yml
        $token = new UsernamePasswordToken($user, $user->getPlainPassword(), $firewall, $roles);

        // For older versions of Symfony, use security.context here
        $this->tokenStorage->setToken($token);

        return $token;
    }