Announcement Announcement Module
Collapse
No announcement yet.
weird problem with multiple authentication-providers with my spring-security app Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • weird problem with multiple authentication-providers with my spring-security app

    I recently incorporated ICEfaces3 based Spring Security LDAP authentication for my application. However I have been noticing the following weird behavior. Maybe somebody on here can either explain/correct me on it.

    Obviously, when I first implemented the solution, in my applicationContext-security.xml file, i implemented the simple <user-service> simple/dummy authentication. And after which I implemented my own CustomAuthentication provider. So, when I have both my simple(aka dummy) and my custom auth listed one after another like below, everything works fine.

    relevant snippet from my applicationContext-security.xml

    Code:
    <authentication-manager alias="authenticationManager">
        	<!-- my dummy auth -->
           <authentication-provider>
                <user-service>
                    <user name="test" password="pass" authorities=""/>
                </user-service>
            </authentication-provider>
            
            <!-- my custom auth provider -->
            <authentication-provider ref="customAuthProvider"/>
        </authentication-manager>

    However, as I finish up with my testing, I obviously want to take out the dummy auth and only leave my custom auth as the only default auth provider. And everytime i do I see a ProviderNotFoundException. Both in my unit tests and within the tomcat container


    Is there any explanation for this, I tried quite a few variants where i used two instances of my same custom auth provider. Nothing seems to make the difference, the only time it works as designed if I have my dummy auth provider along with my custom provider.

    org.springframework.security.authentication.Provid erNotFoundException: No AuthenticationProvider found for org.springframework.security.authentication.Userna mePasswordAuthenticationToken
    at org.springframework.security.authentication.Provid erManager.doAuthentication(ProviderManager.java:17 0)
    at org.springframework.security.authentication.Abstra ctAuthenticationManager.authenticate(AbstractAuthe nticationManager.java:48)
    at com.xxx.safe.spring.security.session.SpringSecurit yTests.testAuthToken(SpringSecurityTests.java:26)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.runners.model.FrameworkMethod$1.runRefle ctiveCall(FrameworkMethod.java:44)
    Any insights appreciated!
Working...
X