Clean up some obsolete logic.

This commit is contained in:
j2blake 2011-04-18 20:00:02 +00:00
parent 5d44fa50f7
commit 0eb6f25e89

View file

@ -24,7 +24,6 @@ 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.auth.policy.PolicyHelper; import edu.cornell.mannlib.vitro.webapp.auth.policy.PolicyHelper;
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction;
import edu.cornell.mannlib.vitro.webapp.beans.DisplayMessage; import edu.cornell.mannlib.vitro.webapp.beans.DisplayMessage;
import edu.cornell.mannlib.vitro.webapp.controller.authenticate.LogoutRedirector; import edu.cornell.mannlib.vitro.webapp.controller.authenticate.LogoutRedirector;
@ -62,10 +61,13 @@ public class VitroHttpServlet extends HttpServlet {
dumpRequestHeaders(hreq); dumpRequestHeaders(hreq);
} }
// Record restricted pages so we won't return to them on logout
if (PolicyHelper.isRestrictedPage(this)) { if (PolicyHelper.isRestrictedPage(this)) {
LogoutRedirector.recordRestrictedPageUri(hreq); LogoutRedirector.recordRestrictedPageUri(hreq);
} }
// If the @RequiresAuthenticationFor actions are not authorized,
// don't show them the page.
if (!PolicyHelper.areRequiredAuthorizationsSatisfied(hreq, this)) { if (!PolicyHelper.areRequiredAuthorizationsSatisfied(hreq, this)) {
if (LoginStatusBean.getBean(hreq).isLoggedIn()) { if (LoginStatusBean.getBean(hreq).isLoggedIn()) {
redirectToInsufficientAuthorizationPage(hreq, hresp); redirectToInsufficientAuthorizationPage(hreq, hresp);
@ -75,6 +77,12 @@ public class VitroHttpServlet extends HttpServlet {
return; return;
} }
} }
// check to see if VitroRequestPrep filter was run
if (hreq.getAttribute("appBean") == null
|| hreq.getAttribute("webappDaoFactory") == null) {
log.warn("request scope was not prepared by VitroRequestPrep");
}
} }
super.service(req, resp); super.service(req, resp);
@ -89,25 +97,6 @@ public class VitroHttpServlet extends HttpServlet {
+ "If you think this is an error, " + "If you think this is an error, "
+ "please contact us and we'll be happy to help."; + "please contact us and we'll be happy to help.";
/**
* Setup the auth flag, portal flag and portal bean objects. Put them in the
* request attributes.
*/
@Override
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
setup(request);
}
protected final void setup(HttpServletRequest request) {
// check to see if VitroRequestPrep filter was run
if (request.getAttribute("appBean") == null
|| request.getAttribute("webappDaoFactory") == null) {
log.warn("request scope was not prepared by VitroRequestPrep");
}
}
/** /**
* doPost does the same thing as the doGet method * doPost does the same thing as the doGet method
*/ */