geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: rev 51833 - geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty
Date Sun, 03 Oct 2004 14:43:08 GMT
Author: adc
Date: Sun Oct  3 07:43:07 2004
New Revision: 51833

Modified:
   geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyXMLConfiguration.java
Log:
JACC v1.0 s3.1.3.2 has not been completely done. 
http://nagoya.apache.org/jira/browse/GERONIMO-351

Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyXMLConfiguration.java
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyXMLConfiguration.java
(original)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyXMLConfiguration.java
Sun Oct  3 07:43:07 2004
@@ -65,6 +65,7 @@
     private Map allMap = new HashMap();
     private Set allRoles = new HashSet();
     private Map roleRefs = new HashMap();
+    private Map servletRoles = new HashMap();
 
 
     public JettyXMLConfiguration(JettyWebAppContext context) {
@@ -88,6 +89,12 @@
         String name = node.getString("servlet-name", false, true);
         if (name == null) name = node.getString("servlet-class", false, true);
 
+        Set roles = (Set)servletRoles.get(name);
+        if (roles == null) {
+            roles = new HashSet();
+            servletRoles.put(name, roles);
+        }
+
         Iterator sRefsIter = node.iterator("security-role-ref");
         while (sRefsIter.hasNext()) {
             XmlParser.Node securityRef = (XmlParser.Node) sRefsIter.next();
@@ -97,6 +104,8 @@
             if (roleName != null && roleName.length() > 0 && roleLink
!= null && roleLink.length() > 0) {
                 if (log.isDebugEnabled()) log.debug("link role " + roleName + " to " + roleLink
+ " for " + this);
 
+                roles.add(roleName);
+
                 Set refs = (Set) roleRefs.get(roleLink);
                 if (refs == null) {
                     refs = new HashSet();
@@ -341,6 +350,21 @@
                     configuration.addToRole(roleLink, (WebRoleRefPermission) iter.next());
                 }
             }
+
+            keys = servletRoles.keySet().iterator();
+            while (keys.hasNext()) {
+                String servletName = (String) keys.next();
+                Set roles = new HashSet(securityRoles);
+
+                roles.removeAll((Set)servletRoles.get(servletName));
+
+                iter = roles.iterator();
+                while(iter.hasNext()) {
+                    String roleName = (String) iter.next();
+                    configuration.addToRole(roleName, new WebRoleRefPermission(servletName,
roleName));
+                }
+            }
+
         } catch (ClassCastException cce) {
             throw new GeronimoSecurityException("Policy configuration object does not implement
RoleMappingConfiguration", cce.getCause());
         } catch (PolicyContextException e) {

Mime
View raw message