From 7e3996e18e713ea29e465dfee48e8f7aca3c67c8 Mon Sep 17 00:00:00 2001 From: jensp Date: Thu, 17 Oct 2019 18:01:19 +0000 Subject: [PATCH] Some logging for diagnostics git-svn-id: https://svn.libreccm.org/ccm/trunk@6271 8810af33-2d31-482b-a856-94f89814c4df --- .../kernel/security/JndiLoginModule.java | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/ccm-core/src/com/arsdigita/kernel/security/JndiLoginModule.java b/ccm-core/src/com/arsdigita/kernel/security/JndiLoginModule.java index cb82ec2d8..6215b3bcf 100644 --- a/ccm-core/src/com/arsdigita/kernel/security/JndiLoginModule.java +++ b/ccm-core/src/com/arsdigita/kernel/security/JndiLoginModule.java @@ -101,12 +101,23 @@ public class JndiLoginModule extends PasswordLoginModule implements LoginModule @Override public boolean login() throws LoginException { + final String username = getUsername(); try { userAuthentication = UserAuthentication - .retrieveForSSOlogin(getUsername()); + .retrieveForSSOlogin(username); } catch (DataObjectNotFoundException ex) { + LOGGER.info( + String.format("No user with SSOName \"%s\" in database.", + username + ) + ); throw new FailedLoginException("User not found in LDAP."); } + LOGGER.info( + String.format( + "User with SSO name \"%s\" found trying to login via LDAP...", + username) + ); final boolean result = super.login(); return result; } @@ -166,6 +177,12 @@ public class JndiLoginModule extends PasswordLoginModule implements LoginModule ); if (!results.hasMore()) { + LOGGER.info( + String.format( + "No user with matching \"%s\" found in LDAP.", + filter + ) + ); throw new FailedLoginException("Bad Username / password"); } @@ -209,7 +226,12 @@ public class JndiLoginModule extends PasswordLoginModule implements LoginModule try { context.getAttributes("", null); } catch (AuthenticationException ex) { - LOGGER.info("LDAP login failed."); + LOGGER.info( + String.format( + "LDAP login for user with SSO name \"%s\" failed.", + username + ) + ); throw new FailedLoginException( "Bad username / password for LDAP" );