LDAP in JBStrap
LDAP stands for Lightweight Directory Access Protocol. It is a platform-independent protocol for accessing and maintaining directories and address books. Its database management relies on a hierarchical tree structure, designed for storing many small pieces of information and quickly retrieving them. LDAP can be used for many different purposes, for example to centralize user and group access control, to provide an easy way of handling system configuration data to quickly search in address books. LDAP has several implementations such as OpenLDAP, Apple Open Directory and Microsoft Active Directory.
Connecting to the LDAP server
In order to access the data in an LDAP server, first you have to connect to the server. You only have to connect to the server once, since once a connection is open, it remains active until it is closed. Implement the connection in the Startup class.
Instantiate the LDAPConnection class to create an LDAP connection. Once the LDAPConnection class parameters are set, you can create the connection by calling the connect() method.
Write the following code to implement the connection:
Disconnecting from an LDAP server
You have to close an LDAP server connection before you quit the application just like all other database connections. Do this using the shutdown() method of the Startup class, as this method is executed before each application shutdown. Use the following statement to disconnect from the LDAP server: