for (Attribute userAttribute : userEntry.getAttributes()) {
displayName = StringUtils.replace(displayName, "${" + userAttribute.getName() + "}", userAttribute.getValue());
}
user.displayName = displayName;
} else {
Attribute attribute = userEntry.getAttribute(displayName);
if (attribute != null && attribute.hasValue()) {
user.displayName = attribute.getValue();
}
}
}
// Get email address Attribute
String email = settings.getString(Keys.realm.ldap.email, "");
if (!StringUtils.isEmpty(email)) {
if (email.contains("${")) {
for (Attribute userAttribute : userEntry.getAttributes()) {
email = StringUtils.replace(email, "${" + userAttribute.getName() + "}", userAttribute.getValue());
}
user.emailAddress = email;
} else {
Attribute attribute = userEntry.getAttribute(email);
if (attribute != null && attribute.hasValue()) {
user.emailAddress = attribute.getValue();
} else {
// issue-456/ticket-134
// allow LDAP to delete an email address
user.emailAddress = null;
}