directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r922643 - in /websites/staging/directory/trunk/content: ./ api/user-guide/2.2-binding-unbinding.html
Date Thu, 18 Sep 2014 03:21:21 GMT
Author: buildbot
Date: Thu Sep 18 03:21:20 2014
New Revision: 922643

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 Sep 18 03:21:20 2014
@@ -1 +1 @@
-1615389
+1625882

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
Sep 18 03:21:20 2014
@@ -172,15 +172,12 @@
 <em> <em>anonymous bind</em></em> <em>name/password bind</em>
 * <em>unauthenticated authentication bind</em></p>
 <p>The first one is the easiest one, but depending on the server configuration, it
will be accepted or rejected (all the servers don't allow anonymous binds)</p>
+<p>Most of the time, the <em>bind</em> operation will not return anything.
You will get bound, or you'll get an <em>LdapException</em> if an error is met.</p>
 <p>Issuing an anonymous bind is very simple, you just provide no user name nor any
password :</p>
 <div class="codehilite"><pre><span class="nd">@Test</span>
 <span class="kd">public</span> <span class="kt">void</span> <span
class="nf">testAnonymousBindRequest</span><span class="o">()</span> <span
class="kd">throws</span> <span class="n">Exception</span>
 <span class="o">{</span>
-    <span class="n">BindResponse</span> <span class="n">bindResponse</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="n">assertNotNull</span><span class="o">(</span>
<span class="n">bindResponse</span> <span class="o">);</span>
-    <span class="n">assertEquals</span><span class="o">(</span> <span
class="n">ResultCodeEnum</span><span class="o">.</span><span class="na">SUCCESS</span><span
class="o">,</span> <span class="n">bindResponse</span><span class="o">.</span><span
class="na">getLdapResult</span><span class="o">().</span><span class="na">getResultCode</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="n">connection</span><span class="o">.</span><span
class="na">bind</span><span class="o">();</span>
 <span class="o">}</span>
 </pre></div>
 
@@ -189,11 +186,7 @@
 <div class="codehilite"><pre><span class="nd">@Test</span>
 <span class="kd">public</span> <span class="kt">void</span> <span
class="nf">testSimpleBindRequest</span><span class="o">()</span> <span
class="kd">throws</span> <span class="n">Exception</span>
 <span class="o">{</span>
-    <span class="n">BindResponse</span> <span class="n">bindResponse</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="n">assertNotNull</span><span class="o">(</span>
<span class="n">bindResponse</span> <span class="o">);</span>
-    <span class="n">assertEquals</span><span class="o">(</span> <span
class="n">ResultCodeEnum</span><span class="o">.</span><span class="na">SUCCESS</span><span
class="o">,</span> <span class="n">bindResponse</span><span class="o">.</span><span
class="na">getLdapResult</span><span class="o">().</span><span class="na">getResultCode</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="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="o">}</span>
 </pre></div>
 
@@ -207,11 +200,7 @@
 <span class="kd">public</span> <span class="kt">void</span> <span
class="nf">testSimpleBindRequest</span><span class="o">()</span> <span
class="kd">throws</span> <span class="n">Exception</span>
 <span class="o">{</span>
 
-    <span class="n">BindResponse</span> <span class="n">bindResponse</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="n">assertNotNull</span><span class="o">(</span>
<span class="n">bindResponse</span> <span class="o">);</span>
-    <span class="n">assertEquals</span><span class="o">(</span> <span
class="n">ResultCodeEnum</span><span class="o">.</span><span class="na">SUCCESS</span><span
class="o">,</span> <span class="n">bindResponse</span><span class="o">.</span><span
class="na">getLdapResult</span><span class="o">().</span><span class="na">getResultCode</span><span
class="o">()</span> <span class="o">);</span>
-    <span class="n">assertFalse</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="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="o">}</span>
 </pre></div>
 
@@ -224,10 +213,7 @@
 <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">BindResponse</span> <span class="n">response</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="n">assertEquals</span><span class="o">(</span> <span
class="n">ResultCodeEnum</span><span class="o">.</span><span class="na">SUCCESS</span><span
class="o">,</span> <span class="n">response</span><span class="o">.</span><span
class="na">getLdapResult</span><span class="o">().</span><span class="na">getResultCode</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">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="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, unbind</span>
     <span class="n">connection</span><span class="o">.</span><span
class="na">unBind</span><span class="o">();</span>
@@ -235,11 +221,7 @@
     <span class="n">assertFalse</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="c1">// And Bind again.</span>
-    <span class="n">response</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="n">LdapResult</span> <span class="n">ldapResult3</span>
<span class="o">=</span> <span class="n">response3</span><span
class="o">.</span><span class="na">getLdapResult</span><span class="o">();</span>
-    <span class="n">assertEquals</span><span class="o">(</span> <span
class="n">ResultCodeEnum</span><span class="o">.</span><span class="na">SUCCESS</span><span
class="o">,</span> <span class="n">response</span><span class="o">.</span><span
class="na">getLdapResult</span><span class="o">.</span><span class="na">getResultCode</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">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="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="o">}</span>
 </pre></div>
 



Mime
View raw message