Interface LdapSession
- All Known Implementing Classes:
LdaptiveSessionImpl
public interface LdapSession
-
Method Summary
Modifier and TypeMethodDescriptionvoid
assignDebug
(boolean isDebug) 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 newlinesvoid
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
-
Method Details
-
isDebug
boolean isDebug()if we are debugging- Returns:
-
assignDebug
void assignDebug(boolean isDebug) if we should capture debug info- Parameters:
inDiagnostics
-
-
getDebugLog
StringBuilder getDebugLog()debug log where lines are separated by newlines- Returns:
-
list
<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 list- Type Parameters:
R
-- Parameters:
returnType
- note, only String.class is currently supportedldapServerId
-searchDn
-ldapSearchScope
-filter
-attributeName
-- Returns:
- the list of results, never null
-
listInObjects
<R> Map<String,List<R>> 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 type- Type Parameters:
R
-- Parameters:
returnType
- note, only String.class is currently supportedldapServerId
-searchDn
-ldapSearchScope
-filter
-attributeName
-- Returns:
- the list of results, never null
-
list
List<LdapEntry> list(String ldapServerId, String searchDn, LdapSearchScope ldapSearchScope, String filter, String[] attributeNames, Integer sizeLimit) Run a filter and return the results.- Parameters:
ldapServerId
-searchDn
-ldapSearchScope
-filter
-attributeNames
-sizeLimit
- - null for no limit- Returns:
- the list of results, never null
-
read
List<LdapEntry> read(String ldapServerId, String searchDn, List<String> dnList, String[] attributeNames) Get the following entries.- Parameters:
ldapServerId
-searchDn
-dnList
-attributeNames
-- Returns:
- the list of results, never null
-
delete
Delete an entry if it exists.- Parameters:
ldapServerId
-dn
-
-
create
Create entry. If entry exists, update attributes instead.- Parameters:
ldapServerId
-ldapEntry
-- Returns:
- true if created, false if updated
-
move
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.- Parameters:
ldapServerId
-oldDn
-newDn
-- Returns:
- true if moved, false if newDn exists and oldDn doesn't exist so no update
-
testConnection
test a connection- Parameters:
ldapServerId
-- Returns:
- true if success, false or exception if not successful (error is in exception)
-
internal_modifyHelper
void internal_modifyHelper(String ldapServerId, String dn, List<LdapModificationItem> ldapModificationItems) modify attributes for an object. this should be done in bulk, and if there is an error, throw it- Parameters:
ldapServerId
-dn
-ldapModificationItems
-- Throws:
Exception
- if problem
-
authenticate
Authenticate a user- Parameters:
ldapServerId
-userDn
-password
-
-
refreshConnectionsIfNeeded
Check if connections need to be refreshed due to config changes- Parameters:
ldapServerId
-
-