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

svn commit: r1003686 - in /websites/staging/directory/trunk/content: ./ api/user-guide/2.2-binding-unbinding.html

Author: buildbot
Date: Thu Dec 29 14:27:30 2016
New Revision: 1003686

Log:
Staging update by buildbot for directory

Modified:
    websites/staging/directory/trunk/content/   (props changed)
    websites/staging/directory/trunk/content/api/user-guide/2.2-binding-unbinding.html

Propchange: websites/staging/directory/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Thu Dec 29 14:27:30 2016
@@ -1 +1 @@
-1774855
+1776435

Modified: websites/staging/directory/trunk/content/api/user-guide/2.2-binding-unbinding.html
==============================================================================
--- websites/staging/directory/trunk/content/api/user-guide/2.2-binding-unbinding.html (original)
+++ websites/staging/directory/trunk/content/api/user-guide/2.2-binding-unbinding.html Thu Dec 29 14:27:30 2016
@@ -183,7 +183,7 @@
   visibility: hidden;
 }
 h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible }</style>
-<h1 id="22-binding-and-unbinding">2.2 - Binding and unbinding (...)<a class="headerlink" href="#22-binding-and-unbinding" title="Permanent link">&para;</a></h1>
+<h1 id="22-binding-and-unbinding">2.2 - Binding and unbinding<a class="headerlink" href="#22-binding-and-unbinding" title="Permanent link">&para;</a></h1>
 <p>In <strong>LDAP</strong>, 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.</p>
 <p>Creating a connection to a <strong>LDAP</strong> server is just about opening a socket between the client and the server. You just need to provide the address and the port. </p>
 <p>The <strong>bind</strong> operation, on the other hand, create a <em>Session</em> which will hold some user's information for the time being of the session. Those information are quite limited, they include the user's credentials.</p>
@@ -235,11 +235,26 @@ h2:hover > .headerlink, h3:hover > .head
 </pre></div>
 
 
-<h3 id="sasl-bind">SASL Bind<a class="headerlink" href="#sasl-bind" title="Permanent link">&para;</a></h3>
-<p>TO BE COMPLETED</p>
+<h3 id="rebinding">Rebinding<a class="headerlink" href="#rebinding" title="Permanent link">&para;</a></h3>
+<p>It's possible to issue a <strong>Bind</strong> 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.</p>
+<div class="codehilite"><pre><span class="nd">@Test</span>
+<span class="kd">public</span> <span class="kt">void</span> <span class="nf">testDoubleSimpleBindValid</span><span class="o">()</span> <span class="kd">throws</span> <span class="n">Exception</span>
+<span class="o">{</span>
+    <span class="n">connection</span><span class="o">.</span><span class="na">bind</span><span class="o">(</span> <span class="s">&quot;uid=admin,ou=system&quot;</span><span class="o">,</span> <span class="s">&quot;secret&quot;</span> <span class="o">);</span>
+
+    <span class="c1">// Now, rebind</span>
+    <span class="n">connection</span><span class="o">.</span><span class="na">bind</span><span class="o">(</span> <span class="s">&quot;cn=john doe,dc=example,dc=com&quot;</span><span class="o">,</span> <span class="s">&quot;secret&quot;</span> <span class="o">);</span>
+
+    <span class="n">assertTrue</span><span class="o">(</span> <span class="n">connection</span><span class="o">.</span><span class="na">isConnected</span><span class="o">()</span> <span class="o">);</span>
+    <span class="n">assertTrue</span><span class="o">(</span> <span class="n">connection</span><span class="o">.</span><span class="na">isAuthenticated</span><span class="o">()</span> <span class="o">);</span>
+<span class="o">}</span>
+</pre></div>
+
+
+<p>If you issue a <em>bind</em> 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.</p>
 <h3 id="unbinding">Unbinding<a class="headerlink" href="#unbinding" title="Permanent link">&para;</a></h3>
 <p>This is a trivial operation : you just send an <strong>UnbindRequest</strong> to the server, which will invalidate your session. </p>
-<p>It's important to know that when you issue an <strong>Unbind</strong>, the connection is dropped. However, if you immediately try another bind, the <strong>API</strong> will open the connection again, using the information provided when the connection has been created. You can then do such a thing :</p>
+<p>It's important to know that when you issue an <strong>Unbind</strong>, the connection is dropped. You can then do such a thing :</p>
 <div class="codehilite"><pre><span class="nd">@Test</span>
 <span class="kd">public</span> <span class="kt">void</span> <span class="nf">testDoubleSimpleBindValid</span><span class="o">()</span> <span class="kd">throws</span> <span class="n">Exception</span>
 <span class="o">{</span>
@@ -256,7 +271,6 @@ h2:hover > .headerlink, h3:hover > .head
 </pre></div>
 
 
-<p>If you issue a <em>bind</em> 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.</p>
 <p>Last, not least, if you close the connection, then the session will also be terminated.</p>