You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2016/12/29 14:27:21 UTC

svn commit: r1776435 - /directory/site/trunk/content/api/user-guide/2.2-binding-unbinding.mdtext

Author: elecharny
Date: Thu Dec 29 14:27:21 2016
New Revision: 1776435

URL: http://svn.apache.org/viewvc?rev=1776435&view=rev
Log:
Completed the page

Modified:
    directory/site/trunk/content/api/user-guide/2.2-binding-unbinding.mdtext

Modified: directory/site/trunk/content/api/user-guide/2.2-binding-unbinding.mdtext
URL: http://svn.apache.org/viewvc/directory/site/trunk/content/api/user-guide/2.2-binding-unbinding.mdtext?rev=1776435&r1=1776434&r2=1776435&view=diff
==============================================================================
--- directory/site/trunk/content/api/user-guide/2.2-binding-unbinding.mdtext (original)
+++ directory/site/trunk/content/api/user-guide/2.2-binding-unbinding.mdtext Thu Dec 29 14:27:21 2016
@@ -22,7 +22,7 @@ Notice: Licensed to the Apache Software
     specific language governing permissions and limitations
     under the License.
 
-# 2.2 - Binding and unbinding (...)
+# 2.2 - Binding and unbinding
 
 In **LDAP**, if one wants to access the data in the base, the common way to do it is to bind on the server. However, it's important to understand that binding is a different beast than connection.
 
@@ -87,15 +87,30 @@ Note that this kind of bind will be supp
         connection.bind( "uid=admin,ou=system" );
     }
 
-### SASL Bind
+### Rebinding
 
-TO BE COMPLETED
+It's possible to issue a **Bind** on an already bound connection : the existing Ldap session will be terminated, and replaced by a new Ldap session. In any case, the connection is not dropped when doing so. Note that if the connection was encrypted, it will remain encrypted.
+
+    :::Java
+    @Test
+    public void testDoubleSimpleBindValid() throws Exception
+    {
+        connection.bind( "uid=admin,ou=system", "secret" );
+
+        // Now, rebind
+        connection.bind( "cn=john doe,dc=example,dc=com", "secret" );
+
+        assertTrue( connection.isConnected() );
+        assertTrue( connection.isAuthenticated() );
+    }
+
+If you issue a _bind_ on the same connection with some different credentials, then the existing session will be terminated on the server, and a new one will be created. All the pending requests for the initial session will be lost.
 
 ### Unbinding
 
 This is a trivial operation : you just send an **UnbindRequest** to the server, which will invalidate your session. 
 
-It's important to know that when you issue an **Unbind**, the connection is dropped. However, if you immediately try another bind, the **API** will open the connection again, using the information provided when the connection has been created. You can then do such a thing :
+It's important to know that when you issue an **Unbind**, the connection is dropped. You can then do such a thing :
 
     :::Java
     @Test
@@ -112,7 +127,5 @@ It's important to know that when you iss
         connection.bind( "uid=admin,ou=system", "secret" );
     }
 
-If you issue a _bind_ on the same connection with some different credentials, then the existing session will be terminated on the server, and a new one will be created. All the pending requests for the initial session will be lost.
-
 Last, not least, if you close the connection, then the session will also be terminated.