public final class JNDIDirContextAdaptor extends LDAPConnection
Modifier and Type | Method and Description |
---|---|
static JNDIDirContextAdaptor |
adapt(DirContext dirContext)
Adapts the provided JNDI
DirContext . |
void |
createEntry(LdapName dn,
Attributes attributes)
Creates a new entry with the specified set of attributes.
|
void |
deleteSubtree(LdapName dn)
Deletes the named subtree.
|
boolean |
entryExists(LdapName dn)
Determines whether or not the named entry exists.
|
Collection<LdapName> |
listEntries(LdapName dn,
String filter)
Lists the children of the named entry.
|
void |
modifyEntry(LdapName dn,
Attributes mods)
Modifies the attributes of the named entry.
|
Attributes |
readEntry(LdapName dn,
Collection<String> attrIds)
Reads the attributes of the named entry.
|
static JNDIDirContextAdaptor |
simpleBind(String host,
int port,
String name,
String password)
Creates a new JNDI connection adaptor by performing a simple bind
operation to the specified LDAP server.
|
static JNDIDirContextAdaptor |
simpleSSLBind(String host,
int port,
String name,
String password)
Creates a new JNDI connection adaptor by performing a simple bind
operation to the specified LDAP server.
|
void |
unbind()
Closes the LDAP connection.
|
public static JNDIDirContextAdaptor adapt(DirContext dirContext)
DirContext
.dirContext
- The JNDI connection.public static JNDIDirContextAdaptor simpleBind(String host, int port, String name, String password) throws CommunicationException, AuthenticationNotSupportedException, AuthenticationException
host
- The host.port
- The port.name
- The LDAP bind DN.password
- The LDAP bind password.CommunicationException
- If the client cannot contact the server due to an
underlying communication problem.AuthenticationNotSupportedException
- If the server does not support simple authentication.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
host
- The host.port
- The port.name
- The LDAP bind DN.password
- The LDAP bind password.CommunicationException
- If the client cannot contact the server due to an
underlying communication problem.AuthenticationNotSupportedException
- If the server does not support simple authentication.AuthenticationException
- If authentication failed for some reason, usually due
to invalid credentials.public void createEntry(LdapName dn, Attributes attributes) throws NamingException
createEntry
in class LDAPConnection
dn
- The name of the entry to be created.attributes
- The set of attributes.NamingException
- If an error occurred whilst creating the entry.public void deleteSubtree(LdapName dn) throws NamingException
deleteSubtree
in class LDAPConnection
dn
- The name of the subtree to be deleted.NamingException
- If an error occurred whilst deleting the subtree.public boolean entryExists(LdapName dn) throws NamingException
entryExists
in class LDAPConnection
dn
- The name of the entry.true
if the entry exists.NamingException
- If an error occurred whilst making the determination.public Collection<LdapName> listEntries(LdapName dn, String filter) throws NamingException
listEntries
in class LDAPConnection
dn
- The name of the entry to list.filter
- An LDAP filter string, or null
indicating
the default filter of (objectclass=*)
.NamingException
- If an error occurred whilst listing the children.public void modifyEntry(LdapName dn, Attributes mods) throws NamingException
modifyEntry
in class LDAPConnection
dn
- The name of the entry to be modified.mods
- The list of attributes which need replacing.NamingException
- If an error occurred whilst applying the modifications.public Attributes readEntry(LdapName dn, Collection<String> attrIds) throws NamingException
readEntry
in class LDAPConnection
dn
- The name of the entry to be read.attrIds
- The list of attributes to be retrievd.NamingException
- If an error occurred whilst reading the entry.public void unbind()
unbind
in class LDAPConnection
Copyright © 2010-2016 ForgeRock AS. All Rights Reserved.