public class LdapExtClient extends Object
Modifier and Type | Method and Description |
---|---|
static NamingEnumeration<SearchResult> |
compare(DirContext dirContext,
String filter,
String entrydn)
Filter the data in the ldap directory
|
static DirContext |
connect(String host,
String port,
String rootdn,
String username,
String password,
String connTimeOut,
boolean secure,
boolean trustAll)
connect to server
|
static DirContext |
createTest(DirContext dirContext,
Attributes attributes,
String string)
Create the entry in the ldap directory for the given string
|
static void |
deleteTest(DirContext dirContext,
String string)
Delete the attribute from the ldap directory
|
static void |
disconnect(DirContext dirContext)
disconnect from the server
|
static void |
moddnOp(DirContext dirContext,
String ddn,
String newdn)
ModDN the data in the ldap directory for the given search base
|
static void |
modifyTest(DirContext dirContext,
ModificationItem[] mods,
String string)
Modify the attribute in the ldap directory for the given string
|
static NamingEnumeration<SearchResult> |
searchTest(DirContext dirContext,
String searchBase,
String searchFilter,
int scope,
long countlim,
int timelim,
String[] attrs,
boolean retobj,
boolean deref)
Filter the data in the ldap directory for the given search base
|
public static DirContext connect(String host, String port, String rootdn, String username, String password, String connTimeOut, boolean secure, boolean trustAll) throws NamingException
host
- name of the server to connectport
- port of the server to connectrootdn
- base of the tree to operate onusername
- name of the user to use for bindingpassword
- password to use for bindingconnTimeOut
- connection timeout for connecting the server see
"com.sun.jndi.ldap.connect.timeout"secure
- flag whether ssl should be usedtrustAll
- flag whether we should trust all certificatesDirContext
NamingException
- when creating the DirContext
failspublic static void disconnect(DirContext dirContext)
dirContext
- context do disconnect (may be null
)public static NamingEnumeration<SearchResult> searchTest(DirContext dirContext, String searchBase, String searchFilter, int scope, long countlim, int timelim, String[] attrs, boolean retobj, boolean deref) throws NamingException
dirContext
- context to perform the search onsearchBase
- base where the search should startsearchFilter
- filter this value from the basescope
- scope for search. May be one of
SearchControls.OBJECT_SCOPE
,
SearchControls.ONELEVEL_SCOPE
or
SearchControls.SUBTREE_SCOPE
countlim
- max number of results to get, 0
for all entriestimelim
- max time to wait for entries (in milliseconds), 0
for unlimited timeattrs
- list of attributes to return. If null
all
attributes will be returned. If empty, none will be returnedretobj
- flag whether the objects should be returnedderef
- flag whether objects should be dereferencedNamingException
- when searching failspublic static NamingEnumeration<SearchResult> compare(DirContext dirContext, String filter, String entrydn) throws NamingException
dirContext
- the context to operate onfilter
- filter this value from the baseentrydn
- distinguished name of entry to compareNamingException
- when searching failspublic static void moddnOp(DirContext dirContext, String ddn, String newdn) throws NamingException
dirContext
- context to operate onddn
- distinguished name of object to renamenewdn
- new distinguished name of objectNamingException
- when renaming failspublic static void modifyTest(DirContext dirContext, ModificationItem[] mods, String string) throws NamingException
dirContext
- context to operate onmods
- list of all the ModificationItem
s to apply on
string
string
- distinguished name of the object to modifyNamingException
- when modification failspublic static DirContext createTest(DirContext dirContext, Attributes attributes, String string) throws NamingException
dirContext
- context to operate onattributes
- add all the attributes and values from the attributes objectstring
- distinguished name of the subcontext to createNamingException
- when creating subcontext failspublic static void deleteTest(DirContext dirContext, String string) throws NamingException
dirContext
- context to operate onstring
- distinguished name of the subcontext to destroyNamingException
- when destroying the subcontext failsCopyright © 1998-2019 Apache Software Foundation. All Rights Reserved.