DS-3519 4_X port of JIRA Ticket DS-2941

This commit is contained in:
Jonas Van Goolen
2017-03-03 10:32:21 +01:00
parent 72cf31cb5b
commit 21c516f0d3

View File

@@ -7,11 +7,7 @@
*/
package org.dspace.authenticate;
import java.sql.SQLException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.dspace.authorize.AuthorizeException;
import org.dspace.core.ConfigurationManager;
@@ -20,6 +16,10 @@ import org.dspace.core.LogManager;
import org.dspace.eperson.EPerson;
import org.dspace.eperson.Group;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.sql.SQLException;
/**
* A stackable authentication method
* based on the DSpace internal "EPerson" database.
@@ -128,7 +128,7 @@ public class PasswordAuthentication
// ensures they are password users
try
{
if (!context.getCurrentUser().getMetadata("password").equals(""))
if (context.getCurrentUser() != null && context.getCurrentUser().getPasswordHash()!=null && StringUtils.isNotBlank(context.getCurrentUser().getPasswordHash().toString()))
{
String groupName = ConfigurationManager.getProperty("authentication-password", "login.specialgroup");
if ((groupName != null) && (!groupName.trim().equals("")))
@@ -149,7 +149,7 @@ public class PasswordAuthentication
}
}
catch (Exception e) {
// The user is not a password user, so we don't need to worry about them
log.error(LogManager.getHeader(context,"getSpecialGroups",""),e);
}
return new int[0];
}