You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Mårten Gustafson (JIRA)" <ji...@apache.org> on 2012/06/03 16:57:22 UTC
[jira] [Created] (DIRSERVER-1730) DSAnnotationProcessor doesn't
correctly set up authenticators
Mårten Gustafson created DIRSERVER-1730:
-------------------------------------------
Summary: DSAnnotationProcessor doesn't correctly set up authenticators
Key: DIRSERVER-1730
URL: https://issues.apache.org/jira/browse/DIRSERVER-1730
Project: Directory ApacheDS
Issue Type: Bug
Components: core
Affects Versions: 2.0.0-M8
Reporter: Mårten Gustafson
Priority: Trivial
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
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (DIRSERVER-1730) DSAnnotationProcessor doesn't
correctly set up authenticators
Posted by "Mårten Gustafson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRSERVER-1730?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mårten Gustafson updated DIRSERVER-1730:
----------------------------------------
Attachment: create-ds-annotation-doesnt-register-authenticators.patch
The Github commit as patch
> DSAnnotationProcessor doesn't correctly set up authenticators
> -------------------------------------------------------------
>
> Key: DIRSERVER-1730
> URL: https://issues.apache.org/jira/browse/DIRSERVER-1730
> Project: Directory ApacheDS
> Issue Type: Bug
> Components: core
> Affects Versions: 2.0.0-M8
> Reporter: Mårten Gustafson
> Priority: Trivial
> Labels: annotation_processor, annotations, unit-test
> Attachments: create-ds-annotation-doesnt-register-authenticators.patch
>
>
> 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
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira