Do not interrupt authentication chain on invalid ldap connection infos

Catch LdapExceptions and throw AuthenticationException to not interrupt authentication chain

fixes #7497
This commit is contained in:
Matthias Jentsch 2014-11-04 12:35:41 +01:00
parent 18bd49e636
commit f9fee2df70

View File

@ -68,8 +68,16 @@ class LdapUserBackend extends UserBackend
*/ */
public function assertAuthenticationPossible() public function assertAuthenticationPossible()
{ {
$q = $this->conn->select()->from($this->userClass); try {
$result = $q->fetchRow(); $q = $this->conn->select()->from($this->userClass);
$result = $q->fetchRow();
} catch (LdapException $e) {
throw new AuthenticationException(
'Connection not possible: %s',
$e->getMessage()
);
}
if (! isset($result)) { if (! isset($result)) {
throw new AuthenticationException( throw new AuthenticationException(
'No objects with objectClass="%s" in DN="%s" found.', 'No objects with objectClass="%s" in DN="%s" found.',
@ -158,7 +166,7 @@ class LdapUserBackend extends UserBackend
} catch (AuthenticationException $e) { } catch (AuthenticationException $e) {
// Authentication not possible // Authentication not possible
throw new AuthenticationException( throw new AuthenticationException(
'Authentication against backend "%s" not possible: ', 'Authentication against backend "%s" not possible: %s',
$this->getName(), $this->getName(),
$e $e
); );