spring-ldap icon indicating copy to clipboard operation
spring-ldap copied to clipboard

Spring LDAP 2 incompatible with Spring Security?

Open fhanik opened this issue 10 years ago • 1 comments

We are experimenting replacing our spring-ldap 1.3 with 2.0. The context source gets wrapped because another file has tx:annotation-driven And it turns out that the new context source does not meet the BindAuthenticator argument type.

Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.ldap.core.support.BaseLdapPathContextSource]: Could not convert constructor argument value of type [org.springframework.ldap.transaction.compensating.manager.TransactionAwareContextSourceProxy] to required type [org.springframework.ldap.core.support.BaseLdapPathContextSource]: Failed to convert value of type 'org.springframework.ldap.transaction.compensating.manager.TransactionAwareContextSourceProxy' to required type 'org.springframework.ldap.core.support.BaseLdapPathContextSource'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.ldap.transaction.compensating.manager.TransactionAwareContextSourceProxy] to required type [org.springframework.ldap.core.support.BaseLdapPathContextSource]: no matching editors or conversion strategy found

    <ldap:context-source id="contextSource"
        url="${ldap.base.url:ldap://localhost:389/}"
        username="${ldap.base.userDn:cn=admin,ou=Users,dc=test,dc=com}"
        password="${ldap.base.password:password}"
        base-env-props-ref="ldapProperties"/>

    <bean id="ldapAuthProvider" class="org.springframework.security.ldap.authentication.LdapAuthenticationProvider">
        <constructor-arg>
            <bean class="org.cloudfoundry.identity.uaa.ldap.PasswordComparisonAuthenticator">
                <constructor-arg ref="contextSource" />
                <property name="userSearch">
                    <bean id="userSearch" class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch">
                        <constructor-arg index="0" value="${ldap.base.searchBase:dc=test,dc=com}" />
                        <constructor-arg index="1" value="${ldap.base.searchFilter:cn={0}}" />
                        <constructor-arg index="2" ref="contextSource" />
                    </bean>
                </property>
                <property name="passwordAttributeName" value="${ldap.base.passwordAttributeName:userPassword}" />
                <property name="passwordEncoder">
                    <bean id="ldapPasswordEncoder"
                        class="${ldap.base.passwordEncoder:org.cloudfoundry.identity.uaa.ldap.DynamicPasswordComparator}">
                    </bean>
                </property>
                <property name="localCompare" value="${ldap.base.localPasswordCompare:true}" />
            </bean>
        </constructor-arg>
        <constructor-arg ref="ldapAuthoritiesPopulator"/>
        <property name="authoritiesMapper" ref="ldapAuthoritiesMapper"/>
    </bean>

fhanik avatar Jun 17 '14 21:06 fhanik

@fhanik Are you still experiencing issues or have updates fixed your issue?

rwinch avatar Apr 28 '15 19:04 rwinch