@Override
protected DirContextOperations doAuthentication(UsernamePasswordAuthenticationToken authentication) {
try {
return super.doAuthentication(authentication);
} catch (InternalAuthenticationServiceException e) {
throw processInternalAuthenticationException(e, e);
} catch (IncorrectResultSizeDataAccessException e) {
LOGGER.error("Failed to authenticate user {}. Error: {}", authentication.getName(), e.getMessage(), e);
throw new BadCredentialsException("LdapAuthentication.bad.user", e);
} catch (RuntimeException e) {
LOGGER.error("Failed to authenticate user {}. Error: {}", authentication.getName(), e.getMessage(), e);
auditProvider.auditLoginFailure(authentication.getName(), null, ConnectionEnvironment.create(SchemaConstants.CHANNEL_GUI_USER_URI), "bad credentials");
throw e;
}
}