Author: sohil.shah(a)jboss.com
Date: 2009-05-16 15:32:18 -0400 (Sat, 16 May 2009)
New Revision: 13381
Added:
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/enforcement/
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/enforcement/LocalEnforcementPointImpl.java
modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/test/
modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/test/pep/
modules/authorization/trunk/policy-server/src/test/resources/pdp-config.xml
Removed:
modules/authorization/trunk/enforcement/
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/enforcement/PolicyEnforcementPointImpl.java
Modified:
modules/authorization/trunk/http-profile/pom.xml
modules/authorization/trunk/policy-server/pom.xml
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/EmbeddedBootstrap.java
modules/authorization/trunk/pom.xml
Log:
moving enforcement under policy-server component
Modified: modules/authorization/trunk/http-profile/pom.xml
===================================================================
--- modules/authorization/trunk/http-profile/pom.xml 2009-05-16 16:03:40 UTC (rev 13380)
+++ modules/authorization/trunk/http-profile/pom.xml 2009-05-16 19:32:18 UTC (rev 13381)
@@ -146,17 +146,8 @@
<overWrite>true</overWrite>
<outputDirectory>target/test-classes/httpprofile-testsuite.war/WEB-INF/lib</outputDirectory>
<destFileName>policy-server.jar</destFileName>
- </artifactItem>
+ </artifactItem>
<artifactItem>
- <groupId>org.jboss.security.authz</groupId>
- <artifactId>enforcement</artifactId>
- <version>${project.version}</version>
- <type>jar</type>
- <overWrite>true</overWrite>
-
<outputDirectory>target/test-classes/httpprofile-testsuite.war/WEB-INF/lib</outputDirectory>
- <destFileName>enforcement.jar</destFileName>
- </artifactItem>
- <artifactItem>
<groupId>org.jboss.security</groupId>
<artifactId>jboss-xacml</artifactId>
<type>jar</type>
Modified: modules/authorization/trunk/policy-server/pom.xml
===================================================================
--- modules/authorization/trunk/policy-server/pom.xml 2009-05-16 16:03:40 UTC (rev 13380)
+++ modules/authorization/trunk/policy-server/pom.xml 2009-05-16 19:32:18 UTC (rev 13381)
@@ -23,12 +23,7 @@
<groupId>org.jboss.security.authz</groupId>
<artifactId>core-components-api</artifactId>
<version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.security.authz</groupId>
- <artifactId>enforcement</artifactId>
- <version>${project.version}</version>
- </dependency>
+ </dependency>
<!-- jboss xacml -->
<dependency>
Copied:
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/enforcement
(from rev 13379,
modules/authorization/trunk/enforcement/src/main/java/org/jboss/security/authz/enforcement)
Property changes on:
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/enforcement
___________________________________________________________________
Name: svn:mergeinfo
+
Copied:
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/enforcement/LocalEnforcementPointImpl.java
(from rev 13379,
modules/authorization/trunk/enforcement/src/main/java/org/jboss/security/authz/enforcement/PolicyEnforcementPointImpl.java)
===================================================================
---
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/enforcement/LocalEnforcementPointImpl.java
(rev 0)
+++
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/enforcement/LocalEnforcementPointImpl.java 2009-05-16
19:32:18 UTC (rev 13381)
@@ -0,0 +1,81 @@
+/*
+* 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.enforcement;
+
+import org.apache.log4j.Logger;
+
+import org.jboss.security.authz.policy.server.Server;
+import org.jboss.security.authz.policy.server.PolicyServer;
+import org.jboss.security.authz.policy.server.PolicyServerException;
+
+/**
+ * This component typically integrates natively with the application layer to receive
Authorization Requests
+ * It then processes the native request and routes it to the Policy Decision Point
component of the Policy Server to get a decision whether the
+ * Authorization should be granted or not or to do something else
+ *
+ * Sometimes, this component can just be a native stub that routes all requests over the
network to the Policy Server,
+ * and sometimes this component can be co-located with the Policy Server
+ *
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ */
+public class LocalEnforcementPointImpl implements PolicyEnforcementPoint
+{
+ private static Logger log = Logger.getLogger(LocalEnforcementPointImpl.class);
+
+ private PolicyServer policyServer;
+
+ public LocalEnforcementPointImpl()
+ {
+
+ }
+
+ public void start()
+ {
+ //Lookup the Policy Server
+ this.policyServer =
(PolicyServer)Server.lookup("/policy-server/PolicyServer");
+
+ if(this.policyServer == null)
+ {
+ throw new RuntimeException("Policy Server is unavailable...");
+ }
+ }
+
+ public void stop()
+ {
+ this.policyServer = null;
+ }
+ //------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ public Response checkAccess(Request request) throws EnforcementException
+ {
+ try
+ {
+
+ return this.policyServer.evaluate(request);
+ }
+ catch(PolicyServerException pe)
+ {
+ log.error(this, pe);
+ throw new EnforcementException(pe);
+ }
+ }
+}
Deleted:
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/enforcement/PolicyEnforcementPointImpl.java
===================================================================
---
modules/authorization/trunk/enforcement/src/main/java/org/jboss/security/authz/enforcement/PolicyEnforcementPointImpl.java 2009-05-15
20:37:32 UTC (rev 13379)
+++
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/enforcement/PolicyEnforcementPointImpl.java 2009-05-16
19:32:18 UTC (rev 13381)
@@ -1,56 +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.enforcement;
-
-/**
- * This component typically integrates natively with the application layer to receive
Authorization Requests
- * It then processes the native request and routes it to the Policy Decision Point
component of the Policy Server to get a decision whether the
- * Authorization should be granted or not or to do something else
- *
- * Sometimes, this component can just be a native stub that routes all requests over the
network to the Policy Server, and sometimes this component can be co-located with the
Policy Server
- *
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- */
-public class PolicyEnforcementPointImpl implements PolicyEnforcementPoint
-{
- public PolicyEnforcementPointImpl()
- {
-
- }
-
- public void start()
- {
-
- }
-
- public void stop()
- {
-
- }
- //------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- public Response checkAccess(Request request) throws EnforcementException
- {
- Response response = new Response();
- return response;
- }
-}
Modified:
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/EmbeddedBootstrap.java
===================================================================
---
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/EmbeddedBootstrap.java 2009-05-16
16:03:40 UTC (rev 13380)
+++
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/EmbeddedBootstrap.java 2009-05-16
19:32:18 UTC (rev 13381)
@@ -24,6 +24,8 @@
import java.net.URL;
+import org.apache.log4j.Logger;
+
import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
import org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer;
@@ -33,6 +35,8 @@
*/
final class EmbeddedBootstrap extends BasicBootstrap
{
+ private static Logger log = Logger.getLogger(EmbeddedBootstrap.class);
+
protected BasicXMLDeployer deployer;
public EmbeddedBootstrap() throws Exception
@@ -55,14 +59,14 @@
// redeployment correctly
if (deployer.getDeploymentNames().contains(url.toString()))
{
- System.out.println("Service is already deployed.");
+ log.debug("Service is already deployed.");
return;
}
deployer.deploy(url);
}
catch (Throwable t)
{
- t.printStackTrace();
+ log.error(this, t);
}
}
@@ -70,7 +74,7 @@
{
if (!deployer.getDeploymentNames().contains(url.toString()))
{
- System.out.println("Service is already undeployed.");
+ log.debug("Service is already undeployed.");
return;
}
try
@@ -79,7 +83,7 @@
}
catch (Throwable t)
{
- t.printStackTrace();
+ log.error(this, t);
}
}
@@ -87,7 +91,7 @@
{
public void run()
{
- System.out.println("Shutting down");
+ log.info("Shutting down");
deployer.shutdown();
}
}
Copied:
modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/test/pep
(from rev 13379,
modules/authorization/trunk/enforcement/src/test/java/org/jboss/security/authz/test/pep)
Property changes on:
modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/test/pep
___________________________________________________________________
Name: svn:mergeinfo
+
Added: modules/authorization/trunk/policy-server/src/test/resources/pdp-config.xml
===================================================================
--- modules/authorization/trunk/policy-server/src/test/resources/pdp-config.xml
(rev 0)
+++ modules/authorization/trunk/policy-server/src/test/resources/pdp-config.xml 2009-05-16
19:32:18 UTC (rev 13381)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<config
xmlns="http://sunxacml.sourceforge.net/schema/config-0.3"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ defaultPDP="pdp" defaultAttributeFactory="attr"
+ defaultCombiningAlgFactory="comb"
defaultFunctionFactory="func">
+
+ <pdp name="pdp">
+ <attributeFinderModule
class="org.jboss.security.xacml.sunxacml.finder.impl.CurrentEnvModule"/>
+ <attributeFinderModule
class="org.jboss.security.xacml.sunxacml.finder.impl.SelectorModule"/>
+ <policyFinderModule
class="org.jboss.security.xacml.sunxacml.finder.impl.FilePolicyModule">
+ <list>
+ <string>simple-policy.xml</string>
+ </list>
+ </policyFinderModule>
+ </pdp>
+
+ <attributeFactory name="attr" useStandardDatatypes="true"/>
+
+ <combiningAlgFactory name="comb"
useStandardAlgorithms="true">
+ <algorithm
class="org.jboss.security.authz.test.pep.NoPermitMeansDeniedAlg"/>
+ <algorithm
class="org.jboss.security.authz.test.pep.RuleCombiningAlgImplies"/>
+ </combiningAlgFactory>
+
+ <functionFactory name="func" useStandardFunctions="true"/>
+</config>
Modified: modules/authorization/trunk/pom.xml
===================================================================
--- modules/authorization/trunk/pom.xml 2009-05-16 16:03:40 UTC (rev 13380)
+++ modules/authorization/trunk/pom.xml 2009-05-16 19:32:18 UTC (rev 13381)
@@ -12,7 +12,6 @@
<modules>
<module>common-api</module>
<module>core-components-api</module>
- <module>enforcement</module>
<module>policy-server</module>
<module>http-profile</module>
</modules>