Jasig/person-directory — pull request #2 by drewwills (2012-10-04 21:29:54+00:00)
Title: PERSONDIR-66

Subclasses of AbstractQueryPersonAttributeDao pull username from the query parameters when they probably shouldn't

This patch addresses the JIRA but takes the tactic of making the fewest possible changes to existing behavior. Specifically, it uses the following approach for selecting a username:

- Option #1: An attribute is named explicitly in the config, and that attribute is present in the results from LDAP; use it
- Option #2: Use the userName attribute provided in the query parameters.
- Option #3: Create the IPersonAttributes doing a best-guess at a userName attribute

So if a userName attribute is *explicitly configured* for the bean, and that attribute is present in the result set, it will prefer it; otherwise it will do what it did before the patch.

I think there's a good argument that the userName attribute should be preferred more often (even when not configured explicitly), but at this point I'm unsure what systems are relying on the old behavior, and what all the outcomes would be.