1

Here is what I would like to achieve:

On one hand, I have an Oracle database. On the other hand, a "simple" Java application (let's call it "App").

And in the middle, an embedded ApacheDS in Java. The idea is to access that database through the embedded LDAP server.

At the moment, I'm able to connect "App" to the embedded LDAP Server, send parameters to it and execute some sql in the Oracle database.

But the problem is that I can't get the result back to "App". Apparently, I should use my own "SearchHandler", but I can't figure out how to do it.

I hope my explanations are clear enough. If not, I can try to give more details.

server.setSearchHandler(new LdapRequestHandler<InternalSearchRequest>() {
        @Override
        public void handle(LdapSession ls, InternalSearchRequest t) throws Exception {
            //Getting data from Oracle database
            System.out.println(dataFromDatabase);                
        }
});
AdriL.
  • 23
  • 5
  • Well, nobody has an idea ? Or a link to a tuto explaining how to create a custom SearchHandler. – AdriL. Mar 08 '16 at 10:26

1 Answers1

0

A little bit late, but you are on the right path.

I am doing more or less the same (but with BindRequestHandler), using ApacheDS as a LDAP proxy. I'm doing it using version 2.0.0-M23.

I extended it like this:

public class LoggerBindRequestHandler extends BindRequestHandler {
   private static final Logger LOGGER = LoggerFactory.getLogger(LoggerBindRequestHandler.class);

   @Override
   public void handle(LdapSession session, BindRequest request) throws Exception {
      LOGGER.debug(session.toString());
      LOGGER.debug(request.toString());

      super.handle(session, request);
   }

   @Override
   public void handleSaslAuth(LdapSession session, BindRequest request) throws Exception {
      LOGGER.debug(session.toString());
      LOGGER.debug(request.toString());

      super.handleSaslAuth(session, request);
   }

   @Override
   public void handleSimpleAuth(LdapSession session, BindRequest request) throws Exception {
      LOGGER.debug(session.toString());
      LOGGER.debug(request.toString());

      super.handleSimpleAuth(session, request);
   }
}

Then I set the ldap server

ldapServer.setBindHandlers(new LoggerBindRequestHandler(), new LoggerBindResponseHandler());

And that's it.

As far I noticed, you are missing the ResponseHandler. This is why you are able to send commands to oracle, but do not send a response.

Bob Rivers
  • 5,261
  • 6
  • 47
  • 59