[ 
https://issues.apache.org/jira/browse/DIRSERVER-1850?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kiran Ayyagari resolved DIRSERVER-1850.
---------------------------------------

    Resolution: Not A Problem
      Assignee: Kiran Ayyagari

The same flag need to be set on @CreateLdapServer as well, like 
@CreateLdapServer(allowAnonymousAccess=true,...)

This may sound inconvenient but it is a little tricky, cause the tests can run
either in embedded mode i.e, using just DirectoryService alone (using @CreateDS 
and LdapCoreSessionConnection) or  in network mode using the
@CreateLdapServer along with @CreateDS, and in network mode the
setting on the CreateLdapServer annotation takes precedence.

> @CreateDS( allowAnonAccess=true ) and anonymous bind failure
> ------------------------------------------------------------
>
>                 Key: DIRSERVER-1850
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1850
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: ldap
>    Affects Versions: 2.0.0-M12
>         Environment: Windows 7
> Eclipse Juno Release Build id: 20120614-1722
>            Reporter: Frédérique Darcy-Moreau
>            Assignee: Kiran Ayyagari
>            Priority: Minor
>              Labels: anonymous
>
> @CreateDS( allowAnonAccess=true, name="myDSname")
> @CreateLdapServer(transports =
>     { @CreateTransport(protocol = "LDAP"), @CreateTransport(protocol = 
> "LDAPS") })
> public class SearchTests extends AbstractLdapTestUnit
> {
>    @Before
>     public void setup() throws Exception
>     {
>         connection =  new LdapNetworkConnection( "localhost", 
> getLdapServer().getPort() );
>     }
>     @After
>     public void shutdown() throws Exception
>     {
>       if( connection != null )
>               connection.close();
>     }
>     private LdapConnection connection;
>      @Test
>        public void testAnonymeBind() throws Exception
>        {
>          connection.bind();
>            assertTrue( connection.isAuthenticated() );
>        }
> }
> fails with
> org.apache.directory.api.ldap.model.exception.LdapAuthenticationException: 
> INVALID_CREDENTIALS: Bind failed: ERR_229 Cannot authenticate user 
>       at 
> org.apache.directory.api.ldap.model.message.ResultCodeEnum.processResponse(ResultCodeEnum.java:2017)
>       at 
> org.apache.directory.ldap.client.api.LdapNetworkConnection.bind(LdapNetworkConnection.java:940)
>       at 
> com.fractales.synchroldap.SearchTests.testAnonBind(SearchTests.java:289)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>       at java.lang.reflect.Method.invoke(Method.java:597)
>       at 
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
>       at 
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
>       at 
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
>       at 
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
>       at 
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
>       at 
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
>       at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
>       at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
>       at 
> org.apache.directory.server.core.integ.FrameworkRunner.runChild(FrameworkRunner.java:412)
>       at 
> org.apache.directory.server.core.integ.FrameworkRunner.runChild(FrameworkRunner.java:56)
>       at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
>       at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
>       at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
>       at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
>       at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
>       at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
>       at 
> org.apache.directory.server.core.integ.FrameworkRunner.run(FrameworkRunner.java:187)
>       at 
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>       at 
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>       at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>       at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>       at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>       at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> with the instruction
>   getLdapServer().getDirectoryService().setAllowAnonymousAccess( true );
> it's OK
> Thanks
> Frédérique



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to