title: Spring Security 3.1.0.RC1: With multiple <http.../> elements why can I only register one authentication manager?
body: <p>I have the following configuration with multiple <code>&lt;http.../&gt;</code> elements (in order to separately support REST authetication via basic auth, and user form login):</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;security:http auto-config="false" pattern="/service/**" create-session="never" 
                 entry-point-ref="basicAuthenticationEntryPoint" &gt;
      &lt;security:intercept-url pattern="/service/**" requires-channel="any" access="ROLE_REST_SERVICE" /&gt;
      &lt;security:custom-filter position="BASIC_AUTH_FILTER" ref="basicAuthenticationFilter" /&gt;
  &lt;/security:http&gt;
  
  &lt;security:http auto-config="false" pattern="/**"
                 entry-point-ref="loginUrlAuthenticationEntryPoint" &gt;
      &lt;security:logout logout-url="/logout" /&gt;
      &lt;security:anonymous enabled="false"/&gt;
      &lt;security:custom-filter position="FORM_LOGIN_FILTER" ref="usernamePasswordAuthenticationFilter" /&gt;
      &lt;security:custom-filter position="ANONYMOUS_FILTER" ref="anonymousAuthFilter" /&gt;
  &lt;/security:http&gt;
  </code></pre>
  
  <p>In each of my two filters requiring authentication (FORM_LOGIN_FILTER, and BASIC_AUTH_FILTER) I reference two different authentication managers.</p>
  
  <p>But I get an error that I've already registered an authentication manager.</p>
  
  <p>Why would I use one authentication manager when I know before hand which Authentication provider is going to be needed for each filter?</p>
  
  <p>Should I not use the authentication manager and just start my <code>AuthenticationProvider</code> as a bean and pass it into the filter directly as the <code>AuthenticationManager</code>?</p>