Uploaded image for project: 'Directory ApacheDS'
  1. Directory ApacheDS
  2. DIRSERVER-1730

DSAnnotationProcessor doesn't correctly set up authenticators

    XMLWordPrintableJSON

Details

    Description

      I've been playing around with a custom authenticator but has had trouble getting my unit tests to work.

      I wrote a test like this:

      @RunWith(FrameworkRunner.class)
      @CreateDS(authenticators =

      { @CreateAuthenticator(type = MyTestAuthenticator.class) }

      )
      @CreateLdapServer(transports =

      { @CreateTransport(protocol = "LDAP", address = "127.0.0.1", port = 9631) }

      )
      public class ATest extends AbstractLdapTestUnit {
      public void testTheAuthenticator()

      { ... }

      }

      But my custom authenticator was never invoked. I now think that I've managed to track this down to a bug in DSAnnotationProcessor in which the method DSAnnotationProcessor.createDS() never registers the authenticators with the DirectoryService.

      The authenticators are processed and added to a set but that set is never used, this is the relevant block of code:
      https://github.com/apache/directory-server/commit/fb232c91ed081baac56d25dd3c430aa3d306bf8f#L2R89

      Adding the following two lines of code before line 124 seems to solve the problem:
      authenticationInterceptor.setAuthenticators(authenticators);
      authenticationInterceptor.init(service);

      Here's a commit fixing the problem and adding a unit test to verify that authenticators get properly registered:
      https://github.com/chids/directory-server/commit/03b9f54b42422a700296952254e17a3778f506db

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              chids Mårten Gustafson
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: