Class LdapSourceAdapter
java.lang.Object
edu.internet2.middleware.subject.provider.BaseSourceAdapter
edu.internet2.middleware.subject.provider.LdapSourceAdapter
- All Implemented Interfaces:
Source
- Direct Known Subclasses:
GrouperLdapSourceAdapter2_5
,HelperGrouperJndiSourceAdapter
,JNDISourceAdapter
Ldap source adapter.
-
Field Summary
Fields inherited from class edu.internet2.middleware.subject.provider.BaseSourceAdapter
attributes, descriptionAttributeName, id, internalAttributes, name, nameAttributeName, params, searchAttributes, searches, sortAttributes, subjectIdentifierAttributes, subjectIdentifierAttributesAll, type, types
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
make sure the config is ok, and log descriptive errors if notcreateSubject
(LdapEntry entry) protected String
escapeSearchFilter
(String filter) Escape a search filter to prevent LDAP injection.getAllAttributes
(SubjectImpl subject) Try to get more attributes for the subject.getLdapResults
(Search search, String searchValue, String[] attributeNames) protected LdapEntry
getLdapUnique
(Search search, String searchValue, String[] attributeNames) max Page sizeprotected String
getNeededProperty
(Properties props, String prop) getSubject
(String id) Deprecated.getSubject
(String id, boolean exceptionIfNull) Gets a Subject by its ID.Deprecated.getSubjectByIdentifier
(String id, boolean exceptionIfNull) note, you should implement this method since this implementation will become abstract at some pointvoid
init()
Called by SourceManager when it loads this source.void
start logging the source low level actionsstop logging and get the outputin the startup on this i2mi app, print helpful and brief info about this sourceUnstructured search for Subjects.searchPage
(String searchValue) Unstructured search for Subjects.void
setMultipleResults
(boolean multipleResults) Set whether or not multiple results are allowed.static <T> T[]
toArray
(Collection collection, Class<T> theClass) convert a list into an array of type of theClassMethods inherited from class edu.internet2.middleware.subject.provider.BaseSourceAdapter
addAttribute, addInitParam, addInternalAttribute, addSubjectType, attributeNameToViewerGroupName, convertSourceAttributeToSubjectAttribute, convertSubjectAttributeToSourceAttribute, createSubject, equals, exportLabelToAttributeName, getAttributes, getConfigId, getId, getInitParam, getInternalAttributes, getName, getSearch, getSearchAttributes, getSearches, getSortAttributes, getSourceAttributesToLowerCase, getSubject, getSubjectByIdentifier, getSubjectByIdOrIdentifier, getSubjectByIdOrIdentifier, getSubjectIdentifierAttributes, getSubjectIdentifierAttributesAll, getSubjectsByIdentifiers, getSubjectsByIdentifiers, getSubjectsByIds, getSubjectsByIds, getSubjectsByIdsOrIdentifiers, getSubjectsByIdsOrIdentifiers, getSubjectStatusConfig, getSubjectType, getSubjectTypes, hashCode, initParams, isEditable, isEnabled, loadSearch, removeInitParam, resultSetLimit, retrieveAllSubjectIds, search, searchPage, setConfigId, setId, setName, setSearchAttributes, setSearches, setSortAttributes, setSubjectIdentifierAttributes, setSubjectIdentifierAttributesAll, virtualAttributesForSource, virtualAttributesForSourceLegacy, virtualAttributeVariablesForSourceLegacy
-
Field Details
-
subjectIDAttributeName
-
subjectIDFormatToLowerCase
protected boolean subjectIDFormatToLowerCase
-
-
Constructor Details
-
LdapSourceAdapter
public LdapSourceAdapter() -
LdapSourceAdapter
- Parameters:
id
-name
-
-
-
Method Details
-
loggingStart
public void loggingStart()Description copied from interface:Source
start logging the source low level actions -
loggingStop
Description copied from interface:Source
stop logging and get the output -
init
public void init()Called by SourceManager when it loads this source.- Specified by:
init
in interfaceSource
- Specified by:
init
in classBaseSourceAdapter
-
toArray
convert a list into an array of type of theClass- Type Parameters:
T
- is the type of the array- Parameters:
collection
- list to converttheClass
- type of array to return- Returns:
- array of type theClass[] filled with the objects from list
-
getSubject
public Subject getSubject(String id, boolean exceptionIfNull) throws SubjectNotFoundException, SubjectNotUniqueException Gets a Subject by its ID.- Specified by:
getSubject
in interfaceSource
- Overrides:
getSubject
in classBaseSourceAdapter
exceptionIfNull
- if SubjectNotFoundException should be throws if the subject is null, or if null should be returned- Returns:
- subject
- Throws:
SubjectNotFoundException
SubjectNotUniqueException
- See Also:
-
getSubject
@Deprecated public Subject getSubject(String id) throws SubjectNotFoundException, SubjectNotUniqueException Deprecated.Gets a Subject by its ID.- Specified by:
getSubject
in interfaceSource
- Specified by:
getSubject
in classBaseSourceAdapter
- Returns:
- subject
- Throws:
SubjectNotFoundException
SubjectNotUniqueException
- See Also:
-
getSubjectByIdentifier
public Subject getSubjectByIdentifier(String id, boolean exceptionIfNull) throws SubjectNotFoundException, SubjectNotUniqueException note, you should implement this method since this implementation will become abstract at some point- Specified by:
getSubjectByIdentifier
in interfaceSource
- Overrides:
getSubjectByIdentifier
in classBaseSourceAdapter
- Returns:
- subject
- Throws:
SubjectNotFoundException
SubjectNotUniqueException
- See Also:
-
getSubjectByIdentifier
@Deprecated public Subject getSubjectByIdentifier(String id) throws SubjectNotFoundException, SubjectNotUniqueException Deprecated.Gets a Subject by other well-known identifiers, aside from the subject ID, for example, login ID.- Specified by:
getSubjectByIdentifier
in interfaceSource
- Specified by:
getSubjectByIdentifier
in classBaseSourceAdapter
- Returns:
- subject
- Throws:
SubjectNotFoundException
SubjectNotUniqueException
- See Also:
-
searchPage
Description copied from interface:Source
Unstructured search for Subjects. Each implementation utilizes its own search algorithm tailored to the Subject repository and schema. Note if config param: throwErrorOnFindAllFailure is false, then swallow and log exceptions if maxPageSize is set in subject.properties, then only return max that many, and if there are more, set the tooManyResults flag- Specified by:
searchPage
in interfaceSource
- Overrides:
searchPage
in classBaseSourceAdapter
- Returns:
- results and if there are too many, never return null!!!
- See Also:
-
search
Unstructured search for Subjects. Each implementation utilizes its own search algorithm tailored to the Subject repository and schema. Note if config param: throwErrorOnFindAllFailure is false, then swallow and log exceptions- Specified by:
search
in interfaceSource
- Specified by:
search
in classBaseSourceAdapter
- Returns:
- set
-
createSubject
- Parameters:
attributes
-
-
getNeededProperty
-
getAllAttributes
Try to get more attributes for the subject.- Parameters:
subject
-
-
getLdapResults
-
getLdapUnique
protected LdapEntry getLdapUnique(Search search, String searchValue, String[] attributeNames) throws SubjectNotFoundException, SubjectNotUniqueException, SourceUnavailableException -
escapeSearchFilter
Escape a search filter to prevent LDAP injection. From http://www.owasp.org/index.php/Preventing_LDAP_Injection_in_Java- Parameters:
filter
-- Returns:
- escaped filter
-
checkConfig
public void checkConfig()Description copied from interface:Source
make sure the config is ok, and log descriptive errors if not- See Also:
-
printConfig
Description copied from interface:Source
in the startup on this i2mi app, print helpful and brief info about this source- Returns:
- the info
- See Also:
-
setMultipleResults
public void setMultipleResults(boolean multipleResults) Set whether or not multiple results are allowed. Primarily for tests.- Parameters:
multipleResults
-
-
getMaxPage
max Page size- Returns:
- the maxPage
-