geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From de...@apache.org
Subject svn commit: r949067 - in /geronimo/server/branches/2.2/plugins/console/console-portal-driver/src/main: java/org/apache/geronimo/console/filter/NoXssShowTreeSettingFilter.java resources/pluto-portal-driver-config.xml webapp/WEB-INF/web.xml
Date Fri, 28 May 2010 02:03:12 GMT
Author: delos
Date: Fri May 28 02:03:11 2010
New Revision: 949067

URL: http://svn.apache.org/viewvc?rev=949067&view=rev
Log:
GERONIMO-5351 make admin console main page visible when user is redirected to it

Added:
    geronimo/server/branches/2.2/plugins/console/console-portal-driver/src/main/java/org/apache/geronimo/console/filter/NoXssShowTreeSettingFilter.java
Modified:
    geronimo/server/branches/2.2/plugins/console/console-portal-driver/src/main/resources/pluto-portal-driver-config.xml
    geronimo/server/branches/2.2/plugins/console/console-portal-driver/src/main/webapp/WEB-INF/web.xml

Added: geronimo/server/branches/2.2/plugins/console/console-portal-driver/src/main/java/org/apache/geronimo/console/filter/NoXssShowTreeSettingFilter.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/console/console-portal-driver/src/main/java/org/apache/geronimo/console/filter/NoXssShowTreeSettingFilter.java?rev=949067&view=auto
==============================================================================
--- geronimo/server/branches/2.2/plugins/console/console-portal-driver/src/main/java/org/apache/geronimo/console/filter/NoXssShowTreeSettingFilter.java
(added)
+++ geronimo/server/branches/2.2/plugins/console/console-portal-driver/src/main/java/org/apache/geronimo/console/filter/NoXssShowTreeSettingFilter.java
Fri May 28 02:03:11 2010
@@ -0,0 +1,105 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.console.filter;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+
+public class NoXssShowTreeSettingFilter implements Filter {
+
+	private static final String NOXSS_SHOW_TREE = "noxssShowTree";
+
+    public void destroy() {
+    }
+
+    public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain)
throws IOException,
+            ServletException {
+    	
+    	if (request instanceof HttpServletRequest && request.getParameterMap()!=null
&& !request.getParameterMap().containsKey(NOXSS_SHOW_TREE)) {
+    	
+    	    NoXssShowTreeSettingRequest wrapper = new  NoXssShowTreeSettingRequest((HttpServletRequest)request);
+
+    	    filterChain.doFilter(wrapper, response);
+    	}else{
+            filterChain.doFilter(request, response);
+    	}
+    }
+
+
+    public void init(FilterConfig arg0) throws ServletException {
+
+    }
+
+    protected static class NoXssShowTreeSettingRequest extends HttpServletRequestWrapper
{
+        
+    	private Map<String, String[]> newParamMap = new HashMap<String, String[]>();
+    	
+        public NoXssShowTreeSettingRequest(HttpServletRequest request) {
+            super(request);
+            
+            
+            newParamMap.putAll(request.getParameterMap());
+            
+            /*
+             * To show navigator tree in admin console, we need to set NOXSS_SHOW_TREE to
true.
+             * 
+             */
+            String[] noxssShowTree = new String[1];
+            noxssShowTree[0]="true";
+            newParamMap.put(NOXSS_SHOW_TREE,noxssShowTree);
+        }
+        
+        @Override
+        public String getParameter(final String name)
+        {
+            String[] strArray = newParamMap.get(name);
+            if (strArray != null && strArray.length>0)   
+            	return strArray[0];
+            else  return null;
+        }
+     
+        @Override
+        public Map<String, String[]> getParameterMap()
+        {
+            return Collections.unmodifiableMap(newParamMap);
+        }
+     
+        @Override
+        public Enumeration<String> getParameterNames()
+        {
+            return Collections.enumeration(newParamMap.keySet());
+        }
+     
+        @Override
+        public String[] getParameterValues(final String key)
+        {
+            return newParamMap.get(key);
+        } 
+    }
+}

Modified: geronimo/server/branches/2.2/plugins/console/console-portal-driver/src/main/resources/pluto-portal-driver-config.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/console/console-portal-driver/src/main/resources/pluto-portal-driver-config.xml?rev=949067&r1=949066&r2=949067&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/console/console-portal-driver/src/main/resources/pluto-portal-driver-config.xml
(original)
+++ geronimo/server/branches/2.2/plugins/console/console-portal-driver/src/main/resources/pluto-portal-driver-config.xml
Fri May 28 02:03:11 2010
@@ -37,7 +37,7 @@ limitations under the License.
 
 
   <!-- Render configuration which defines the portal pages. -->
-  <render-config default="Welcome">
+  <render-config default="0/Welcome">
 
   </render-config>
   

Modified: geronimo/server/branches/2.2/plugins/console/console-portal-driver/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/console/console-portal-driver/src/main/webapp/WEB-INF/web.xml?rev=949067&r1=949066&r2=949067&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/console/console-portal-driver/src/main/webapp/WEB-INF/web.xml
(original)
+++ geronimo/server/branches/2.2/plugins/console/console-portal-driver/src/main/webapp/WEB-INF/web.xml
Fri May 28 02:03:11 2010
@@ -52,6 +52,16 @@ limitations under the License.
     <listener-class>org.apache.pluto.driver.PortalStartupListener</listener-class>
   </listener>
   
+   <filter>
+    <filter-name>NoXssShowTreeSettingFilter</filter-name>
+    <filter-class>org.apache.geronimo.console.filter.NoXssShowTreeSettingFilter</filter-class>
+  </filter>
+  
+  <filter-mapping>
+    <filter-name>NoXssShowTreeSettingFilter</filter-name>
+    <url-pattern>/secure/*</url-pattern>
+  </filter-mapping>
+  
   <filter>
     <filter-name>PlutoURLRebuildFilter</filter-name>
     <filter-class>org.apache.geronimo.console.filter.PlutoURLRebuildFilter</filter-class>
@@ -287,7 +297,7 @@ limitations under the License.
   </security-constraint>
 
 
-        <security-constraint>
+  <security-constraint>
     <web-resource-collection>
       <web-resource-name>console monitor</web-resource-name>
       <url-pattern>/portal</url-pattern>



Mime
View raw message