/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
* Portions Copyright 2013-2015 ForgeRock AS
*/
/**
* An LDAP connection adaptor which maps LDAP requests onto an
* underlying JNDI connection context.
*/
/**
* Adapts the provided JNDI <code>DirContext</code>.
*
* @param dirContext
* The JNDI connection.
* @return Returns a new JNDI connection adaptor.
*/
return new JNDIDirContextAdaptor(dirContext);
}
/**
* 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.
*/
return createJNDIDirContextAdaptor(env);
}
/**
* 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.
*/
// Specify SSL
return createJNDIDirContextAdaptor(env);
}
{
try {
throw new AuthenticationException(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. */
/**
* Create a new JNDI connection adaptor using the provider JNDI
* DirContext.
*/
this.dirContext = dirContext;
}
/** {@inheritDoc} */
throws NamingException {
}
/** {@inheritDoc} */
// Delete the children first.
}
// Delete the named entry.
}
/** {@inheritDoc} */
boolean entryExists = false;
try {
try
{
// To avoid having a systematic abandon in the server.
entryExists = true;
}
}
finally
{
}
} catch (NameNotFoundException e) {
// Fall through - entry not found.
}
return entryExists;
}
/** {@inheritDoc} */
throws NamingException {
filter = "(objectClass=*)";
}
try
{
}
}
finally
{
}
return children;
}
/** {@inheritDoc} */
}
}
/** {@inheritDoc} */
throws NamingException {
}
/** {@inheritDoc} */
public void unbind() {
try {
dirContext.close();
} catch (NamingException e) {
// nothing to do
}
}
}