directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r675304 - /directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/SaslBindITest.java
Date Wed, 09 Jul 2008 18:48:44 GMT
Author: elecharny
Date: Wed Jul  9 11:48:44 2008
New Revision: 675304

URL: http://svn.apache.org/viewvc?rev=675304&view=rev
Log:
Added a defensive test (demonstrate that we can't bind if the password is incorrect)

Modified:
    directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/SaslBindITest.java

Modified: directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/SaslBindITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/SaslBindITest.java?rev=675304&r1=675303&r2=675304&view=diff
==============================================================================
--- directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/SaslBindITest.java
(original)
+++ directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/SaslBindITest.java
Wed Jul  9 11:48:44 2008
@@ -359,6 +359,38 @@
 
 
     /**
+     * Tests to make sure SIMPLE binds below the RootDSE fail if the password is bad.
+     */
+    @Test
+    public void testSimpleBindUnauthenticated()
+    {
+        try
+        {
+            Hashtable<String, String> env = new Hashtable<String, String>();
+            env.put( Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"
);
+            env.put( Context.PROVIDER_URL, "ldap://localhost:" + port );
+
+            env.put( Context.SECURITY_AUTHENTICATION, "simple" );
+            env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
+            env.put( Context.SECURITY_CREDENTIALS, "" );
+
+            DirContext context = new InitialDirContext( env );
+
+            String[] attrIDs =
+                { "uid" };
+
+            context.getAttributes( "uid=hnelson,ou=users,dc=example,dc=com", attrIDs );
+
+            fail( "Should not have gotten here." );
+        }
+        catch ( NamingException e )
+        {
+            assertTrue( e.getMessage().contains( "Bind failed" ) );
+        }
+    }
+
+
+    /**
      * Tests to make sure DIGEST-MD5 binds below the RootDSE work.
      */
     @Test



Mime
View raw message