You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2007/12/17 17:20:59 UTC

svn commit: r604909 - in /lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya: ac/ ac/file/ ac/impl/ cms/ac/cocoon/

Author: andreas
Date: Mon Dec 17 08:20:58 2007
New Revision: 604909

URL: http://svn.apache.org/viewvc?rev=604909&view=rev
Log:
Access control refactoring: Added dedicated FileItem interface because not all items are configurable anymore. Added ManagedUserReference because otherwise the TransientUserReference would violate Liskov's substitution principle.

Added:
    lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/ManagedUserReference.java
    lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileItem.java
Modified:
    lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/Identifiable.java
    lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/Identity.java
    lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/Item.java
    lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/Machine.java
    lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/UserReference.java
    lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileGroup.java
    lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileIPRange.java
    lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileItemManager.java
    lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileRole.java
    lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileUser.java
    lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/AnonymousAuthenticator.java
    lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/TransientUserReference.java
    lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/UserAuthenticator.java
    lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/cms/ac/cocoon/PolicyHelper.java

Modified: lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/Identifiable.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/Identifiable.java?rev=604909&r1=604908&r2=604909&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/Identifiable.java (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/Identifiable.java Mon Dec 17 08:20:58 2007
@@ -26,7 +26,17 @@
  * An identifiable object which can be put into the session.
  */
 public interface Identifiable extends Serializable {
-    
+
+    /**
+     * <p>
+     * Returns an array of all {@link Accreditable}s belonging to this identifiable. The
+     * credentials of all of these {@link Accreditable}s have to be considered when making an
+     * authorization decision about the identifiable.
+     * </p>
+     * 
+     * @param manager The accreditable manager.
+     * @return An array of {@link Accreditable}s.
+     */
     Accreditable[] getAccreditables(AccreditableManager manager);
-    
+
 }

Modified: lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/Identity.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/Identity.java?rev=604909&r1=604908&r2=604909&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/Identity.java (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/Identity.java Mon Dec 17 08:20:58 2007
@@ -96,7 +96,16 @@
     }
 
     /**
-     * @return all {@link Accreditable}s which belong to this identity.
+     * <p>
+     * Returns an array of all {@link Accreditable}s belonging to the identifiables of this
+     * identity. The credentials of all of these {@link Accreditable}s have to be considered when
+     * making an authorization decision about the identity, i.e. the credential set of the identity
+     * is the union of all credential sets of all accreditables.
+     * </p>
+     * 
+     * @see Identifiable#getAccreditables(AccreditableManager)
+     * @param manager The accreditable manager.
+     * @return An array of {@link Accreditable}s.
      */
     public Accreditable[] getAccreditables(AccreditableManager manager) {
         Set accreditables = new HashSet();

Modified: lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/Item.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/Item.java?rev=604909&r1=604908&r2=604909&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/Item.java (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/Item.java Mon Dec 17 08:20:58 2007
@@ -61,17 +61,4 @@
      */
     void setDescription(String description);
     
-    /**
-     * Sets the configuration directory of this item.
-     * @param configurationDirectory The configuration directory.
-     */
-    void setConfigurationDirectory(File configurationDirectory);
-
-    /**
-     * Configures this item.
-     * @param configuration The configuration.
-     * @throws ConfigurationException when something went wrong.
-     */
-    void configure(Configuration configuration) throws ConfigurationException;
-
 }

Modified: lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/Machine.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/Machine.java?rev=604909&r1=604908&r2=604909&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/Machine.java (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/Machine.java Mon Dec 17 08:20:58 2007
@@ -24,11 +24,13 @@
 import java.util.Set;
 
 /**
- * A machine (representing an IP address).
+ * A machine, representing an IP address.
  * @version $Id: Machine.java 473841 2006-11-12 00:46:38Z gregor $
  */
 public class Machine implements Identifiable {
 
+    private static final long serialVersionUID = 1L;
+
     /**
      * Creates a new machine object. This method accepts
      * numeric IPv4 addresses like <code>"129.168.0.32"</code>,
@@ -74,6 +76,11 @@
         return getAddress().hashCode();
     }
 
+    /**
+     * This method returns all IP ranges which contain the machine's IP address.
+     * @see org.apache.lenya.ac.Identifiable#getAccreditables(org.apache.lenya.ac.AccreditableManager)
+     * @see #getIpRanges(AccreditableManager)
+     */
     public Accreditable[] getAccreditables(AccreditableManager manager) {
         IPRange[] ranges = getIpRanges(manager);
         Set accrs = new HashSet();
@@ -148,7 +155,7 @@
     }
     
     /**
-     * Returns the IP ranges this machine belongs to.
+     * Returns the IP ranges which contain the IP address of this machine.
      * @param manager The accreditable manager to obtain the IP ranges from.
      * @return An array of IP ranges.
      */

Added: lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/ManagedUserReference.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/ManagedUserReference.java?rev=604909&view=auto
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/ManagedUserReference.java (added)
+++ lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/ManagedUserReference.java Mon Dec 17 08:20:58 2007
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.lenya.ac;
+
+/**
+ * A reference to a managed user.
+ */
+public class ManagedUserReference extends UserReference {
+
+    /**
+     * @param id The user ID.
+     * @param managerId The ID of the accreditable manager the user belongs to.
+     */
+    public ManagedUserReference(String id, String managerId) {
+        super(id);
+        this.managerId = managerId;
+    }
+    
+    private static final long serialVersionUID = 1L;
+    private String managerId;
+
+    protected String getManagerId() {
+        return this.managerId;
+    }
+
+    public User getUser(AccreditableManager accrMgr) {
+        try {
+            if (canGetUserFrom(accrMgr)) {
+                return accrMgr.getUserManager().getUser(getId());
+            } else {
+                throw new RuntimeException("Invalid accreditable manager.");
+            }
+        } catch (AccessControlException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public boolean canGetUserFrom(AccreditableManager accrMgr) {
+        try {
+            UserManager userMgr = accrMgr.getUserManager();
+            return userMgr.getId().equals(getManagerId());
+        } catch (AccessControlException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+}

Modified: lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/UserReference.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/UserReference.java?rev=604909&r1=604908&r2=604909&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/UserReference.java (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/UserReference.java Mon Dec 17 08:20:58 2007
@@ -21,45 +21,29 @@
 import java.util.HashSet;
 import java.util.Set;
 
+/**
+ * An identifiable which represents a user.
+ */
+public abstract class UserReference implements Identifiable {
 
-public class UserReference implements Identifiable {
+    private static final long serialVersionUID = 1L;
 
     private String id;
-    private String managerId;
-    
-    public UserReference(String id, String managerId) {
+
+    /**
+     * @param id The ID of the user.
+     * @see Item#getId()
+     */
+    public UserReference(String id) {
         this.id = id;
-        this.managerId = managerId;
     }
-    
+
+    /**
+     * @return The ID of the referenced user.
+     */
     public String getId() {
         return this.id;
     }
-    
-    protected String getManagerId() {
-        return this.managerId;
-    }
-
-    public User getUser(AccreditableManager accrMgr) {
-        try {
-            if (canGetUserFrom(accrMgr)) {
-                return accrMgr.getUserManager().getUser(getId());
-            } else {
-                throw new RuntimeException("Invalid accreditable manager.");
-            }
-        } catch (AccessControlException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    public boolean canGetUserFrom(AccreditableManager accrMgr) {
-        try {
-            UserManager userMgr = accrMgr.getUserManager();
-            return userMgr.getId().equals(getManagerId());
-        } catch (AccessControlException e) {
-            throw new RuntimeException(e);
-        }
-    }
 
     public Accreditable[] getAccreditables(AccreditableManager accrMgr) {
         Set accreditables = new HashSet();
@@ -74,12 +58,32 @@
         return (Accreditable[]) accreditables.toArray(new Accreditable[accreditables.size()]);
     }
 
+    /**
+     * @param accrMgr The accreditable manager.
+     * @return The user of the accreditable's user manager which is represented by this user
+     *         reference.
+     * @throws RuntimeException if the accreditable manager doesn't contain a user which is
+     *             represented by this user reference.
+     */
+    public abstract User getUser(AccreditableManager accrMgr);
+
+    /**
+     * @param accrMgr The accreditable manager.
+     * @return If the accreditable manager contains a user which is represented by this user
+     *         reference.
+     */
+    public abstract boolean canGetUserFrom(AccreditableManager accrMgr);
+
+    /**
+     * @param accrMgr The accreditable manager.
+     * @param user The user.
+     * @return All groups of the accreditable manager which have a rule matching the user.
+     */
     protected Set getMatchingGroups(AccreditableManager accrMgr, AttributeOwner user) {
         Set matchingGroups = new HashSet();
         if (user.getAttributeNames().length > 0) {
             try {
-                Group[] groups = accrMgr.getGroupManager()
-                        .getGroups();
+                Group[] groups = accrMgr.getGroupManager().getGroups();
                 for (int i = 0; i < groups.length; i++) {
                     if (groups[i].matches(user)) {
                         matchingGroups.add(groups[i]);

Modified: lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileGroup.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileGroup.java?rev=604909&r1=604908&r2=604909&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileGroup.java (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileGroup.java Mon Dec 17 08:20:58 2007
@@ -33,7 +33,7 @@
 /**
  * File-based group implementation.
  */
-public class FileGroup extends AbstractGroup {
+public class FileGroup extends AbstractGroup implements FileItem {
 
     protected static final String RULE = "rule";
 

Modified: lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileIPRange.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileIPRange.java?rev=604909&r1=604908&r2=604909&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileIPRange.java (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileIPRange.java Mon Dec 17 08:20:58 2007
@@ -21,7 +21,6 @@
 package org.apache.lenya.ac.file;
 
 import java.io.File;
-import java.io.Serializable;
 
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
@@ -36,14 +35,14 @@
 /**
  * IP range that is stored in a file.
  */
-public class FileIPRange extends AbstractIPRange implements Serializable {
+public class FileIPRange extends AbstractIPRange implements FileItem {
 
 	/**
 	 * Main method.
 	 * 
 	 * @param args
 	 *            The command-line arguments.
-	 * @deprecated This should bemoved to a JUnit test.
+	 * @deprecated This should be moved to a JUnit test.
 	 */
 	public static void main(String[] args) {
 		if (args.length == 0) {

Added: lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileItem.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileItem.java?rev=604909&view=auto
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileItem.java (added)
+++ lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileItem.java Mon Dec 17 08:20:58 2007
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *
+ */
+
+/* $Id: Item.java 473841 2006-11-12 00:46:38Z gregor $  */
+package org.apache.lenya.ac.file;
+
+import java.io.File;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.lenya.ac.Item;
+
+/**
+ * An item which is stored in a file.
+ */
+public interface FileItem extends Item {
+
+    /**
+     * Sets the configuration directory of this item.
+     * @param configurationDirectory The configuration directory.
+     */
+    void setConfigurationDirectory(File configurationDirectory);
+
+    /**
+     * Configures this item.
+     * @param configuration The configuration.
+     * @throws ConfigurationException when something went wrong.
+     */
+    void configure(Configuration configuration) throws ConfigurationException;
+    
+}

Modified: lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileItemManager.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileItemManager.java?rev=604909&r1=604908&r2=604909&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileItemManager.java (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileItemManager.java Mon Dec 17 08:20:58 2007
@@ -131,8 +131,7 @@
             File[] addedFiles = notifier.getAddedFiles();
 
             for (int i = 0; i < addedFiles.length; i++) {
-                Item item = loadItem(addedFiles[i]);
-                add(item);
+                add(loadItem(addedFiles[i]));
             }
 
             File[] removedFiles = notifier.getRemovedFiles();
@@ -171,12 +170,12 @@
      * @return An item.
      * @throws AccessControlException when something went wrong.
      */
-    protected Item loadItem(File file) throws AccessControlException {
+    protected FileItem loadItem(File file) throws AccessControlException {
         Configuration config = getItemConfiguration(file);
 
         String fileName = file.getName();
         String id = fileName.substring(0, fileName.length() - getSuffix().length());
-        Item item = (Item) items.get(id);
+        FileItem item = (FileItem) items.get(id);
 
         String klass = getItemClass(config);
         if (item == null) {
@@ -193,10 +192,10 @@
         return item;
     }
 
-    protected Item createItem(String klass) throws AccessControlException {
-        Item item;
+    protected FileItem createItem(String klass) throws AccessControlException {
+        FileItem item;
         try {
-            item = (Item) Class.forName(klass).newInstance();
+            item = (FileItem) Class.forName(klass).newInstance();
             ((AbstractItem) item).setItemManager(this);
         } catch (Exception e) {
             String errorMsg = "Exception when trying to instanciate: " + klass

Modified: lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileRole.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileRole.java?rev=604909&r1=604908&r2=604909&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileRole.java (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileRole.java Mon Dec 17 08:20:58 2007
@@ -32,7 +32,7 @@
  * File-based role implementation.
  * @version $Id: FileRole.java 473841 2006-11-12 00:46:38Z gregor $
  */
-public class FileRole extends AbstractRole {
+public class FileRole extends AbstractRole implements FileItem {
     
     /**
     * Creates a new file role.

Modified: lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileUser.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileUser.java?rev=604909&r1=604908&r2=604909&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileUser.java (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/file/FileUser.java Mon Dec 17 08:20:58 2007
@@ -19,7 +19,6 @@
 package org.apache.lenya.ac.file;
 
 import java.io.File;
-import java.io.Serializable;
 
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
@@ -35,7 +34,8 @@
  * File-based user implementation.
  * @version $Id: FileUser.java 473841 2006-11-12 00:46:38Z gregor $
  */
-public class FileUser extends AbstractUser implements Serializable {
+public class FileUser extends AbstractUser implements FileItem {
+    
     private static final Logger log = Logger.getLogger(FileUser.class);
 
     public static final String ID = "identity";

Modified: lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/AnonymousAuthenticator.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/AnonymousAuthenticator.java?rev=604909&r1=604908&r2=604909&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/AnonymousAuthenticator.java (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/AnonymousAuthenticator.java Mon Dec 17 08:20:58 2007
@@ -24,6 +24,7 @@
 import org.apache.lenya.ac.Authenticator;
 import org.apache.lenya.ac.ErrorHandler;
 import org.apache.lenya.ac.Identity;
+import org.apache.lenya.ac.ManagedUserReference;
 import org.apache.lenya.ac.UserManager;
 import org.apache.lenya.ac.UserReference;
 
@@ -66,7 +67,7 @@
                 }
                 identity.removeIdentifiable(oldUser);
             }
-            identity.addIdentifiable(new UserReference(username, userManager.getId()));
+            identity.addIdentifiable(new ManagedUserReference(username, userManager.getId()));
             authenticated = true;
         } else {
             if (getLogger().isDebugEnabled()) {

Modified: lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/TransientUserReference.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/TransientUserReference.java?rev=604909&r1=604908&r2=604909&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/TransientUserReference.java (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/TransientUserReference.java Mon Dec 17 08:20:58 2007
@@ -26,12 +26,20 @@
 import org.apache.lenya.ac.UserReference;
 import org.apache.lenya.util.Assert;
 
+/**
+ * A reference to a transient user.
+ */
 public class TransientUserReference extends UserReference {
     
+    private static final long serialVersionUID = 1L;
+    
     private TransientUser user;
     
+    /**
+     * @param user The user which this reference represents.
+     */
     public TransientUserReference(TransientUser user) {
-        super(user.getId(), "");
+        super(user.getId());
         Assert.notNull(user);
         this.user = user;
     }

Modified: lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/UserAuthenticator.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/UserAuthenticator.java?rev=604909&r1=604908&r2=604909&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/UserAuthenticator.java (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/impl/UserAuthenticator.java Mon Dec 17 08:20:58 2007
@@ -28,6 +28,7 @@
 import org.apache.lenya.ac.ErrorHandler;
 import org.apache.lenya.ac.Identity;
 import org.apache.lenya.ac.ManagedUser;
+import org.apache.lenya.ac.ManagedUserReference;
 import org.apache.lenya.ac.User;
 import org.apache.lenya.ac.UserManager;
 import org.apache.lenya.ac.UserReference;
@@ -108,7 +109,7 @@
                     }
                     identity.removeIdentifiable(oldUser);
                 }
-                identity.addIdentifiable(new UserReference(username, userManager.getId()));
+                identity.addIdentifiable(new ManagedUserReference(username, userManager.getId()));
                 authenticated = true;
             } else {
                 if (getLogger().isDebugEnabled()) {

Modified: lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/cms/ac/cocoon/PolicyHelper.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/cms/ac/cocoon/PolicyHelper.java?rev=604909&r1=604908&r2=604909&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/cms/ac/cocoon/PolicyHelper.java (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/cms/ac/cocoon/PolicyHelper.java Mon Dec 17 08:20:58 2007
@@ -34,11 +34,11 @@
 import org.apache.lenya.ac.AccreditableManager;
 import org.apache.lenya.ac.Identity;
 import org.apache.lenya.ac.Item;
+import org.apache.lenya.ac.ManagedUserReference;
 import org.apache.lenya.ac.Policy;
 import org.apache.lenya.ac.Role;
 import org.apache.lenya.ac.User;
 import org.apache.lenya.ac.UserManager;
-import org.apache.lenya.ac.UserReference;
 import org.apache.lenya.ac.impl.Credential;
 import org.apache.lenya.ac.impl.DefaultAccessController;
 import org.apache.lenya.ac.impl.DefaultPolicy;
@@ -325,7 +325,7 @@
             for (int i = 0; i < userArray.length; i++) {
                 Identity identity = new Identity();
                 User user = userArray[i];
-                identity.addIdentifiable(new UserReference(user.getId(), userManager.getId()));
+                identity.addIdentifiable(new ManagedUserReference(user.getId(), userManager.getId()));
                 Role[] roles = policy.getRoles(identity);
                 for (int roleIndex = 0; roleIndex < roles.length; roleIndex++) {
                     if (roles[roleIndex].getId().equals(roleId)) {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org