spring-projects / spring-projects/spring-ldap

Spring LDAP 2 incompatible with Spring Security?

Open
#10 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
375
Forks
501
Avg merge
6h 4m
Merged PRs (30d)
63

Description

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>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the XML configuration in the issue and reproduce it using Spring LDAP 2.0 with tx:annotation-driven enabled. Inspect PasswordComparisonAuthenticator, FilterBasedLdapUserSearch, and the context-source types involved in the reported constructor error. Done means the LDAP authentication wiring accepts the configured context source without the conversion failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
authentication, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.