Class LdaptiveSessionImpl
java.lang.Object
edu.internet2.middleware.grouper.ldap.ldaptive.LdaptiveSessionImpl
- All Implemented Interfaces:
LdapSession
will handle the ldap config, and inverse of control for pooling
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
assignDebug
(boolean isDebug) if we should capture debug infovoid
assignDebug
(boolean isDebug, StringBuilder theDebugLog) if we should capture debug infovoid
authenticate
(String ldapServerId, String userDn, String password) Authenticate a userboolean
Create entry.void
Delete an entry if it exists.debug log where lines are separated by newlinesstatic void
Used by unit testsvoid
internal_modifyHelper
(String ldapServerId, String dn, List<LdapModificationItem> ldapModificationItems) modify attributes for an object.boolean
isDebug()
if we are debugging<R> List<R>
list
(Class<R> returnType, String ldapServerId, String searchDn, LdapSearchScope ldapSearchScope, String filter, String attributeName) run a filter, for one attribute, and return a list of that attribute typecast as a certain type note, if it is a multi-valued attributes, and there are multiple object results, it will be flattened into one listlist
(String ldapServerId, String searchDn, LdapSearchScope ldapSearchScope, String filter, String[] attributeNames, Integer sizeLimit) Run a filter and return the results.listInObjects
(Class<R> returnType, String ldapServerId, String searchDn, LdapSearchScope ldapSearchScope, String filter, String attributeName) run a filter, for one attribute, and return a map of the DN key to the value of list of that attribute typecast as a certain typeboolean
Move an object to a new dn.Get the following entries.void
refreshConnectionsIfNeeded
(String ldapServerId) Check if connections need to be refreshed due to config changesboolean
testConnection
(String ldapServerId) test a connection
-
Constructor Details
-
LdaptiveSessionImpl
public LdaptiveSessionImpl()
-
-
Method Details
-
getDebugLog
debug log where lines are separated by newlines- Specified by:
getDebugLog
in interfaceLdapSession
- Returns:
-
isDebug
public boolean isDebug()if we are debugging- Specified by:
isDebug
in interfaceLdapSession
- Returns:
-
assignDebug
if we should capture debug info- Parameters:
isDebug
-
-
assignDebug
public void assignDebug(boolean isDebug) if we should capture debug info- Specified by:
assignDebug
in interfaceLdapSession
- Parameters:
isDebug
-
-
list
public <R> List<R> list(Class<R> returnType, String ldapServerId, String searchDn, LdapSearchScope ldapSearchScope, String filter, String attributeName) Description copied from interface:LdapSession
run a filter, for one attribute, and return a list of that attribute typecast as a certain type note, if it is a multi-valued attributes, and there are multiple object results, it will be flattened into one list- Specified by:
list
in interfaceLdapSession
- Parameters:
returnType
- note, only String.class is currently supported- Returns:
- the list of results, never null
- See Also:
-
listInObjects
public <R> Map<String,List<R>> listInObjects(Class<R> returnType, String ldapServerId, String searchDn, LdapSearchScope ldapSearchScope, String filter, String attributeName) Description copied from interface:LdapSession
run a filter, for one attribute, and return a map of the DN key to the value of list of that attribute typecast as a certain type- Specified by:
listInObjects
in interfaceLdapSession
- Parameters:
returnType
- note, only String.class is currently supported- Returns:
- the list of results, never null
- See Also:
-
list
public List<LdapEntry> list(String ldapServerId, String searchDn, LdapSearchScope ldapSearchScope, String filter, String[] attributeNames, Integer sizeLimit) Description copied from interface:LdapSession
Run a filter and return the results.- Specified by:
list
in interfaceLdapSession
sizeLimit
- - null for no limit- Returns:
- the list of results, never null
- See Also:
-
read
public List<LdapEntry> read(String ldapServerId, String searchDn, List<String> dnList, String[] attributeNames) Description copied from interface:LdapSession
Get the following entries.- Specified by:
read
in interfaceLdapSession
- Returns:
- the list of results, never null
-
authenticate
Description copied from interface:LdapSession
Authenticate a user- Specified by:
authenticate
in interfaceLdapSession
- See Also:
-
delete
Description copied from interface:LdapSession
Delete an entry if it exists.- Specified by:
delete
in interfaceLdapSession
-
create
Description copied from interface:LdapSession
Create entry. If entry exists, update attributes instead.- Specified by:
create
in interfaceLdapSession
- Returns:
- true if created, false if updated
-
move
Description copied from interface:LdapSession
Move an object to a new dn. Assuming this would only be called if it's expected to work. i.e. If the ldap server doesn't allow this, the caller should avoid calling this and instead do a delete/re-create as appropriate.- Specified by:
move
in interfaceLdapSession
- Returns:
- true if moved, false if newDn exists and oldDn doesn't exist so no update
-
internal_modifyHelper
public void internal_modifyHelper(String ldapServerId, String dn, List<LdapModificationItem> ldapModificationItems) Description copied from interface:LdapSession
modify attributes for an object. this should be done in bulk, and if there is an error, throw it- Specified by:
internal_modifyHelper
in interfaceLdapSession
-
testConnection
Description copied from interface:LdapSession
test a connection- Specified by:
testConnection
in interfaceLdapSession
- Returns:
- true if success, false or exception if not successful (error is in exception)
-
refreshConnectionsIfNeeded
Description copied from interface:LdapSession
Check if connections need to be refreshed due to config changes- Specified by:
refreshConnectionsIfNeeded
in interfaceLdapSession
-
internal_closeAllPools
public static void internal_closeAllPools()Used by unit tests
-