geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r161394 [2/2] - in geronimo/trunk/modules: axis-builder/ j2ee-builder/ j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/ j2ee-builder/src/schema/ j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/ jetty-builder/src/java/org/apache/geronimo/jetty/deployment/ jetty-builder/src/schema/ jetty/src/java/org/apache/geronimo/jetty/ jetty/src/java/org/apache/geronimo/jetty/interceptor/ jetty/src/test/org/apache/geronimo/jetty/ security-builder/src/java/org/apache/geronimo/security/deployment/ security/src/java/org/apache/geronimo/security/ security/src/java/org/apache/geronimo/security/deploy/ security/src/java/org/apache/geronimo/security/jacc/
Date Fri, 15 Apr 2005 05:35:29 GMT
Added: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jacc/ComponentPermissions.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jacc/ComponentPermissions.java?view=auto&rev=161394
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jacc/ComponentPermissions.java
(added)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jacc/ComponentPermissions.java
Thu Apr 14 22:35:25 2005
@@ -0,0 +1,48 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed 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.security.jacc;
+
+import java.security.PermissionCollection;
+import java.util.Map;
+import java.io.Serializable;
+
+/**
+ * @version $Rev:  $ $Date:  $
+ */
+public class ComponentPermissions implements Serializable {
+    private final PermissionCollection excludedPermissions;
+    private final PermissionCollection uncheckedPermissions;
+    private final Map rolePermissions;
+
+    public ComponentPermissions(PermissionCollection excludedPermissions, PermissionCollection
uncheckedPermissions, Map rolePermissions) {
+        this.excludedPermissions = excludedPermissions;
+        this.uncheckedPermissions = uncheckedPermissions;
+        this.rolePermissions = rolePermissions;
+    }
+
+    public PermissionCollection getExcludedPermissions() {
+        return excludedPermissions;
+    }
+
+    public PermissionCollection getUncheckedPermissions() {
+        return uncheckedPermissions;
+    }
+
+    public Map getRolePermissions() {
+        return rolePermissions;
+    }
+}

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jacc/PolicyConfigurationGeneric.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jacc/PolicyConfigurationGeneric.java?view=diff&r1=161393&r2=161394
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jacc/PolicyConfigurationGeneric.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jacc/PolicyConfigurationGeneric.java
Thu Apr 14 22:35:25 2005
@@ -28,6 +28,7 @@
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.Map;
 import javax.security.jacc.PolicyContextException;
 
 
@@ -91,6 +92,11 @@
         }
     }
 
+    public void setPrincipalRoleMapping(Map principalRoleMap) throws PolicyContextException
{
+        principalRoleMapping.clear();
+        principalRoleMapping.putAll(principalRoleMap);
+    }
+
     public void addToRole(String roleName, PermissionCollection permissions) throws PolicyContextException
{
         if (state != OPEN) throw new UnsupportedOperationException("Not in an open state");
 
@@ -166,18 +172,18 @@
     public void linkConfiguration(javax.security.jacc.PolicyConfiguration link) throws PolicyContextException
{
         if (state != OPEN) throw new UnsupportedOperationException("Not in an open state");
 
-        RoleMappingConfiguration roleMapper = RoleMappingConfigurationFactory.getRoleMappingFactory().getRoleMappingConfiguration(link.getContextID(),
false);
-        Iterator principals = principalRoleMapping.keySet().iterator();
-        while (principals.hasNext()) {
-            Principal principal = (Principal) principals.next();
-
-            Iterator roles = ((HashSet) principalRoleMapping.get(principal)).iterator();
-            while (roles.hasNext()) {
-                roleMapper.addRoleMapping((String) roles.next(), Collections.singletonList(principal));
-            }
-
-        }
-        link.linkConfiguration(this);
+//        RoleMappingConfiguration roleMapper = RoleMappingConfigurationFactory.getRoleMappingFactory().getRoleMappingConfiguration(link.getContextID(),
false);
+//        Iterator principals = principalRoleMapping.keySet().iterator();
+//        while (principals.hasNext()) {
+//            Principal principal = (Principal) principals.next();
+//
+//            Iterator roles = ((HashSet) principalRoleMapping.get(principal)).iterator();
+//            while (roles.hasNext()) {
+//                roleMapper.addRoleMapping((String) roles.next(), Collections.singletonList(principal));
+//            }
+//
+//        }
+//        link.linkConfiguration(this);
     }
 
     public void delete() throws PolicyContextException {
@@ -187,9 +193,9 @@
     public void commit() throws PolicyContextException {
         if (state != OPEN) throw new UnsupportedOperationException("Not in an open state");
 
-        Iterator principals = principalRoleMapping.keySet().iterator();
-        while (principals.hasNext()) {
-            Principal principal = (Principal) principals.next();
+        for (Iterator principalEntries = principalRoleMapping.entrySet().iterator(); principalEntries.hasNext();
) {
+            Map.Entry principalEntry = (Map.Entry) principalEntries.next();
+            Principal principal = (Principal) principalEntry.getKey();
             Permissions principalPermissions = (Permissions) principalPermissionsMap.get(principal);
 
             if (principalPermissions == null) {
@@ -197,12 +203,11 @@
                 principalPermissionsMap.put(principal, principalPermissions);
             }
 
-            Iterator roles = ((HashSet) principalRoleMapping.get(principal)).iterator();
-            while (roles.hasNext()) {
+            HashSet roleSet = (HashSet) principalEntry.getValue();
+            for (Iterator roles = roleSet.iterator(); roles.hasNext(); ) {
                 Permissions permissions = (Permissions) rolePermissionsMap.get(roles.next());
                 if (permissions == null) continue;
-                Enumeration rolePermissions = permissions.elements();
-                while (rolePermissions.hasMoreElements()) {
+                for (Enumeration rolePermissions = permissions.elements(); rolePermissions.hasMoreElements();
) {
                     principalPermissions.add((Permission) rolePermissions.nextElement());
                 }
             }

Added: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jacc/RoleDesignateSource.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jacc/RoleDesignateSource.java?view=auto&rev=161394
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jacc/RoleDesignateSource.java
(added)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jacc/RoleDesignateSource.java
Thu Apr 14 22:35:25 2005
@@ -0,0 +1,26 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed 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.security.jacc;
+
+import java.util.Map;
+
+/**
+ * @version $Rev:  $ $Date:  $
+ */
+public interface RoleDesignateSource {
+    Map getRoleDesignateMap();
+}

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jacc/RoleMappingConfiguration.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jacc/RoleMappingConfiguration.java?view=diff&r1=161393&r2=161394
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jacc/RoleMappingConfiguration.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jacc/RoleMappingConfiguration.java
Thu Apr 14 22:35:25 2005
@@ -18,6 +18,7 @@
 package org.apache.geronimo.security.jacc;
 
 import java.util.Collection;
+import java.util.Map;
 import javax.security.jacc.PolicyContextException;
 
 
@@ -45,5 +46,7 @@
      * @throws javax.security.jacc.PolicyContextException
      *          if the mapping principals to the same role twice occurs.
      */
-    public void addRoleMapping(String role, Collection principals) throws PolicyContextException;
+    void addRoleMapping(String role, Collection principals) throws PolicyContextException;
+
+    void setPrincipalRoleMapping(Map principalRoleMap) throws PolicyContextException;
 }

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jacc/RoleMappingConfigurationImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jacc/RoleMappingConfigurationImpl.java?view=diff&r1=161393&r2=161394
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jacc/RoleMappingConfigurationImpl.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jacc/RoleMappingConfigurationImpl.java
Thu Apr 14 22:35:25 2005
@@ -17,6 +17,7 @@
 package org.apache.geronimo.security.jacc;
 
 import java.util.Collection;
+import java.util.Map;
 import javax.security.jacc.PolicyContextException;
 
 
@@ -33,5 +34,9 @@
 
     public void addRoleMapping(String role, Collection principals) throws PolicyContextException
{
         policyConfiguration.addRoleMapping(role, principals);
+    }
+
+    public void setPrincipalRoleMapping(Map principalRoleMap) throws PolicyContextException
{
+        policyConfiguration.setPrincipalRoleMapping(principalRoleMap);
     }
 }



Mime
View raw message