Add DEBUG/TRACE logs for LDAP bind (#36028)

Introduces a debug log message when a bind fails and a trace message
when a bind succeeds.

It may seem strange to only debug a bind failure, but failures of this
nature are relatively common in some realm configurations (e.g. LDAP
realm with multiple user templates, or additional realms configured
after an LDAP realm).
This commit is contained in:
Tim Vernum 2018-12-03 10:05:57 +11:00 committed by GitHub
parent 46962308aa
commit d20bb3789d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -133,11 +133,13 @@ public final class LdapUtils {
@SuppressForbidden(reason = "Bind allowed if forking of the LDAP Connection Reader Thread.") @SuppressForbidden(reason = "Bind allowed if forking of the LDAP Connection Reader Thread.")
protected void doRun() throws Exception { protected void doRun() throws Exception {
privilegedConnect(() -> ldapPool.bindAndRevertAuthentication(bind.duplicate())); privilegedConnect(() -> ldapPool.bindAndRevertAuthentication(bind.duplicate()));
LOGGER.trace("LDAP bind [{}] succeeded for [{}]", bind, ldapPool);
runnable.run(); runnable.run();
} }
@Override @Override
public void onFailure(Exception e) { public void onFailure(Exception e) {
LOGGER.debug("LDAP bind [{}] failed for [{}] - [{}]", bind, ldapPool, e.toString());
runnable.onFailure(e); runnable.onFailure(e);
} }
@ -178,11 +180,13 @@ public final class LdapUtils {
@SuppressForbidden(reason = "Bind allowed if forking of the LDAP Connection Reader Thread.") @SuppressForbidden(reason = "Bind allowed if forking of the LDAP Connection Reader Thread.")
protected void doRun() throws Exception { protected void doRun() throws Exception {
privilegedConnect(() -> ldap.bind(bind.duplicate())); privilegedConnect(() -> ldap.bind(bind.duplicate()));
LOGGER.trace("LDAP bind [{}] succeeded for [{}]", bind, ldap);
runnable.run(); runnable.run();
} }
@Override @Override
public void onFailure(Exception e) { public void onFailure(Exception e) {
LOGGER.debug("LDAP bind [{}] failed for [{}] - [{}]", bind, ldap, e.toString());
runnable.onFailure(e); runnable.onFailure(e);
} }