title: Symfony - custom login
body: <p>I need to implement one thing. In Symfony I have 2 firewalls (admin and whole web) - both using FOSUserBundle. Now I need to do a login for one simple section, which is a standalone part. I do not want to use User entity which I have for admin and web login, because I do not want to mix the users with the new section. So I created a standalone entity SectionUser and new firewall. Now I tried to log the user manually - with creating a new UsernamePasswordToken against the new firewall.</p>
  
  <pre><code>$token = new UsernamePasswordToken($user, $user-&gt;getPassword(), "section", array());
  $securityContext = $this-&gt;container-&gt;get('security.context'); // do it your way
  $securityContext-&gt;setToken($token);
  </code></pre>
  
  <p>but I end up in infinite loop on /new-section/login. This is my security.yml and firewall settings:</p>
  
  <pre><code>section:
          pattern: ^/new-section(.*)
          form_login:
              login_path:     /new-section/login
              use_forward:    true
              check_path:     /new-section/login_check
              failure_path:   null
          logout:
              path:           /new-section/logout
          anonymous:    true
  </code></pre>
  
  <p>Do I need to implement anything else or my approach is wrong and I should use FOSUserBundle in any way? Thank you for pointing me a direction.</p>
  
  <p>Is custom login provider a way? I am stuck here and do not know how to handle it.</p>