public class LDAPSession extends BaseSession
Modifier and Type | Field and Description |
---|---|
protected DirContext |
dirContext |
protected Set<String> |
emptySet |
protected String |
idAttribute |
protected String |
idCase |
protected static String |
MISSING_ID_LOWER_CASE |
protected static String |
MISSING_ID_UPPER_CASE |
protected String |
passwordHashAlgorithm |
protected String |
rdnAttribute |
protected String |
rdnField |
protected String |
searchBaseDn |
protected String |
sid |
protected BaseDirectoryDescriptor.SubstringMatchType |
substringMatchType |
autoincrementId, directory, directoryName, MULTI_TENANT_ID_FORMAT, permissions, POWER_USERS_GROUP, readAllColumns, READONLY_ENTRY_FLAG, referenceClass, schemaName
Constructor and Description |
---|
LDAPSession(LDAPDirectory directory) |
Modifier and Type | Method and Description |
---|---|
boolean |
authenticate(String username,
String password)
Checks that the credentials provided by the UserManager match those registered in the directory.
|
protected String |
changeEntryIdCase(String id,
String idFieldCase) |
void |
close()
Closes the session and all open result sets obtained from this session.
|
DocumentModel |
createEntry(DocumentModel entry)
Creates an entry in a directory.
|
protected DocumentModel |
createEntryWithoutReferences(Map<String,Object> fieldMap)
To be implemented for specific creation.
|
void |
deleteEntry(String id,
Map<String,String> map)
Deletes a directory entry by id and secondary ids.
|
void |
deleteEntryWithoutReferences(String id)
To be implemented for specific deletion.
|
protected DocumentModel |
fieldMapToDocumentModel(Map<String,Object> fieldMap) |
protected Attribute |
getAttributeValue(String fieldName,
Object value) |
DirContext |
getContext() |
LDAPDirectory |
getDirectory()
To be implemented with a more specific return type.
|
DocumentModel |
getEntryFromSource(String id,
boolean fetchReferences) |
protected Object |
getFieldValue(Attribute attribute,
String fieldName,
String entryId,
boolean fetchReferences) |
protected SearchResult |
getLdapEntry(String id) |
protected SearchResult |
getLdapEntry(String id,
boolean fetchAllAttributes) |
protected List<String> |
getMandatoryAttributes() |
protected List<String> |
getMandatoryAttributes(Attribute objectClassesAttribute) |
protected void |
handleException(Exception e,
String message) |
boolean |
hasEntry(String id)
Returns true if session has an entry with given id.
|
boolean |
isAuthenticating()
Tells whether the directory implementation can be used as an authenticating backend for the UserManager (based on
login / password check).
|
protected DocumentModelList |
ldapResultsToDocumentModels(NamingEnumeration<SearchResult> results,
boolean fetchReferences) |
protected DocumentModel |
ldapResultToDocumentModel(SearchResult result,
String entryId,
boolean fetchReferences) |
DocumentModelList |
query(Map<String,Serializable> filter,
Set<String> fulltext,
Map<String,String> orderBy,
boolean fetchReferences)
Executes a query with the possibility to fetch references
|
boolean |
rdnMatchesIdField() |
String |
toString() |
protected List<String> |
updateEntryWithoutReferences(DocumentModel docModel)
To be implemented for specific update.
|
checkDeleteConstraints, checkPermission, computeMultiTenantDirectoryId, createEntry, createEntryModel, createEntryModel, deleteEntry, deleteEntry, getEntries, getEntry, getEntry, getIdField, getPasswordField, getProjection, getProjection, hasPermission, hasPermission, isReadOnly, isReadOnlyEntry, query, query, query, query, setReadAllColumns, setReadOnlyEntry, setReadWriteEntry, updateEntry
protected static final String MISSING_ID_LOWER_CASE
protected static final String MISSING_ID_UPPER_CASE
protected DirContext dirContext
protected final String idAttribute
protected final String searchBaseDn
protected BaseDirectoryDescriptor.SubstringMatchType substringMatchType
protected final String rdnAttribute
protected final String passwordHashAlgorithm
public LDAPSession(LDAPDirectory directory)
public LDAPDirectory getDirectory()
BaseSession
getDirectory
in class BaseSession
public DirContext getContext()
protected DocumentModel createEntryWithoutReferences(Map<String,Object> fieldMap)
BaseSession
createEntryWithoutReferences
in class BaseSession
protected List<String> updateEntryWithoutReferences(DocumentModel docModel) throws DirectoryException
BaseSession
updateEntryWithoutReferences
in class BaseSession
DirectoryException
public void deleteEntryWithoutReferences(String id)
BaseSession
deleteEntryWithoutReferences
in class BaseSession
public boolean hasEntry(String id) throws DirectoryException
Session
DirectoryException
protected SearchResult getLdapEntry(String id) throws NamingException, DirectoryException
NamingException
DirectoryException
protected SearchResult getLdapEntry(String id, boolean fetchAllAttributes) throws NamingException
NamingException
protected void handleException(Exception e, String message)
public void deleteEntry(String id, Map<String,String> map)
Session
This is used for hierarchical vocabularies, where the actual unique key is the couple (parent, id).
deleteEntry
in interface Session
deleteEntry
in class BaseSession
id
- the id of the entry to delete.map
- a map of secondary key values.public DocumentModel getEntryFromSource(String id, boolean fetchReferences) throws DirectoryException
getEntryFromSource
in interface EntrySource
getEntryFromSource
in class BaseSession
DirectoryException
public DocumentModelList query(Map<String,Serializable> filter, Set<String> fulltext, Map<String,String> orderBy, boolean fetchReferences) throws DirectoryException
Session
query
in interface Session
query
in class BaseSession
DirectoryException
Session.query(Map, Set, Map)
public void close() throws DirectoryException
Session
Releases this Connection object's resources immediately instead of waiting for them to be automatically released.
TODO: should this operation auto-commit pending changes?
DirectoryException
- if a communication error occursprotected DocumentModel fieldMapToDocumentModel(Map<String,Object> fieldMap) throws DirectoryException
DirectoryException
protected Object getFieldValue(Attribute attribute, String fieldName, String entryId, boolean fetchReferences) throws DirectoryException
DirectoryException
protected Attribute getAttributeValue(String fieldName, Object value) throws DirectoryException
DirectoryException
protected DocumentModelList ldapResultsToDocumentModels(NamingEnumeration<SearchResult> results, boolean fetchReferences) throws DirectoryException, NamingException
DirectoryException
NamingException
protected DocumentModel ldapResultToDocumentModel(SearchResult result, String entryId, boolean fetchReferences) throws DirectoryException, NamingException
DirectoryException
NamingException
protected String changeEntryIdCase(String id, String idFieldCase)
public boolean authenticate(String username, String password) throws DirectoryException
Session
DirectoryException
public boolean isAuthenticating() throws DirectoryException
Session
isAuthenticating
in interface Session
isAuthenticating
in class BaseSession
DirectoryException
public boolean rdnMatchesIdField()
protected List<String> getMandatoryAttributes(Attribute objectClassesAttribute) throws DirectoryException
DirectoryException
protected List<String> getMandatoryAttributes() throws DirectoryException
DirectoryException
public DocumentModel createEntry(DocumentModel entry)
Session
createEntry
in interface Session
createEntry
in class BaseSession
entry
- the document model representing the entry to createCopyright © 2018 Nuxeo. All rights reserved.