Add an option to enable/disable hash lookup via the LDAP provider.

This commit is contained in:
Anatoly Sablin
2019-12-25 22:51:44 +03:00
parent 84ca8ebbd9
commit 82a538c750
2 changed files with 12 additions and 0 deletions

View File

@@ -159,6 +159,10 @@ public class LdapThreePidProvider extends LdapBackend implements IThreePidProvid
@Override @Override
public Iterable<ThreePidMapping> populateHashes() { public Iterable<ThreePidMapping> populateHashes() {
List<ThreePidMapping> result = new ArrayList<>(); List<ThreePidMapping> result = new ArrayList<>();
if (!getCfg().getIdentity().isLookup()) {
return result;
}
String filter = getCfg().getIdentity().getFilter(); String filter = getCfg().getIdentity().getFilter();
try (LdapConnection conn = getConn()) { try (LdapConnection conn = getConn()) {

View File

@@ -233,6 +233,7 @@ public abstract class LdapConfig {
private String filter; private String filter;
private String token = "%3pid"; private String token = "%3pid";
private Map<String, String> medium = new HashMap<>(); private Map<String, String> medium = new HashMap<>();
private boolean lookup = false;
public String getFilter() { public String getFilter() {
return filter; return filter;
@@ -262,6 +263,13 @@ public abstract class LdapConfig {
this.medium = medium; this.medium = medium;
} }
public boolean isLookup() {
return lookup;
}
public void setLookup(boolean lookup) {
this.lookup = lookup;
}
} }
public static class Profile { public static class Profile {