I've been searching for a way to validate a username with LDAP using the spring ldapTemplate.
My search led me to
ldapTemplate.search(base, filter, contextMapper/AttributeMapper)
But i'm wondering what i need to put in the contextMapper or attributeMapper. From what i've read, it is used to map the data to an object. But I dont need the object. I only want a boolean to know if it exists or not.
An example of my attributes:
base="ou=accounts,dc=example,dc=local"
// Replace $1 with the username we'd like to find.
filter="(&(objectclass=Person)(sAMAccountName=$1))"
My template contains the url, username and password and connection has been established.
I could use a little help as i'm not sure if using the search method is the right way to go here.
I have authentication set up with the ldapTemplate and would like to re-use it.
thanks