title: The token storage contains no authentication token
body: <p>I'm stack heeeere in security, help me please!! 
   I got this error 2 days ago and couldn't solve it : "The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL." My login in the index page, and the login and login_check are in the same function (indexAction).This is my security.yml file, my controller, and my entity "user" :</p>
  
  <pre><code>                # you can read more about security in the related section of the documentation
                  # http://symfony.com/doc/current/book/security.html
                  security:
                      # http://symfony.com/doc/current/book/security.html#encoding-the-user-s-password
  
  
                    encoders:
                          #Symfony\Component\Security\Core\User\User: plaintext
                          CNAM\CMSBundle\Entity\user: bcrypt
  
                      # http://symfony.com/doc/current/book/security.html#hierarchical-roles
                      role_hierarchy:
                          ROLE_ADMIN:       ROLE_USER
                          ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
  
                      # http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
                      providers:
                          in_memory:
                              memory:
                                  users:
                                      user:  { password: userpass, roles: [ 'ROLE_USER' ] }
                                      admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }
                          database:
                              entity:
                                  class: CNAM\CMSBundle\Entity\user
                                  property: username
                      # the main part of the security, where you can set up firewalls
                      # for specific sections of your app
                      firewalls:
                          # disables authentication for assets and the profiler, adapt it according to your needs
                          dev:
                              pattern:  ^/(_(profiler|wdt)|css|images|js)/
                              security: false
  
  
   admin_area:
          pattern:    ^/admin
          form_login:
             check_path: _default_index
             login_path: _default_index
  
                      access_control:
                          #- { path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY}
                          - { path: ^/admin, roles: ROLE_ADMIN}
          &lt;?php
  
          namespace CNAM\CMSBundle\Controller;
  
          use Symfony\Bundle\FrameworkBundle\Controller\Controller;
          use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
          use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
          use Symfony\Component\HttpFoundation\Request;
          use CNAM\CMSBundle\Entity\user;
          use CNAM\CMSBundle\Entity\userprof;
          use CNAM\CMSBundle\Entity\profil;
          use CNAM\CMSBundle\Entity\privilege;
          use Symfony\Component\BrowserKit\Response;
          use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
          use Symfony\Component\Form\AbstractType;
          use Symfony\Component\Form\FormBuilder;
          use Symfony\Component\Security\Core\Security;
  
  
          class DefaultController extends Controller
          {
              /**
               * @Route("/")
               * @Template()
               */
              public function indexAction(Request $request)
              {
                  $user = new user();
                  $form = $this-&gt;createFormBuilder($user)
                      -&gt;add('id', 'text',array('attr'=&gt;array('name'=&gt;'login_user','required'=&gt;'required',
                          'maxlength'=&gt;'255','placeholder'=&gt;'Votre matricule','id'=&gt;'login_user')))
                      -&gt;add('password', 'password',array('attr'=&gt;array('name'=&gt;'login_password','required'=&gt;'required',
                          'maxlength'=&gt;'20','placeholder'=&gt;'Mot de passe','id'=&gt;'login_password')))
                      -&gt;add('Connexion', 'submit',array('attr'=&gt;array('class'=&gt;'btn btn-primary btn-block rounded_btn','id'=&gt;'login_btn',
                          'style'=&gt;"width:8vw;height:5vh;padding:0px 0px; position:relative;left:5vmin;top:1vmin;font-size:2vmin;")))
                      -&gt;getForm();
                  $form-&gt;handleRequest($request);
                  //$b_search=$this-&gt;get('session')-&gt;get('search');
                  $id = $request-&gt;request-&gt;get('id');
                  $session = $request-&gt;getSession();
  
                  if ($form-&gt;isValid()) {
                      $data = $form-&gt;getData();
                      $repository = $this
                          -&gt;getDoctrine()
                          -&gt;getManager()
                          -&gt;getRepository("CNAMCMSBundle:user");
                      $rep = $this
                          -&gt;getDoctrine()
                          -&gt;getManager()
                          -&gt;getRepository("CNAMCMSBundle:userprof");
                      $search = $repository-&gt;find($data);
                      $p_search=$rep-&gt;find($data);
                      $helper = $this-&gt;get('security.authentication_utils');
                     if (!$search) {
                         //throw $this-&gt;createNotFoundException('Utilisateur introuvable!');
  
                       }
                     else {
                          //$session=$this-&gt;get("session");
                          //$session-&gt;start();
                          // $session-&gt;set('search', $search);
                          $user-&gt;setEtat(1);
                          $em = $this-&gt;getDoctrine()-&gt;getManager();
                          $user=$em-&gt;merge($user);
                          $em-&gt;flush();
  
                          $id_prof=$p_search-&gt;getIdProfil();
  
                          switch ($id_prof)
                          {
                              case 1: return $this-&gt;redirect($this-&gt;generateUrl('cnam_cms_default_webmaster'),301);break;
                              case 2: $user-&gt;setRole("ROLE_ADMIN");$em = $this-&gt;getDoctrine()-&gt;getManager();$user=$em-&gt;merge($user);
                                  $em-&gt;flush();return $this-&gt;redirect($this-&gt;generateUrl('cnam_cms_default_admin'),301);break;
                              case 3: return $this-&gt;redirect($this-&gt;generateUrl('cnam_cms_default_sup_med'),301);break;
                              case 4: return $this-&gt;redirect($this-&gt;generateUrl('cnam_cms_default_med'),301);break;
                              case 5: return $this-&gt;redirect($this-&gt;generateUrl('cnam_cms_default_gest_mp'),301);break;
                          }
                      }
  
                      //return $this-&gt;render('CNAMCMSBundle:Default:profile.html.twig', array(
                      //'search' =&gt; $search,
                      //'b_search'=&gt;$b_search
                      // ));
                  }
                  return array('form'=&gt;$form-&gt;createView());
                 }
                  /**
                   * @Route("/admin")
                   * @Template()
                   */
                  public function adminAction()
                 {
                     return $this-&gt;render('CNAMCMSBundle:Default:admin.html.twig', array());
                 }
  
                  /**
                   * @Route("/admin/gestEtat",name="gestEtat")
                   * @Template()
                   */
                  public function gestEtatAction()
                 {
                     return $this-&gt;render('CNAMCMSBundle:Default:gestEtat.html.twig', array());
                 }
  
          }
  
      &lt;?php
  
      namespace CNAM\CMSBundle\Entity;
  
      use Doctrine\ORM\Mapping as ORM;
      use Doctrine\Common\Collections\ArrayCollection;
      use Symfony\Component\Validator\Constraints as Assert;
      use Symfony\Component\Security\Core\User\UserInterface;
  
      /**
       * user
       *
       * @ORM\Table(name="user")
       * @ORM\Entity
       */
      class user implements UserInterface
      {
          /**
           * @var integer
           *@Assert\NotBlank()
           * @ORM\Column(name="id", type="integer")
           * @ORM\Id
           */
          private $id;
  
          /**
           * @var string
           *@Assert\NotBlank()
           * @ORM\Column(name="password", type="string", length=40)
           */
          private $password;
  
          /*
           * @ORM\ManyToOne(targetEntity="profil" , inversedBy="users")
           * @ORM\JoinColumn(name="id_profil", referencedColumnName="id_profil")
           */
          private $profil;
  
          public function __construct()
          {
              $this-&gt;profil = new ArrayCollection();
          }
  
          /**
           * @var boolean
           *
           * @ORM\Column(name="etat", type="boolean")
           */
          private $etat;
  
  
          /**
           * Get id
           *
           * @return integer 
           */
          public function getId()
          {
              return $this-&gt;id;
          }
          /**
           * Set id
           *
           * @param integer $id
           * @return user
           */
          public function setId($id)
          {
              $this-&gt;id = $id;
  
              return $this;
          }
  
          /**
           * Set password
           *
           * @param string $password
           * @return user
           */
          public function setPassword($password)
          {
              $this-&gt;password = $password;
  
              return $this;
          }
  
          /**
           * Get password
           *
           * @return string 
           */
          public function getPassword()
          {
              return $this-&gt;password;
          }
  
          /**
           * Set etat
           *
           * @param boolean $etat
           * @return user
           */
          public function setEtat($etat)
          {
              $this-&gt;etat = $etat;
  
              return $this;
          }
  
          /**
           * Get etat
           *
           * @return boolean 
           */
          public function getEtat()
          {
              return $this-&gt;etat;
          }
  
          /**
           * Get profil
           *
           * @return \Doctrine\Common\Collections\Collection
           */
          public function getProfil()
          {
              return $this-&gt;profil;
          }
  
  
          /**
           * Add profil
           *
           * @param \CNAM\CMSBundle\Entity\user $profil
           * @return user
           */
          public function addProfil(\CNAM\CMSBundle\Entity\profil $profil)
          {
              $this-&gt;profil[] = $profil;
  
              return $this;
          }
  
          /**
           * Remove profil
           *
           * @param \CNAM\CMSBundle\Entity\profil $profil
           */
          public function removeProfil(\CNAM\CMSBundle\Entity\profil $profil)
          {
              $this-&gt;profil-&gt;removeElement($profil);
          }
          public function getUsername()
          {
              return $this-&gt;id;
          }
          public function getRoles()
          {
              return array('ROLE_USER');
          }
  
          public function getSalt()
          {
              return null;
          }
  
          public function eraseCredentials()
          {
  
          }
  
          public function equals(UserInterface $user)
          {
              return $user-&gt;getId() == $this-&gt;getId();
          }
      }
  </code></pre>