title: multiple authentication manager in spring security
body: <p>I'm new at spring security. I want to have two different login forms for two different type of users. I have a package called /admin which is contained my main project for system users and /portal for other users./portal users will work on their tenant and won't know anything about /admin and vice versa.Each user group has its own database too.
  In spring-security.xml I defined two authentication managers,but when I login from both login forms it goes to 'AuthenticatingManager' but as I mentioned in xml file, for /portal users it should goes to PortalAuthenticatingManager. what shall I do? or what did I miss?</p>
  
  <pre><code>&lt;security:http use-expressions="true" pattern="/portal/**" authentication-manager-ref="portalAuthMgr"  access-denied-page="/unauthorized.jsp"&gt;
      &lt;form-login login-page="/plLogin.jsp"  default-target-url="/portal/portal"  /&gt;
      &lt;security:intercept-url pattern="/plLogin.jsp" access="permitAll"/&gt;
  &lt;security:intercept-url pattern="/portal/**" access="hasRole('ROLE_PORTAL')" /&gt;
  &lt;/security:http&gt;
  &lt;security:http  authentication-manager-ref="adminAuthMgr" access-denied-page="/unauthorized.jsp"&gt;
      &lt;intercept-url pattern="/admin/**" access="ROLE_ADMIN" /&gt;
  &lt;security:form-login login-page="/login.jsp"  authentication-failure-handler-ref="authenticationFailureHandler"/&gt;
  &lt;/security:http&gt;
  
  &lt;security:authentication-manager id="adminAuthMgr"&gt;
      &lt;security:authentication-provider ref="produxAuthenticationProvider"/&gt;
  &lt;/security:authentication-manager&gt;
  &lt;security:authentication-manager alias="portalAuthMgr"&gt;
      &lt;security:authentication-provider ref="portalAuthenticationProvider"/&gt;
  &lt;/security:authentication-manager&gt;
  
  &lt;beans:bean id="produxAuthenticationProvider" class="com.spring.AuthenticatingManager"&gt;
  &lt;/beans:bean&gt;
   &lt;beans:bean id="portalAuthenticationProvider" class="com.spring.PortalAuthenticatingManager"&gt;
  &lt;/beans:bean&gt;
  </code></pre>