kevin
kevin

Reputation: 570

How to read values from ldap using spring-ldap

I am trying to read values from ldap using spring-ldap.

I am trying to follow ldap query based on the document http://docs.spring.io/spring-ldap/docs/current/reference/#basic-queries

My program is failing to compile because LdapQuery is not found.

LdapQuery query = query()
         .base("dc=261consulting,dc=com")
         .attributes("cn", "sn")
         .where("objectclass").is("person")
         .and("sn").is(lastName);

My pom.xml has the following entry.

<dependency>
    <groupId>org.springframework.ldap</groupId>
    <artifactId>spring-ldap-core</artifactId>
    <version>1.3.1.RELEASE</version>
</dependency>

I looked at spring-ldap api documentation at http://docs.spring.io/spring-ldap/site/apidocs/index.html and they dont seem to have LdapQuery class.

Can you please help on how to read values from ldap using spring? If you can provide an example, that will be great.

Thanks

Upvotes: 1

Views: 528

Answers (1)

Andrew S
Andrew S

Reputation: 2756

LdapQuery was added with 2.0. If you're constrained to an earlier version consider using LdapTemplate.

Upvotes: 1

Related Questions