PHP & LDAP
Posted by Quinn Madson | Posted in | Posted on 8:24 AM
0
// get username and password via form scope
$user = $_POST["username"];
$pass = $_POST["password"];
// format username for uwm ldap auth
$basedn = "ou=people,o=somewhere.edu";
$ldap_user = "uid=" . $user . "," . $basedn;
// connect to uwm ldap server
$ds=ldap_connect("ldap://ldap.uwm.edu");
if ($ds) {
// bind to uwm ldap server
$r=ldap_bind($ds, $ldap_user, $pass);
}
// close out ldap connection
ldap_close($ds);
Your basedn may vary. Also, the protocol, ldaps://. supposedly works but so far, I have had no luck. I have a sneaking suspicion that it has something to do with self-signed certificates.
Comments (0)
Post a Comment