directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1441721 - /directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/getRootDse/GetRootDseIT.java
Date Sat, 02 Feb 2013 10:07:12 GMT
Author: elecharny
Date: Sat Feb  2 10:07:11 2013
New Revision: 1441721

URL: http://svn.apache.org/viewvc?rev=1441721&view=rev
Log:
Added two tests to check that the rootDSE can be accessed by an anonymous user, even if the
ACI subsystem is activated

Modified:
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/getRootDse/GetRootDseIT.java

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/getRootDse/GetRootDseIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/getRootDse/GetRootDseIT.java?rev=1441721&r1=1441720&r2=1441721&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/getRootDse/GetRootDseIT.java
(original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/getRootDse/GetRootDseIT.java
Sat Feb  2 10:07:11 2013
@@ -27,6 +27,8 @@ import static org.junit.Assert.assertTru
 
 import org.apache.directory.api.ldap.model.entry.Entry;
 import org.apache.directory.ldap.client.api.LdapConnection;
+import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.api.LdapCoreSessionConnection;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.server.core.integ.IntegrationUtils;
@@ -62,7 +64,7 @@ public class GetRootDseIT extends Abstra
     public void testGetRootDse() throws Exception
     {
         Entry rootDse = connection.getRootDse();
-        
+
         assertNotNull( rootDse );
 
         assertEquals( 1, rootDse.size() );
@@ -98,7 +100,7 @@ public class GetRootDseIT extends Abstra
         Entry rootDse = connection.getRootDse( "+" );
 
         assertNotNull( rootDse );
-        
+
         assertEquals( 9, rootDse.size() );
         assertTrue( rootDse.containsAttribute( "entryUUID" ) );
         assertTrue( rootDse.containsAttribute( "namingContexts" ) );
@@ -123,7 +125,7 @@ public class GetRootDseIT extends Abstra
         Entry rootDse = connection.getRootDse( "objectClass", "vendorName", "vendorVersion"
);
 
         assertNotNull( rootDse );
-        
+
         assertEquals( 3, rootDse.size() );
         assertTrue( rootDse.containsAttribute( "objectClass" ) );
         assertTrue( rootDse.containsAttribute( "vendorName" ) );
@@ -143,7 +145,7 @@ public class GetRootDseIT extends Abstra
         Entry rootDse = connection.getRootDse( "*", "vendorName", "vendorVersion" );
 
         assertNotNull( rootDse );
-        
+
         assertEquals( 3, rootDse.size() );
         assertTrue( rootDse.containsAttribute( "objectClass" ) );
         assertTrue( rootDse.containsAttribute( "vendorName" ) );
@@ -163,7 +165,7 @@ public class GetRootDseIT extends Abstra
         Entry rootDse = connection.getRootDse( "+", "Objectclass" );
 
         assertNotNull( rootDse );
-        
+
         assertEquals( 10, rootDse.size() );
         assertTrue( rootDse.containsAttribute( "objectClass" ) );
         assertTrue( rootDse.containsAttribute( "entryUUID" ) );
@@ -190,7 +192,7 @@ public class GetRootDseIT extends Abstra
         Entry rootDse = connection.getRootDse( "+", "*" );
 
         assertNotNull( rootDse );
-        
+
         assertEquals( 10, rootDse.size() );
         assertTrue( rootDse.containsAttribute( "objectClass" ) );
         assertTrue( rootDse.containsAttribute( "entryUUID" ) );
@@ -216,7 +218,7 @@ public class GetRootDseIT extends Abstra
         Entry rootDse = connection.getRootDse( "1.1" );
 
         assertNotNull( rootDse );
-        
+
         assertEquals( 0, rootDse.size() );
     }
 
@@ -232,8 +234,44 @@ public class GetRootDseIT extends Abstra
         Entry rootDse = connection.getRootDse( "1.1", "objectClass" );
 
         assertNotNull( rootDse );
-        
+
         assertEquals( 1, rootDse.size() );
         assertTrue( rootDse.containsAttribute( "objectClass" ) );
     }
+
+
+    /**
+     * Check that we cannot access the RootDSE with an anonymous user and default access
control
+     * @throws Exception
+     */
+    @Test
+    public void testGetRootDSEAnonymousNoAccessControl() throws Exception
+    {
+        DirectoryService service = getService();
+        service.setAccessControlEnabled( false );
+        LdapCoreSessionConnection connection = new LdapCoreSessionConnection( service );
+        connection.bind( "", "" );
+
+        Entry rootDse = connection.getRootDse();
+
+        assertNotNull( rootDse );
+    }
+
+
+    /**
+     * Check that we can access the RootDSE with an anonymous user and access control set
(but no ACI)
+     * @throws Exception
+     */
+    @Test
+    public void testGetRootDSEAnonymousWithAccessControl() throws Exception
+    {
+        DirectoryService service = getService();
+        service.setAccessControlEnabled( true );
+        LdapCoreSessionConnection connection = new LdapCoreSessionConnection( service );
+        connection.bind( "", "" );
+
+        Entry rootDse = connection.getRootDse();
+
+        assertNotNull( rootDse );
+    }
 }



Mime
View raw message