Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am starting to write an application for our office and the first step is authentication through LDAP where all users already exist. Everything I need is a code in Java to check if the pair <nick,password> is right. Google found me many links, but I think that I will find here the most sofisticate, short and up to date solution (I don't want to read all articles like 2 whole days to do something so simple).

I have written many dkBs of code in C++, but in Java I am total noob and I haven't coded anything with LDAP yet so try to be simple if speaking in Java and LDAP terms if possible.

share|improve this question

closed as off topic by Sven, HopelessN00b, Brent Pabst, Iain Sep 26 '12 at 17:58

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
You are totally wrong here. This site is for system administrators, not for software developers (see the FAQ). Stack Overflow might be for you, but check their site and FAQ first. –  Sven Sep 26 '12 at 15:20
    
I note that your account is blocked from asking questions on stackoverflow. Please don't ask any more Off Topic programming related questions on serverfault as the same will happen here. –  Iain Sep 26 '12 at 18:00

1 Answer 1

up vote 1 down vote accepted

Stack Overflow is the right site. In the meantime, using the UnboundID LDAP SDK:

try {
    LDAPConnection ldapConnection = new LDAPConnection(host,port,bindDN,bindPassword);
} catch (LDAPException ex) {
    handle exception ...
}

or

try {
    LDAPConnection ldapConnection = new LDAPConnection(host,port);
    SimpleBindRequest bindRequest = new SimpleBindRequest(bindDN,bindPassword);
    final BindResult bindResult = ldapConnection.bind(bindRequest);
} catch (LDAPException ex) {
    handle exception ...
}

for simple BIND requests. SASL binds are also handled by the LDAP SDK.

share|improve this answer
    
OK, I was searching the net and the majority told me that UnboundID LDAP is the simplest, clearest and cleanest way to do it. I can't try it yet, because there is not the guy which understands networking, so I don't know the host and port. But this is the answer I was looking for. I am banned on stackoverflow btw :D –  Salda Sep 27 '12 at 14:38
    
I am trying to use that LDAP, but I am not sure if I build my application through Ant with use of UnboundID if it will run on other computers without it installed as well. I am new in Java, so I don't know how the use of libraries work. –  Salda Oct 3 '12 at 13:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.