title: Using Custom AuthenticationProcessingFilter with <form-login> (auto-config="true")
body: <p>Spring security (2.0.x) http namespace, form-login definition automatically uses AuthenticationProcessingFilter. </p>
  
  <pre><code>&lt;form-login login-page='/logon.jsp' 
  default-target-url='/home.jsp' 
  always-use-default-target='true' /&gt;
  </code></pre>
  
  <p>I also know that If I set <code>auto-config="false"</code> I can customise authentication by providing custom bean definition.</p>
  
  <p>I have CustomAuthenticationProcessingFilter that extends AuthenticationProcessingFilter overrides obtainUsername and uses custom logic to get username than the one passed.</p>
  
  <pre><code>protected String obtainUsername(HttpServletRequest request) {
     // custom logic to return username from parameter/cookies/header etc ... 
  }
  </code></pre>
  
  <p>Is it possible to use CustomAuthenticationProcessingFilter while still using <code>auto-config="true" &lt;form-login&gt;</code> without needing to define customAuthFilter and all dependent beans ? </p>
  
  <pre><code>  &lt;beans:bean id="customAuthFilter" class="x.y.z.CustomAuthenticationProcessingFilter"&gt;
      &lt;custom-filter  position="AUTHENTICATION_PROCESSING_FILTER" /&gt;
      &lt;beans:property name="defaultTargetUrl" value="/home.jsp"&gt;&lt;/beans:property&gt;
      ...
      ...
    &lt;/beans:bean&gt;
  </code></pre>