directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1143321 - /directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java
Date Wed, 06 Jul 2011 09:50:48 GMT
Author: pamarcelot
Date: Wed Jul  6 09:50:47 2011
New Revision: 1143321

URL: http://svn.apache.org/viewvc?rev=1143321&view=rev
Log:
Added two tests (ignored ATM) demonstrating a decoding issue while setting SASL QoP to 'auth-inf'
and 'auth-conf'.

Modified:
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java?rev=1143321&r1=1143320&r2=1143321&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java
(original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java
Wed Jul  6 09:50:47 2011
@@ -66,6 +66,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.api.LdapEncoder;
 import org.apache.directory.shared.ldap.codec.api.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.api.MessageDecorator;
+import org.apache.directory.shared.ldap.model.constants.SaslQoP;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.model.constants.SupportedSaslMechanisms;
 import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
@@ -344,6 +345,80 @@ public class SaslBindIT extends Abstract
 
         connection.close();
     }
+    
+    /**
+     * Tests to make sure DIGEST-MD5 binds below the RootDSE work with
+     * SASL Quality of Protection set to 'auth'.
+     */
+    @Test
+    public void testSaslDigestMd5BindSaslQoPAuth() throws Exception
+    {
+        Dn userDn = new Dn( "uid=hnelson,ou=users,dc=example,dc=com" );
+        LdapNetworkConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort()
);
+
+        DigestMd5Request request = new DigestMd5Request();
+        request.setUsername( userDn.getRdn().getUpValue().getString() );
+        request.setCredentials( "secret" );
+        request.setRealmName( ldapServer.getSaslRealms().get( 0 ) );
+        request.setQualityOfProtection( SaslQoP.AUTH );
+        BindResponse resp = connection.bind( request );
+        assertEquals( ResultCodeEnum.SUCCESS, resp.getLdapResult().getResultCode() );
+
+        Entry entry = connection.lookup( userDn );
+        assertEquals( "hnelson", entry.get( "uid" ).getString() );
+
+        connection.close();
+    }
+    
+    /**
+     * Tests to make sure DIGEST-MD5 binds below the RootDSE work with
+     * SASL Quality of Protection set to 'auth-int'.
+     */
+    @Test
+    @Ignore
+    public void testSaslDigestMd5BindSaslQoPAuthInt() throws Exception
+    {
+        Dn userDn = new Dn( "uid=hnelson,ou=users,dc=example,dc=com" );
+        LdapNetworkConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort()
);
+
+        DigestMd5Request request = new DigestMd5Request();
+        request.setUsername( userDn.getRdn().getUpValue().getString() );
+        request.setCredentials( "secret" );
+        request.setRealmName( ldapServer.getSaslRealms().get( 0 ) );
+        request.setQualityOfProtection( SaslQoP.AUTH_INT );
+        BindResponse resp = connection.bind( request );
+        assertEquals( ResultCodeEnum.SUCCESS, resp.getLdapResult().getResultCode() );
+
+        Entry entry = connection.lookup( userDn );
+        assertEquals( "hnelson", entry.get( "uid" ).getString() );
+
+        connection.close();
+    }
+    
+    /**
+     * Tests to make sure DIGEST-MD5 binds below the RootDSE work with
+     * SASL Quality of Protection set to 'auth-conf'.
+     */
+    @Test
+    @Ignore
+    public void testSaslDigestMd5BindSaslQoPAuthConf() throws Exception
+    {
+        Dn userDn = new Dn( "uid=hnelson,ou=users,dc=example,dc=com" );
+        LdapNetworkConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort()
);
+
+        DigestMd5Request request = new DigestMd5Request();
+        request.setUsername( userDn.getRdn().getUpValue().getString() );
+        request.setCredentials( "secret" );
+        request.setRealmName( ldapServer.getSaslRealms().get( 0 ) );
+        request.setQualityOfProtection( SaslQoP.AUTH_CONF );
+        BindResponse resp = connection.bind( request );
+        assertEquals( ResultCodeEnum.SUCCESS, resp.getLdapResult().getResultCode() );
+
+        Entry entry = connection.lookup( userDn );
+        assertEquals( "hnelson", entry.get( "uid" ).getString() );
+
+        connection.close();
+    }
 
 
     /**



Mime
View raw message