Created
June 25, 2010 19:43
-
-
Save axfelix/453345 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function authenticate($username, $password) { | |
$valid = false; | |
if ($password != null) { | |
if ($this->open()) { | |
if ($entry = $this->getUserEntry($username)) { | |
$userdn = ldap_get_dn($this->conn, $entry); | |
if ($this->bind($userdn, $password)) { | |
$valid = true; | |
} | |
} | |
$this->close(); | |
} | |
return $valid; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As discussed in http://pkp.sfu.ca/support/forum/viewtopic.php?f=8&t=5268, LDAP can bind as anonymous in the case of null credentials. I’m not entirely sure of the utility of allowing null credentials in the first place, but I imagine that this becomes irrelevant when a user chooses to enable LDAP. Suggest that the above becomes the default behavior.