J
John English
Can anyone tell me how to do password authentication against an LDAP
server in Java? Here's how I do it in PHP...
$ldap = ldap_connect("ldap.bton.ac.uk");
if (ldap_bind($ldap)) {
$srch = ldap_search($ldap,"ou=people,dc=brighton,dc=ac,dc=uk",
"uid=$user",array("uid"));
if ($srch) {
$dn = ldap_get_dn($ldap,ldap_first_entry($ldap,$srch));
if ($dn) {
if (ldap_unbind($ldap)) {
$ldap = ldap_connect("ldap.bton.ac.uk");
if (@ldap_bind($ldap,$dn,$pass)) {
return strtoupper($user);
}
}
}
}
}
I'm finding it a bit hard to figure out how to connect, bind, search,
get DNs, and other such simple things...
Any pointers much appreciated!
-----------------------------------------------------------------
John English | mailto:[email protected]
Senior Lecturer | http://www.it.bton.ac.uk/staff/je
School of Computing & MIS | ** NON-PROFIT CD FOR CS STUDENTS **
University of Brighton | -- see http://burks.bton.ac.uk
-----------------------------------------------------------------
server in Java? Here's how I do it in PHP...
$ldap = ldap_connect("ldap.bton.ac.uk");
if (ldap_bind($ldap)) {
$srch = ldap_search($ldap,"ou=people,dc=brighton,dc=ac,dc=uk",
"uid=$user",array("uid"));
if ($srch) {
$dn = ldap_get_dn($ldap,ldap_first_entry($ldap,$srch));
if ($dn) {
if (ldap_unbind($ldap)) {
$ldap = ldap_connect("ldap.bton.ac.uk");
if (@ldap_bind($ldap,$dn,$pass)) {
return strtoupper($user);
}
}
}
}
}
I'm finding it a bit hard to figure out how to connect, bind, search,
get DNs, and other such simple things...
Any pointers much appreciated!
-----------------------------------------------------------------
John English | mailto:[email protected]
Senior Lecturer | http://www.it.bton.ac.uk/staff/je
School of Computing & MIS | ** NON-PROFIT CD FOR CS STUDENTS **
University of Brighton | -- see http://burks.bton.ac.uk
-----------------------------------------------------------------