handavid commented on code in PR #1240:
URL: https://github.com/apache/knox/pull/1240#discussion_r3353459349
##########
gateway-server/src/main/java/org/apache/knox/gateway/services/ldap/KnoxLDAPServerManager.java:
##########
@@ -174,11 +183,30 @@ private void addGroupLookupInterceptor() {
}
}
- final GroupLookupInterceptor interceptor = new
GroupLookupInterceptor(directoryService, backend);
- if (authIdx != -1) {
- interceptors.add(authIdx, interceptor);
- } else {
- interceptors.add(interceptor);
+ // Add our configured interceptors
+ SchemaManager schemaManager = directoryService.getSchemaManager();
+ for (Interceptor interceptor : interceptors) {
+ if (interceptor instanceof UserSearchInterceptor) {
+ // Create partition for remote base DN if different from proxy
base DN
+ // This allows backend entries with remote DNs to be returned
in search results
+ LdapBackend backend = ((UserSearchInterceptor)
interceptor).getBackend();
+ String remoteBaseDn = backend.getBaseDn();
+ if (!baseDns.contains(remoteBaseDn)) {
+ //create partition
+ String id = backend.getName().replaceAll("\\s+", "");
+ JdbmPartition remotePartition = new
JdbmPartition(schemaManager, directoryService.getDnFactory());
+ remotePartition.setId(id);
+ remotePartition.setSuffixDn(new Dn(schemaManager,
remoteBaseDn));
+ remotePartition.setPartitionPath(new File(workDir,
id).toURI());
+ directoryService.addPartition(remotePartition);
+ baseDns.add(remoteBaseDn);
+ }
Review Comment:
done. I pulled this out to get the values from the configs rather than the
Interceptors.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]