Chapter 13. Writing a Simple LDAP Proxy

The OpenDJ LDAP SDK example Proxy demonstrates a simple LDAP proxy that forwards requests to one or more remote directory servers. Although the implementation is intended as an example, it does demonstrate use of the asynchronous API, load balancing, and connection pooling.

The Proxy example sets up connections pools with load balancing to the directory servers. It passes the connection factories to a ProxyBackend that handles the requests passed back to the directory servers. It also sets up an LDAP listener to receive incoming connections from clients of the Proxy.

The ProxyBackend uses separate connection factories, one for bind operations, the other for other operations. It uses the proxied authorization control to ensure operations are performed using the bind identity for the operation.

The ProxyBackend's function is to handle each client request, encapsulating the result handlers that allow it to deal with each basic operation. It authenticates to the directory server to check incoming credentials, and adds the proxied authorization control to requests other than binds. The ProxyBackend handles all operations using asynchronous connections and methods.