directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1491145 - in /directory: apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/ shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/
Date Sun, 09 Jun 2013 06:24:02 GMT
Author: kayyagari
Date: Sun Jun  9 06:24:02 2013
New Revision: 1491145

URL: http://svn.apache.org/r1491145
Log:
o added a flag to start TLS layer
o connection now starts TLS in connect() method
o changed the test to use this new flag

Modified:
    directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapSSLConnectionTest.java
    directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionConfig.java
    directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java

Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapSSLConnectionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapSSLConnectionTest.java?rev=1491145&r1=1491144&r2=1491145&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapSSLConnectionTest.java
(original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapSSLConnectionTest.java
Sun Jun  9 06:24:02 2013
@@ -161,8 +161,8 @@ public class LdapSSLConnectionTest exten
         try
         {
             connection = new LdapNetworkConnection( tlsConfig );
+            tlsConfig.setUseTls( true );
             connection.connect();
-            connection.startTls();
             connection.bind( "uid=admin,ou=system", "secret" );
 
             assertTrue( connection.isAuthenticated() );
@@ -183,8 +183,8 @@ public class LdapSSLConnectionTest exten
     public void testGetSupportedControlsWithStartTLS() throws Exception
     {
         LdapNetworkConnection connection = new LdapNetworkConnection( tlsConfig );
+        tlsConfig.setUseTls( true );
         connection.connect();
-        connection.startTls();
 
         Dn dn = new Dn( "uid=admin,ou=system" );
         connection.bind( dn.getName(), "secret" );

Modified: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionConfig.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionConfig.java?rev=1491145&r1=1491144&r2=1491145&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionConfig.java
(original)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionConfig.java
Sun Jun  9 06:24:02 2013
@@ -68,6 +68,9 @@ public class LdapConnectionConfig
     /** A flag indicating if we are using SSL or not, default value is false */
     private boolean useSsl = false;
 
+    /** A flag indicating if we are using TLS or not, default value is false */
+    private boolean useTls = false;
+
     /** The selected LDAP port */
     private int ldapPort;
 
@@ -435,4 +438,26 @@ public class LdapConnectionConfig
     {
         this.binaryAttributeDetector = binaryAttributeDetector;
     }
+
+
+    /**
+     * Checks if TLS is used.
+     *
+     * @return true, if TLS is used
+     */
+    public boolean isUseTls()
+    {
+        return useTls;
+    }
+
+
+    /**
+     * Sets whether TLS should be used.
+     *
+     * @param useSsl true to use TLS
+     */
+    public void setUseTls( boolean useTls )
+    {
+        this.useTls = useTls;
+    }
 }

Modified: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java?rev=1491145&r1=1491144&r2=1491145&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
(original)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
Sun Jun  9 06:24:02 2013
@@ -1152,6 +1152,12 @@ public class LdapNetworkConnection exten
         // try to connect, if we aren't already connected.
         connect();
 
+        // establish TLS layer if TLS is enabled and SSL is NOT
+        if ( config.isUseTls() && !config.isUseSsl() )
+        {
+            startTls();
+        }
+        
         // If the session has not been establish, or is closed, we get out immediately
         checkSession();
 



Mime
View raw message