ldap.Helper: Use local logger and make logger in LdapRealm private
Loggers should not be shared between classes. Change-Id: I043df22de41b00afa93e1c1596b19576d2a3c3dc Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
committed by
David Pursehouse
parent
ba6fd0f3b1
commit
480c638ba3
@@ -52,9 +52,13 @@ import javax.security.auth.Subject;
|
||||
import javax.security.auth.login.LoginContext;
|
||||
import javax.security.auth.login.LoginException;
|
||||
import org.eclipse.jgit.lib.Config;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@Singleton
|
||||
class Helper {
|
||||
private static final Logger log = LoggerFactory.getLogger(Helper.class);
|
||||
|
||||
static final String LDAP_UUID = "ldap:";
|
||||
|
||||
private final Cache<String, ImmutableSet<String>> parentGroups;
|
||||
@@ -151,7 +155,7 @@ class Helper {
|
||||
} catch (PrivilegedActionException e) {
|
||||
Throwables.throwIfInstanceOf(e.getException(), NamingException.class);
|
||||
Throwables.throwIfInstanceOf(e.getException(), RuntimeException.class);
|
||||
LdapRealm.log.warn("Internal error", e.getException());
|
||||
log.warn("Internal error", e.getException());
|
||||
return null;
|
||||
} finally {
|
||||
ctx.logout();
|
||||
@@ -297,7 +301,7 @@ class Helper {
|
||||
}
|
||||
}
|
||||
} catch (NamingException e) {
|
||||
LdapRealm.log.warn("Could not find group " + groupDN, e);
|
||||
log.warn("Could not find group {}", groupDN, e);
|
||||
}
|
||||
cachedParentsDNs = dns.build();
|
||||
parentGroups.put(groupDN, cachedParentsDNs);
|
||||
@@ -430,10 +434,10 @@ class Helper {
|
||||
try {
|
||||
return LdapType.guessType(ctx);
|
||||
} catch (NamingException e) {
|
||||
LdapRealm.log.warn(
|
||||
"Cannot discover type of LDAP server at "
|
||||
+ server
|
||||
+ ", assuming the server is RFC 2307 compliant.",
|
||||
log.warn(
|
||||
"Cannot discover type of LDAP server at {},"
|
||||
+ " assuming the server is RFC 2307 compliant.",
|
||||
server,
|
||||
e);
|
||||
return LdapType.RFC_2307;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,8 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
@Singleton
|
||||
class LdapRealm extends AbstractRealm {
|
||||
static final Logger log = LoggerFactory.getLogger(LdapRealm.class);
|
||||
private static final Logger log = LoggerFactory.getLogger(LdapRealm.class);
|
||||
|
||||
static final String LDAP = "com.sun.jndi.ldap.LdapCtxFactory";
|
||||
static final String USERNAME = "username";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user