public class LDAPSession extends BaseSession
BaseSession.FieldDetector
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 |
autoincrementId, computeMultiTenantId, directory, directoryName, MULTI_TENANT_ID_FORMAT, permissions, POWER_USERS_GROUP, readAllColumns, READONLY_ENTRY_FLAG, referenceClass, schemaName, substringMatchType, TENANT_ID_FIELD
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,
int limit,
int offset)
Executes a query with the possibility to fetch a subset of the results.
|
DocumentModelList |
query(QueryBuilder queryBuilder,
boolean fetchReferences)
Executes a query with the possibility to fetch a subset of the results.
|
List<String> |
queryIds(QueryBuilder queryBuilder)
Executes a query with the possibility to fetch a subset of the results.
|
boolean |
rdnMatchesIdField() |
String |
toString() |
protected List<String> |
updateEntryWithoutReferences(DocumentModel docModel)
To be implemented for specific update.
|
addTenantId, applyQueryLimits, applyQueryLimits, canDeleteMultiTenantEntry, checkDeleteConstraints, checkPermission, computeMultiTenantDirectoryId, createEntry, createEntryModel, createEntryModel, deleteEntry, deleteEntry, getCurrentTenantId, getEntries, getEntry, getEntry, getIdField, getPasswordField, getProjection, getProjection, hasPermission, hasPermission, isMultiTenant, isReadOnly, isReadOnlyEntry, query, query, query, query, setReadAllColumns, setReadOnlyEntry, setReadWriteEntry, toStringList, 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 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)
BaseSession
updateEntryWithoutReferences
in class BaseSession
public void deleteEntryWithoutReferences(String id)
BaseSession
deleteEntryWithoutReferences
in class BaseSession
public boolean hasEntry(String id)
Session
protected SearchResult getLdapEntry(String id) throws NamingException
NamingException
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)
getEntryFromSource
in interface EntrySource
getEntryFromSource
in class BaseSession
public DocumentModelList query(Map<String,Serializable> filter, Set<String> fulltext, Map<String,String> orderBy, boolean fetchReferences, int limit, int offset)
Session
limit
- maximum number of results ignored if less than 1offset
- number of rows skipped before starting, will be 0 if less than 0.Session.query(Map, Set, Map, boolean)
public DocumentModelList query(QueryBuilder queryBuilder, boolean fetchReferences)
Session
queryBuilder
- the query to use, including limit, offset, ordering and countTotalfetchReferences
- boolean stating if references have to be fetchedpublic List<String> queryIds(QueryBuilder queryBuilder)
Session
queryBuilder
- the query to use, including limit, offset and orderingpublic void close()
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?
protected DocumentModel fieldMapToDocumentModel(Map<String,Object> fieldMap)
protected Object getFieldValue(Attribute attribute, String fieldName, String entryId, boolean fetchReferences)
protected Attribute getAttributeValue(String fieldName, Object value)
protected DocumentModelList ldapResultsToDocumentModels(NamingEnumeration<SearchResult> results, boolean fetchReferences) throws NamingException
NamingException
protected DocumentModel ldapResultToDocumentModel(SearchResult result, String entryId, boolean fetchReferences) throws NamingException
NamingException
protected String changeEntryIdCase(String id, String idFieldCase)
public boolean authenticate(String username, String password)
Session
public boolean isAuthenticating()
Session
isAuthenticating
in interface Session
isAuthenticating
in class BaseSession
public boolean rdnMatchesIdField()
protected List<String> getMandatoryAttributes(Attribute objectClassesAttribute)
protected List<String> getMandatoryAttributes()
public DocumentModel createEntry(DocumentModel entry)
Session
createEntry
in interface Session
createEntry
in class BaseSession
entry
- the document model representing the entry to createCopyright © 2019 Nuxeo. All rights reserved.