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, updateEntryprotected 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()
BaseSessiongetDirectory in class BaseSessionpublic DirContext getContext()
protected DocumentModel createEntryWithoutReferences(Map<String,Object> fieldMap)
BaseSessioncreateEntryWithoutReferences in class BaseSessionprotected List<String> updateEntryWithoutReferences(DocumentModel docModel)
BaseSessionupdateEntryWithoutReferences in class BaseSessionpublic void deleteEntryWithoutReferences(String id)
BaseSessiondeleteEntryWithoutReferences in class BaseSessionpublic boolean hasEntry(String id)
Sessionprotected SearchResult getLdapEntry(String id) throws NamingException
NamingExceptionprotected SearchResult getLdapEntry(String id, boolean fetchAllAttributes) throws NamingException
NamingExceptionprotected void handleException(Exception e, String message)
public void deleteEntry(String id, Map<String,String> map)
SessionThis is used for hierarchical vocabularies, where the actual unique key is the couple (parent, id).
deleteEntry in interface SessiondeleteEntry in class BaseSessionid - the id of the entry to delete.map - a map of secondary key values.public DocumentModel getEntryFromSource(String id, boolean fetchReferences)
getEntryFromSource in interface EntrySourcegetEntryFromSource in class BaseSessionpublic DocumentModelList query(Map<String,Serializable> filter, Set<String> fulltext, Map<String,String> orderBy, boolean fetchReferences, int limit, int offset)
Sessionlimit - 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)
SessionqueryBuilder - the query to use, including limit, offset, ordering and countTotalfetchReferences - boolean stating if references have to be fetchedpublic List<String> queryIds(QueryBuilder queryBuilder)
SessionqueryBuilder - the query to use, including limit, offset and orderingpublic void close()
SessionReleases 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
NamingExceptionprotected DocumentModel ldapResultToDocumentModel(SearchResult result, String entryId, boolean fetchReferences) throws NamingException
NamingExceptionprotected String changeEntryIdCase(String id, String idFieldCase)
public boolean authenticate(String username, String password)
Sessionpublic boolean isAuthenticating()
SessionisAuthenticating in interface SessionisAuthenticating in class BaseSessionpublic boolean rdnMatchesIdField()
protected List<String> getMandatoryAttributes(Attribute objectClassesAttribute)
protected List<String> getMandatoryAttributes()
public DocumentModel createEntry(DocumentModel entry)
SessioncreateEntry in interface SessioncreateEntry in class BaseSessionentry - the document model representing the entry to createCopyright © 2019 Nuxeo. All rights reserved.