mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-11 03:53:07 +00:00
DS-3542 Fix salt reuse + Authorization header + licenses
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
*/
|
||||
package org.dspace.authenticate;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -15,6 +14,8 @@ import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.dspace.authenticate.service.AuthenticationService;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.core.Context;
|
||||
@@ -113,15 +114,7 @@ public class AuthenticationServiceImpl implements AuthenticationService
|
||||
ret = AuthenticationMethod.NO_SUCH_USER;
|
||||
}
|
||||
if (ret == AuthenticationMethod.SUCCESS) {
|
||||
EPerson me = context.getCurrentUser();
|
||||
me.setLastActive(new Date());
|
||||
try {
|
||||
ePersonService.update(context, me);
|
||||
} catch (SQLException ex) {
|
||||
log.error("Could not update last-active stamp", ex);
|
||||
} catch (AuthorizeException ex) {
|
||||
log.error("Could not update last-active stamp", ex);
|
||||
}
|
||||
updateLastActiveDate(context);
|
||||
return ret;
|
||||
}
|
||||
if (ret < bestRet) {
|
||||
@@ -132,6 +125,20 @@ public class AuthenticationServiceImpl implements AuthenticationService
|
||||
return bestRet;
|
||||
}
|
||||
|
||||
public void updateLastActiveDate(Context context) {
|
||||
EPerson me = context.getCurrentUser();
|
||||
if(me != null) {
|
||||
me.setLastActive(new Date());
|
||||
try {
|
||||
ePersonService.update(context, me);
|
||||
} catch (SQLException ex) {
|
||||
log.error("Could not update last-active stamp", ex);
|
||||
} catch (AuthorizeException ex) {
|
||||
log.error("Could not update last-active stamp", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSelfRegister(Context context,
|
||||
HttpServletRequest request,
|
||||
|
Reference in New Issue
Block a user