From 95e73eb3bdab96363e6bd01c48203336782f6a5e Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Thu, 08 Sep 2011 12:03:54 +0000
Subject: [PATCH] Issue OPENDJ-262: Implement pass through authentication (PTA)

---
 opends/src/server/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java |   39 +++++++++++++++++++++++++++------------
 1 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/opends/src/server/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java b/opends/src/server/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java
index 41077a6..a27f7b8 100644
--- a/opends/src/server/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java
+++ b/opends/src/server/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java
@@ -316,8 +316,8 @@
             break;
 
           case OP_TYPE_SEARCH_RESULT_REFERENCE:
-            // Count this as a result.
-            resultCount++;
+            // The reference does not necessarily mean that there would have
+            // been any matching results, so lets ignore it.
             break;
 
           case OP_TYPE_SEARCH_RESULT_DONE:
@@ -334,19 +334,28 @@
               break;
 
             case SIZE_LIMIT_EXCEEDED:
-              // TODO: Too many entries would have been returned.
+              // Multiple matching candidates.
               throw new DirectoryException(
                   ResultCode.CLIENT_SIDE_MORE_RESULTS_TO_RETURN,
-                  (Message) null);
+                  ERR_LDAP_PTA_CONNECTION_SEARCH_SIZE_LIMIT.get(host, port,
+                      String.valueOf(options.dn()), String.valueOf(baseDN),
+                      String.valueOf(filter)));
 
             case TIME_LIMIT_EXCEEDED:
-              // FIXME: search timed out.
+              // The server timed out the search.
               throw new DirectoryException(ResultCode.CLIENT_SIDE_TIMEOUT,
-                  (Message) null);
+                  ERR_LDAP_PTA_CONNECTION_SEARCH_TIME_LIMIT.get(host, port,
+                      String.valueOf(options.dn()), String.valueOf(baseDN),
+                      String.valueOf(filter)));
 
             default:
-              // FIXME: The search failed for some reason.
-              throw new DirectoryException(resultCode, (Message) null);
+              // The search failed for some reason.
+              throw new DirectoryException(resultCode,
+                  ERR_LDAP_PTA_CONNECTION_SEARCH_FAILED.get(host, port,
+                      String.valueOf(options.dn()), String.valueOf(baseDN),
+                      String.valueOf(filter), resultCode.getIntValue(),
+                      resultCode.getResultCodeName(),
+                      searchResult.getErrorMessage()));
             }
 
             break;
@@ -361,16 +370,22 @@
 
         if (resultCount > 1)
         {
-          // FIXME: too many matching entries found.
+          // Multiple matching candidates.
           throw new DirectoryException(
-              ResultCode.CLIENT_SIDE_MORE_RESULTS_TO_RETURN, (Message) null);
+              ResultCode.CLIENT_SIDE_MORE_RESULTS_TO_RETURN,
+              ERR_LDAP_PTA_CONNECTION_SEARCH_SIZE_LIMIT.get(host, port,
+                  String.valueOf(options.dn()), String.valueOf(baseDN),
+                  String.valueOf(filter)));
         }
 
         if (username == null)
         {
-          // FIXME: no matching entries found.
+          // No matching entries found.
           throw new DirectoryException(
-              ResultCode.CLIENT_SIDE_NO_RESULTS_RETURNED, (Message) null);
+              ResultCode.CLIENT_SIDE_NO_RESULTS_RETURNED,
+              ERR_LDAP_PTA_CONNECTION_SEARCH_NO_MATCHES.get(host, port,
+                  String.valueOf(options.dn()), String.valueOf(baseDN),
+                  String.valueOf(filter)));
         }
 
         return username;

--
Gitblit v1.10.0