portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r692972 - in /portals/jetspeed-2/portal/branches/security-refactoring: components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/ jetspeed-api/src/main/java/org/apache/jetspeed/security/ jetspeed-api/src/main/java/org/apa...
Date Mon, 08 Sep 2008 01:16:17 GMT
Author: ate
Date: Sun Sep  7 18:16:16 2008
New Revision: 692972

URL: http://svn.apache.org/viewvc?rev=692972&view=rev
Log:
more core interfaces and base implementation fixes and improvements

Modified:
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java
    portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalAssociationHandler.java
    portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/JetspeedPrincipalAssociationStorageManager.java
    portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/JetspeedPrincipalStorageManager.java
    portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialManager.java
    portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialStorageManager.java

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java?rev=692972&r1=692971&r2=692972&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java
(original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java
Sun Sep  7 18:16:16 2008
@@ -34,6 +34,7 @@
 import org.apache.jetspeed.security.PrincipalAssociationRequiredException;
 import org.apache.jetspeed.security.PrincipalNotFoundException;
 import org.apache.jetspeed.security.PrincipalNotRemovableException;
+import org.apache.jetspeed.security.PrincipalReadOnlyException;
 import org.apache.jetspeed.security.PrincipalUpdateException;
 import org.apache.jetspeed.security.spi.JetspeedPrincipalAccessManager;
 import org.apache.jetspeed.security.spi.JetspeedPrincipalManagerSPI;
@@ -222,10 +223,9 @@
     }
 
     public void addPrincipal(JetspeedPrincipal principal, Set<JetspeedPrincipalAssociationReference>
associations)
-        throws PrincipalAssociationNotAllowedException, PrincipalAlreadyExistsException,
PrincipalAssociationRequiredException
+        throws PrincipalAssociationNotAllowedException, PrincipalAlreadyExistsException,
PrincipalAssociationRequiredException, PrincipalNotFoundException
     {
         validatePrincipal(principal);
-        
         if (associations != null)
         {
             AssociationHandlerKey key = null;
@@ -257,6 +257,20 @@
             }
         }
         jpsm.addPrincipal(principal, associations);
+        if (associations != null)
+        {
+            for ( JetspeedPrincipalAssociationReference ref : associations)
+            {
+                if (ref.type == JetspeedPrincipalAssociationReference.Type.FROM)
+                {
+                    addAssociation(ref.associationName, ref.ref, principal);
+                }
+                else
+                {
+                    addAssociation(ref.associationName, principal, ref.ref);
+                }
+            }
+        }
     }
 
     public void removePrincipal(JetspeedPrincipal principal) throws PrincipalNotFoundException,
@@ -267,20 +281,24 @@
         {
             if (jpah.getAssociationType().getFromPrincipalType().getName().equals(principalType.getName()))
             {
-                jpah.removeAllFrom(principal);
+                jpah.beforeRemoveFrom(principal);
             }
             else
             {
-                jpah.removeAllTo(principal);
+                jpah.beforeRemoveTo(principal);
             }
         }
         jpsm.removePrincipal(principal);
     }
 
     public void updatePrincipal(JetspeedPrincipal principal) throws PrincipalUpdateException,
-                                                            PrincipalNotFoundException
+                                                            PrincipalNotFoundException, PrincipalReadOnlyException
     {
         validatePrincipal(principal);
+        if (principal.isReadOnly())
+        {
+            throw new PrincipalReadOnlyException();
+        }
         jpsm.updatePrincipal(principal);
     }
 
@@ -321,7 +339,7 @@
         jpah.add(from, to);
     }
 
-    public void removeAssociation(String associationName, JetspeedPrincipal from, JetspeedPrincipal
to) throws PrincipalNotFoundException, PrincipalAssociationRequiredException
+    public void removeAssociation(String associationName, JetspeedPrincipal from, JetspeedPrincipal
to) throws PrincipalAssociationRequiredException
     {
         AssociationHandlerKey key = new AssociationHandlerKey(associationName, from.getType().getName(),
to.getType().getName());
         JetspeedPrincipalAssociationHandler jpah = assHandlers.get(key);

Modified: portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalAssociationHandler.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalAssociationHandler.java?rev=692972&r1=692971&r2=692972&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalAssociationHandler.java
(original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalAssociationHandler.java
Sun Sep  7 18:16:16 2008
@@ -25,11 +25,27 @@
 
     void add(JetspeedPrincipal from, JetspeedPrincipal to) throws PrincipalNotFoundException,
PrincipalAssociationNotAllowedException;
 
-    void remove(JetspeedPrincipal from, JetspeedPrincipal to) throws PrincipalNotFoundException,
PrincipalAssociationRequiredException;
+    void remove(JetspeedPrincipal from, JetspeedPrincipal to) throws PrincipalAssociationRequiredException;
 
-    // may only be called when removing the principal itself
-    void removeAllFrom(JetspeedPrincipal from) throws PrincipalNotFoundException, PrincipalNotRemovableException;

+    /**
+     * <p>
+     * When the from principal is removed, dependent to principals might need updating or
removal themselves first.
+     * </p>
+     * <p>
+     * External authorization providers can remove all the associations of the from principal
themselves on this message
+     * or do so during the subsequent removal of the principal itself
+     * </p>
+     */
+    void beforeRemoveFrom(JetspeedPrincipal from) throws PrincipalNotRemovableException,
DependentPrincipalException; 
 
-    // may only be called when removing the principal itself
-    void removeAllTo(JetspeedPrincipal to) throws PrincipalNotFoundException, PrincipalNotRemovableException;
+    /**
+     * <p>
+     * When the to principal is removed, dependent from principals might need updating or
removal themselves first
+     * </p>
+     * <p>
+     * External authorization providers can remove all the associations of the to principal
themselves on this message
+     * or do so during the subsequent removal of the principal itself
+     * </p>
+     */
+    void beforeRemoveTo(JetspeedPrincipal to) throws PrincipalNotRemovableException, DependentPrincipalException;
 }

Modified: portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/JetspeedPrincipalAssociationStorageManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/JetspeedPrincipalAssociationStorageManager.java?rev=692972&r1=692971&r2=692972&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/JetspeedPrincipalAssociationStorageManager.java
(original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/JetspeedPrincipalAssociationStorageManager.java
Sun Sep  7 18:16:16 2008
@@ -31,5 +31,5 @@
         throws PrincipalNotFoundException, PrincipalAssociationUnsupportedException, PrincipalAssociationNotAllowedException;
 
     void removeAssociation(JetspeedPrincipal from, JetspeedPrincipal to, String associationName)
-        throws PrincipalNotFoundException, PrincipalAssociationUnsupportedException, PrincipalAssociationRequiredException;
+        throws PrincipalAssociationUnsupportedException, PrincipalAssociationRequiredException;
 }

Modified: portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/JetspeedPrincipalStorageManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/JetspeedPrincipalStorageManager.java?rev=692972&r1=692971&r2=692972&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/JetspeedPrincipalStorageManager.java
(original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/JetspeedPrincipalStorageManager.java
Sun Sep  7 18:16:16 2008
@@ -25,6 +25,7 @@
 import org.apache.jetspeed.security.PrincipalAssociationNotAllowedException;
 import org.apache.jetspeed.security.PrincipalNotFoundException;
 import org.apache.jetspeed.security.PrincipalNotRemovableException;
+import org.apache.jetspeed.security.PrincipalReadOnlyException;
 import org.apache.jetspeed.security.PrincipalUpdateException;
 import org.apache.jetspeed.security.PrincipalAssociationRequiredException;
 
@@ -36,9 +37,9 @@
     boolean isMapped();
     
     void addPrincipal(JetspeedPrincipal principal, Set<JetspeedPrincipalAssociationReference>
associations)
-        throws PrincipalAssociationNotAllowedException, PrincipalAlreadyExistsException,
PrincipalAssociationRequiredException;
+        throws PrincipalAssociationNotAllowedException, PrincipalAlreadyExistsException,
PrincipalAssociationRequiredException, PrincipalNotFoundException;
 
-    void updatePrincipal(JetspeedPrincipal principal) throws PrincipalUpdateException, PrincipalNotFoundException;
+    void updatePrincipal(JetspeedPrincipal principal) throws PrincipalUpdateException, PrincipalNotFoundException,
PrincipalReadOnlyException;
 
     void removePrincipal(JetspeedPrincipal principal)
         throws PrincipalNotFoundException, PrincipalNotRemovableException, DependentPrincipalException;

Modified: portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialManager.java?rev=692972&r1=692971&r2=692972&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialManager.java
(original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialManager.java
Sun Sep  7 18:16:16 2008
@@ -16,22 +16,9 @@
  */
 package org.apache.jetspeed.security.spi;
 
-import java.util.List;
-
-import org.apache.jetspeed.security.PasswordCredential;
-import org.apache.jetspeed.security.User;
-
 /**
  * @version $Id$
  */
 public interface UserPasswordCredentialManager extends UserPasswordCredentialStorageManager
 {
-    boolean isReadOnly();
-    
-    void setUserPasswordCredentialStorageManager(UserPasswordCredentialStorageManager sm);
-    PasswordCredential newPasswordCredential(User user);
-
-    List<PasswordCredential> getPasswordCredentials(String userName);
-
-    List<PasswordCredential> getPasswordCredentials(User user);
 }
\ No newline at end of file

Modified: portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialStorageManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialStorageManager.java?rev=692972&r1=692971&r2=692972&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialStorageManager.java
(original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialStorageManager.java
Sun Sep  7 18:16:16 2008
@@ -17,15 +17,14 @@
 package org.apache.jetspeed.security.spi;
 
 import org.apache.jetspeed.security.PasswordCredential;
+import org.apache.jetspeed.security.SecurityException;
+import org.apache.jetspeed.security.User;
 
 /**
  * @version $Id$
  */
 public interface UserPasswordCredentialStorageManager
 {
-    void addCredential(PasswordCredential credential);
-
-    void updateCredential(PasswordCredential credential);
-
-    void removeCredential(PasswordCredential credential);
+    PasswordCredential getPasswordCredential(User user);
+    void storePasswordCredential(PasswordCredential credential) throws SecurityException;
 }



---------------------------------------------------------------------
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