3 Replies Latest reply on Feb 15, 2014 6:52 PM by Eduardo Martins

    WildFly 8 CR1: Not an instance of LdapContext error

    Alicja Przewodowska Newbie

      Hello.

       

      I have war application with spring ldap login. Spring version is 3.1.4. In WildFly 8 Beta1 I don't have this error, but in CR1 I have:

       

      14:08:10,282 ERROR [org.springframework.security.ldap.ppolicy.PasswordPolicyControlExtractor] (default task-19) Failed to obtain response controls: javax.naming.NotContextException: Not an instance of LdapContext

        at javax.naming.ldap.InitialLdapContext.getDefaultLdapInitCtx(InitialLdapContext.java:171) [rt.jar:1.7.0_04]

        at javax.naming.ldap.InitialLdapContext.getResponseControls(InitialLdapContext.java:209) [rt.jar:1.7.0_04]

        at org.springframework.security.ldap.ppolicy.PasswordPolicyControlExtractor.extractControl(PasswordPolicyControlExtractor.java:23) [spring-security-ldap-3.1.4.RELEASE.jar:3.1.4.RELEASE]

        at org.springframework.security.ldap.authentication.BindAuthenticator.bindWithDn(BindAuthenticator.java:114) [spring-security-ldap-3.1.4.RELEASE.jar:3.1.4.RELEASE]

        at org.springframework.security.ldap.authentication.BindAuthenticator.authenticate(BindAuthenticator.java:81) [spring-security-ldap-3.1.4.RELEASE.jar:3.1.4.RELEASE]

        at org.springframework.security.ldap.authentication.LdapAuthenticationProvider.doAuthentication(LdapAuthenticationProvider.java:178) [spring-security-ldap-3.1.4.RELEASE.jar:3.1.4.RELEASE]

        at org.springframework.security.ldap.authentication.AbstractLdapAuthenticationProvider.authenticate(AbstractLdapAuthenticationProvider.java:61) [spring-security-ldap-3.1.4.RELEASE.jar:3.1.4.RELEASE]

        at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:156) [spring-security-core-3.1.4.RELEASE.jar:3.1.4.RELEASE]

        at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:174) [spring-security-core-3.1.4.RELEASE.jar:3.1.4.RELEASE]

        at org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter.attemptAuthentication(UsernamePasswordAuthenticationFilter.java:94) [spring-security-web-3.1.4.RELEASE.jar:3.1.4.RELEASE]

        at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:195) [spring-security-web-3.1.4.RELEASE.jar:3.1.4.RELEASE]

        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.1.4.RELEASE.jar:3.1.4.RELEASE]

        at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105) [spring-security-web-3.1.4.RELEASE.jar:3.1.4.RELEASE]

        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.1.4.RELEASE.jar:3.1.4.RELEASE]

        at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) [spring-security-web-3.1.4.RELEASE.jar:3.1.4.RELEASE]

        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.1.4.RELEASE.jar:3.1.4.RELEASE]

        at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192) [spring-security-web-3.1.4.RELEASE.jar:3.1.4.RELEASE]

        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160) [spring-security-web-3.1.4.RELEASE.jar:3.1.4.RELEASE]

        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) [spring-web-3.1.4.RELEASE.jar:3.1.4.RELEASE]

        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259) [spring-web-3.1.4.RELEASE.jar:3.1.4.RELEASE]

        at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]

        at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]

        at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]

        at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]

        at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]

        at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:70)

        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]

        at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]

        at io.undertow.security.handlers.AuthenticationCallHandler.handleRequest(AuthenticationCallHandler.java:52) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]

        at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]

        at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]

        at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:67) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]

        at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:70) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]

        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]

        at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)

        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]

        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]

        at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]

        at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]

        at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]

        at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]

        at io.undertow.server.Connectors.executeRootHandler(Connectors.java:164) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]

        at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:654) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_04]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_04]

        at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_04]

       

      Please help

        • 1. Re: WildFly 8 CR1: Not an instance of LdapContext error
          Tomaz Cerar Master

          what are you looking up?

           

          how does your ldap configuration look like?

          • 2. Re: WildFly 8 CR1: Not an instance of LdapContext error
            Alicja Przewodowska Newbie

            My ldap configuration:

             

            <beans:bean id="contextSource" class="org.springframework.security.ldap.DefaultSpringSecurityContextSource">

                 <beans:constructor-arg value="LDAPAddress" />

            </beans:bean>

             

            <beans:bean id="ldapAuthProvider" class="org.springframework.security.ldap.authentication.LdapAuthenticationProvider">

                 <beans:constructor-arg>

                      <beans:bean class="org.springframework.security.ldap.authentication.BindAuthenticator">

                           <beans:constructor-arg ref="contextSource" />

                           <beans:property name="userDnPatterns">

                                <beans:list>

                                     <beans:value>uid={0},ou=Employee</beans:value>

                                </beans:list>

                           </beans:property>

                      </beans:bean>

                 </beans:constructor-arg>

                 <beans:constructor-arg>

                      <beans:bean class="pap.nse2.security.NseAuthoritiesPopulator" />

                 </beans:constructor-arg>

            </beans:bean>

             

            <beans:bean id="authenticationFilter" class="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter">

                 <beans:property name="authenticationManager" ref="authenticationManager" />

                 <beans:property name="postOnly" value="false" />

            </beans:bean>

             

            <authentication-manager alias="authenticationManager">

                 <authentication-provider ref='ldapAuthProvider' />

            </authentication-manager>

            • 3. Re: WildFly 8 CR1: Not an instance of LdapContext error
              Eduardo Martins Apprentice

              This is fixed in WildFly 8.0.0.Final.