From aa0713703c4909349969fd5f7a7288f7f61732ab Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 22 Jun 2016 14:17:02 +0000
Subject: [PATCH] follow-up on OPENDJ-3095 call the correct method for anonymous bind
---
opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ConnectionWrapper.java | 16 ++++++----------
1 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ConnectionWrapper.java b/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ConnectionWrapper.java
index 44916bb..1f35ac0 100644
--- a/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ConnectionWrapper.java
+++ b/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ConnectionWrapper.java
@@ -17,6 +17,7 @@
import static org.forgerock.opendj.config.client.ldap.LDAPManagementContext.*;
import static org.forgerock.opendj.ldap.LDAPConnectionFactory.*;
+import static org.forgerock.opendj.ldap.requests.Requests.*;
import static org.forgerock.util.time.Duration.*;
import static org.opends.admin.ads.util.ConnectionUtils.*;
import static org.opends.admin.ads.util.PreferredConnection.Type.*;
@@ -40,7 +41,7 @@
import org.forgerock.opendj.ldap.LDAPConnectionFactory;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.SSLContextBuilder;
-import org.forgerock.opendj.ldap.requests.Requests;
+import org.forgerock.opendj.ldap.requests.SimpleBindRequest;
import org.forgerock.opendj.server.config.client.RootCfgClient;
import org.forgerock.util.Options;
import org.opends.admin.ads.util.PreferredConnection.Type;
@@ -174,15 +175,10 @@
options.set(SSL_CONTEXT, getSSLContext(trustManager, keyManager))
.set(SSL_USE_STARTTLS, isStartTls);
}
- if (bindDn != null && bindPwd != null)
- {
- options.set(AUTHN_BIND_REQUEST, Requests.newSimpleBindRequest(bindDn, bindPwd.toCharArray()));
- }
- else
- {
- final String traceString = "Anonymous ConnectionWrapper: tried connecting with bindDN=" + bindDn;
- options.set(AUTHN_BIND_REQUEST, Requests.newAnonymousSASLBindRequest(traceString));
- }
+ SimpleBindRequest request = bindDn != null && bindPwd != null
+ ? newSimpleBindRequest(bindDn, bindPwd.toCharArray())
+ : newSimpleBindRequest(); // anonymous bind
+ options.set(AUTHN_BIND_REQUEST, request);
return options;
}
--
Gitblit v1.10.0