title: User authentication with SecurityServiceProvider via POST
body: <p>What I'm looking to do is </p>
  
  <ol>
  <li>Authenticate users on <em>bar</em>.com and </li>
  <li>Post their credentials to foo.com/login and re-authenticate them without needing to log in again.</li>
  </ol>
  
  <p>Currently, to GET secure pages on foo.com I'm using form-based access via the <code>SecurityServiceProvider</code> and a db-backed <a href="http://silex.sensiolabs.org/doc/providers/security.html#defining-a-custom-user-provider" rel="nofollow"><code>UserProvider</code></a> to authenticate. Works great: any attempt to load a secured route is intercepted by the firewall and then redirected after successful authentication.</p>
  
  <p>What I can't figure out is how to pass the POST variables (username and password) on to the <code>provider</code> instance and forward the user to the supplied route.</p>
  
  <p>Stub POST route:</p>
  
  <pre><code>$app-&gt;post('/login', function(Request $req) use ($app) {
      $route    = $req-&gt;request-&gt;filter('route');
      $username = $req-&gt;get('username');
      $password = $req-&gt;get('password');
  
      /* magic happens...? */ 
  });
  </code></pre>