Interface LdapAttributeMapper

    • 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 specified LDAPEntry onto a LdapUserData.
        Parameters:
        ldapEntry - a non-null directory entry to map
        userData - a non-null user cache entry
      • mapUserDataOntoUserEdit

        void mapUserDataOntoUserEdit​(LdapUserData userData,
                                     org.sakaiproject.user.api.UserEdit userEdit)
        Maps attribites from the specified LdapUserData onto a UserEdit.
        Parameters:
        userData - a non-null user cache entry
        userEdit - 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:
        null if 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 given LdapUserData by this LdapAttributeMapper. 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's eid and some other configured RDN string.
        Parameters:
        userData - a mapped collection of user attributes from which to derive a bindable DN. Should not be null
        Returns:
        a bindable DN derived from userData or null 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 name

        In 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