Some logging for diagnostics

git-svn-id: https://svn.libreccm.org/ccm/trunk@6271 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2019-10-17 18:01:19 +00:00
parent a6ffe42ec1
commit 7e3996e18e
1 changed files with 24 additions and 2 deletions

View File

@ -101,12 +101,23 @@ public class JndiLoginModule extends PasswordLoginModule implements LoginModule
@Override @Override
public boolean login() throws LoginException { public boolean login() throws LoginException {
final String username = getUsername();
try { try {
userAuthentication = UserAuthentication userAuthentication = UserAuthentication
.retrieveForSSOlogin(getUsername()); .retrieveForSSOlogin(username);
} catch (DataObjectNotFoundException ex) { } catch (DataObjectNotFoundException ex) {
LOGGER.info(
String.format("No user with SSOName \"%s\" in database.",
username
)
);
throw new FailedLoginException("User not found in LDAP."); 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(); final boolean result = super.login();
return result; return result;
} }
@ -166,6 +177,12 @@ public class JndiLoginModule extends PasswordLoginModule implements LoginModule
); );
if (!results.hasMore()) { if (!results.hasMore()) {
LOGGER.info(
String.format(
"No user with matching \"%s\" found in LDAP.",
filter
)
);
throw new FailedLoginException("Bad Username / password"); throw new FailedLoginException("Bad Username / password");
} }
@ -209,7 +226,12 @@ public class JndiLoginModule extends PasswordLoginModule implements LoginModule
try { try {
context.getAttributes("", null); context.getAttributes("", null);
} catch (AuthenticationException ex) { } 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( throw new FailedLoginException(
"Bad username / password for LDAP" "Bad username / password for LDAP"
); );