Merge "Detect LDAP misconfiguration and fail earlier"
This commit is contained in:
commit
ecbaf100a6
@ -163,6 +163,7 @@ public class LdapRealm extends AbstractRealm {
|
||||
return null;
|
||||
|
||||
} else {
|
||||
checkBackendCompliance(n, v[0], Strings.isNullOrEmpty(d));
|
||||
return v[0];
|
||||
}
|
||||
}
|
||||
@ -186,6 +187,16 @@ public class LdapRealm extends AbstractRealm {
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkBackendCompliance(String configOption,
|
||||
String suppliedValue, boolean disabledByBackend) {
|
||||
if (disabledByBackend && !Strings.isNullOrEmpty(suppliedValue)) {
|
||||
String msg = String.format("LDAP backend doesn't support: ldap.%s",
|
||||
configOption);
|
||||
log.error(msg);
|
||||
throw new IllegalArgumentException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowsEdit(final Account.FieldName field) {
|
||||
return !readOnlyAccountFields.contains(field);
|
||||
|
Loading…
Reference in New Issue
Block a user