Author: sohil.shah(a)jboss.com
Date: 2009-02-02 06:41:03 -0500 (Mon, 02 Feb 2009)
New Revision: 12766
Added:
modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/configuration/
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/provisioning/
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/provisioning/MemoryPolicyStore.java
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/provisioning/PolicyDeployer.java
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/spi/
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/spi/PolicyConfig.java
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/spi/PolicyStore.java
Removed:
modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/configuration/HttpPolicyStore.java
modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/provisioning/
modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/provisioning/TestHttpPolicyDeployer.java
modules/authorization/trunk/http-profile/src/test/resources/META-INF/
modules/authorization/trunk/provisioning/
Modified:
modules/authorization/trunk/http-profile/pom.xml
modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/configuration/HttpPolicyConfig.java
modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/provisioning/TestHttpPolicyConfig.java
modules/authorization/trunk/policy-server/pom.xml
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/PolicyServer.java
modules/authorization/trunk/policy-server/src/main/resources/META-INF/jboss-beans.xml
modules/authorization/trunk/pom.xml
Log:
adding provisioning function to the policy server
merging 'provisioning' component into the 'policy-server' component
Modified: modules/authorization/trunk/http-profile/pom.xml
===================================================================
--- modules/authorization/trunk/http-profile/pom.xml 2009-02-02 11:20:45 UTC (rev 12765)
+++ modules/authorization/trunk/http-profile/pom.xml 2009-02-02 11:41:03 UTC (rev 12766)
@@ -23,24 +23,13 @@
<groupId>org.jboss.security.authz</groupId>
<artifactId>jboss-authz-core-components</artifactId>
<version>${project.version}</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.jboss.security.authz</groupId>
- <artifactId>jboss-authz-provisioning</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.security.authz</groupId>
<artifactId>jboss-authz-policy-server</artifactId>
<version>${project.version}</version>
</dependency>
-
- <dependency>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-kernel</artifactId>
- <scope>test</scope>
- </dependency>
-
+
<!-- test dependencies -->
<!-- jboss xacml -->
<dependency>
Copied:
modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/configuration
(from rev 12764,
modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/provisioning)
Modified:
modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/configuration/HttpPolicyConfig.java
===================================================================
---
modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/provisioning/HttpPolicyConfig.java 2009-02-02
04:10:43 UTC (rev 12764)
+++
modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/configuration/HttpPolicyConfig.java 2009-02-02
11:41:03 UTC (rev 12766)
@@ -20,15 +20,13 @@
* 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.authz.http.provisioning;
+package org.jboss.security.authz.http.configuration;
import java.io.IOException;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.List;
import java.util.ArrayList;
-import java.util.Set;
-import java.util.HashSet;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -41,10 +39,8 @@
import org.jboss.security.authz.components.http.HttpResource;
import org.jboss.security.authz.model.Policy;
-import org.jboss.security.authz.model.Rule;
-import org.jboss.security.authz.model.Target;
import org.jboss.security.authz.policy.server.plugin.HierarchialPolicy;
-import org.jboss.security.authz.provisioning.spi.PolicyConfig;
+import org.jboss.security.authz.policy.server.spi.PolicyConfig;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
Deleted:
modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/configuration/HttpPolicyStore.java
===================================================================
---
modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/provisioning/HttpPolicyStore.java 2009-02-02
04:10:43 UTC (rev 12764)
+++
modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/configuration/HttpPolicyStore.java 2009-02-02
11:41:03 UTC (rev 12766)
@@ -1,90 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, 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.authz.http.provisioning;
-
-import java.util.Map;
-import java.util.HashMap;
-
-import org.jboss.security.authz.model.Policy;
-import org.jboss.security.authz.model.PolicyException;
-import org.jboss.security.authz.provisioning.spi.PolicyStore;
-
-/**
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class HttpPolicyStore implements PolicyStore
-{
- /**
- * TODO: this method of Policy Storage is only for testing. Eventually this should be
replaced by
- * a Database based Policy Storage Implementation
- */
- private Map<String, Policy> policies;
-
- public HttpPolicyStore()
- {
- this.policies = new HashMap<String, Policy>();
- }
-
- /**
- * Read a stored Policy identified by the unique policyUri
- *
- * @param policyUri
- * @return a stored Policy
- */
- public Policy readPolicy(String policyUri) throws PolicyException
- {
- return this.policies.get(policyUri);
- }
-
- /**
- * Returns all the stored Policies for the system
- *
- * @return all the stored Policies
- */
- public Policy[] readAllPolicies() throws PolicyException
- {
- return this.policies.values().toArray(new Policy[0]);
- }
-
- /**
- * Saves a Policy into storage. If this policy already exists in storage, then it
updates it
- *
- * @param policy Policy to be saved into storage
- */
- public void savePolicy(Policy policy) throws PolicyException
- {
- this.policies.put(policy.getPolicyUri(), policy);
- }
-
- /**
- * Deletes the specified Policy from storage
- *
- * @param policyUri unique identifier for the Policy
- */
- public void deletePolicy(String policyUri) throws PolicyException
- {
- this.policies.remove(policyUri);
- }
-}
Modified:
modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/provisioning/TestHttpPolicyConfig.java
===================================================================
---
modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/provisioning/TestHttpPolicyConfig.java 2009-02-02
11:20:45 UTC (rev 12765)
+++
modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/provisioning/TestHttpPolicyConfig.java 2009-02-02
11:41:03 UTC (rev 12766)
@@ -26,9 +26,9 @@
import org.apache.log4j.Logger;
-import org.jboss.security.authz.http.provisioning.HttpPolicyConfig;
+import org.jboss.security.authz.http.configuration.HttpPolicyConfig;
import org.jboss.security.authz.model.Policy;
-import org.jboss.security.authz.provisioning.spi.PolicyConfig;
+import org.jboss.security.authz.policy.server.spi.PolicyConfig;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
Deleted:
modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/provisioning/TestHttpPolicyDeployer.java
===================================================================
---
modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/provisioning/TestHttpPolicyDeployer.java 2009-02-02
11:20:45 UTC (rev 12765)
+++
modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/provisioning/TestHttpPolicyDeployer.java 2009-02-02
11:41:03 UTC (rev 12766)
@@ -1,62 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, 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.authz.http.provisioning;
-
-import junit.framework.TestCase;
-
-import org.apache.log4j.Logger;
-
-import org.jboss.security.authz.model.Policy;
-import org.jboss.security.authz.policy.server.Server;
-import org.jboss.security.authz.provisioning.policy.PolicyDeployer;
-
-/**
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class TestHttpPolicyDeployer extends TestCase
-{
- private static Logger log = Logger.getLogger(TestHttpPolicyDeployer.class);
-
- @Override
- protected void setUp() throws Exception
- {
- Server.bootstrap();
- }
-
- public void testPolicyDeploy() throws Exception
- {
- PolicyDeployer policyDeployer =
(PolicyDeployer)Server.lookup("/http-profile/PolicyDeployer");
-
-
policyDeployer.deploy(Thread.currentThread().getContextClassLoader().getResource("http-policy.xml"));
-
- Policy[] policies = policyDeployer.getStore().readAllPolicies();
- this.assertTrue("Should not be empty", policies != null &&
policies.length>0);
- for(int i=0; i<policies.length; i++)
- {
-
log.info("-------------------------------------------------------------");
- log.info(policies[i].generateXACMLPolicy());
-
log.info("-------------------------------------------------------------");
- }
- }
-}
Modified: modules/authorization/trunk/policy-server/pom.xml
===================================================================
--- modules/authorization/trunk/policy-server/pom.xml 2009-02-02 11:20:45 UTC (rev 12765)
+++ modules/authorization/trunk/policy-server/pom.xml 2009-02-02 11:41:03 UTC (rev 12766)
@@ -23,6 +23,11 @@
<groupId>org.jboss.security.authz</groupId>
<artifactId>jboss-authz-enforcement</artifactId>
<version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.security.authz</groupId>
+ <artifactId>jboss-authz-provisioning</artifactId>
+ <version>${project.version}</version>
</dependency>
<!-- jboss xacml -->
Modified:
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/PolicyServer.java
===================================================================
---
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/PolicyServer.java 2009-02-02
11:20:45 UTC (rev 12765)
+++
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/PolicyServer.java 2009-02-02
11:41:03 UTC (rev 12766)
@@ -21,11 +21,12 @@
*/
package org.jboss.security.authz.policy.server;
-import java.io.File;
-
import org.apache.log4j.Logger;
+import org.jboss.security.authz.model.Policy;
+import org.jboss.security.authz.model.PolicyException;
import org.jboss.security.authz.policy.server.decision.PolicyDecisionPoint;
+import org.jboss.security.authz.policy.server.spi.PolicyStore;
import org.jboss.security.authz.enforcement.Request;
import org.jboss.security.authz.enforcement.Response;
@@ -40,6 +41,7 @@
private static Logger log = Logger.getLogger(PolicyServer.class);
private PolicyDecisionPoint policyDecisionPoint;
+ private PolicyStore policyStore;
public PolicyServer()
{
@@ -64,6 +66,16 @@
{
this.policyDecisionPoint = policyDecisionPoint;
}
+
+ public PolicyStore getPolicyStore()
+ {
+ return policyStore;
+ }
+
+ public void setPolicyStore(PolicyStore policyStore)
+ {
+ this.policyStore = policyStore;
+ }
//--------Decision making
services--------------------------------------------------------------------------------------------------------------------------
/**
* Makes an Authorization Decision
@@ -91,6 +103,45 @@
{
return this.policyDecisionPoint.evaluate(xml);
}
- //------- Provisioning
services-----------------------------------------------------------------------------------------------------------------------------
-
+ //------- Provisioning
services-----------------------------------------------------------------------------------------------------------------------------
+ /**
+ * Read a stored Policy identified by the unique policyUri
+ *
+ * @param policyUri
+ * @return a stored Policy
+ */
+ public Policy readPolicy(String policyUri) throws PolicyException
+ {
+ return this.policyStore.readPolicy(policyUri);
+ }
+
+ /**
+ * Returns all the stored Policies for the system
+ *
+ * @return all the stored Policies
+ */
+ public Policy[] readAllPolicies() throws PolicyException
+ {
+ return this.policyStore.readAllPolicies();
+ }
+
+ /**
+ * Saves a Policy into storage. If this policy already exists in storage, then it
updates it
+ *
+ * @param policy Policy to be saved into storage
+ */
+ public void savePolicy(Policy policy) throws PolicyException
+ {
+ this.policyStore.savePolicy(policy);
+ }
+
+ /**
+ * Deletes the specified Policy from storage
+ *
+ * @param policyUri unique identifier for the Policy
+ */
+ public void deletePolicy(String policyUri) throws PolicyException
+ {
+ this.policyStore.deletePolicy(policyUri);
+ }
}
Added:
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/provisioning/MemoryPolicyStore.java
===================================================================
---
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/provisioning/MemoryPolicyStore.java
(rev 0)
+++
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/provisioning/MemoryPolicyStore.java 2009-02-02
11:41:03 UTC (rev 12766)
@@ -0,0 +1,102 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, 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.authz.policy.server.provisioning;
+
+import java.util.Map;
+import java.util.HashMap;
+
+import org.apache.log4j.Logger;
+import org.jboss.security.authz.model.Policy;
+import org.jboss.security.authz.model.PolicyException;
+import org.jboss.security.authz.policy.server.spi.PolicyStore;
+
+/**
+ * this method of Policy Storage is only for testing. In an Enterprise setup this would
be replaced by a Database Policy Store
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class MemoryPolicyStore implements PolicyStore
+{
+ private static Logger log = Logger.getLogger(MemoryPolicyStore.class);
+
+ private Map<String, Policy> policies;
+
+ public MemoryPolicyStore()
+ {
+ this.policies = new HashMap<String, Policy>();
+ }
+
+ public void start()
+ {
+
log.info("-----------------------------------------------------------------------");
+ log.info("In-Memory Policy Store successfully
started............................");
+
log.info("-----------------------------------------------------------------------");
+ }
+
+ public void stop()
+ {
+
+ }
+
//-----------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ * Read a stored Policy identified by the unique policyUri
+ *
+ * @param policyUri
+ * @return a stored Policy
+ */
+ public Policy readPolicy(String policyUri) throws PolicyException
+ {
+ return this.policies.get(policyUri);
+ }
+
+ /**
+ * Returns all the stored Policies for the system
+ *
+ * @return all the stored Policies
+ */
+ public Policy[] readAllPolicies() throws PolicyException
+ {
+ return this.policies.values().toArray(new Policy[0]);
+ }
+
+ /**
+ * Saves a Policy into storage. If this policy already exists in storage, then it
updates it
+ *
+ * @param policy Policy to be saved into storage
+ */
+ public void savePolicy(Policy policy) throws PolicyException
+ {
+ this.policies.put(policy.getPolicyUri(), policy);
+ }
+
+ /**
+ * Deletes the specified Policy from storage
+ *
+ * @param policyUri unique identifier for the Policy
+ */
+ public void deletePolicy(String policyUri) throws PolicyException
+ {
+ this.policies.remove(policyUri);
+ }
+}
Added:
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/provisioning/PolicyDeployer.java
===================================================================
---
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/provisioning/PolicyDeployer.java
(rev 0)
+++
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/provisioning/PolicyDeployer.java 2009-02-02
11:41:03 UTC (rev 12766)
@@ -0,0 +1,128 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, 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.authz.policy.server.provisioning;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.net.URL;
+
+import org.apache.log4j.Logger;
+
+import org.jboss.security.authz.model.Policy;
+import org.jboss.security.authz.model.PolicyException;
+import org.jboss.security.authz.policy.server.spi.PolicyConfig;
+import org.jboss.security.authz.policy.server.spi.PolicyStore;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class PolicyDeployer
+{
+ private static Logger log = Logger.getLogger(PolicyDeployer.class);
+
+ private PolicyConfig configuration = null;
+ private PolicyStore store = null;
+
+ public PolicyDeployer()
+ {
+
+ }
+
+ public PolicyConfig getConfiguration()
+ {
+ return configuration;
+ }
+
+ public void setConfiguration(PolicyConfig configuration)
+ {
+ this.configuration = configuration;
+ }
+
+ public PolicyStore getStore()
+ {
+ return store;
+ }
+
+ public void setStore(PolicyStore store)
+ {
+ this.store = store;
+ }
+
+ public void deploy(URL url) throws PolicyException
+ {
+ BufferedInputStream is = null;
+ ByteArrayOutputStream bos = null;
+ try
+ {
+ is = new BufferedInputStream(url.openStream());
+ bos = new ByteArrayOutputStream();
+
+ byte[] buffer = new byte[1024]; //using a 1K buffer
+ int bytesRead = -1;
+ while((bytesRead=is.read(buffer)) != -1)
+ {
+ bos.write(buffer, 0, bytesRead);
+ }
+
+ String deploymentXml = new String(bos.toByteArray());
+
+ //Get Policy instances
+ Policy[] policies = this.configuration.configure(deploymentXml);
+
+ //Persist Policy instances into the Policy Store
+ if(policies != null)
+ {
+ for(int i=0; i<policies.length; i++)
+ {
+ this.store.savePolicy(policies[i]);
+ }
+ }
+ }
+ catch(IOException ioe)
+ {
+ log.error(this, ioe);
+ throw new PolicyException(ioe);
+ }
+ finally
+ {
+ try
+ {
+ if(is != null)
+ {
+ is.close();
+ }
+
+ if(bos != null)
+ {
+ bos.close();
+ }
+ }
+ catch(IOException ioe)
+ {
+ log.warn(this, ioe);
+ }
+ }
+ }
+}
Added:
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/spi/PolicyConfig.java
===================================================================
---
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/spi/PolicyConfig.java
(rev 0)
+++
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/spi/PolicyConfig.java 2009-02-02
11:41:03 UTC (rev 12766)
@@ -0,0 +1,42 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, 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.authz.policy.server.spi;
+
+import org.jboss.security.authz.model.Policy;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public interface PolicyConfig
+{
+ /**
+ * Configures the Policy instances that can be represented in system level XACML
format. The easyDomainXml is a user friendly XML configuration that is within the context
+ * of the application tier being protected. For instance, to apply Access Control at
the web tier, the XML configuration would consist of Resources and
+ * Actions in the context of the Web Tier such as HTTP Uris, HttpServletRequest
parameters, HTTP actions like GET, POST, PUT, etc
+ *
+ * @param easyDomainXml User Friendly XML configuration within the context of the
Application being protected
+ * @return a fully configured Policy instance
+ */
+ public Policy[] configure(String easyDomainXml);
+}
Added:
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/spi/PolicyStore.java
===================================================================
---
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/spi/PolicyStore.java
(rev 0)
+++
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/spi/PolicyStore.java 2009-02-02
11:41:03 UTC (rev 12766)
@@ -0,0 +1,62 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, 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.authz.policy.server.spi;
+
+import org.jboss.security.authz.model.Policy;
+import org.jboss.security.authz.model.PolicyException;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public interface PolicyStore
+{
+ /**
+ * Read a stored Policy identified by the unique policyUri
+ *
+ * @param policyUri
+ * @return a stored Policy
+ */
+ public Policy readPolicy(String policyUri) throws PolicyException;
+
+ /**
+ * Returns all the stored Policies for the system
+ *
+ * @return all the stored Policies
+ */
+ public Policy[] readAllPolicies() throws PolicyException;
+
+ /**
+ * Saves a Policy into storage. If this policy already exists in storage, then it
updates it
+ *
+ * @param policy Policy to be saved into storage
+ */
+ public void savePolicy(Policy policy) throws PolicyException;
+
+ /**
+ * Deletes the specified Policy from storage
+ *
+ * @param policyUri unique identifier for the Policy
+ */
+ public void deletePolicy(String policyUri) throws PolicyException;
+}
Modified:
modules/authorization/trunk/policy-server/src/main/resources/META-INF/jboss-beans.xml
===================================================================
---
modules/authorization/trunk/policy-server/src/main/resources/META-INF/jboss-beans.xml 2009-02-02
11:20:45 UTC (rev 12765)
+++
modules/authorization/trunk/policy-server/src/main/resources/META-INF/jboss-beans.xml 2009-02-02
11:41:03 UTC (rev 12766)
@@ -7,8 +7,14 @@
<property name="policyDecisionPoint">
<inject bean="/policy-server/PolicyDecisionPoint"/>
</property>
+ <property name="policyStore">
+ <inject bean="/policy-server/PolicyStore"/>
+ </property>
</bean>
<bean name="/policy-server/PolicyDecisionPoint"
class="org.jboss.security.authz.policy.server.decision.PolicyDecisionPoint">
+ </bean>
+
+ <bean name="/policy-server/PolicyStore"
class="org.jboss.security.authz.policy.server.provisioning.MemoryPolicyStore">
</bean>
</deployment>
\ No newline at end of file
Modified: modules/authorization/trunk/pom.xml
===================================================================
--- modules/authorization/trunk/pom.xml 2009-02-02 11:20:45 UTC (rev 12765)
+++ modules/authorization/trunk/pom.xml 2009-02-02 11:41:03 UTC (rev 12766)
@@ -13,7 +13,6 @@
<module>common</module>
<module>core-components</module>
<module>enforcement</module>
- <module>provisioning</module>
<module>policy-server</module>
<module>http-profile</module>
<!--