Thursday, May 20, 2010

Find a person in a group with an LDAP Filter

I've never before had the joy of trying to authenticate a Java app with LDAP. It turns out you can do all sorts of tricks with an LDAP filter - which is just like a weird query language.

Most of it made sense to me, but filtering users that belong to a certain group was a little tricky.

Here is a filter that will locate a user that belongs to a specific LDAP Group:

(&(objectClass=user)(sAMAccountName=%u)(memberOf=CN=GROUP_NAME,OU=Security Groups,DC=desqld,DC=internal))

0 comments: