[jboss-cvs] JBossAS SVN: r68045 - in projects/security/security-spi/trunk: acl and 6 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Dec 7 12:30:41 EST 2007
Author: sguilhen at redhat.com
Date: 2007-12-07 12:30:41 -0500 (Fri, 07 Dec 2007)
New Revision: 68045
Added:
projects/security/security-spi/trunk/acl/
projects/security/security-spi/trunk/acl/pom.xml
projects/security/security-spi/trunk/acl/src/
projects/security/security-spi/trunk/acl/src/main/
projects/security/security-spi/trunk/acl/src/main/org/
projects/security/security-spi/trunk/acl/src/main/org/jboss/
projects/security/security-spi/trunk/acl/src/main/org/jboss/security/
projects/security/security-spi/trunk/acl/src/main/org/jboss/security/acl/
projects/security/security-spi/trunk/acl/src/main/org/jboss/security/acl/ACL.java
projects/security/security-spi/trunk/acl/src/main/org/jboss/security/acl/ACLEntry.java
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/Permission.java
Modified:
projects/security/security-spi/trunk/.classpath
projects/security/security-spi/trunk/pom.xml
Log:
Created first version of the ACL SPI.
Modified: projects/security/security-spi/trunk/.classpath
===================================================================
--- projects/security/security-spi/trunk/.classpath 2007-12-07 17:29:58 UTC (rev 68044)
+++ projects/security/security-spi/trunk/.classpath 2007-12-07 17:30:41 UTC (rev 68045)
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="spi/src/tests"/>
+ <classpathentry kind="src" path="acl/src/main"/>
<classpathentry kind="src" path="identity/src/tests"/>
<classpathentry kind="src" path="identity/src/main"/>
<classpathentry kind="src" path="authorization/src/main"/>
<classpathentry kind="src" path="spi/src/main"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-javaee/5.0.0.Beta3/jboss-javaee-5.0.0.Beta3.jar"/>
<classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-jaspi-api/1.0-BETA1/jboss-jaspi-api-1.0-BETA1.jar"/>
<classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
<classpathentry kind="output" path="target/eclipse-classes"/>
Added: projects/security/security-spi/trunk/acl/pom.xml
===================================================================
--- projects/security/security-spi/trunk/acl/pom.xml (rev 0)
+++ projects/security/security-spi/trunk/acl/pom.xml 2007-12-07 17:30:41 UTC (rev 68045)
@@ -0,0 +1,71 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jboss-security-spi-parent</artifactId>
+ <version>2.0.2.beta</version>
+ <relativePath>../parent</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>acl-spi</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Security Access Control List SPI</name>
+ <url>http://labs.jboss.org/portal/jbosssecurity/</url>
+ <description>JBoss Security is a cross cutting project that handles security for the JEMS projects</description>
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <url>http://repository.jboss.com/licenses/lgpl.txt</url>
+ </license>
+ </licenses>
+ <organization>
+ <name>JBoss Inc.</name>
+ <url>http://www.jboss.org</url>
+ </organization>
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/security-spi/trunk/</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/security-spi/trunk/</developerConnection>
+ <url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/projects/security-spi/trunk/</url>
+ </scm>
+ <build>
+ <sourceDirectory>${basedir}/src/main</sourceDirectory>
+ <testSourceDirectory>${basedir}/src/tests</testSourceDirectory>
+ <testOutputDirectory>${basedir}/target/test-classes</testOutputDirectory>
+ <finalName>${artifactId}</finalName>
+ <outputDirectory>${basedir}/target/classes</outputDirectory>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <includes>
+ <include>JBossORG-EULA.txt</include>
+ </includes>
+ </resource>
+ </resources>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>identity-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>authorization-spi</artifactId>
+ </dependency>
+ </dependencies>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <aggregate>true</aggregate>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+</project>
Added: projects/security/security-spi/trunk/acl/src/main/org/jboss/security/acl/ACL.java
===================================================================
--- projects/security/security-spi/trunk/acl/src/main/org/jboss/security/acl/ACL.java (rev 0)
+++ projects/security/security-spi/trunk/acl/src/main/org/jboss/security/acl/ACL.java 2007-12-07 17:30:41 UTC (rev 68045)
@@ -0,0 +1,98 @@
+/*
+ * 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.acl;
+
+import java.util.Collection;
+
+import org.jboss.security.authorization.Resource;
+import org.jboss.security.identity.Identity;
+
+/**
+ * <p>
+ * This interface represents an Access Control List (ACL), a data structure used to protect access
+ * to resources. It is composed of entries, where each entry is represented by the <code>ALCEntry</code>
+ * class and represents the permissions assigned to a given identity.
+ * </p>
+ * <p>
+ * When a client attempts to perform an operation on a resource, the ACL associated to the resource is used
+ * to verify if the client has enough permissions to perform that operation. In order to do that, the
+ * <code>ACLEntry</code> corresponding to the client's identity is retrieved and then the permission set
+ * contained in the entry is verified to decide if access should be granted or not.
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen at redhat.com">Stefan Guilhen</a>
+ */
+public interface ACL
+{
+
+ /**
+ * <p>
+ * Adds an entry to this ACL. If the ACL already has an <code>ACLEntry</code> associated to the new
+ * entry's identity, then the new entry will not be added.
+ * </p>
+ *
+ * @param entry the <code>ACLEntry</code> to be added.
+ * @return <code>true</code> if the entry was added; <code>false</code> otherwise.
+ */
+ public boolean addEntry(ACLEntry entry);
+
+ /**
+ * <p>
+ * Removes an entry from this ACL.
+ * </p>
+ *
+ * @param entry the <code>ACLEntry</code> to be removed.
+ * @return <code>true</code> if the entry is removed; <code>false</code> if the entry can't be found
+ * in the ACL.
+ */
+ public boolean removeEntry(ACLEntry entry);
+
+ /**
+ * <p>
+ * Obtains the collection of all <code>ACLEntries</code> in this ACL.
+ * </p>
+ *
+ * @return a <code>Collection</code> containing all entries in this ACL.
+ */
+ public Collection<ACLEntry> getEntries();
+
+ /**
+ * <p>
+ * Obtains a reference to the resource being protected by this ACL.
+ * </p>
+ *
+ * @return a reference to the <code>Resource</code>.
+ */
+ public Resource getResource();
+
+ /**
+ * <p>
+ * Verify if the given permission is assigned to the specified <code>Identity</code>.
+ * </p>
+ *
+ * @param permission the <code>Permission</code> to be checked for.
+ * @param identity the <code>Identity</code> being verified.
+ * @return <code>true</code> if the specified permission is assigned to the identity;
+ * <code>false</code> otherwise.
+ */
+ public boolean isGranted(Permission permission, Identity identity);
+}
Added: projects/security/security-spi/trunk/acl/src/main/org/jboss/security/acl/ACLEntry.java
===================================================================
--- projects/security/security-spi/trunk/acl/src/main/org/jboss/security/acl/ACLEntry.java (rev 0)
+++ projects/security/security-spi/trunk/acl/src/main/org/jboss/security/acl/ACLEntry.java 2007-12-07 17:30:41 UTC (rev 68045)
@@ -0,0 +1,54 @@
+/*
+ * 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.acl;
+
+import org.jboss.security.identity.Identity;
+
+/**
+ * <p>
+ * This interface represents an entry in the Access Control List.
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen at redhat.com">Stefan Guilhen</a>
+ */
+public interface ACLEntry
+{
+
+ /**
+ * <p>
+ * Obtains the <code>Identity</code> for which a permission has been assigned in
+ * this entry.
+ * </p>
+ *
+ * @return a reference to the <code>Identity</code> contained in this entry.
+ */
+ public Identity getIdentity();
+
+ /**
+ * <p>
+ * Obtains the <code>Permission</code> object held by this entry.
+ * </p>
+ *
+ * @return a reference to the <code>Permission</code> contained in this entry.
+ */
+ public Permission getPermission();
+}
Added: 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 (rev 0)
+++ projects/security/security-spi/trunk/acl/src/main/org/jboss/security/acl/ACLProvider.java 2007-12-07 17:30:41 UTC (rev 68045)
@@ -0,0 +1,78 @@
+/*
+ * 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.acl;
+
+import org.jboss.security.authorization.Resource;
+
+/**
+ * <p>
+ * An <code>ACLProvider</code> is responsible for the management of the ACLs associated to the
+ * resources being protected. Implementations of this interface will tipically interact with some
+ * sort of repository, where the ACLs are stored.
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen at redhat.com">Stefan Guilhen</a>
+ */
+public interface ACLProvider
+{
+
+ /**
+ * <p>
+ * Obtains a reference to the <code>ACL</code> associated to the given resource.
+ * </p>
+ *
+ * @param resource the <code>Resource</code> for which the associated ACL is wanted.
+ * @return a reference to the <code>ACL</code> associated with the resource, or null if no
+ * ACL could be found.
+ */
+ public ACL retrieveACL(Resource resource);
+
+ /**
+ * <p>
+ * Creates a new ACL and associates it to the given resource.
+ * </p>
+ *
+ * @param resource the <code>Resource</code> for which an ACL is to be created.
+ * @return a reference to the created <code>ACL</code>.
+ */
+ public ACL createACL(Resource resource);
+
+ /**
+ * <p>
+ * Updates the given ACL. This usually means updating the repository where the ACLs are stored.
+ * </p>
+ *
+ * @param acl the <code>ACL</code> that needs to be updated.
+ * @return <code>true</code> if the ACL was update; <code>false</code> otherwise.
+ */
+ public boolean updateACL(ACL acl);
+
+ /**
+ * <p>
+ * Removes the given ACL, breaking the existing association with the resource it relates to.
+ * </p>
+ *
+ * @param acl a reference to the <code>ACL</code> that is to be removed.
+ * @return <code>true</code> if the ACL was removed; <code>false</code> otherwise.
+ */
+ public boolean removeACL(ACL acl);
+}
Added: projects/security/security-spi/trunk/acl/src/main/org/jboss/security/acl/Permission.java
===================================================================
--- projects/security/security-spi/trunk/acl/src/main/org/jboss/security/acl/Permission.java (rev 0)
+++ projects/security/security-spi/trunk/acl/src/main/org/jboss/security/acl/Permission.java 2007-12-07 17:30:41 UTC (rev 68045)
@@ -0,0 +1,35 @@
+/*
+ * 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.acl;
+
+/**
+ * <p>
+ * A <code>Permission</code> represents privileges held by an <code>Identity</code>, and is used to
+ * grant or deny access to a <code>Resource</code>.
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen at redhat.com">Stefan Guilhen</a>
+ */
+public interface Permission
+{
+
+}
Modified: projects/security/security-spi/trunk/pom.xml
===================================================================
--- projects/security/security-spi/trunk/pom.xml 2007-12-07 17:29:58 UTC (rev 68044)
+++ projects/security/security-spi/trunk/pom.xml 2007-12-07 17:30:41 UTC (rev 68045)
@@ -43,6 +43,7 @@
<module>parent</module>
<module>identity</module>
<module>authorization</module>
+ <module>acl</module>
<module>spi</module>
</modules>
More information about the jboss-cvs-commits
mailing list