Be clear about which LDAP config/backend is picked up
This commit is contained in:
@@ -29,7 +29,7 @@ import io.kamax.mxisd.UserIdType;
|
||||
import io.kamax.mxisd.auth.provider.AuthenticatorProvider;
|
||||
import io.kamax.mxisd.auth.provider.BackendAuthResult;
|
||||
import io.kamax.mxisd.config.MatrixConfig;
|
||||
import io.kamax.mxisd.config.ldap.generic.GenericLdapConfig;
|
||||
import io.kamax.mxisd.config.ldap.LdapConfig;
|
||||
import io.kamax.mxisd.util.GsonUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.directory.api.ldap.model.cursor.CursorException;
|
||||
@@ -59,7 +59,7 @@ public class LdapAuthProvider extends LdapBackend implements AuthenticatorProvid
|
||||
private PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
|
||||
|
||||
@Autowired
|
||||
public LdapAuthProvider(GenericLdapConfig cfg, MatrixConfig mxCfg) {
|
||||
public LdapAuthProvider(LdapConfig cfg, MatrixConfig mxCfg) {
|
||||
super(cfg, mxCfg);
|
||||
}
|
||||
|
||||
|
@@ -22,7 +22,6 @@ package io.kamax.mxisd.backend.ldap;
|
||||
|
||||
import io.kamax.mxisd.config.MatrixConfig;
|
||||
import io.kamax.mxisd.config.ldap.LdapConfig;
|
||||
import io.kamax.mxisd.config.ldap.generic.GenericLdapConfig;
|
||||
import io.kamax.mxisd.controller.directory.v1.io.UserDirectorySearchResult;
|
||||
import io.kamax.mxisd.directory.IDirectoryProvider;
|
||||
import io.kamax.mxisd.exception.InternalServerError;
|
||||
@@ -49,7 +48,7 @@ public class LdapDirectoryProvider extends LdapBackend implements IDirectoryProv
|
||||
private Logger log = LoggerFactory.getLogger(LdapDirectoryProvider.class);
|
||||
|
||||
@Autowired
|
||||
public LdapDirectoryProvider(GenericLdapConfig cfg, MatrixConfig mxCfg) {
|
||||
public LdapDirectoryProvider(LdapConfig cfg, MatrixConfig mxCfg) {
|
||||
super(cfg, mxCfg);
|
||||
}
|
||||
|
||||
|
@@ -21,7 +21,7 @@
|
||||
package io.kamax.mxisd.backend.ldap;
|
||||
|
||||
import io.kamax.mxisd.config.MatrixConfig;
|
||||
import io.kamax.mxisd.config.ldap.generic.GenericLdapConfig;
|
||||
import io.kamax.mxisd.config.ldap.LdapConfig;
|
||||
import io.kamax.mxisd.exception.InternalServerError;
|
||||
import io.kamax.mxisd.lookup.SingleLookupReply;
|
||||
import io.kamax.mxisd.lookup.SingleLookupRequest;
|
||||
@@ -49,7 +49,7 @@ public class LdapThreePidProvider extends LdapBackend implements IThreePidProvid
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(LdapThreePidProvider.class);
|
||||
|
||||
public LdapThreePidProvider(GenericLdapConfig cfg, MatrixConfig mxCfg) {
|
||||
public LdapThreePidProvider(LdapConfig cfg, MatrixConfig mxCfg) {
|
||||
super(cfg, mxCfg);
|
||||
}
|
||||
|
||||
|
@@ -20,22 +20,18 @@
|
||||
|
||||
package io.kamax.mxisd.config.ldap;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import io.kamax.matrix.ThreePidMedium;
|
||||
import io.kamax.matrix.json.GsonUtil;
|
||||
import io.kamax.mxisd.backend.ldap.LdapBackend;
|
||||
import io.kamax.mxisd.exception.ConfigurationException;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.*;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "ldap")
|
||||
public class LdapConfig {
|
||||
public abstract class LdapConfig {
|
||||
|
||||
public static class UID {
|
||||
|
||||
@@ -240,7 +236,6 @@ public class LdapConfig {
|
||||
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(LdapConfig.class);
|
||||
private static Gson gson = new Gson();
|
||||
|
||||
private boolean enabled;
|
||||
private String filter;
|
||||
@@ -251,6 +246,8 @@ public class LdapConfig {
|
||||
private Directory directory;
|
||||
private Identity identity;
|
||||
|
||||
protected abstract String getConfigName();
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
@@ -309,7 +306,7 @@ public class LdapConfig {
|
||||
|
||||
@PostConstruct
|
||||
public void build() {
|
||||
log.info("--- LDAP Config ---");
|
||||
log.info("--- " + getConfigName() + " Config ---");
|
||||
log.info("Enabled: {}", isEnabled());
|
||||
|
||||
if (!isEnabled()) {
|
||||
@@ -365,10 +362,10 @@ public class LdapConfig {
|
||||
log.info("Bind DN: {}", connection.getBindDn());
|
||||
log.info("Base DN: {}", connection.getBaseDn());
|
||||
|
||||
log.info("Attribute: {}", gson.toJson(attribute));
|
||||
log.info("Auth: {}", gson.toJson(auth));
|
||||
log.info("Directory: {}", gson.toJson(directory));
|
||||
log.info("Identity: {}", gson.toJson(identity));
|
||||
log.info("Attribute: {}", GsonUtil.get().toJson(attribute));
|
||||
log.info("Auth: {}", GsonUtil.get().toJson(auth));
|
||||
log.info("Directory: {}", GsonUtil.get().toJson(directory));
|
||||
log.info("Identity: {}", GsonUtil.get().toJson(identity));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -30,4 +30,9 @@ import org.springframework.context.annotation.Primary;
|
||||
@Primary
|
||||
public class GenericLdapConfig extends LdapConfig {
|
||||
|
||||
@Override
|
||||
protected String getConfigName() {
|
||||
return "Generic LDAP";
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -20,12 +20,17 @@
|
||||
|
||||
package io.kamax.mxisd.config.ldap.netiq;
|
||||
|
||||
import io.kamax.mxisd.config.ldap.generic.GenericLdapConfig;
|
||||
import io.kamax.mxisd.config.ldap.LdapConfig;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "netiq")
|
||||
public class NetIqLdapConfig extends GenericLdapConfig {
|
||||
public class NetIqLdapConfig extends LdapConfig {
|
||||
|
||||
@Override
|
||||
protected String getConfigName() {
|
||||
return "NetIQ eDirectory";
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user