title: Symfony FOSUserBundle - include login form in layout template
body: <p>We've successfully configured the FOSUserBundle; login, register, reset password, etc, are all working just fine.</p>
  
  <p>Now we want to incorporate the login form into our general site layout, notably placing the form into the top-right section of the layout header. Doing this would be easy enough if we were just dealing with the username and password fields. However we can't seem to figure out how to obtain the CSRF token which is generated by the FOSUserBundle service:</p>
  
  <pre><code>$this-&gt;container-&gt;get('form.csrf_provider')-&gt;generateCsrfToken('authenticate');
  </code></pre>
  
  <p>I tried calling the above within a Twig extension which otherwise works fine however apparently the extension can't properly reference the container.</p>
  
  <p>Surely there is some easy way to obtain the FOSUserBundle CSRF token globally?</p>
  
  <p>Thanks!
  Jason</p>