Take a look at the source code of
StrongKey CryptoEngine; it authenticates users to Active Directory as well as OpenDS, a Java-based open-source Directory Server. The code has the potential to work against any standard LDAP Directory Server.
Arshad Noor
StrongAuth, Inc.