Spring Security
  1. Spring Security
  2. SEC-1812

Authentication Managers can not be overridden

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Complete
    • Affects Version/s: 3.1.0.RC2
    • Fix Version/s: 3.1.0
    • Component/s: Namespace
    • Labels:
      None

      Description

      application-security.xml
      <security:authentication-manager>
      <security:authentication-provider>
      <security:user-service>
      <security:user name="admin" password="admin" authorities="ROLE_USER, ROLE_ADMIN" />
      <security:user name="user" password="user" authorities="ROLE_USER" />
      </security:user-service>
      </security:authentication-provider>
      </security:authentication-manager>

      application-security-override.xml
      <security:authentication-manager>
      <security:authentication-provider ref="activeDirectoryAuthenticationProvider"/>
      </security:authentication-manager>

      gives :
      org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [application-security.xml]; nested
      exception is java.lang.IllegalStateException: AuthenticationManager has already been registered!

      As one would expect with Plain Old Spring Beans (POSB ;-0), namespaced elements can not be overridden. I don't know if that's intentional, but poor user (like me) is taken by surprise to see it not working.

        Activity

        Hide
        Luke Taylor added a comment -

        I've replace the assertion with a warning when the global AuthenticationManager is overwritten. Note that the changes in SEC-1847 may also be of interest.

        Show
        Luke Taylor added a comment - I've replace the assertion with a warning when the global AuthenticationManager is overwritten. Note that the changes in SEC-1847 may also be of interest.

          People

          • Assignee:
            Luke Taylor
            Reporter:
            kunal dabir
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: