Take a look at the LDAP auth plugin. It is dealing with similar issues to fetch user details from the LDAP.
General developer forum
Authentication Plugin using Atlassian Crowd
This discussion has been locked so you can no longer reply to it.