portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r592149 - in /portals/jetspeed-2/branches/JETSPEED-2.1.3: components/security/src/java/org/apache/jetspeed/security/impl/ components/security/src/java/org/apache/jetspeed/security/om/impl/ components/security/src/java/org/apache/jetspeed/se...
Date Mon, 05 Nov 2007 21:05:31 GMT
Author: taylor
Date: Mon Nov  5 13:05:25 2007
New Revision: 592149

URL: http://svn.apache.org/viewvc?rev=592149&view=rev
Log:
https://issues.apache.org/jira/browse/JS2-21
always support mapping for groups
expose mapping flag to Jetspeed Principal implementations

Modified:
    portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/impl/BasePrincipalImpl.java
    portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/impl/GroupPrincipalImpl.java
    portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/impl/RolePrincipalImpl.java
    portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/impl/UserPrincipalImpl.java
    portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalGroupPrincipalImpl.java
    portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultGroupSecurityHandler.java
    portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultRoleSecurityHandler.java
    portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultSecurityMappingHandler.java
    portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultUserSecurityHandler.java
    portals/jetspeed-2/branches/JETSPEED-2.1.3/jetspeed-api/src/java/org/apache/jetspeed/security/BasePrincipal.java

Modified: portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/impl/BasePrincipalImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/impl/BasePrincipalImpl.java?rev=592149&r1=592148&r2=592149&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/impl/BasePrincipalImpl.java
(original)
+++ portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/impl/BasePrincipalImpl.java
Mon Nov  5 13:05:25 2007
@@ -37,6 +37,12 @@
     /** The full path. */
     private final String fullPath;
 
+    /** is this principal enabled **/
+    private boolean enabled = true;
+    
+    /** is this principal a mapping **/
+    private boolean isMapping = false;
+    
     /**
      * <p>
      * Principal constructor given a name and preferences root.
@@ -47,8 +53,15 @@
      */
     public BasePrincipalImpl(String name, String prefsRoot, boolean hiearchicalNames)
     {
+        this(name, prefsRoot, hiearchicalNames, true, false);
+    }
+    
+    public BasePrincipalImpl(String name, String prefsRoot, boolean hiearchicalNames, boolean
isEnabled, boolean isMapping)
+    {
         this.name = name;
         this.fullPath = getFullPathFromPrincipalName(name, prefsRoot, hiearchicalNames);
+        this.enabled = isEnabled;
+        this.isMapping = isMapping;
     }
 
     /**
@@ -184,8 +197,6 @@
 //        return getPrincipalNameFromFullPath(fullPath, prefsRoot, true);
 //    }
 
-    private boolean enabled = true;
-
     /**
      * @see org.apache.jetspeed.security.BasePrincipal#isEnabled()
      */
@@ -201,4 +212,10 @@
     {
         this.enabled = enabled;
     }
+   
+    public boolean isMapping()
+    {
+        return isMapping;
+    }
+    
 }

Modified: portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/impl/GroupPrincipalImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/impl/GroupPrincipalImpl.java?rev=592149&r1=592148&r2=592149&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/impl/GroupPrincipalImpl.java
(original)
+++ portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/impl/GroupPrincipalImpl.java
Mon Nov  5 13:05:25 2007
@@ -46,6 +46,11 @@
         super(groupName, PREFS_GROUP_ROOT, hiearchicalNames);
     }
 
+    public GroupPrincipalImpl(String groupName, boolean isEnabled, boolean isMapping)
+    {
+        super(groupName, PREFS_GROUP_ROOT, hiearchicalNames, isEnabled, isMapping);
+    }
+    
     /**
      * <p>Compares this principal to the specified object.  Returns true
      * if the object passed in matches the principal represented by

Modified: portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/impl/RolePrincipalImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/impl/RolePrincipalImpl.java?rev=592149&r1=592148&r2=592149&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/impl/RolePrincipalImpl.java
(original)
+++ portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/impl/RolePrincipalImpl.java
Mon Nov  5 13:05:25 2007
@@ -43,8 +43,14 @@
      */
     public RolePrincipalImpl(String roleName)
     {
-        super(roleName, PREFS_ROLE_ROOT, hiearchicalNames);
+        this(roleName, true, false);
     }
+    
+    public RolePrincipalImpl(String roleName, boolean isEnabled, boolean isMapping)
+    {
+        super(roleName, PREFS_ROLE_ROOT, hiearchicalNames, isEnabled, isMapping);
+    }
+    
 
     /**
      * <p>Compares this principal to the specified object.  Returns true

Modified: portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/impl/UserPrincipalImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/impl/UserPrincipalImpl.java?rev=592149&r1=592148&r2=592149&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/impl/UserPrincipalImpl.java
(original)
+++ portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/impl/UserPrincipalImpl.java
Mon Nov  5 13:05:25 2007
@@ -44,9 +44,19 @@
      */
     public UserPrincipalImpl(String userName)
     {
-        super(userName, PREFS_USER_ROOT, hiearchicalNames);   
+        this(userName, true, false);   
     }
 
+    public UserPrincipalImpl(String userName, boolean isMapping)
+    {
+        this(userName, true, isMapping);   
+    }
+    
+    public UserPrincipalImpl(String userName, boolean isEnabled, boolean isMapping)
+    {
+        super(userName, PREFS_USER_ROOT, hiearchicalNames, isEnabled, isMapping);
+    }
+    
     /**
      * <p>Compares this principal to the specified object.  Returns true
      * if the object passed in matches the principal represented by

Modified: portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalGroupPrincipalImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalGroupPrincipalImpl.java?rev=592149&r1=592148&r2=592149&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalGroupPrincipalImpl.java
(original)
+++ portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalGroupPrincipalImpl.java
Mon Nov  5 13:05:25 2007
@@ -16,6 +16,7 @@
  */
 package org.apache.jetspeed.security.om.impl;
 
+import java.util.ArrayList;
 import java.util.Collection;
 
 import org.apache.jetspeed.security.om.InternalGroupPrincipal;
@@ -47,7 +48,8 @@
      */
     public InternalGroupPrincipalImpl(String fullPath)
     {
-        super(GROUP_PRINCIPAL_CLASSNAME, fullPath);  
+        super(GROUP_PRINCIPAL_CLASSNAME, fullPath); 
+        this.rolePrincipals = new ArrayList();       
     }
 
     private Collection userPrincipals;

Modified: portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultGroupSecurityHandler.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultGroupSecurityHandler.java?rev=592149&r1=592148&r2=592149&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultGroupSecurityHandler.java
(original)
+++ portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultGroupSecurityHandler.java
Mon Nov  5 13:05:25 2007
@@ -61,7 +61,7 @@
         if (null != internalGroup)
         {
             groupPrincipal = new GroupPrincipalImpl(GroupPrincipalImpl
-                    .getPrincipalNameFromFullPath(internalGroup.getFullPath()));
+                    .getPrincipalNameFromFullPath(internalGroup.getFullPath()), internalGroup.isEnabled(),
internalGroup.isMappingOnly());
         }
         return groupPrincipal;
     }
@@ -125,9 +125,9 @@
                 continue;
             }
             groupPrincipals
-                    .add(new GroupPrincipalImpl(GroupPrincipalImpl
-                            .getPrincipalNameFromFullPath(internalGroup
-                                    .getFullPath())));
+                    .add(new GroupPrincipalImpl(GroupPrincipalImpl.getPrincipalNameFromFullPath(internalGroup.getFullPath()),
+                                internalGroup.isEnabled(), internalGroup.isMappingOnly())

+                            );
         }
         return groupPrincipals;
     }

Modified: portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultRoleSecurityHandler.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultRoleSecurityHandler.java?rev=592149&r1=592148&r2=592149&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultRoleSecurityHandler.java
(original)
+++ portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultRoleSecurityHandler.java
Mon Nov  5 13:05:25 2007
@@ -61,7 +61,8 @@
         if (null != internalRole)
         {
             rolePrincipal = new RolePrincipalImpl(RolePrincipalImpl
-                    .getPrincipalNameFromFullPath(internalRole.getFullPath()));
+                    .getPrincipalNameFromFullPath(internalRole.getFullPath()), 
+                    internalRole.isEnabled(), internalRole.isMappingOnly());
         }
         return rolePrincipal;
     }

Modified: portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultSecurityMappingHandler.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultSecurityMappingHandler.java?rev=592149&r1=592148&r2=592149&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultSecurityMappingHandler.java
(original)
+++ portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultSecurityMappingHandler.java
Mon Nov  5 13:05:25 2007
@@ -32,6 +32,7 @@
 import org.apache.jetspeed.security.om.InternalGroupPrincipal;
 import org.apache.jetspeed.security.om.InternalRolePrincipal;
 import org.apache.jetspeed.security.om.InternalUserPrincipal;
+import org.apache.jetspeed.security.om.impl.InternalGroupPrincipalImpl;
 import org.apache.jetspeed.security.om.impl.InternalUserPrincipalImpl;
 import org.apache.jetspeed.security.spi.SecurityAccess;
 import org.apache.jetspeed.security.spi.SecurityMappingHandler;
@@ -262,16 +263,19 @@
     {
         InternalGroupPrincipal internalGroup = commonQueries.getInternalGroupPrincipal(GroupPrincipalImpl
                 .getFullPathFromPrincipalName(groupFullPathName));
+        boolean isMappingOnly = false;
         if (null == internalGroup)
         {
-            throw new SecurityException(SecurityException.GROUP_DOES_NOT_EXIST.create(groupFullPathName));
-        }
+            // This is a record for mapping only.
+            isMappingOnly = true;
+            internalGroup = new InternalGroupPrincipalImpl(groupFullPathName);
+        }        
         Collection internalRoles = internalGroup.getRolePrincipals();
         InternalRolePrincipal internalRole = commonQueries.getInternalRolePrincipal(RolePrincipalImpl
                 .getFullPathFromPrincipalName(roleFullPathName));
         internalRoles.add(internalRole);
         internalGroup.setRolePrincipals(internalRoles);
-        commonQueries.setInternalGroupPrincipal(internalGroup, false);
+        commonQueries.setInternalGroupPrincipal(internalGroup, isMappingOnly);
     }
 
     /**
@@ -282,6 +286,13 @@
     {
         InternalGroupPrincipal internalGroup = commonQueries.getInternalGroupPrincipal(GroupPrincipalImpl
                 .getFullPathFromPrincipalName(groupFullPathName));
+        boolean isMappingOnly = false;
+        if (null == internalGroup)
+        {
+            // This is a record for mapping only.
+            isMappingOnly = true;
+            internalGroup = new InternalGroupPrincipalImpl(groupFullPathName);
+        }                
         if (null == internalGroup)
         {
             throw new SecurityException(SecurityException.GROUP_DOES_NOT_EXIST.create(internalGroup));
@@ -291,7 +302,7 @@
                 .getFullPathFromPrincipalName(roleFullPathName));
         internalRoles.remove(internalRole);
         internalGroup.setRolePrincipals(internalRoles);
-        commonQueries.setInternalGroupPrincipal(internalGroup, false);
+        commonQueries.setInternalGroupPrincipal(internalGroup, isMappingOnly);
     }
 
     /**

Modified: portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultUserSecurityHandler.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultUserSecurityHandler.java?rev=592149&r1=592148&r2=592149&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultUserSecurityHandler.java
(original)
+++ portals/jetspeed-2/branches/JETSPEED-2.1.3/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultUserSecurityHandler.java
Mon Nov  5 13:05:25 2007
@@ -63,7 +63,7 @@
         InternalUserPrincipal internalUser = securityAccess.getInternalUserPrincipal(username,
false);
         if (null != internalUser)
         {
-            userPrincipal = new UserPrincipalImpl(UserPrincipalImpl.getPrincipalNameFromFullPath(internalUser.getFullPath()));
+            userPrincipal = new UserPrincipalImpl(UserPrincipalImpl.getPrincipalNameFromFullPath(internalUser.getFullPath()),
true, internalUser.isMappingOnly());
             userPrincipal.setEnabled(internalUser.isEnabled());
         }
         return userPrincipal;

Modified: portals/jetspeed-2/branches/JETSPEED-2.1.3/jetspeed-api/src/java/org/apache/jetspeed/security/BasePrincipal.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/JETSPEED-2.1.3/jetspeed-api/src/java/org/apache/jetspeed/security/BasePrincipal.java?rev=592149&r1=592148&r2=592149&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-2.1.3/jetspeed-api/src/java/org/apache/jetspeed/security/BasePrincipal.java
(original)
+++ portals/jetspeed-2/branches/JETSPEED-2.1.3/jetspeed-api/src/java/org/apache/jetspeed/security/BasePrincipal.java
Mon Nov  5 13:05:25 2007
@@ -51,5 +51,12 @@
      * Setter for the enabled state</p>
      * @param enabled The enabled state
      */
-    void setEnabled(boolean enabled);    
+    void setEnabled(boolean enabled);
+    
+    /**
+     * <p>is this principal a security principal mapping or a real principal</p>
+     * @return true if is a mapping
+     */
+    boolean isMapping();
+    
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message