mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-14 05:23:14 +00:00
(Scott Phillips) Added protection against NPEs during authentication.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2851 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -145,6 +145,10 @@ public class LDAPAuthentication
|
|||||||
{
|
{
|
||||||
log.info(LogManager.getHeader(context, "auth", "attempting trivial auth of user="+netid));
|
log.info(LogManager.getHeader(context, "auth", "attempting trivial auth of user="+netid));
|
||||||
|
|
||||||
|
// Skip out when no netid or password is given.
|
||||||
|
if (netid == null || password == null)
|
||||||
|
return BAD_ARGS;
|
||||||
|
|
||||||
// Locate the eperson
|
// Locate the eperson
|
||||||
EPerson eperson = null;
|
EPerson eperson = null;
|
||||||
try
|
try
|
||||||
|
@@ -97,6 +97,10 @@ public class AuthenticateAction extends AbstractAction
|
|||||||
String password = request.getParameter("login_password");
|
String password = request.getParameter("login_password");
|
||||||
String realm = request.getParameter("login_realm");
|
String realm = request.getParameter("login_realm");
|
||||||
|
|
||||||
|
// Skip out if no email or password is given.
|
||||||
|
if (email == null || password == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Context context = AuthenticationUtil.Authenticate(objectModel, email,password, realm);
|
Context context = AuthenticationUtil.Authenticate(objectModel, email,password, realm);
|
||||||
|
@@ -92,9 +92,12 @@ public class LDAPAuthenticateAction extends AbstractAction {
|
|||||||
String password = request.getParameter("ldap_password");
|
String password = request.getParameter("ldap_password");
|
||||||
String realm = request.getParameter("login_realm");
|
String realm = request.getParameter("login_realm");
|
||||||
|
|
||||||
|
// Skip out of no name or password given.
|
||||||
|
if (username == null || password == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Context context = AuthenticationUtil.Authenticate(objectModel,
|
Context context = AuthenticationUtil.Authenticate(objectModel,username, password, realm);
|
||||||
username, password, realm);
|
|
||||||
|
|
||||||
EPerson eperson = context.getCurrentUser();
|
EPerson eperson = context.getCurrentUser();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user