Working with LDAP

Discussion in 'Forum for discussion of ANTICHAT' started by Dracula4ever, 20 May 2006.

  1. Dracula4ever

    Dracula4ever Elder - Старейшина

    Joined:
    8 May 2006
    Messages:
    418
    Likes Received:
    183
    Reputations:
    26
    Hey again,

    In the last few weeks I was working on an application that works with the Active Directory of Windows 2003 using LDAP.This time my boss told me to write it in Java so i went looking for a technology that implement the connection with the Active Directory and I found OpenLDAP (http://www.openldap.org/). first I was looking for some code examples for the jar and on Novell's site I found http://developer.novell.com/ndk/doc/samplecode/jldap_sample/CheckBind.java.html - that was exactly what I was looking for. Still, there was a weird problem with the password checking

    attribute = new LDAPAttribute( "userPassword", userPWD );

    that got exception every time I ran it ... but without that part the code was running perfectly and I didnt really needed it for my specific application was supposed to open a connection to the Active Directory and that's it.
    (I mean: lc.connect( ldapHost, ldapPort ); was enough)
    ah yeah, if you are trying to work with LDAP protocol dont forget that the username and password in the Active Directory isnt enough, You need to get the User's full details in the LDAP specific string (the example from the code above was "cn=JSmith,ou=sales,o=Acme")
    I dont remember the port I was using exactly but try ports 389/636.
    I am almost sure it was one of them.

    have fun! :)
    dracula4ever