mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-09 19:13:18 +00:00
DS-1739 fix LDAP auth appending "null" to username
This commit is contained in:
@@ -252,13 +252,18 @@ public class LDAPAuthentication
|
|||||||
|
|
||||||
// If there is no email and the email domain is set, add it to the netid
|
// If there is no email and the email domain is set, add it to the netid
|
||||||
String email = ldap.ldapEmail;
|
String email = ldap.ldapEmail;
|
||||||
if (((email == null) || ("".equals(email))) &&
|
|
||||||
(!"".equals(ConfigurationManager.getProperty("authentication-ldap", "netid_email_domain"))))
|
if ((StringUtils.isEmpty(email)) &&
|
||||||
|
(StringUtils.isNotEmpty(ConfigurationManager.getProperty("authentication-ldap", "netid_email_domain"))))
|
||||||
{
|
{
|
||||||
email = netid + ConfigurationManager.getProperty("authentication-ldap", "netid_email_domain");
|
email = netid + ConfigurationManager.getProperty("authentication-ldap", "netid_email_domain");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
email = netid;
|
||||||
|
}
|
||||||
|
|
||||||
if ((email != null) && (!"".equals(email)))
|
if (StringUtils.isNotEmpty(email))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -288,19 +293,19 @@ public class LDAPAuthentication
|
|||||||
{
|
{
|
||||||
context.setIgnoreAuthorization(true);
|
context.setIgnoreAuthorization(true);
|
||||||
eperson = EPerson.create(context);
|
eperson = EPerson.create(context);
|
||||||
if ((email != null) && (!"".equals(email)))
|
if (StringUtils.isNotEmpty(email))
|
||||||
{
|
{
|
||||||
eperson.setEmail(email);
|
eperson.setEmail(email);
|
||||||
}
|
}
|
||||||
if ((ldap.ldapGivenName!=null) && (!ldap.ldapGivenName.equals("")))
|
if (StringUtils.isNotEmpty(ldap.ldapGivenName))
|
||||||
{
|
{
|
||||||
eperson.setFirstName(ldap.ldapGivenName);
|
eperson.setFirstName(ldap.ldapGivenName);
|
||||||
}
|
}
|
||||||
if ((ldap.ldapSurname!=null) && (!ldap.ldapSurname.equals("")))
|
if (StringUtils.isNotEmpty(ldap.ldapSurname))
|
||||||
{
|
{
|
||||||
eperson.setLastName(ldap.ldapSurname);
|
eperson.setLastName(ldap.ldapSurname);
|
||||||
}
|
}
|
||||||
if ((ldap.ldapPhone!=null)&&(!ldap.ldapPhone.equals("")))
|
if (StringUtils.isNotEmpty(ldap.ldapPhone))
|
||||||
{
|
{
|
||||||
eperson.setMetadata("phone", ldap.ldapPhone);
|
eperson.setMetadata("phone", ldap.ldapPhone);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user