[jboss-cvs] JBossAS SVN: r69507 - in projects/security/security-spi/trunk: authorization/src/main/org/jboss/security and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jan 31 14:40:21 EST 2008


Author: anil.saldhana at jboss.com
Date: 2008-01-31 14:40:21 -0500 (Thu, 31 Jan 2008)
New Revision: 69507

Added:
   projects/security/security-spi/trunk/acl/src/main/org/jboss/security/acl/ACLContext.java
   projects/security/security-spi/trunk/authorization/src/main/org/jboss/security/config/ModuleOption.java
Modified:
   projects/security/security-spi/trunk/acl/src/main/org/jboss/security/acl/ACLProvider.java
   projects/security/security-spi/trunk/authorization/src/main/org/jboss/security/AuthorizationManager.java
   projects/security/security-spi/trunk/authorization/src/main/org/jboss/security/authorization/EntitlementHolder.java
   projects/security/security-spi/trunk/spi/src/tests/org/jboss/test/security/factories/SomeAuthorizationManager.java
Log:
SECURITY-118:acl integration into authorizationmanager

Added: projects/security/security-spi/trunk/acl/src/main/org/jboss/security/acl/ACLContext.java
===================================================================
--- projects/security/security-spi/trunk/acl/src/main/org/jboss/security/acl/ACLContext.java	                        (rev 0)
+++ projects/security/security-spi/trunk/acl/src/main/org/jboss/security/acl/ACLContext.java	2008-01-31 19:40:21 UTC (rev 69507)
@@ -0,0 +1,68 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2007, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.security.acl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.security.authorization.AuthorizationException;
+import org.jboss.security.authorization.EntitlementHolder;
+import org.jboss.security.authorization.Resource;
+import org.jboss.security.identity.Identity;
+ 
+
+/**
+ *  Represents a set of ACLProviders
+ *  @author Anil.Saldhana at redhat.com
+ *  @since  Jan 30, 2008 
+ *  @version $Revision$
+ */
+public abstract class ACLContext
+{
+   protected String securityDomainName = null; 
+   protected Map<String,Object> sharedState = new HashMap<String,Object>(); 
+   protected List<ACLProvider> modules = new ArrayList<ACLProvider>(); 
+   
+   /**
+    * Instance Based Security
+    * Get all the entitlements assigned to the components of a Resource
+    * @param clazz class type of the entitlements
+    * @param resource A Resource (Can be a Portal Resource, a Rules Resource)
+    * @param identity The Identity against whom the entitlements need to be generated
+    * @return a Entitlements Wrapper
+    * @throws AuthorizationException
+    */
+   public abstract <T> EntitlementHolder<T> getEntitlements(final Class<T> clazz,
+         final Resource resource,
+         final Identity identity) throws AuthorizationException;
+   
+   /**
+    * Return the Security Domain Name
+    * @return security domain
+    */
+   public String getSecurityDomain()
+   {
+     return this.securityDomainName;   
+   } 
+}
\ No newline at end of file

Modified: projects/security/security-spi/trunk/acl/src/main/org/jboss/security/acl/ACLProvider.java
===================================================================
--- projects/security/security-spi/trunk/acl/src/main/org/jboss/security/acl/ACLProvider.java	2008-01-31 19:36:18 UTC (rev 69506)
+++ projects/security/security-spi/trunk/acl/src/main/org/jboss/security/acl/ACLProvider.java	2008-01-31 19:40:21 UTC (rev 69507)
@@ -22,20 +22,48 @@
 package org.jboss.security.acl;
 
 import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
 
+import org.jboss.security.authorization.AuthorizationException;
 import org.jboss.security.authorization.Resource;
+import org.jboss.security.identity.Identity;
 
 /**
  * <p>
  * An {@code ACLProvider} is responsible for the management of the ACLs associated to the
- * resources being protected. Implementations of this interface will tipically interact with some
+ * resources being protected. Implementations of this interface will typically interact with some
  * sort of repository, where the ACLs are stored.
  * </p>
  * 
  * @author <a href="mailto:sguilhen at redhat.com">Stefan Guilhen</a>
+ * @author Anil.Saldhana at redhat.com
  */
 public interface ACLProvider
 {
+   /**
+    * Initialize the provider
+    * @param sharedState Shared State
+    * @param options Options
+    */
+   public void initialize(Map<String,Object> sharedState, Map<String,Object> options);
+   
+   /**
+    * <p>
+    * For a given Resource and an Identity, return all the entitlements
+    * Eg: A portal page can consist of say 10 components such as windows, subpages
+    * etc. Now the Portal page can be the resource and for a given identity, the
+    * entitlements would be the subset of these 10 components to which the identity 
+    * has access
+    * </p>
+    * @param <T>
+    * @param resource
+    * @param identity
+    * @return
+    * @throws AuthorizationException
+    */
+   public <T> Set<T> getEntitlements(Class<T> clazz, Resource resource, Identity identity) 
+   throws AuthorizationException;
 
    /**
     * <p>
@@ -98,5 +126,11 @@
     * @return   {@code true} if the ACL was removed; {@code false} otherwise.
     */
    public boolean removeACL(Resource resource);
-
+   
+   /**
+    * Give an opportunity for the provider to finalize the 
+    * operations
+    * @return
+    */
+   public boolean tearDown();
 }

Modified: projects/security/security-spi/trunk/authorization/src/main/org/jboss/security/AuthorizationManager.java
===================================================================
--- projects/security/security-spi/trunk/authorization/src/main/org/jboss/security/AuthorizationManager.java	2008-01-31 19:36:18 UTC (rev 69506)
+++ projects/security/security-spi/trunk/authorization/src/main/org/jboss/security/AuthorizationManager.java	2008-01-31 19:40:21 UTC (rev 69507)
@@ -81,12 +81,13 @@
    /**
     * Instance Based Security
     * Get all the entitlements assigned to the components of a Resource
+    * @param clazz Defines the class type of the entitlements
     * @param resource A Resource (Can be a Portal Resource, a Rules Resource)
     * @param identity The Identity against whom the entitlements need to be generated
     * @return a Entitlements Wrapper
     * @throws AuthorizationException
     */
-   public EntitlementHolder<?> entitlements(final Resource resource,
+   public <T> EntitlementHolder<T> getEntitlements(final Class<T> clazz, final Resource resource,
          final Identity identity) throws AuthorizationException;
   
    

Modified: projects/security/security-spi/trunk/authorization/src/main/org/jboss/security/authorization/EntitlementHolder.java
===================================================================
--- projects/security/security-spi/trunk/authorization/src/main/org/jboss/security/authorization/EntitlementHolder.java	2008-01-31 19:36:18 UTC (rev 69506)
+++ projects/security/security-spi/trunk/authorization/src/main/org/jboss/security/authorization/EntitlementHolder.java	2008-01-31 19:40:21 UTC (rev 69507)
@@ -21,7 +21,7 @@
   */
 package org.jboss.security.authorization;
 
-import java.util.List;
+import java.util.Set;
 
 //$Id$
 
@@ -40,5 +40,5 @@
     * that are entitled
     * @return
     */
-   List<T> getEntitled();
+   Set<T> getEntitled();
 }
\ No newline at end of file

Added: projects/security/security-spi/trunk/authorization/src/main/org/jboss/security/config/ModuleOption.java
===================================================================
--- projects/security/security-spi/trunk/authorization/src/main/org/jboss/security/config/ModuleOption.java	                        (rev 0)
+++ projects/security/security-spi/trunk/authorization/src/main/org/jboss/security/config/ModuleOption.java	2008-01-31 19:40:21 UTC (rev 69507)
@@ -0,0 +1,53 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.security.config;
+
+/**
+ * A login module option name/value pair holder
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 45684 $
+ */
+public class ModuleOption
+{
+   String name;
+   Object value = "";
+
+   public ModuleOption(String name)
+   {
+      this.name = name;
+   }
+
+   public String getName()
+   {
+      return name;
+   }
+   public Object getValue()
+   {
+      return value;
+   }
+   public void setValue(Object value)
+   {
+      this.value = value;
+   }
+
+}

Modified: projects/security/security-spi/trunk/spi/src/tests/org/jboss/test/security/factories/SomeAuthorizationManager.java
===================================================================
--- projects/security/security-spi/trunk/spi/src/tests/org/jboss/test/security/factories/SomeAuthorizationManager.java	2008-01-31 19:36:18 UTC (rev 69506)
+++ projects/security/security-spi/trunk/spi/src/tests/org/jboss/test/security/factories/SomeAuthorizationManager.java	2008-01-31 19:40:21 UTC (rev 69507)
@@ -70,7 +70,7 @@
       return false;
    }
 
-   public EntitlementHolder<?> entitlements(Resource resource,
+   public <T> EntitlementHolder<T> getEntitlements(Class<T> clazz, Resource resource,
          Identity identity) throws AuthorizationException
    { 
       return null;




More information about the jboss-cvs-commits mailing list