NIHVIVO-151 when forcing a login, assemble the process bean and go straight to the form.
This commit is contained in:
parent
8676ec5544
commit
3c239271e3
1 changed files with 15 additions and 11 deletions
|
@ -21,8 +21,9 @@ import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
|
import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.authenticate.LoginRedirector;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.authenticate.LogoutRedirector;
|
import edu.cornell.mannlib.vitro.webapp.controller.authenticate.LogoutRedirector;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.login.LoginProcessBean;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.login.LoginProcessBean.State;
|
||||||
|
|
||||||
public class VitroHttpServlet extends HttpServlet {
|
public class VitroHttpServlet extends HttpServlet {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -125,16 +126,10 @@ public class VitroHttpServlet extends HttpServlet {
|
||||||
*/
|
*/
|
||||||
public static void redirectToLoginPage(HttpServletRequest request,
|
public static void redirectToLoginPage(HttpServletRequest request,
|
||||||
HttpServletResponse response) {
|
HttpServletResponse response) {
|
||||||
String postLoginRequest;
|
LoginProcessBean bean = new LoginProcessBean();
|
||||||
|
bean.setState(State.LOGGING_IN);
|
||||||
String queryString = request.getQueryString();
|
bean.setAfterLoginUrl(assembleAfterLoginUrl(request));
|
||||||
if ((queryString == null) || queryString.isEmpty()) {
|
LoginProcessBean.setBean(request, bean);
|
||||||
postLoginRequest = request.getRequestURI();
|
|
||||||
} else {
|
|
||||||
postLoginRequest = request.getRequestURI() + "?" + queryString;
|
|
||||||
}
|
|
||||||
|
|
||||||
LoginRedirector.setReturnUrlFromForcedLogin(request, postLoginRequest);
|
|
||||||
|
|
||||||
String loginPage = request.getContextPath() + Controllers.LOGIN;
|
String loginPage = request.getContextPath() + Controllers.LOGIN;
|
||||||
|
|
||||||
|
@ -145,6 +140,15 @@ public class VitroHttpServlet extends HttpServlet {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String assembleAfterLoginUrl(HttpServletRequest request) {
|
||||||
|
String queryString = request.getQueryString();
|
||||||
|
if ((queryString == null) || queryString.isEmpty()) {
|
||||||
|
return request.getRequestURI();
|
||||||
|
} else {
|
||||||
|
return request.getRequestURI() + "?" + queryString;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If logging is set to the TRACE level, dump the HTTP headers on the request.
|
* If logging is set to the TRACE level, dump the HTTP headers on the request.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue