public class LdapExtClient
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static javax.naming.NamingEnumeration<javax.naming.directory.SearchResult> |
compare(javax.naming.directory.DirContext dirContext,
java.lang.String filter,
java.lang.String entrydn)
Filter the data in the ldap directory
|
static javax.naming.directory.DirContext |
connect(java.lang.String host,
java.lang.String port,
java.lang.String rootdn,
java.lang.String username,
java.lang.String password,
java.lang.String connTimeOut,
boolean secure,
boolean trustAll)
connect to server
|
static javax.naming.directory.DirContext |
createTest(javax.naming.directory.DirContext dirContext,
javax.naming.directory.Attributes attributes,
java.lang.String string)
Create the entry in the ldap directory for the given string
|
static void |
deleteTest(javax.naming.directory.DirContext dirContext,
java.lang.String string)
Delete the attribute from the ldap directory
|
static void |
disconnect(javax.naming.directory.DirContext dirContext)
disconnect from the server
|
static void |
moddnOp(javax.naming.directory.DirContext dirContext,
java.lang.String ddn,
java.lang.String newdn)
ModDN the data in the ldap directory for the given search base
|
static void |
modifyTest(javax.naming.directory.DirContext dirContext,
javax.naming.directory.ModificationItem[] mods,
java.lang.String string)
Modify the attribute in the ldap directory for the given string
|
static javax.naming.NamingEnumeration<javax.naming.directory.SearchResult> |
searchTest(javax.naming.directory.DirContext dirContext,
java.lang.String searchBase,
java.lang.String searchFilter,
int scope,
long countlim,
int timelim,
java.lang.String[] attrs,
boolean retobj,
boolean deref)
Filter the data in the ldap directory for the given search base
|
public static javax.naming.directory.DirContext connect(java.lang.String host, java.lang.String port, java.lang.String rootdn, java.lang.String username, java.lang.String password, java.lang.String connTimeOut, boolean secure, boolean trustAll) throws javax.naming.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
javax.naming.NamingException
- when creating the DirContext
failspublic static void disconnect(javax.naming.directory.DirContext dirContext)
dirContext
- context do disconnect (may be null
)public static javax.naming.NamingEnumeration<javax.naming.directory.SearchResult> searchTest(javax.naming.directory.DirContext dirContext, java.lang.String searchBase, java.lang.String searchFilter, int scope, long countlim, int timelim, java.lang.String[] attrs, boolean retobj, boolean deref) throws javax.naming.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 dereferencedjavax.naming.NamingException
- when searching failspublic static javax.naming.NamingEnumeration<javax.naming.directory.SearchResult> compare(javax.naming.directory.DirContext dirContext, java.lang.String filter, java.lang.String entrydn) throws javax.naming.NamingException
dirContext
- the context to operate onfilter
- filter this value from the baseentrydn
- distinguished name of entry to comparejavax.naming.NamingException
- when searching failspublic static void moddnOp(javax.naming.directory.DirContext dirContext, java.lang.String ddn, java.lang.String newdn) throws javax.naming.NamingException
dirContext
- context to operate onddn
- distinguished name of object to renamenewdn
- new distinguished name of objectjavax.naming.NamingException
- when renaming failspublic static void modifyTest(javax.naming.directory.DirContext dirContext, javax.naming.directory.ModificationItem[] mods, java.lang.String string) throws javax.naming.NamingException
dirContext
- context to operate onmods
- list of all the ModificationItem
s to apply on
string
string
- distinguished name of the object to modifyjavax.naming.NamingException
- when modification failspublic static javax.naming.directory.DirContext createTest(javax.naming.directory.DirContext dirContext, javax.naming.directory.Attributes attributes, java.lang.String string) throws javax.naming.NamingException
dirContext
- context to operate onattributes
- add all the attributes and values from the attributes objectstring
- distinguished name of the subcontext to createjavax.naming.NamingException
- when creating subcontext failspublic static void deleteTest(javax.naming.directory.DirContext dirContext, java.lang.String string) throws javax.naming.NamingException
dirContext
- context to operate onstring
- distinguished name of the subcontext to destroyjavax.naming.NamingException
- when destroying the subcontext failsCopyright © 1998-2019 Apache Software Foundation. All Rights Reserved.