List Info

Thread: svn commit: r592149 - in /portals/jetspeed-2/branches/JETSPEED-2.1.3: components/security/src/java/o




svn commit: r592149 - in /portals/jetspeed-2/branches/JETSPEED-2. 1.3: components/security/src/java/o
country flaguser name
United States
2007-11-05 15:05:31
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/securi
ty/src/java/org/apache/jetspeed/security/impl/BasePrincipalI
mpl.java
   
portals/jetspeed-2/branches/JETSPEED-2.1.3/components/securi
ty/src/java/org/apache/jetspeed/security/impl/GroupPrincipal
Impl.java
   
portals/jetspeed-2/branches/JETSPEED-2.1.3/components/securi
ty/src/java/org/apache/jetspeed/security/impl/RolePrincipalI
mpl.java
   
portals/jetspeed-2/branches/JETSPEED-2.1.3/components/securi
ty/src/java/org/apache/jetspeed/security/impl/UserPrincipalI
mpl.java
   
portals/jetspeed-2/branches/JETSPEED-2.1.3/components/securi
ty/src/java/org/apache/jetspeed/security/om/impl/InternalGro
upPrincipalImpl.java
   
portals/jetspeed-2/branches/JETSPEED-2.1.3/components/securi
ty/src/java/org/apache/jetspeed/security/spi/impl/DefaultGro
upSecurityHandler.java
   
portals/jetspeed-2/branches/JETSPEED-2.1.3/components/securi
ty/src/java/org/apache/jetspeed/security/spi/impl/DefaultRol
eSecurityHandler.java
   
portals/jetspeed-2/branches/JETSPEED-2.1.3/components/securi
ty/src/java/org/apache/jetspeed/security/spi/impl/DefaultSec
urityMappingHandler.java
   
portals/jetspeed-2/branches/JETSPEED-2.1.3/components/securi
ty/src/java/org/apache/jetspeed/security/spi/impl/DefaultUse
rSecurityHandler.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/securi
ty/src/java/org/apache/jetspeed/security/impl/BasePrincipalI
mpl.java
URL: http://svn.apache.org/
viewvc/portals/jetspeed-2/branches/JETSPEED-2.1.3/components
/security/src/java/org/apache/jetspeed/security/impl/BasePri
ncipalImpl.java?rev=592149&r1=592148&r2=592149&v
iew=diff
============================================================
==================
---
portals/jetspeed-2/branches/JETSPEED-2.1.3/components/securi
ty/src/java/org/apache/jetspeed/security/impl/BasePrincipalI
mpl.java (original)
+++
portals/jetspeed-2/branches/JETSPEED-2.1.3/components/securi
ty/src/java/org/apache/jetspeed/security/impl/BasePrincipalI
mpl.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/securi
ty/src/java/org/apache/jetspeed/security/impl/GroupPrincipal
Impl.java
URL: http://svn.apache.org
/viewvc/portals/jetspeed-2/branches/JETSPEED-2.1.3/component
s/security/src/java/org/apache/jetspeed/security/impl/GroupP
rincipalImpl.java?rev=592149&r1=592148&r2=592149&
;view=diff
============================================================
==================
---
portals/jetspeed-2/branches/JETSPEED-2.1.3/components/securi
ty/src/java/org/apache/jetspeed/security/impl/GroupPrincipal
Impl.java (original)
+++
portals/jetspeed-2/branches/JETSPEED-2.1.3/components/securi
ty/src/java/org/apache/jetspeed/security/impl/GroupPrincipal
Impl.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/securi
ty/src/java/org/apache/jetspeed/security/impl/RolePrincipalI
mpl.java
URL: http://svn.apache.org/
viewvc/portals/jetspeed-2/branches/JETSPEED-2.1.3/components
/security/src/java/org/apache/jetspeed/security/impl/RolePri
ncipalImpl.java?rev=592149&r1=592148&r2=592149&v
iew=diff
============================================================
==================
---
portals/jetspeed-2/branches/JETSPEED-2.1.3/components/securi
ty/src/java/org/apache/jetspeed/security/impl/RolePrincipalI
mpl.java (original)
+++
portals/jetspeed-2/branches/JETSPEED-2.1.3/components/securi
ty/src/java/org/apache/jetspeed/security/impl/RolePrincipalI
mpl.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/securi
ty/src/java/org/apache/jetspeed/security/impl/UserPrincipalI
mpl.java
URL: http://svn.apache.org/
viewvc/portals/jetspeed-2/branches/JETSPEED-2.1.3/components
/security/src/java/org/apache/jetspeed/security/impl/UserPri
ncipalImpl.java?rev=592149&r1=592148&r2=592149&v
iew=diff
============================================================
==================
---
portals/jetspeed-2/branches/JETSPEED-2.1.3/components/securi
ty/src/java/org/apache/jetspeed/security/impl/UserPrincipalI
mpl.java (original)
+++
portals/jetspeed-2/branches/JETSPEED-2.1.3/components/securi
ty/src/java/org/apache/jetspeed/security/impl/UserPrincipalI
mpl.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/securi
ty/src/java/org/apache/jetspeed/security/om/impl/InternalGro
upPrincipalImpl.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=59
2148&r2=592149&view=diff
============================================================
==================
---
portals/jetspeed-2/branches/JETSPEED-2.1.3/components/securi
ty/src/java/org/apache/jetspeed/security/om/impl/InternalGro
upPrincipalImpl.java (original)
+++
portals/jetspeed-2/branches/JETSPEED-2.1.3/components/securi
ty/src/java/org/apache/jetspeed/security/om/impl/InternalGro
upPrincipalImpl.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/securi
ty/src/java/org/apache/jetspeed/security/spi/impl/DefaultGro
upSecurityHandler.java
URL: http://s
vn.apache.org/viewvc/portals/jetspeed-2/branches/JETSPEED-2.
1.3/components/security/src/java/org/apache/jetspeed/securit
y/spi/impl/DefaultGroupSecurityHandler.java?rev=592149&r
1=592148&r2=592149&view=diff
============================================================
==================
---
portals/jetspeed-2/branches/JETSPEED-2.1.3/components/securi
ty/src/java/org/apache/jetspeed/security/spi/impl/DefaultGro
upSecurityHandler.java (original)
+++
portals/jetspeed-2/branches/JETSPEED-2.1.3/components/securi
ty/src/java/org/apache/jetspeed/security/spi/impl/DefaultGro
upSecurityHandler.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.getPrincipalNameFromFu
llPath(internalGroup.getFullPath()),
+                                internalGroup.isEnabled(),
internalGroup.isMappingOnly()) 
+                            );
         }
         return groupPrincipals;
     }

Modified:
portals/jetspeed-2/branches/JETSPEED-2.1.3/components/securi
ty/src/java/org/apache/jetspeed/security/spi/impl/DefaultRol
eSecurityHandler.java
URL: http://sv
n.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/securi
ty/src/java/org/apache/jetspeed/security/spi/impl/DefaultRol
eSecurityHandler.java (original)
+++
portals/jetspeed-2/branches/JETSPEED-2.1.3/components/securi
ty/src/java/org/apache/jetspeed/security/spi/impl/DefaultRol
eSecurityHandler.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/securi
ty/src/java/org/apache/jetspeed/security/spi/impl/DefaultSec
urityMappingHandler.java
URL: http:/
/svn.apache.org/viewvc/portals/jetspeed-2/branches/JETSPEED-
2.1.3/components/security/src/java/org/apache/jetspeed/secur
ity/spi/impl/DefaultSecurityMappingHandler.java?rev=592149&a
mp;r1=592148&r2=592149&view=diff
============================================================
==================
---
portals/jetspeed-2/branches/JETSPEED-2.1.3/components/securi
ty/src/java/org/apache/jetspeed/security/spi/impl/DefaultSec
urityMappingHandler.java (original)
+++
portals/jetspeed-2/branches/JETSPEED-2.1.3/components/securi
ty/src/java/org/apache/jetspeed/security/spi/impl/DefaultSec
urityMappingHandler.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.InternalGroupPrincipalI
mpl;
 import
org.apache.jetspeed.security.om.impl.InternalUserPrincipalIm
pl;
 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.cre
ate(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.cre
ate(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/securi
ty/src/java/org/apache/jetspeed/security/spi/impl/DefaultUse
rSecurityHandler.java
URL: http://sv
n.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/securi
ty/src/java/org/apache/jetspeed/security/spi/impl/DefaultUse
rSecurityHandler.java (original)
+++
portals/jetspeed-2/branches/JETSPEED-2.1.3/components/securi
ty/src/java/org/apache/jetspeed/security/spi/impl/DefaultUse
rSecurityHandler.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.getPrincipalNameFromFull
Path(internalUser.getFullPath()));
+            userPrincipal = new
UserPrincipalImpl(UserPrincipalImpl.getPrincipalNameFromFull
Path(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/j
etspeed-2/branches/JETSPEED-2.1.3/jetspeed-api/src/java/org/
apache/jetspeed/security/BasePrincipal.java?rev=592149&r
1=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-unsubscribeportals.apache.org
For additional commands, e-mail: jetspeed-dev-helpportals.apache.org


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )