geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r934335 - in /geronimo/server/trunk/plugins: j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/ j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/ j2ee/geronimo-web-2.5-bui...
Date Thu, 15 Apr 2010 09:11:02 GMT
Author: xuhaihong
Date: Thu Apr 15 09:11:02 2010
New Revision: 934335

URL: http://svn.apache.org/viewvc?rev=934335&view=rev
Log:
Support ServletSecurity annotation scan, some more work might need for it while adding Servlet
dynamically

Added:
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/annotation/ServletSecurityAnnotationMergeHandler.java
  (with props)
Modified:
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeHelper.java
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletMappingMergeHandler.java
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/security/URLPattern.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatInstanceManager.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/security/authentication/FormAuthenticator.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/security/jacc/JACCAuthorizer.java

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java?rev=934335&r1=934334&r2=934335&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
Thu Apr 15 09:11:02 2010
@@ -299,12 +299,12 @@ public abstract class AbstractWebModuleB
 
     protected String getModuleName(WebAppType webApp) {
         if (webApp.sizeOfModuleNameArray() > 0) {
-            return webApp.getModuleNameArray()[0].getStringValue().trim();        
+            return webApp.getModuleNameArray()[0].getStringValue().trim();
         } else {
             return null;
         }
     }
-    
+
     public void installModule(JarFile earFile, EARContext earContext, Module module, Collection
configurationStores, ConfigurationStore targetConfigurationStore, Collection repositories)
             throws DeploymentException {
         EARContext moduleContext;
@@ -436,8 +436,7 @@ public abstract class AbstractWebModuleB
         //Process Web Service
         Map servletNameToPathMap = buildServletNameToPathMap((WebAppType) webModule.getSpecDD(),
webModule.getContextRoot());
         Map sharedContext = webModule.getSharedContext();
-        for (Object aWebServiceBuilder : webServiceBuilder) {
-            WebServiceBuilder serviceBuilder = (WebServiceBuilder) aWebServiceBuilder;
+        for (WebServiceBuilder serviceBuilder : webServiceBuilder) {
             serviceBuilder.findWebServices(webModule, false, servletNameToPathMap, webModule.getEnvironment(),
sharedContext);
         }
         serviceBuilders.build(gerWebApp, earContext, webModule.getEarContext());
@@ -824,7 +823,7 @@ public abstract class AbstractWebModuleB
         }
         return context;
     }
-    
+
     private static class InternWrapper implements XMLStreamReader {
 
         private final XMLStreamReader delegate;

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeHelper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeHelper.java?rev=934335&r1=934334&r2=934335&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeHelper.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeHelper.java
Thu Apr 15 09:11:02 2010
@@ -45,6 +45,7 @@ import org.apache.geronimo.kernel.osgi.D
 import org.apache.geronimo.kernel.osgi.BundleResourceFinder.ResourceFinderCallback;
 import org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder;
 import org.apache.geronimo.web25.deployment.merge.annotation.AnnotationMergeHandler;
+import org.apache.geronimo.web25.deployment.merge.annotation.ServletSecurityAnnotationMergeHandler;
 import org.apache.geronimo.web25.deployment.merge.annotation.WebFilterAnnotationMergeHandler;
 import org.apache.geronimo.web25.deployment.merge.annotation.WebListenerAnnotationMergeHandler;
 import org.apache.geronimo.web25.deployment.merge.annotation.WebServletAnnotationMergeHandler;
@@ -113,6 +114,8 @@ public class MergeHelper {
 
     private static final AnnotationMergeHandler WEB_SERVLET_ANNOTATION_MERGE_HANDLER = new
WebServletAnnotationMergeHandler();
 
+    private static final AnnotationMergeHandler SERVLET_SECURITY_ANNOTATION_MERGE_HANDLER
= new ServletSecurityAnnotationMergeHandler();
+
     /**
      * If absolute-ordering is found in the web.xml file, our steps :
      *   1. Process those web-fragment.xml which are explicitly configured by its sub name
elements
@@ -303,6 +306,7 @@ public class MergeHelper {
         WEB_SERVLET_ANNOTATION_MERGE_HANDLER.preProcessWebXmlElement(webApp, mergeContext);
         WEB_FILTER_ANNOTATION_MERGE_HANDLER.preProcessWebXmlElement(webApp, mergeContext);
         WEB_LISTENER_ANNOTATION_MERGE_HANDLER.preProcessWebXmlElement(webApp, mergeContext);
+        SERVLET_SECURITY_ANNOTATION_MERGE_HANDLER.preProcessWebXmlElement(webApp, mergeContext);
         //Pre-process each web fragment
         for (WebFragmentMergeHandler<WebFragmentType, WebAppType> webFragmentMergeHandler
: WEB_FRAGMENT_MERGE_HANDLERS) {
             webFragmentMergeHandler.preProcessWebXmlElement(webApp, mergeContext);
@@ -322,12 +326,13 @@ public class MergeHelper {
         for (WebFragmentMergeHandler<WebFragmentType, WebAppType> webFragmentMergeHandler
: WEB_FRAGMENT_MERGE_HANDLERS) {
             webFragmentMergeHandler.postProcessWebXmlElement(webApp, mergeContext);
         }
+        //Merge the annotations found in WEB-INF/classes folder
+        mergeAnnotations(bundle, webApp, mergeContext, "/WEB-INF/classes");
         //Post-process for annotations
         WEB_SERVLET_ANNOTATION_MERGE_HANDLER.postProcessWebXmlElement(webApp, mergeContext);
         WEB_FILTER_ANNOTATION_MERGE_HANDLER.postProcessWebXmlElement(webApp, mergeContext);
         WEB_LISTENER_ANNOTATION_MERGE_HANDLER.postProcessWebXmlElement(webApp, mergeContext);
-        //Merge the annotations found in WEB-INF/classes folder
-        mergeAnnotations(bundle, webApp, mergeContext, "/WEB-INF/classes");
+        SERVLET_SECURITY_ANNOTATION_MERGE_HANDLER.postProcessWebXmlElement(webApp, mergeContext);
         mergeContext.clearup();
     }
 

Added: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/annotation/ServletSecurityAnnotationMergeHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/annotation/ServletSecurityAnnotationMergeHandler.java?rev=934335&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/annotation/ServletSecurityAnnotationMergeHandler.java
(added)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/annotation/ServletSecurityAnnotationMergeHandler.java
Thu Apr 15 09:11:02 2010
@@ -0,0 +1,233 @@
+/**
+ *  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.web25.deployment.merge.annotation;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.Servlet;
+import javax.servlet.annotation.HttpConstraint;
+import javax.servlet.annotation.HttpMethodConstraint;
+import javax.servlet.annotation.ServletSecurity;
+import javax.servlet.annotation.ServletSecurity.TransportGuarantee;
+
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.web25.deployment.merge.MergeContext;
+import org.apache.geronimo.web25.deployment.merge.webfragment.ServletMappingMergeHandler;
+import org.apache.geronimo.xbeans.javaee6.AuthConstraintType;
+import org.apache.geronimo.xbeans.javaee6.SecurityConstraintType;
+import org.apache.geronimo.xbeans.javaee6.ServletMappingType;
+import org.apache.geronimo.xbeans.javaee6.ServletType;
+import org.apache.geronimo.xbeans.javaee6.UrlPatternType;
+import org.apache.geronimo.xbeans.javaee6.WebAppType;
+import org.apache.geronimo.xbeans.javaee6.WebResourceCollectionType;
+import org.osgi.framework.Bundle;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ServletSecurityAnnotationMergeHandler implements AnnotationMergeHandler {
+
+    private static final Logger logger = LoggerFactory.getLogger(ServletSecurityAnnotationMergeHandler.class);
+
+    public static final Set<String> SUPPORTED_HTTP_METHODS = new HashSet<String>();
+    static {
+        SUPPORTED_HTTP_METHODS.add("OPTIONS");
+        SUPPORTED_HTTP_METHODS.add("GET");
+        SUPPORTED_HTTP_METHODS.add("HEAD");
+        SUPPORTED_HTTP_METHODS.add("POST");
+        SUPPORTED_HTTP_METHODS.add("PUT");
+        SUPPORTED_HTTP_METHODS.add("DELETE");
+        SUPPORTED_HTTP_METHODS.add("TRACE");
+        SUPPORTED_HTTP_METHODS.add("CONNECT");
+    }
+
+    @Override
+    public void merge(Class<?>[] classes, WebAppType webApp, MergeContext mergeContext)
throws DeploymentException {
+    }
+
+    @Override
+    public void postProcessWebXmlElement(WebAppType webApp, MergeContext mergeContext) throws
DeploymentException {
+        try {
+            Bundle bundle = mergeContext.getBundle();
+            Map<String, Set<String>> servletClassNameUrlPatternsMap = genetateServletClassUrlPatternsMap(webApp,
mergeContext);
+            for (ServletType servlet : webApp.getServletArray()) {
+                if (servlet.getServletClass() == null || servlet.getServletClass().getStringValue().isEmpty())
{
+                    continue;
+                }
+                String servletClassName = servlet.getServletClass().getStringValue();
+                Class<?> cls = bundle.loadClass(servletClassName);
+                if (!Servlet.class.isAssignableFrom(cls)) {
+                    continue;
+                }
+                ServletSecurity servletSecurity = cls.getAnnotation(ServletSecurity.class);
+                if (servletSecurity == null) {
+                    continue;
+                }
+                Set<String> urlPatterns = servletClassNameUrlPatternsMap.get(servletClassName);
+                if (urlPatterns == null || urlPatterns.isEmpty()) {
+                    if (logger.isDebugEnabled()) {
+                        logger.debug("No url pattern for the servlet class " + servletClassName
+ " is found in the deployment plan, SecurityConstraint annotation is ignored");
+                    }
+                    continue;
+                }
+                HttpConstraint httpConstraint = servletSecurity.value();
+                if (servletSecurity.httpMethodConstraints().length > 0) {
+                    String[] omissionMethods = new String[servletSecurity.httpMethodConstraints().length];
+                    int iIndex = 0;
+                    for (HttpMethodConstraint httpMethodConstraint : servletSecurity.httpMethodConstraints())
{
+                        //Generate a security-constraint for each HttpMethodConstraint
+                        String httpMethod = normalizeHTTPMethod(servletClassName, httpMethodConstraint.value());
+                        omissionMethods[iIndex++] = httpMethod;
+                        addNewHTTPMethodSecurityConstraint(webApp, servletClassName, httpMethodConstraint.rolesAllowed(),
httpMethodConstraint.transportGuarantee(), httpMethodConstraint
+                                .emptyRoleSemantic(), httpMethod, urlPatterns);
+                    }
+                } else {
+                    addNewHTTPSecurityConstraint(webApp, servletClassName, httpConstraint.rolesAllowed(),
httpConstraint.transportGuarantee(), httpConstraint.value(), new String[] {}, urlPatterns);
+                }
+            }
+        } catch (ClassNotFoundException e) {
+            throw new DeploymentException("Fail to load servlet class", e);
+        }
+    }
+
+    /**
+     * Create Security Constraint based on the arguments
+     * @param webApp
+     * @param rolesAllowed
+     * @param transportGuarantee
+     * @param emptyRoleSemantic
+     * @return null when emptyRoleSemantic=PERMIT AND rolesAllowed={} AND transportGuarantee=NONE
+     */
+    private SecurityConstraintType addNewSecurityConstraint(WebAppType webApp, String className,
String[] rolesAllowed, TransportGuarantee transportGuarantee,
+            ServletSecurity.EmptyRoleSemantic emptyRoleSemantic) throws DeploymentException
{
+        if (rolesAllowed.length > 0 && emptyRoleSemantic.equals(ServletSecurity.EmptyRoleSemantic.DENY))
{
+            throw new DeploymentException("EmptyRoleSemantic with value DENY is not allowed
in combination with a non-empty rolesAllowed list in the class " + className);
+        }
+        //If emptyRoleSemantic=PERMIT AND rolesAllowed={} AND transportGuarantee=NONE then
+        //No Constraint
+        if (rolesAllowed.length > 0 || transportGuarantee.equals(TransportGuarantee.CONFIDENTIAL)
|| emptyRoleSemantic.equals(ServletSecurity.EmptyRoleSemantic.DENY)) {
+            SecurityConstraintType securityConstraint = webApp.addNewSecurityConstraint();
+            if (transportGuarantee.equals(TransportGuarantee.CONFIDENTIAL)) {
+                securityConstraint.addNewUserDataConstraint().addNewTransportGuarantee().setStringValue(TransportGuarantee.CONFIDENTIAL.name());
+            }
+            if (emptyRoleSemantic.equals(ServletSecurity.EmptyRoleSemantic.DENY)) {
+                securityConstraint.addNewAuthConstraint();
+            } else {
+                AuthConstraintType authConstraint = securityConstraint.addNewAuthConstraint();
+                for (String roleAllowed : rolesAllowed) {
+                    authConstraint.addNewRoleName().setStringValue(roleAllowed);
+                }
+            }
+            return securityConstraint;
+        }
+        return null;
+    }
+
+    private SecurityConstraintType addNewHTTPSecurityConstraint(WebAppType webApp, String
className, String[] rolesAllowed, TransportGuarantee transportGuarantee,
+            ServletSecurity.EmptyRoleSemantic emptyRoleSemantic, String[] omissionMethods,
Set<String> urlPatterns) throws DeploymentException {
+        SecurityConstraintType securityConstraint = addNewSecurityConstraint(webApp, className,
rolesAllowed, transportGuarantee, emptyRoleSemantic);
+        if (omissionMethods.length > 0 || securityConstraint != null) {
+            if (securityConstraint == null) {
+                securityConstraint = webApp.addNewSecurityConstraint();
+            }
+            WebResourceCollectionType webResourceCollection = securityConstraint.getWebResourceCollectionArray().length
== 0 ? securityConstraint.addNewWebResourceCollection() : securityConstraint
+                    .getWebResourceCollectionArray(0);
+            for (String omissionMethod : omissionMethods) {
+                webResourceCollection.addNewHttpMethodOmission().setStringValue(omissionMethod);
+            }
+            for (String urlPattern : urlPatterns) {
+                webResourceCollection.addNewUrlPattern().setStringValue(urlPattern);
+            }
+        }
+        return securityConstraint;
+    }
+
+    private SecurityConstraintType addNewHTTPMethodSecurityConstraint(WebAppType webApp,
String className, String[] rolesAllowed, TransportGuarantee transportGuarantee,
+            ServletSecurity.EmptyRoleSemantic emptyRoleSemantic, String httpMethod, Set<String>
urlPatterns) throws DeploymentException {
+        SecurityConstraintType securityConstraint = addNewSecurityConstraint(webApp, className,
rolesAllowed, transportGuarantee, emptyRoleSemantic);
+        if (securityConstraint == null) {
+            securityConstraint = webApp.addNewSecurityConstraint();
+        }
+        WebResourceCollectionType webResourceCollection = securityConstraint.getWebResourceCollectionArray().length
== 0 ? securityConstraint.addNewWebResourceCollection() : securityConstraint
+                .getWebResourceCollectionArray(0);
+        for (String urlPattern : urlPatterns) {
+            webResourceCollection.addNewUrlPattern().setStringValue(urlPattern);
+        }
+        webResourceCollection.addNewHttpMethod().setStringValue(httpMethod);
+        return securityConstraint;
+    }
+
+    private void addSecurityConstraintHttpMethod(SecurityConstraintType securityConstraint,
String httpMethod) {
+        WebResourceCollectionType webResourceCollection = securityConstraint.getWebResourceCollectionArray().length
== 0 ? securityConstraint.addNewWebResourceCollection() : securityConstraint
+                .getWebResourceCollectionArray(0);
+        webResourceCollection.addNewHttpMethod().setStringValue(httpMethod);
+    }
+
+    private String normalizeHTTPMethod(String servletClassName, String httpMethod) throws
DeploymentException {
+        if (httpMethod == null || httpMethod.isEmpty()) {
+            throw new DeploymentException("HTTP protocol method could not be null or empty
string in the ServletSecurity anntation of the class " + servletClassName);
+        }
+        httpMethod = httpMethod.toUpperCase();
+        if (!SUPPORTED_HTTP_METHODS.contains(httpMethod)) {
+            throw new DeploymentException("Invalid HTTP protocol method " + httpMethod +
" in the ServletSecurity annotation of the class " + servletClassName);
+        }
+        return httpMethod;
+    }
+
+    private Map<String, Set<String>> genetateServletClassUrlPatternsMap(WebAppType
webApp, MergeContext mergeContext) {
+        Set<String> urlPatternsConfiguredInSecurityConstraint = new HashSet<String>();
+        for (SecurityConstraintType secuirtyConstrait : webApp.getSecurityConstraintArray())
{
+            for (WebResourceCollectionType webResourceCollection : secuirtyConstrait.getWebResourceCollectionArray())
{
+                for (UrlPatternType urlPattern : webResourceCollection.getUrlPatternArray())
{
+                    urlPatternsConfiguredInSecurityConstraint.add(urlPattern.getStringValue());
+                }
+            }
+        }
+        Map<String, Set<String>> servletClassUrlPatternsMap = new HashMap<String,
Set<String>>();
+        for (ServletType servlet : webApp.getServletArray()) {
+            if (servlet.getServletClass() == null || servlet.getServletClass().getStringValue().isEmpty())
{
+                continue;
+            }
+            String servletClassName = servlet.getServletClass().getStringValue();
+            Set<String> urlPatterns = servletClassUrlPatternsMap.get(servlet.getServletClass().getStringValue());
+            if (urlPatterns == null) {
+                urlPatterns = new HashSet<String>();
+                servletClassUrlPatternsMap.put(servletClassName, urlPatterns);
+            }
+            ServletMappingType servletMapping = (ServletMappingType) mergeContext.getAttribute(ServletMappingMergeHandler.createServletMappingKey(servlet.getServletName().getStringValue()));
+            if (servletMapping != null) {
+                for (UrlPatternType urlPattern : servletMapping.getUrlPatternArray()) {
+                    String urlPatternValue = urlPattern.getStringValue();
+                    if (!urlPatternsConfiguredInSecurityConstraint.contains(urlPatternValue))
{
+                        urlPatterns.add(urlPatternValue);
+                    }
+                }
+            }
+        }
+        return servletClassUrlPatternsMap;
+    }
+
+    @Override
+    public void preProcessWebXmlElement(WebAppType webApp, MergeContext mergeContext) throws
DeploymentException {
+    }
+}

Propchange: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/annotation/ServletSecurityAnnotationMergeHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/annotation/ServletSecurityAnnotationMergeHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/annotation/ServletSecurityAnnotationMergeHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletMappingMergeHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletMappingMergeHandler.java?rev=934335&r1=934334&r2=934335&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletMappingMergeHandler.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletMappingMergeHandler.java
Thu Apr 15 09:11:02 2010
@@ -72,9 +72,9 @@ public class ServletMappingMergeHandler 
 
     @Override
     public void preProcessWebXmlElement(WebAppType webApp, MergeContext context) throws DeploymentException
{
-        for (ServletMappingType filterMapping : webApp.getServletMappingArray()) {
-            String filterName = filterMapping.getServletName().getStringValue();
-            context.setAttribute(createServletMappingKey(filterName), filterMapping);
+        for (ServletMappingType servletMapping : webApp.getServletMappingArray()) {
+            String filterName = servletMapping.getServletName().getStringValue();
+            context.setAttribute(createServletMappingKey(filterName), servletMapping);
         }
         for (SubMergeHandler<ServletMappingType, ServletMappingType> subMergeHandler
: subMergeHandlers) {
             subMergeHandler.preProcessWebXmlElement(webApp, context);

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/security/URLPattern.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/security/URLPattern.java?rev=934335&r1=934334&r2=934335&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/security/URLPattern.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/security/URLPattern.java
Thu Apr 15 09:11:02 2010
@@ -75,7 +75,7 @@ public class URLPattern {
             return pattern;
         } else {
             HashSet<String> bucket = new HashSet<String>();
-            StringBuffer result = new StringBuffer(pattern);
+            StringBuilder result = new StringBuilder(pattern);
 
             // Collect a set of qualifying patterns, depending on the type of this pattern.
             for (URLPattern p : patterns) {

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatInstanceManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatInstanceManager.java?rev=934335&r1=934334&r2=934335&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatInstanceManager.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatInstanceManager.java
Thu Apr 15 09:11:02 2010
@@ -59,6 +59,9 @@ public class TomcatInstanceManager imple
 
     public Object newInstance(String className) throws IllegalAccessException, InvocationTargetException,
NamingException, InstantiationException, ClassNotFoundException {
         try {
+            //TODO Specification 13.4.1 p125
+            //The @ServletSecurity annotation is not applied to the url-patterns of a ServletRegistration
created using the addServlet(String, Servlet)  method of the ServletContext interface,
+            //unless the Servlet was constructed by the createServlet method of the ServletContext
interface.
             return holder.newInstance(className, classLoader, context);
         } catch (IllegalAccessException e) {
             throw e;

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/security/authentication/FormAuthenticator.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/security/authentication/FormAuthenticator.java?rev=934335&r1=934334&r2=934335&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/security/authentication/FormAuthenticator.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/security/authentication/FormAuthenticator.java
Thu Apr 15 09:11:02 2010
@@ -428,12 +428,13 @@ public class FormAuthenticator implement
                 (SavedRequest) session.getNote(Constants.FORM_REQUEST_NOTE);
         if (saved == null)
             return (null);
-        StringBuffer sb = new StringBuffer(saved.getRequestURI());
         if (saved.getQueryString() != null) {
+            StringBuilder sb = new StringBuilder(saved.getRequestURI());
             sb.append('?');
             sb.append(saved.getQueryString());
+            return sb.toString();
         }
-        return (sb.toString());
+        return saved.getRequestURI();
 
     }
 

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/security/jacc/JACCAuthorizer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/security/jacc/JACCAuthorizer.java?rev=934335&r1=934334&r2=934335&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/security/jacc/JACCAuthorizer.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/security/jacc/JACCAuthorizer.java
Thu Apr 15 09:11:02 2010
@@ -20,17 +20,17 @@
 
 package org.apache.geronimo.tomcat.security.jacc;
 
+import java.security.AccessControlContext;
+import java.security.AccessControlException;
+
+import javax.security.jacc.WebResourcePermission;
+import javax.security.jacc.WebUserDataPermission;
+
 import org.apache.catalina.connector.Request;
-import org.apache.catalina.Realm;
-import org.apache.geronimo.tomcat.security.Authorizer;
 import org.apache.geronimo.tomcat.security.AuthResult;
+import org.apache.geronimo.tomcat.security.Authorizer;
 import org.apache.geronimo.tomcat.security.UserIdentity;
 
-import javax.security.jacc.WebUserDataPermission;
-import javax.security.jacc.WebResourcePermission;
-import java.security.AccessControlContext;
-import java.security.AccessControlException;
-
 /**
  * @version $Rev$ $Date$
  */



Mime
View raw message