This package is not actively maintained, but it will be re-released once it has been reworked as time permits.

Gldapwrap - Usage

To use Gldapwrap, you need to make sure the Gldapwrap jar is in your classpath as well as the Spring LDAP jars (provided in the download). An easy way to do this is to to put the jars in ~/.groovy/lib/.

First thing you need to do is define a schema class. A schema class is just an ordinary POGO.

class MyLdapEntry
	List objectclass
	String distinguisheName

That's all you need to do to define a schema.

Next is to create a GldapwrapTemplate which is basically the details of the LDAP server you want to connect to.

import gldapwrap.GldapwrapTemplate

def template = new GldapwrapTemplate(
	url: "ldap://",
	base: "dc=example,dc=com",
	userDn: "cn=admin,dc=example,dc=com",
	password: "secret"

Next you need to inject the template into your schema class.

import gldapwrap.GldapwrapInjector(MyLdapEntry, template)

Now you can do searches.

List entries = MyLdapEntry.find() // Find all entries at base

entries = MyLdapEntry.find(
	filter: "(objectclass=person)", 
) // Find all people in the whole directory

entries = MyLdapEntry.find(
	filter: "(objectclass=person)", 
	base: "ou=People"
	countLimit: 50
) // Find the first 50 people in the directory under the people OU

See Searching for more detail about searching.