Hacking LDAP Username Attribute

Hi folks,

I’m elbow deep in the openfire source right now, trying to figure out the best way to put more than one ldap attribute in the username field.

Specifically we want the username to be ({phone number}) when it shows up in pidgin (or w/e client you use).

Has anyone had any luck with this? How did you approach it. (Let me say that we don’t really want to manually enter a new field in LDAP for every employee, or manually enter anything. Our solution needs to use the fields already in LDAP and automatically smush them together.)

My current approach is to subclass LDAPManager and override retrieveList() to intercept the names as they are being pulled from LDAP.

                // Get the next result.
                SearchResult next = (SearchResult)answer.next();
                String result = (String)(next).getAttributes().get(attribute).get() + " (" + (String)(next).getAttributes().get("phone number").get() + ")";
                // Remove suffixToTrim if set
                if (suffixToTrim != null && suffixToTrim.length() > 0 && result.endsWith(suffixToTrim)) {
                    result = result.substring(0,result.length()-suffixToTrim.length());

Is there a smarter approach to this that anyone more familiiar with the source can point me towards?


Tim Maxwell

Optaros, Inc.

If you are talking about the name displayed in the roster that is controlled by the settings in the openfire.xml file of the server. You need to change this section:

<nameField>displayName</nameField> I use displayName to make the roster show the field Display Name as listed in my Active Directory.

No, I’m aware of how to set up the config file.

What we want is really new functionality altogether.

We want to take multiple fields from the LDAP and concatenate them to create the displayed username.


Tim, you ever figure this out we want to do the same. Username (Extension)