Package org.sakaiproject.unboundid
Interface LdapAttributeMapper
-
- All Known Implementing Classes:
EmailAddressDerivingLdapAttributeMapper,MultipleEmailLdapAttributeMapper,SimpleLdapAttributeMapper
public interface LdapAttributeMapperImplementations handle mappings between logical and physical directory attribute names and between directory entries and Sakai domain and framework objects. The also handle search filter writing.- Author:
- Dan McCallum, Unicon Inc
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringescapeSearchFilterTerm(String term)Scrubs the given search filter term (i.e. a value to be matched, or not, in a search predicate) for reserved characters.StringgetAttributeMapping(String key)Map the given logical attribute name to a physical attribute name.Map<String,String>getAttributeMappings()Access the current directory attribute map.StringgetFindUserByAidFilter(String aid)Output a filter string for searching the directory with the specified user aid as a key.StringgetFindUserByCrossAttributeSearchFilter(String criteria)Builds a filter to perform a wildcard search for criteria in uid, email, first name or last nameStringgetFindUserByEidFilter(String eid)Output a filter string for searching the directory with the specified user eid as a key.StringgetFindUserByEmailFilter(String emailAddr)Output a filter string for searching the directory with the specified email address as a key.StringgetManyUsersInOneSearch(Set<String> criteria)Builds a filter to a uid search against many users at once For reference, the LDAP search filter is of the form: "(|(uid=sample.user)(uid=john.doe)(uid=jane.smith))"String[]getSearchResultAttributes()Access the standard attributes returned from any given directory search.StringgetUserBindDn(LdapUserData userData)Determine the DN to which to bind when executing an authentication attempt for the given user.voidinit()Complete internal configuration.voidmapLdapEntryOntoUserData(com.unboundid.ldap.sdk.migrate.ldapjdk.LDAPEntry ldapEntry, LdapUserData userData)Maps attribites from the specifiedLDAPEntryonto aLdapUserData.voidmapUserDataOntoUserEdit(LdapUserData userData, org.sakaiproject.user.api.UserEdit userEdit)Maps attribites from the specifiedLdapUserDataonto aUserEdit.voidsetAttributeMappings(Map<String,String> attributeMappings)Assign the directory attribute map.
-
-
-
Method Detail
-
init
void init()
Complete internal configuration. Typical called by Spring.
-
getFindUserByEmailFilter
String getFindUserByEmailFilter(String emailAddr)
Output a filter string for searching the directory with the specified email address as a key.- Parameters:
emailAddr- an email address to search on- Returns:
- an LDAP search filter
-
getFindUserByEidFilter
String getFindUserByEidFilter(String eid)
Output a filter string for searching the directory with the specified user eid as a key.- Parameters:
eid- a user eid to search on- Returns:
- an LDAP search filter
-
getFindUserByAidFilter
String getFindUserByAidFilter(String aid)
Output a filter string for searching the directory with the specified user aid as a key.- Parameters:
aid- a user authentication id.- Returns:
- an LDAP search filter
-
mapLdapEntryOntoUserData
void mapLdapEntryOntoUserData(com.unboundid.ldap.sdk.migrate.ldapjdk.LDAPEntry ldapEntry, LdapUserData userData)Maps attribites from the specifiedLDAPEntryonto aLdapUserData.- Parameters:
ldapEntry- a non-null directory entry to mapuserData- a non-null user cache entry
-
mapUserDataOntoUserEdit
void mapUserDataOntoUserEdit(LdapUserData userData, org.sakaiproject.user.api.UserEdit userEdit)
Maps attribites from the specifiedLdapUserDataonto aUserEdit.- Parameters:
userData- a non-null user cache entryuserEdit- a non-null user domain object
-
getSearchResultAttributes
String[] getSearchResultAttributes()
Access the standard attributes returned from any given directory search.- Returns:
- an array of directory attribute names
-
getAttributeMappings
Map<String,String> getAttributeMappings()
Access the current directory attribute map. Keys are logical names, values are physical names.- Returns:
- the current attribute map.
-
setAttributeMappings
void setAttributeMappings(Map<String,String> attributeMappings)
Assign the directory attribute map. Keys are logical names, values are physical names.- Parameters:
attributeMappings- the attribute map.
-
getAttributeMapping
String getAttributeMapping(String key)
Map the given logical attribute name to a physical attribute name.- Parameters:
key- the logical attribute name- Returns:
- the corresponding physical attribute name, or null if no mapping exists.
-
escapeSearchFilterTerm
String escapeSearchFilterTerm(String term)
Scrubs the given search filter term (i.e. a value to be matched, or not, in a search predicate) for reserved characters. I.e. protects against query injection.- Parameters:
term- The string value to be scrubbed- Returns:
nullif the received String is null, otherwise a copy of the received String with reserved characters escaped.
-
getUserBindDn
String getUserBindDn(LdapUserData userData)
Determine the DN to which to bind when executing an authentication attempt for the given user. An invocation implies that the DN can be derived from attributes already mapped onto the givenLdapUserDataby thisLdapAttributeMapper. For example, the mapper could have cached the DN in the user's property map, or the bind DN could be reliably calculated from a combination of the user'seidand some other configured RDN string.- Parameters:
userData- a mapped collection of user attributes from which to derive a bindable DN. Should not benull- Returns:
- a bindable DN derived from
userDataornull if the DN is not known.
-
getFindUserByCrossAttributeSearchFilter
String getFindUserByCrossAttributeSearchFilter(String criteria)
Builds a filter to perform a wildcard search for criteria in uid, email, first name or last nameIn order to minimise hitting the limits of searches, this only performs a wildcard match on anything after the supplied criteria.
For example, a search for 'john' will match 'john' and 'johnson' but not 'gudjohnsen'.For reference, the LDAP search filter is of the form: "(|(uid=criteria*)(mail=criteria*)(givenName=criteria*)(sn=criteria*))"
- Parameters:
the- search string- Returns:
- the formatted search filter
-
getManyUsersInOneSearch
String getManyUsersInOneSearch(Set<String> criteria)
Builds a filter to a uid search against many users at once For reference, the LDAP search filter is of the form: "(|(uid=sample.user)(uid=john.doe)(uid=jane.smith))"- Parameters:
the- search string- Returns:
- the formatted search filter
-
-