From f73b655466092169abac34833fb628fce1fcdebe Mon Sep 17 00:00:00 2001
From: jcduff <jcduff@localhost>
Date: Thu, 23 Oct 2008 14:04:24 +0000
Subject: [PATCH] The commit will bring the following features : - An updated version of the underlying database. BDB JE 3.3 is now used. - Attribute API refactoring providing a better abstraction and offering improved performances. - A new GUI called the Control-Panel to replace the Status-Panel: the specifications for this GUI are available on OpenDS Wiki and contains a link to a mockup. See <https://www.opends.org/wiki/page/ControlPanelUISpecification>. - Some changes in the replication protocol to implement "Assured Replication Mode". The specifications are on OpenDS Wiki at <https://www.opends.org/wiki/page/AssuredMode> and section 7 described some of the replication changes required to support this. Assured Replication is not finished, but the main replication protocol changes to support it are done. As explained by Gilles on an email on the Dev mailing list (http://markmail.org/message/46rgo3meq3vriy4a), with these changes the newer versions of OpenDS may not be able to replicate with OpenDS 1.0 instances. - Support for Service Tags on the platforms where the functionality is available and enabled. Specifications are published at <https://www.opends.org/wiki/page/OpenDSServiceTagEnabled>. For more information on Service Tags see <http://wikis.sun.com/display/ServiceTag/Sun+Service+Tag+FAQ>. - The Admin Connector service. In order to provide agentry of the OpenDS server at any time, a new service has been added, dedicated to the administration, configuration and monitoring of the server. An overview of the Admin Connector service and it's use is available on the OpenDS wiki <https://www.opends.org/wiki/page/ManagingAdministrationTrafficToTheServer> - Updates to the various command line tools to support the Admin Connector service. - Some internal re-architecting of the server to put the foundation of future developments such as virtual directory services. The new NetworkGroups and WorkFlow internal services which have been specified in <https://www.opends.org/wiki/page/BasicOperationRoutingThroughNetworkGroup> are now implemented. - Many bug fixes...
---
opends/src/server/org/opends/server/admin/client/ldap/JNDIDirContextAdaptor.java | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 59 insertions(+), 0 deletions(-)
diff --git a/opends/src/server/org/opends/server/admin/client/ldap/JNDIDirContextAdaptor.java b/opends/src/server/org/opends/server/admin/client/ldap/JNDIDirContextAdaptor.java
index 39a357d..9e35a95 100644
--- a/opends/src/server/org/opends/server/admin/client/ldap/JNDIDirContextAdaptor.java
+++ b/opends/src/server/org/opends/server/admin/client/ldap/JNDIDirContextAdaptor.java
@@ -47,7 +47,9 @@
import javax.naming.ldap.LdapName;
import javax.naming.ldap.Rdn;
+import org.opends.admin.ads.util.BlindTrustManager;
import org.opends.admin.ads.util.ConnectionUtils;
+import org.opends.admin.ads.util.TrustedSocketFactory;
import org.opends.server.admin.client.AuthenticationException;
import org.opends.server.admin.client.AuthenticationNotSupportedException;
import org.opends.server.admin.client.CommunicationException;
@@ -124,6 +126,63 @@
return new JNDIDirContextAdaptor(ctx);
}
+ /**
+ * Creates a new JNDI connection adaptor by performing a simple bind
+ * operation to the specified LDAP server.
+ *
+ * @param host
+ * The host.
+ * @param port
+ * The port.
+ * @param name
+ * The LDAP bind DN.
+ * @param password
+ * The LDAP bind password.
+ * @return Returns a new JNDI connection adaptor.
+ * @throws CommunicationException
+ * If the client cannot contact the server due to an
+ * underlying communication problem.
+ * @throws AuthenticationNotSupportedException
+ * If the server does not support simple authentication.
+ * @throws AuthenticationException
+ * If authentication failed for some reason, usually due
+ * to invalid credentials.
+ */
+ public static JNDIDirContextAdaptor simpleSSLBind(String host, int port,
+ String name, String password) throws CommunicationException,
+ AuthenticationNotSupportedException, AuthenticationException {
+ Hashtable<String, Object> env = new Hashtable<String, Object>();
+ env.put(Context.INITIAL_CONTEXT_FACTORY,
+ "com.sun.jndi.ldap.LdapCtxFactory");
+ String hostname = ConnectionUtils.getHostNameForLdapUrl(host) ;
+ env.put(Context.PROVIDER_URL, "ldaps://" + hostname + ":" + port);
+ env.put(Context.SECURITY_PRINCIPAL, name);
+ env.put(Context.SECURITY_CREDENTIALS, password);
+ env.put(Context.SECURITY_AUTHENTICATION, "simple");
+ // Specify SSL
+ env.put(Context.SECURITY_PROTOCOL, "ssl");
+ env.put("java.naming.ldap.factory.socket",
+ org.opends.admin.ads.util.TrustedSocketFactory.class.getName());
+ TrustedSocketFactory.setCurrentThreadTrustManager(new BlindTrustManager(),
+ null);
+ DirContext ctx;
+ try {
+ ctx = new InitialLdapContext(env, null);
+ } catch (javax.naming.CommunicationException e) {
+ throw new CommunicationException(e);
+ } catch (javax.naming.AuthenticationException e) {
+ throw new AuthenticationException(e);
+ } catch (javax.naming.AuthenticationNotSupportedException e) {
+ throw new AuthenticationNotSupportedException(e);
+ } catch (NamingException e) {
+ // Assume some kind of communication problem.
+ throw new CommunicationException(e);
+ }
+
+ return new JNDIDirContextAdaptor(ctx);
+ }
+
+
// The JNDI connection context.
private final DirContext dirContext;
--
Gitblit v1.10.0