title: Overriding the authentication failure handler - Symfony2
body: <p>I am extending the authentication failure handler and everything is mainly working ok, but for one small problem.</p>
  
  <p>This is my services.yml:</p>
  
  <pre><code>  http.utils.class:
      class: Symfony\Component\Security\Http\HttpUtils
    auth.fail:
      class: Acme\MyBundle\AuthenticationFailure
      arguments:
        - @http_kernel
        - @http.utils.class
        - []
  </code></pre>
  
  <p>I have set this to be used in security.yml:</p>
  
  <pre><code>failure_handler: auth.fail
  </code></pre>
  
  <p>This is my Acme\MyBundle\AuthenticationFailure.php:</p>
  
  <pre><code>namespace Acme\MyBundle;
  
  use Symfony\Component\HttpFoundation\Request;
  use Symfony\Component\Security\Core\Exception\AuthenticationException;
  use Symfony\Component\Security\Http\Authentication\DefaultAuthenticationFailureHandler;
  use Symfony\Component\HttpFoundation\Response;
  
  class AuthenticationFailure extends DefaultAuthenticationFailureHandler
  {
  
      public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
      {
  
          //do something
  
      }
  
  }
  </code></pre>
  
  <p>The problem is that the options I've set in security.yml are ignored. I know the third parameter of the _construct method of the class is the $options array, and I've not passed anything in as the third parameter (in services.yml), so I'm guessing this is the problem and a solution could be to just pass the values in. I'm guessing I could also do something like this:</p>
  
  <pre><code>arguments:
    - @http_kernel
    - @http.utils.class
    - %security.firewalls.secure_area.form_login%
  </code></pre>
  
  <p>....I've not tested as the problem is this is hard-coding that in services.yml and it isn't ideal as if I changed the name of secure_area it would break. Surely these values are available in a better way?</p>