Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Classes/Service/BindProvider/LdapBind.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,20 @@ class LdapBind extends AbstractBindProvider
public function bind($username, $password)
{
$bindDn = Arrays::getValueByPath($this->options, 'bind.dn');
$bindPassword = Arrays::getValueByPath($this->options, 'bind.password');
if (!empty($username) && !empty($password)) {
// if credentials are given, use them to authenticate
$this->bindWithDn(sprintf($bindDn, $username), $password);
if (empty($bindPassword)) {
// if credentials are given, use them to authenticate
$this->bindWithDn(sprintf($bindDn, $username), $password);
} else {
// if the settings specify a bind password, we are safe to assume no anonymous authentication is needed
$this->bindWithDn($bindDn, $bindPassword);
}
return;
}

$bindPassword = Arrays::getValueByPath($this->options, 'bind.password');
if (!empty($bindPassword)) {
// if the settings specify a bind password, we are safe to assume no anonymous authentication is needed
$this->bindWithDn($bindDn, $bindPassword);
}

$anonymousBind = Arrays::getValueByPath($this->options, 'bind.anonymous');
if ($anonymousBind === true) {
if ($anonymousBind) {
// if allowed, bind without username or password
$this->bindAnonymously();
}
Expand Down
2 changes: 2 additions & 0 deletions Classes/Service/DirectoryService.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ public function authenticate($username, $password)
throw new Exception('Error while authenticating: authenticated user could not be fetched from the directory', 1488289104);
}

$this->bindProvider->verifyCredentials($entries[0]['dn'], $password);

return $entries[0];
}

Expand Down