diff --git a/src/main/java/org/elasticsearch/shield/authc/Realms.java b/src/main/java/org/elasticsearch/shield/authc/Realms.java index c79987fbc9a..be47f539504 100644 --- a/src/main/java/org/elasticsearch/shield/authc/Realms.java +++ b/src/main/java/org/elasticsearch/shield/authc/Realms.java @@ -7,6 +7,8 @@ package org.elasticsearch.shield.authc; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.internal.Nullable; +import org.elasticsearch.common.logging.ESLogger; +import org.elasticsearch.common.logging.ESLoggerFactory; import org.elasticsearch.shield.authc.esusers.ESUsersRealm; import org.elasticsearch.shield.authc.ldap.LdapRealm; import org.elasticsearch.shield.authc.system.SystemRealm; @@ -19,6 +21,8 @@ import java.util.List; */ public class Realms { + private static final ESLogger logger = ESLoggerFactory.getLogger(Realms.class.getName()); + private final Realm[] realms; @Inject @@ -27,9 +31,11 @@ public class Realms { List realms = new ArrayList<>(); realms.add(system); if (esusers != null) { + logger.info("Realm [" + esusers.type() + "] is used"); realms.add(esusers); } if (ldap != null) { + logger.info("Realm [" + ldap.type() + "] is used"); realms.add(ldap); } this.realms = realms.toArray(new Realm[realms.size()]); diff --git a/src/main/java/org/elasticsearch/shield/authc/esusers/FileUserPasswdStore.java b/src/main/java/org/elasticsearch/shield/authc/esusers/FileUserPasswdStore.java index 1fd55718cc9..6445d738058 100644 --- a/src/main/java/org/elasticsearch/shield/authc/esusers/FileUserPasswdStore.java +++ b/src/main/java/org/elasticsearch/shield/authc/esusers/FileUserPasswdStore.java @@ -54,6 +54,9 @@ public class FileUserPasswdStore extends AbstractComponent implements UserPasswd super(settings); file = resolveFile(settings, env); esUsers = parseFile(file, logger); + if (esUsers.isEmpty() && logger.isDebugEnabled()) { + logger.debug("Realm [esusers] has no users"); + } FileWatcher watcher = new FileWatcher(file.getParent().toFile()); watcher.addListener(new FileListener()); watcherService.add(watcher, ResourceWatcherService.Frequency.HIGH);