geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgenen...@apache.org
Subject svn commit: r159119 - geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
Date Sat, 26 Mar 2005 21:33:03 GMT
Author: jgenender
Date: Sat Mar 26 13:33:02 2005
New Revision: 159119

URL: http://svn.apache.org/viewcvs?view=rev&rev=159119
Log:
Added unchecked permissions normalization code to combine common distinct permissions per
the JACC spec

Modified:
    geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java

Modified: geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java?view=diff&r1=159118&r2=159119
==============================================================================
--- geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
(original)
+++ geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
Sat Mar 26 13:33:02 2005
@@ -1006,18 +1006,18 @@
         //Create the uncheckedPermissions for WebResourcePermissions
         iter = uncheckedResourcePatterns.keySet().iterator();
         while (iter.hasNext()) {
-            String name = (String)iter.next();
-            String actions = (String)uncheckedResourcePatterns.get(name);
+            UncheckedItem item = (UncheckedItem)iter.next();
+            String actions = (String)uncheckedResourcePatterns.get(item);
 
-            uncheckedPermissions.add(new WebResourcePermission(name, actions));
+            uncheckedPermissions.add(new WebResourcePermission(item.getName(), actions));
         }
         //Create the uncheckedPermissions for WebUserDataPermissions
         iter = uncheckedUserPatterns.keySet().iterator();
         while (iter.hasNext()) {
-            String name = (String)iter.next();
-            String actions = (String)uncheckedUserPatterns.get(name);
+            UncheckedItem item = (UncheckedItem)iter.next();
+            String actions = (String)uncheckedUserPatterns.get(item);
 
-            uncheckedPermissions.add(new WebUserDataPermission(name, actions));
+            uncheckedPermissions.add(new WebUserDataPermission(item.getName(), actions));
         }
 
         webModuleData.setAttribute("excludedPermissions", excludedPermissions);
@@ -1026,13 +1026,14 @@
     }
 
     private void addOrUpdatePattern(Map patternMap, String name, String actions){
-        String oldActions = (String)patternMap.get(name);
-        if (oldActions != null){
-            patternMap.put(name,actions + "," + oldActions);
+        UncheckedItem item = new UncheckedItem(name, actions);
+        String existingActions = (String)patternMap.get(item);
+        if (existingActions != null){
+            patternMap.put(item, actions + "," + existingActions);
             return;
         }
 
-        patternMap.put(name, actions);
+        patternMap.put(item, actions);
     }
 
     private static Set collectRoleNames(WebAppType webApp) {
@@ -1131,6 +1132,55 @@
         if (webApp.getLoginConfigArray().length > 1) throw new DeploymentException("Multiple
<login-config> elements found");
     }
 
+    class UncheckedItem{
+        final static int NA = 0x00;
+        final static int INTEGRAL = 0x01;
+        final static int CONFIDENTIAL = 0x02;
+
+        private int transportType = NA;
+        private String name;
+
+        public UncheckedItem(String name, String actions){
+            setName(name);
+            setTransportType(actions);
+        }
+
+        public boolean equals(Object o){
+            UncheckedItem item = (UncheckedItem)o;
+            return item.getKey().equals(this.getKey());
+        }
+
+        public String getKey(){
+            return (name + transportType);
+        }
+
+        public int hashCode(){
+            return getKey().hashCode();
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public void setName(String name) {
+            this.name = name;
+        }
+
+        public int getTransportType() {
+            return transportType;
+        }
+
+        public void setTransportType(String actions) {
+            String[] tokens = actions.split(":", 2);
+            if (tokens.length == 2) {
+                if (tokens[1].equals("INTEGRAL")) {
+                    this.transportType = INTEGRAL;
+                } else if (tokens[1].equals("CONFIDENTIAL")) {
+                    this.transportType = CONFIDENTIAL;
+                }
+            } 
+        }
+    }
 
     public static final GBeanInfo GBEAN_INFO;
 



Mime
View raw message