Author: mwringe
Date: 2011-08-31 11:24:39 -0400 (Wed, 31 Aug 2011)
New Revision: 7263
Modified:
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
Log:
JBEPP-1106: merge in patch from GTNPORTAL-2040 (r7620). Protected portals now redirect to
login page instead of 404.
Modified:
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2011-08-31
12:39:59 UTC (rev 7262)
+++
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2011-08-31
15:24:39 UTC (rev 7263)
@@ -101,6 +101,8 @@
final static public String REQUEST_METADATA =
"portal:requestMetadata".intern();
final static private String LAST_PORTAL_NAME = "prc.lastPortalName";
+
+ final static private String DO_LOGIN_PATTERN = "dologin";
/** The path decoded from the request. */
private final String nodePath_;
@@ -329,6 +331,12 @@
appRes_ = getApplication().getResourceBundle(getLocale());
}
+ public void requestAuthenticationLogin() throws Exception
+ {
+ String doLoginPath = request_.getContextPath() + "/" + DO_LOGIN_PATTERN +
"?initialURI=" + request_.getRequestURI();
+ sendRedirect(doLoginPath);
+ }
+
public String getTitle() throws Exception
{
String title = (String)request_.getAttribute(REQUEST_TITLE);
Modified:
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java 2011-08-31
12:39:59 UTC (rev 7262)
+++
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java 2011-08-31
15:24:39 UTC (rev 7263)
@@ -21,7 +21,10 @@
import org.exoplatform.commons.utils.I18N;
import org.exoplatform.commons.utils.Safe;
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.StaleModelException;
+import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.web.ControllerContext;
@@ -130,7 +133,20 @@
PortalRequestContext context = new PortalRequestContext(app, controllerContext,
requestSiteType, requestSiteName, requestPath, requestLocale);
if (context.getUserPortalConfig() == null)
{
- context.sendError(HttpServletResponse.SC_NOT_FOUND);
+ DataStorage storage =
(DataStorage)PortalContainer.getComponent(DataStorage.class);
+ PortalConfig persistentPortalConfig = storage.getPortalConfig(requestSiteType,
requestSiteName);
+ if (persistentPortalConfig == null)
+ {
+ context.sendError(HttpServletResponse.SC_NOT_FOUND);
+ }
+ else if(req.getRemoteUser() == null)
+ {
+ context.requestAuthenticationLogin();
+ }
+ else
+ {
+ context.sendError(HttpServletResponse.SC_FORBIDDEN);
+ }
}
else
{
Modified:
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2011-08-31
12:39:59 UTC (rev 7262)
+++
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2011-08-31
15:24:39 UTC (rev 7263)
@@ -87,8 +87,7 @@
if (targetNode != null)
{
uiPortalApp.setLastRequestURI(null);
- String doLoginPath = pcontext.getRequest().getContextPath() +
"/dologin?initialURI=" + pcontext.getRequestURI();
- pcontext.sendRedirect(doLoginPath);
+ pcontext.requestAuthenticationLogin();
return;
}
}
Show replies by date