public class LdapClient extends Object
Constructor and Description |
---|
LdapClient()
Constructor for the LdapClient object.
|
Modifier and Type | Method and Description |
---|---|
void |
connect(String host,
String port,
String rootdn,
String username,
String password)
Connect to server.
|
void |
createTest(BasicAttributes basicattributes,
String string)
Create the attribute in the ldap directory for the given string.
|
void |
deleteTest(String string)
Delete the attribute from the ldap directory.
|
void |
disconnect()
Disconnect from the server.
|
void |
modifyTest(ModificationItem[] mods,
String string)
Modify the attribute in the ldap directory for the given string.
|
boolean |
searchTest(String searchBase,
String searchFilter)
Filter the data in the ldap directory for the given search base.
|
public void connect(String host, String port, String rootdn, String username, String password) throws NamingException
host
- name of the ldap serverport
- port of the ldap serverrootdn
- base dn to start ldap operations fromusername
- user name to use for bindingpassword
- password to use for bindingNamingException
- if InitialDirContext
can not be build using the above
parameterspublic void disconnect()
public boolean searchTest(String searchBase, String searchFilter) throws NamingException
searchBase
- where the search should startsearchFilter
- filter this value from the basetrue
when the search yields results,
false
otherwiseNamingException
- when searching failspublic void modifyTest(ModificationItem[] mods, String string) throws NamingException
mods
- list of all ModificationItem
s to applystring
- dn of the object to modifyNamingException
- when modification failspublic void createTest(BasicAttributes basicattributes, String string) throws NamingException
basicattributes
- add all the entry in to the basicattributestring
- the string (dn) valueNamingException
- when creating subcontext failspublic void deleteTest(String string) throws NamingException
string
- the string (dn) valueNamingException
- when destroying sub context failsCopyright © 1998-2019 Apache Software Foundation. All Rights Reserved.