[jboss-cvs] JBossAS SVN: r63861 - in projects/security/security-xacml/trunk: build and 29 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Jul 6 03:19:22 EDT 2007
Author: anil.saldhana at jboss.com
Date: 2007-07-06 03:19:22 -0400 (Fri, 06 Jul 2007)
New Revision: 63861
Added:
projects/security/security-xacml/trunk/build/
projects/security/security-xacml/trunk/build/assembly/
projects/security/security-xacml/trunk/build/assembly/bin.xml
projects/security/security-xacml/trunk/build/assembly/sources.xml
projects/security/security-xacml/trunk/build/pom.xml
projects/security/security-xacml/trunk/jboss-xacml/
projects/security/security-xacml/trunk/jboss-xacml/.classpath
projects/security/security-xacml/trunk/jboss-xacml/.project
projects/security/security-xacml/trunk/jboss-xacml/pom.xml
projects/security/security-xacml/trunk/jboss-xacml/src/
projects/security/security-xacml/trunk/jboss-xacml/src/main/
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/bridge/
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/bridge/PolicySetFinderModule.java
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossPDP.java
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossXACMLPolicy.java
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/factories/
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/factories/PolicyFactory.java
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/PolicyDecisionPoint.java
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/PolicyLocator.java
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/XACMLPolicy.java
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/LocatorType.java
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/LocatorsType.java
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/ObjectFactory.java
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/Option.java
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PDP.java
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PoliciesType.java
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PolicySetType.java
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PolicyType.java
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/package-info.java
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/locators/
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/locators/JBossPolicySetLocator.java
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/util/
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/util/XACMLPolicyUtil.java
projects/security/security-xacml/trunk/jboss-xacml/src/resources/
projects/security/security-xacml/trunk/jboss-xacml/src/resources/schema/
projects/security/security-xacml/trunk/jboss-xacml/src/resources/schema/jbossxacml-2.0.xsd
projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/
projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/config/
projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/config/basicPolicySetConfig.xml
projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/config/interopPolicySetConfig.xml
projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/policies/
projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/policies/interop/
projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/policies/interop/xacml-policy2.xml
projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/policies/interop/xacml-policy3.xml
projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/policies/interop/xacml-policy4.xml
projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/policies/interop/xacml-policy5.xml
projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/policies/interop/xacml-policySet.xml
projects/security/security-xacml/trunk/jboss-xacml/src/tests/
projects/security/security-xacml/trunk/jboss-xacml/src/tests/org/
projects/security/security-xacml/trunk/jboss-xacml/src/tests/org/jboss/
projects/security/security-xacml/trunk/jboss-xacml/src/tests/org/jboss/test/
projects/security/security-xacml/trunk/jboss-xacml/src/tests/org/jboss/test/security/
projects/security/security-xacml/trunk/jboss-xacml/src/tests/org/jboss/test/security/xacml/
projects/security/security-xacml/trunk/jboss-xacml/src/tests/org/jboss/test/security/xacml/config/
projects/security/security-xacml/trunk/jboss-xacml/src/tests/org/jboss/test/security/xacml/config/JBossXACMLConfigUnitTestCase.java
projects/security/security-xacml/trunk/jboss-xacml/src/tests/org/jboss/test/security/xacml/factories/
projects/security/security-xacml/trunk/jboss-xacml/src/tests/org/jboss/test/security/xacml/factories/PolicyFactoryUnitTestCase.java
Log:
JBossXACML workspace
Added: projects/security/security-xacml/trunk/build/assembly/bin.xml
===================================================================
--- projects/security/security-xacml/trunk/build/assembly/bin.xml (rev 0)
+++ projects/security/security-xacml/trunk/build/assembly/bin.xml 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,12 @@
+<assembly>
+ <formats>
+ <format>jar</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <fileSets>
+ <fileSet>
+ <directory>../jboss-xacml/target/classes</directory>
+ <outputDirectory>/</outputDirectory>
+ </fileSet>
+ </fileSets>
+</assembly>
Added: projects/security/security-xacml/trunk/build/assembly/sources.xml
===================================================================
--- projects/security/security-xacml/trunk/build/assembly/sources.xml (rev 0)
+++ projects/security/security-xacml/trunk/build/assembly/sources.xml 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,13 @@
+<assembly>
+ <id>sources</id>
+ <formats>
+ <format>jar</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <fileSets>
+ <fileSet>
+ <directory>../jboss-xacml/src/main</directory>
+ <outputDirectory>/</outputDirectory>
+ </fileSet>
+ </fileSets>
+</assembly>
Added: projects/security/security-xacml/trunk/build/pom.xml
===================================================================
--- projects/security/security-xacml/trunk/build/pom.xml (rev 0)
+++ projects/security/security-xacml/trunk/build/pom.xml 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ The parent maven for the project that expects a structure like:
+ build/pom.xml
+ jboss-xacml/pom.xml
+ jboss-xacml-docs/pom.xml
+
+ This pom aggregates the subproject pom, and it also functions as a default
+ configuration. The subproject poms each inherit configuration from this one.
+
+ To build this project maven 2 should be installed and in the system path.
+ From the command line run "mvn" from the build directory and "install" will
+ be used as the default goal. In order to use the "deploy" goal,
+ the mvn.cvs.root should be specified in settings.xml.
+
+ To add a module edit the modules section and add the module also to
+ assembly/bin.xml and assembly.sources.xml.
+-->
+<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>jboss</groupId>
+ <artifactId>jboss-parent</artifactId>
+ <version>2</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jboss-xacml-project</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>JBoss XACML Build</name>
+ <url>http://www.jboss.com</url>
+ <description>
+ The JBoss XACML Project
+ </description>
+ <build>
+ <sourceDirectory>src/main</sourceDirectory>
+ <testSourceDirectory>src/tests</testSourceDirectory>
+ <finalName>${artifactId}</finalName>
+ <resources>
+ <resource>
+ <directory>src/etc</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ <testResources>
+ <testResource>
+ <directory>src/resources</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ <filtering>true</filtering>
+ </testResource>
+ </testResources>
+ <plugins>
+ <!-- define that we wish to create src jars -->
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>2.0</version>
+ <inherited>true</inherited>
+ <executions>
+ <execution>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>assembly</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <descriptors>
+ <descriptor>assembly/bin.xml</descriptor>
+ <descriptor>assembly/sources.xml</descriptor>
+ </descriptors>
+ </configuration>
+ <inherited>false</inherited>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <printSummary>false</printSummary>
+ <testFailureIgnore>true</testFailureIgnore>
+ <includes>
+ <include>**/**TestCase.java</include>
+ </includes>
+ <skip>false</skip>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>jboss.maven-plugins</groupId>
+ <artifactId>jboss-deploy-maven-plugin</artifactId>
+ <version>1.3-SNAPSHOT</version>
+ </plugin>
+ </plugins>
+ </build>
+ <repositories>
+ <repository>
+ <id>jboss</id>
+ <name>JBoss Repository</name>
+ <layout>default</layout>
+ <url>http://anonsvn.jboss.org/repos/repository.jboss.org/maven2</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <modules>
+ <module>../jboss-xacml</module>
+ </modules>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>dependencies</report>
+ <report>issue-tracking</report>
+ <report>license</report>
+ <report>scm</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ </plugins>
+ </reporting>
+</project>
Added: projects/security/security-xacml/trunk/jboss-xacml/.classpath
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/.classpath (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/.classpath 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main"/>
+ <classpathentry kind="src" path="src/resources"/>
+ <classpathentry kind="src" path="src/tests"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="var" path="M2_REPO/sun-jaxb/jaxb-api/2.0.5/jaxb-api-2.0.5.jar"/>
+ <classpathentry kind="var" path="M2_REPO/sun-jaxb/jaxb-impl/2.0.5/jaxb-impl-2.0.5.jar"/>
+ <classpathentry kind="var" path="M2_REPO/sun-jaxb/jaxb-xjc/2.0.5/jaxb-xjc-2.0.5.jar"/>
+ <classpathentry kind="var" path="M2_REPO/sun-xacml/sun-xacml/2.0/sun-xacml-2.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/sun-jaf/activation/1.0.2/activation-1.0.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-javaee/5.0.0-SNAPSHOT/jboss-javaee-5.0.0-SNAPSHOT.jar"/>
+ <classpathentry kind="output" path="target/eclipse-classes"/>
+</classpath>
Added: projects/security/security-xacml/trunk/jboss-xacml/.project
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/.project (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/.project 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>jboss-xacml</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+ <linkedResources>
+ <link>
+ <name>Link</name>
+ <type>2</type>
+ <locationURI>TEMP</locationURI>
+ </link>
+ </linkedResources>
+</projectDescription>
Added: projects/security/security-xacml/trunk/jboss-xacml/pom.xml
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/pom.xml (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/pom.xml 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,59 @@
+<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>jboss</groupId>
+ <artifactId>jboss-xacml-project</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <relativePath>../build/pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-xacml</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>JBoss XACML</name>
+ <url>http://www.jboss.org</url>
+ <description>JBoss XACML Library</description>
+ <dependencies>
+ <dependency>
+ <groupId>sun-xacml</groupId>
+ <artifactId>sun-xacml</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>sun-jaxb</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.0.5</version>
+ </dependency>
+ <dependency>
+ <groupId>sun-jaxb</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.0.5</version>
+ </dependency>
+ <dependency>
+ <groupId>sun-jaxb</groupId>
+ <artifactId>jaxb-xjc</artifactId>
+ <version>2.0.5</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ </dependency>
+ <dependency>
+ <groupId>sun-jaf</groupId>
+ <artifactId>activation</artifactId>
+ <version>1.0.2</version>
+ </dependency>
+ <dependency>
+ <groupId>codehaus-stax</groupId>
+ <artifactId>stax</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-javaee</artifactId>
+ <version>5.0.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
Added: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/bridge/PolicySetFinderModule.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/bridge/PolicySetFinderModule.java (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/bridge/PolicySetFinderModule.java 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,147 @@
+/*
+ * 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.xacml.bridge;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.sun.xacml.AbstractPolicy;
+import com.sun.xacml.EvaluationCtx;
+import com.sun.xacml.MatchResult;
+import com.sun.xacml.Policy;
+import com.sun.xacml.PolicyMetaData;
+import com.sun.xacml.PolicySet;
+import com.sun.xacml.VersionConstraints;
+import com.sun.xacml.ctx.Status;
+import com.sun.xacml.finder.PolicyFinder;
+import com.sun.xacml.finder.PolicyFinderModule;
+import com.sun.xacml.finder.PolicyFinderResult;
+
+/**
+* PolicyFinderModule for PolicySet
+* @author Anil.Saldhana at redhat.com
+* @since Jul 6, 2007
+* @version $Revision$
+*/
+public class PolicySetFinderModule extends PolicyFinderModule
+{
+ private PolicySet policySet;
+ private List<Policy> policies = new ArrayList<Policy>();
+ protected PolicyFinder policyFinder = null;
+
+
+ public PolicySetFinderModule()
+ {
+ }
+
+ public PolicySetFinderModule(PolicySet policySet)
+ {
+ this.policySet = policySet;
+ }
+
+ public PolicySetFinderModule(PolicySet policySet, List<Policy> policies)
+ {
+ this.policySet = policySet;
+ this.policies.addAll(policies);
+ }
+
+ @Override
+ public void init(PolicyFinder finder)
+ {
+ this.policyFinder = finder;
+ }
+
+ /**
+ * Finds the applicable policy (if there is one) for the given context.
+ *
+ * @param context the evaluation context
+ *
+ * @return an applicable policy, if one exists, or an error
+ */
+ @Override
+ public PolicyFinderResult findPolicy(EvaluationCtx context)
+ {
+ AbstractPolicy selectedPolicy = null;
+ MatchResult match = policySet.match(context);
+ int result = match.getResult();
+
+ // if target matching was indeterminate, then return the error
+ if (result == MatchResult.INDETERMINATE)
+ return new PolicyFinderResult(match.getStatus());
+
+ // see if the target matched
+ if (result == MatchResult.MATCH) {
+ // see if we previously found another match
+ if (selectedPolicy != null) {
+ // we found a match before, so this is an error
+ ArrayList code = new ArrayList();
+ code.add(Status.STATUS_PROCESSING_ERROR);
+ Status status = new Status(code, "too many applicable "
+ + "top-level policies");
+ return new PolicyFinderResult(status);
+ }
+
+ // this is the first match we've found, so remember it
+ selectedPolicy = policySet;
+ }
+
+
+ // return the single applicable policy (if there was one)
+ return new PolicyFinderResult(selectedPolicy);
+ }
+
+
+ @Override
+ public PolicyFinderResult findPolicy(URI idReference, int type,
+ VersionConstraints constraints, PolicyMetaData parentMetaData)
+ {
+ for(Policy p:policies)
+ {
+ if(p.getId().compareTo(idReference) == 0)
+ return new PolicyFinderResult(p);
+ }
+ return new PolicyFinderResult();
+ }
+
+ @Override
+ public boolean isRequestSupported()
+ {
+ return true;
+ }
+
+ /**
+ * Always returns true, since reference-based retrieval is supported.
+ *
+ * @return true
+ */
+ public boolean isIdReferenceSupported()
+ {
+ return true;
+ }
+
+ public void set(PolicySet ps, List<Policy> policies)
+ {
+ this.policySet = ps;
+ this.policies = policies;
+ }
+}
Added: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossPDP.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossPDP.java (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossPDP.java 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,199 @@
+/*
+ * 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.xacml.core;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.XMLConstants;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.jboss.security.xacml.factories.PolicyFactory;
+import org.jboss.security.xacml.interfaces.PolicyDecisionPoint;
+import org.jboss.security.xacml.interfaces.PolicyLocator;
+import org.jboss.security.xacml.interfaces.XACMLPolicy;
+import org.jboss.security.xacml.jaxb.PDP;
+import org.jboss.security.xacml.jaxb.PoliciesType;
+import org.jboss.security.xacml.jaxb.PolicySetType;
+import org.jboss.security.xacml.jaxb.PolicyType;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+
+//$Id$
+
+/**
+ * PDP for JBoss XACML
+ * @author Anil.Saldhana at redhat.com
+ * @since Jul 6, 2007
+ * @version $Revision$
+ */
+public class JBossPDP implements PolicyDecisionPoint
+{
+ private Unmarshaller unmarshaller = null;
+ private Set<PolicyLocator> locators = new HashSet<PolicyLocator>();
+ private Set<XACMLPolicy> policies = new HashSet<XACMLPolicy>();
+
+ public JBossPDP()
+ {
+ }
+
+ public JBossPDP(InputStream configFile)
+ {
+ createValidatingUnMarshaller();
+ try
+ {
+ JAXBElement<?> jxb = (JAXBElement<?>) unmarshaller.unmarshal(configFile);
+ createPolicyObjects((PDP) jxb.getValue());
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public JBossPDP(InputSource configFile)
+ {
+ createValidatingUnMarshaller();
+ try
+ {
+ JAXBElement<?> jxb = (JAXBElement<?>) unmarshaller.unmarshal(configFile);
+ createPolicyObjects((PDP) jxb.getValue());
+ }
+ catch ( Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public JBossPDP(Node configFile)
+ {
+ createValidatingUnMarshaller();
+ try
+ {
+ JAXBElement<?> jxb = (JAXBElement<?>) unmarshaller.unmarshal(configFile);
+ createPolicyObjects((PDP) jxb.getValue());
+ }
+ catch ( Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public JBossPDP(XMLStreamReader configFile)
+ {
+ createValidatingUnMarshaller();
+ try
+ {
+ JAXBElement<?> jxb = (JAXBElement<?>) unmarshaller.unmarshal(configFile);
+ createPolicyObjects((PDP) jxb.getValue());
+ }
+ catch ( Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void setLocators(Set<PolicyLocator> locators)
+ {
+ this.locators = locators;
+ }
+
+ public void setPolicies(Set<XACMLPolicy> policies)
+ {
+ this.policies = policies;
+ }
+
+ private void createPolicyObjects(PDP pdp) throws Exception
+ {
+ PoliciesType policiesType = pdp.getPolicies();
+ List<PolicySetType> pset = policiesType.getPolicySet();
+ for(PolicySetType pst: pset)
+ {
+ String loc = pst.getLocation();
+ XACMLPolicy policySet = PolicyFactory.createPolicySet(getInputStream(loc));
+ List<PolicyType> policyTypeList = pst.getPolicy();
+
+ List<XACMLPolicy> policyList = new ArrayList<XACMLPolicy>();
+ for(PolicyType pt:policyTypeList)
+ {
+ policyList.add(PolicyFactory.createPolicy(getInputStream(pt.getLocation())));
+ }
+ policySet.setEnclosingPolicies(policyList);
+
+ policies.add(policySet);
+ }
+ //Take care of additional policies
+ List<PolicyType> policyList = policiesType.getPolicy();
+ for(PolicyType pt:policyList)
+ {
+ policies.add(PolicyFactory.createPolicy(getInputStream(pt.getLocation())));
+ }
+ }
+
+ private void createValidatingUnMarshaller()
+ {
+ try
+ {
+ JAXBContext jc = JAXBContext.newInstance( "org.jboss.security.xacml.jaxb" ); ;
+ unmarshaller = jc.createUnmarshaller();
+ //Validate against schema
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ URL schemaURL = tcl.getResource("schema/jbossxacml-2.0.xsd");
+ SchemaFactory scFact = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = scFact.newSchema(schemaURL);
+ unmarshaller.setSchema(schema);
+ }
+ catch(Exception jxb)
+ {
+ throw new RuntimeException(jxb);
+ }
+ }
+
+ private InputStream getInputStream(String loc)
+ {
+ InputStream is = null;
+ //Try URL
+ try
+ {
+ URL url = new URL(loc);
+ is = url.openStream();
+ }
+ catch (Exception e)
+ {
+ }
+ if(is == null)
+ {
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ is = tcl.getResourceAsStream(loc);
+ }
+ return is;
+ }
+}
Added: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossXACMLPolicy.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossXACMLPolicy.java (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossXACMLPolicy.java 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,88 @@
+/*
+ * 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.xacml.core;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.security.xacml.interfaces.XACMLPolicy;
+import org.jboss.security.xacml.util.XACMLPolicyUtil;
+
+import com.sun.xacml.AbstractPolicy;
+import com.sun.xacml.finder.PolicyFinder;
+
+//$Id$
+
+/**
+ * JBossXACML Policy
+ * @author Anil.Saldhana at redhat.com
+ * @since Jul 6, 2007
+ * @version $Revision$
+ */
+public class JBossXACMLPolicy implements XACMLPolicy
+{
+ //The base SunXACML Policy
+ private AbstractPolicy policy = null;
+ private PolicyFinder policyFinder = new PolicyFinder();
+ private List<XACMLPolicy> enclosingPolicies = new ArrayList<XACMLPolicy>();
+
+ private int policyType = XACMLPolicy.POLICY;
+
+ public JBossXACMLPolicy(URL url, int type) throws Exception
+ {
+ this(url.openStream(), type);
+ }
+
+ public JBossXACMLPolicy(InputStream is, int type) throws Exception
+ {
+ XACMLPolicyUtil xpu = new XACMLPolicyUtil();
+ this.policyType = type;
+ if(type == XACMLPolicy.POLICYSET)
+ {
+ policy = xpu.createPolicySet(is, policyFinder);
+ }
+ else
+ if(type == XACMLPolicy.POLICY)
+ {
+ policy = xpu.createPolicy(is);
+ }
+ else
+ throw new RuntimeException("Unknown type");
+ }
+
+ public int getType()
+ {
+ return this.policyType;
+ }
+
+ public void setEnclosingPolicies(List<XACMLPolicy> policies)
+ {
+ enclosingPolicies.addAll(policies);
+ }
+
+ public List<XACMLPolicy> getEnclosingPolicies()
+ {
+ return enclosingPolicies;
+ }
+}
Added: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/factories/PolicyFactory.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/factories/PolicyFactory.java (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/factories/PolicyFactory.java 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,88 @@
+/*
+ * 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.xacml.factories;
+
+import java.io.InputStream;
+import java.lang.reflect.Constructor;
+
+import org.jboss.security.xacml.core.JBossXACMLPolicy;
+import org.jboss.security.xacml.interfaces.XACMLPolicy;
+
+//$Id$
+
+/**
+ * A Policy Factory that creates XACML Policy
+ * or Policy Sets
+ * @author Anil.Saldhana at redhat.com
+ * @since Jul 5, 2007
+ * @version $Revision$
+ */
+public class PolicyFactory
+{
+ public static Class constructingClass = JBossXACMLPolicy.class;
+
+ public static void setConstructingClass(Class clazz)
+ {
+ if(XACMLPolicy.class.isAssignableFrom(clazz) == false)
+ throw new RuntimeException("clazz is not of type XACMLPolicy");
+ constructingClass = clazz;
+ }
+
+ public static void setConstructingClass(String fqn)
+ {
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ setConstructingClass(tcl.loadClass(fqn));
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+
+ public static XACMLPolicy createPolicySet(InputStream policySetFile)
+ throws Exception
+ {
+ return (XACMLPolicy) getCtr().newInstance(new Object[]{policySetFile,
+ XACMLPolicy.POLICYSET});
+ }
+
+ public static XACMLPolicy createPolicy(InputStream policyFile)
+ throws Exception
+ {
+ return (XACMLPolicy) getCtr().newInstance(new Object[]
+ {
+ policyFile,
+ XACMLPolicy.POLICY
+ }
+ );
+ }
+
+ private static Constructor<XACMLPolicy> getCtr() throws Exception
+ {
+ return constructingClass.getConstructor(new Class[] {
+ InputStream.class,
+ Integer.TYPE });
+ }
+}
Added: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/PolicyDecisionPoint.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/PolicyDecisionPoint.java (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/PolicyDecisionPoint.java 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,38 @@
+/*
+ * 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.xacml.interfaces;
+
+import java.util.Set;
+
+//$Id$
+
+/**
+ * Represents a XACML PDP
+ * @author Anil.Saldhana at redhat.com
+ * @since Jul 5, 2007
+ * @version $Revision$
+ */
+public interface PolicyDecisionPoint
+{
+ void setPolicies(Set<XACMLPolicy> policies);
+ void setLocators(Set<PolicyLocator> locators);
+}
Added: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/PolicyLocator.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/PolicyLocator.java (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/PolicyLocator.java 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,35 @@
+/*
+ * 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.xacml.interfaces;
+
+//$Id$
+
+/**
+ * Interface representing a locator for a XACML Policy
+ * @author Anil.Saldhana at redhat.com
+ * @since Jul 5, 2007
+ * @version $Revision$
+ */
+public interface PolicyLocator
+{
+
+}
Added: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/XACMLPolicy.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/XACMLPolicy.java (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/XACMLPolicy.java 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,42 @@
+/*
+ * 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.xacml.interfaces;
+
+import java.util.List;
+
+//$Id$
+
+/**
+ * Represents a Policy or a PolicySet in the XACML World
+ * @author Anil.Saldhana at redhat.com
+ * @since Jul 5, 2007
+ * @version $Revision$
+ */
+public interface XACMLPolicy
+{
+ int POLICYSET = 0;
+ int POLICY = 1;
+
+ int getType();
+ void setEnclosingPolicies(List<XACMLPolicy> policies);
+ List<XACMLPolicy> getEnclosingPolicies();
+}
Added: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/LocatorType.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/LocatorType.java (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/LocatorType.java 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,97 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1-b02-fcs
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2007.07.06 at 02:07:35 AM CDT
+//
+
+
+package org.jboss.security.xacml.jaxb;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for LocatorType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="LocatorType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element ref="{urn:jboss:xacml:2.0}Option" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="Name" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ at XmlAccessorType(XmlAccessType.FIELD)
+ at XmlType(name = "LocatorType", propOrder = {
+ "option"
+})
+public class LocatorType {
+
+ @XmlElement(name = "Option")
+ protected Option option;
+ @XmlAttribute(name = "Name")
+ protected String name;
+
+ /**
+ * Gets the value of the option property.
+ *
+ * @return
+ * possible object is
+ * {@link Option }
+ *
+ */
+ public Option getOption() {
+ return option;
+ }
+
+ /**
+ * Sets the value of the option property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Option }
+ *
+ */
+ public void setOption(Option value) {
+ this.option = value;
+ }
+
+ /**
+ * Gets the value of the name property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the value of the name property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setName(String value) {
+ this.name = value;
+ }
+
+}
Added: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/LocatorsType.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/LocatorsType.java (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/LocatorsType.java 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,69 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1-b02-fcs
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2007.07.06 at 02:07:35 AM CDT
+//
+
+
+package org.jboss.security.xacml.jaxb;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for LocatorsType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="LocatorsType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="Locator" type="{urn:jboss:xacml:2.0}LocatorType" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ at XmlAccessorType(XmlAccessType.FIELD)
+ at XmlType(name = "LocatorsType", propOrder = {
+ "locator"
+})
+public class LocatorsType {
+
+ @XmlElement(name = "Locator")
+ protected LocatorType locator;
+
+ /**
+ * Gets the value of the locator property.
+ *
+ * @return
+ * possible object is
+ * {@link LocatorType }
+ *
+ */
+ public LocatorType getLocator() {
+ return locator;
+ }
+
+ /**
+ * Sets the value of the locator property.
+ *
+ * @param value
+ * allowed object is
+ * {@link LocatorType }
+ *
+ */
+ public void setLocator(LocatorType value) {
+ this.locator = value;
+ }
+
+}
Added: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/ObjectFactory.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/ObjectFactory.java (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/ObjectFactory.java 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,128 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1-b02-fcs
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2007.07.06 at 02:07:35 AM CDT
+//
+
+
+package org.jboss.security.xacml.jaxb;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.namespace.QName;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the org.jboss.security.xacml.jaxb package.
+ * <p>An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ */
+ at XmlRegistry
+public class ObjectFactory {
+
+ private final static QName _Policies_QNAME = new QName("urn:jboss:xacml:2.0", "Policies");
+ private final static QName _Locators_QNAME = new QName("urn:jboss:xacml:2.0", "Locators");
+ private final static QName _Jbosspdp_QNAME = new QName("urn:jboss:xacml:2.0", "jbosspdp");
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.jboss.security.xacml.jaxb
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of {@link PoliciesType }
+ *
+ */
+ public PoliciesType createPoliciesType() {
+ return new PoliciesType();
+ }
+
+ /**
+ * Create an instance of {@link PolicySetType }
+ *
+ */
+ public PolicySetType createPolicySetType() {
+ return new PolicySetType();
+ }
+
+ /**
+ * Create an instance of {@link PDP }
+ *
+ */
+ public PDP createPDP() {
+ return new PDP();
+ }
+
+ /**
+ * Create an instance of {@link Option }
+ *
+ */
+ public Option createOption() {
+ return new Option();
+ }
+
+ /**
+ * Create an instance of {@link LocatorType }
+ *
+ */
+ public LocatorType createLocatorType() {
+ return new LocatorType();
+ }
+
+ /**
+ * Create an instance of {@link LocatorsType }
+ *
+ */
+ public LocatorsType createLocatorsType() {
+ return new LocatorsType();
+ }
+
+ /**
+ * Create an instance of {@link PolicyType }
+ *
+ */
+ public PolicyType createPolicyType() {
+ return new PolicyType();
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link PoliciesType }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "urn:jboss:xacml:2.0", name = "Policies")
+ public JAXBElement<PoliciesType> createPolicies(PoliciesType value) {
+ return new JAXBElement<PoliciesType>(_Policies_QNAME, PoliciesType.class, null, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link LocatorsType }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "urn:jboss:xacml:2.0", name = "Locators")
+ public JAXBElement<LocatorsType> createLocators(LocatorsType value) {
+ return new JAXBElement<LocatorsType>(_Locators_QNAME, LocatorsType.class, null, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link PDP }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "urn:jboss:xacml:2.0", name = "jbosspdp")
+ public JAXBElement<PDP> createJbosspdp(PDP value) {
+ return new JAXBElement<PDP>(_Jbosspdp_QNAME, PDP.class, null, value);
+ }
+
+}
Added: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/Option.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/Option.java (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/Option.java 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,109 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1-b02-fcs
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2007.07.06 at 02:07:35 AM CDT
+//
+
+
+package org.jboss.security.xacml.jaxb;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAnyElement;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlMixed;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <any/>
+ * </sequence>
+ * <attribute name="Name" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ at XmlAccessorType(XmlAccessType.FIELD)
+ at XmlType(name = "", propOrder = {
+ "content"
+})
+ at XmlRootElement(name = "Option")
+public class Option {
+
+ @XmlMixed
+ @XmlAnyElement(lax = true)
+ protected List<Object> content;
+ @XmlAttribute(name = "Name")
+ protected String name;
+
+ /**
+ * Gets the value of the content property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the content property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getContent().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link String }
+ * {@link Object }
+ *
+ *
+ */
+ public List<Object> getContent() {
+ if (content == null) {
+ content = new ArrayList<Object>();
+ }
+ return this.content;
+ }
+
+ /**
+ * Gets the value of the name property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the value of the name property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setName(String value) {
+ this.name = value;
+ }
+
+}
Added: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PDP.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PDP.java (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PDP.java 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,97 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1-b02-fcs
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2007.07.06 at 02:07:35 AM CDT
+//
+
+
+package org.jboss.security.xacml.jaxb;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for PDP complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="PDP">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element ref="{urn:jboss:xacml:2.0}Policies"/>
+ * <element ref="{urn:jboss:xacml:2.0}Locators"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ at XmlAccessorType(XmlAccessType.FIELD)
+ at XmlType(name = "PDP", propOrder = {
+ "policies",
+ "locators"
+})
+public class PDP {
+
+ @XmlElement(name = "Policies", required = true)
+ protected PoliciesType policies;
+ @XmlElement(name = "Locators", required = true)
+ protected LocatorsType locators;
+
+ /**
+ * Gets the value of the policies property.
+ *
+ * @return
+ * possible object is
+ * {@link PoliciesType }
+ *
+ */
+ public PoliciesType getPolicies() {
+ return policies;
+ }
+
+ /**
+ * Sets the value of the policies property.
+ *
+ * @param value
+ * allowed object is
+ * {@link PoliciesType }
+ *
+ */
+ public void setPolicies(PoliciesType value) {
+ this.policies = value;
+ }
+
+ /**
+ * Gets the value of the locators property.
+ *
+ * @return
+ * possible object is
+ * {@link LocatorsType }
+ *
+ */
+ public LocatorsType getLocators() {
+ return locators;
+ }
+
+ /**
+ * Sets the value of the locators property.
+ *
+ * @param value
+ * allowed object is
+ * {@link LocatorsType }
+ *
+ */
+ public void setLocators(LocatorsType value) {
+ this.locators = value;
+ }
+
+}
Added: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PoliciesType.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PoliciesType.java (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PoliciesType.java 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,109 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1-b02-fcs
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2007.07.06 at 02:07:35 AM CDT
+//
+
+
+package org.jboss.security.xacml.jaxb;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for PoliciesType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="PoliciesType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="PolicySet" type="{urn:jboss:xacml:2.0}PolicySetType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="Policy" type="{urn:jboss:xacml:2.0}PolicyType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ at XmlAccessorType(XmlAccessType.FIELD)
+ at XmlType(name = "PoliciesType", propOrder = {
+ "policySet",
+ "policy"
+})
+public class PoliciesType {
+
+ @XmlElement(name = "PolicySet")
+ protected List<PolicySetType> policySet;
+ @XmlElement(name = "Policy")
+ protected List<PolicyType> policy;
+
+ /**
+ * Gets the value of the policySet property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the policySet property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getPolicySet().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link PolicySetType }
+ *
+ *
+ */
+ public List<PolicySetType> getPolicySet() {
+ if (policySet == null) {
+ policySet = new ArrayList<PolicySetType>();
+ }
+ return this.policySet;
+ }
+
+ /**
+ * Gets the value of the policy property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the policy property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getPolicy().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link PolicyType }
+ *
+ *
+ */
+ public List<PolicyType> getPolicy() {
+ if (policy == null) {
+ policy = new ArrayList<PolicyType>();
+ }
+ return this.policy;
+ }
+
+}
Added: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PolicySetType.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PolicySetType.java (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PolicySetType.java 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,106 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1-b02-fcs
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2007.07.06 at 02:07:35 AM CDT
+//
+
+
+package org.jboss.security.xacml.jaxb;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for PolicySetType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="PolicySetType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="Location" type="{http://www.w3.org/2001/XMLSchema}anyURI" minOccurs="0"/>
+ * <element name="Policy" type="{urn:jboss:xacml:2.0}PolicyType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ at XmlAccessorType(XmlAccessType.FIELD)
+ at XmlType(name = "PolicySetType", propOrder = {
+ "location",
+ "policy"
+})
+public class PolicySetType {
+
+ @XmlElement(name = "Location")
+ @XmlSchemaType(name = "anyURI")
+ protected String location;
+ @XmlElement(name = "Policy")
+ protected List<PolicyType> policy;
+
+ /**
+ * Gets the value of the location property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getLocation() {
+ return location;
+ }
+
+ /**
+ * Sets the value of the location property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setLocation(String value) {
+ this.location = value;
+ }
+
+ /**
+ * Gets the value of the policy property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the policy property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getPolicy().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link PolicyType }
+ *
+ *
+ */
+ public List<PolicyType> getPolicy() {
+ if (policy == null) {
+ policy = new ArrayList<PolicyType>();
+ }
+ return this.policy;
+ }
+
+}
Added: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PolicyType.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PolicyType.java (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PolicyType.java 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,71 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1-b02-fcs
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2007.07.06 at 02:07:35 AM CDT
+//
+
+
+package org.jboss.security.xacml.jaxb;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for PolicyType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="PolicyType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="Location" type="{http://www.w3.org/2001/XMLSchema}anyURI"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ at XmlAccessorType(XmlAccessType.FIELD)
+ at XmlType(name = "PolicyType", propOrder = {
+ "location"
+})
+public class PolicyType {
+
+ @XmlElement(name = "Location", required = true)
+ @XmlSchemaType(name = "anyURI")
+ protected String location;
+
+ /**
+ * Gets the value of the location property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getLocation() {
+ return location;
+ }
+
+ /**
+ * Sets the value of the location property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setLocation(String value) {
+ this.location = value;
+ }
+
+}
Added: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/package-info.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/package-info.java (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/package-info.java 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,9 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1-b02-fcs
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2007.07.06 at 02:07:35 AM CDT
+//
+
+ at javax.xml.bind.annotation.XmlSchema(namespace = "urn:jboss:xacml:2.0", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package org.jboss.security.xacml.jaxb;
Added: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/locators/JBossPolicySetLocator.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/locators/JBossPolicySetLocator.java (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/locators/JBossPolicySetLocator.java 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,39 @@
+/*
+ * 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.xacml.locators;
+
+import org.jboss.security.xacml.interfaces.PolicyLocator;
+
+//$Id$
+
+/**
+ * Locator for a PolicySet
+ * @author Anil.Saldhana at redhat.com
+ * @since Jul 6, 2007
+ * @version $Revision$
+ */
+public class JBossPolicySetLocator implements PolicyLocator
+{
+ public JBossPolicySetLocator()
+ {
+ }
+}
Added: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/util/XACMLPolicyUtil.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/util/XACMLPolicyUtil.java (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/util/XACMLPolicyUtil.java 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,78 @@
+/*
+ * 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.xacml.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+import com.sun.xacml.Policy;
+import com.sun.xacml.PolicySet;
+import com.sun.xacml.finder.PolicyFinder;
+
+/**
+ * Create an XACML Policy Object from the url for the policy xml
+ * @author Anil.Saldhana at redhat.com
+ * @since Jul 6, 2007
+ * @version $Revision$
+ */
+public class XACMLPolicyUtil
+{
+ public PolicySet createPolicySet(URL location, PolicyFinder finder) throws Exception
+ {
+ return createPolicySet(location.openStream(), finder);
+ }
+
+ public PolicySet createPolicySet(InputStream is, PolicyFinder finder) throws Exception
+ {
+ Document doc = getDocument(is);
+ return PolicySet.getInstance(doc.getFirstChild(), finder);
+ }
+
+ public Policy createPolicy(URL location) throws Exception
+ {
+ return createPolicy(location.openStream());
+ }
+
+ public Policy createPolicy(InputStream is) throws Exception
+ {
+ Document doc = getDocument(is);
+ return Policy.getInstance(doc.getFirstChild());
+ }
+
+ private Document getDocument(InputStream is)
+ throws ParserConfigurationException, SAXException, IOException
+ {
+ DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
+ docBuilderFactory.setNamespaceAware(true);
+ DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
+ Document doc = docBuilder.parse (is);
+ return doc;
+ }
+}
Added: projects/security/security-xacml/trunk/jboss-xacml/src/resources/schema/jbossxacml-2.0.xsd
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/resources/schema/jbossxacml-2.0.xsd (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/resources/schema/jbossxacml-2.0.xsd 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:ns="urn:jboss:xacml:2.0"
+ targetNamespace="urn:jboss:xacml:2.0"
+ elementFormDefault="qualified" attributeFormDefault="unqualified">
+ <xs:element name="jbosspdp" type="ns:PDP">
+ <xs:annotation>
+ <xs:documentation>Root Element for JBoss XACML</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:complexType name="PDP">
+ <xs:sequence>
+ <xs:element ref="ns:Policies" minOccurs="1"/>
+ <xs:element ref="ns:Locators" minOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:element name="Policies" type="ns:PoliciesType"/>
+ <xs:complexType name="PoliciesType">
+ <xs:sequence>
+ <xs:element name="PolicySet" type="ns:PolicySetType" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="Policy" type="ns:PolicyType" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="PolicySetType">
+ <xs:sequence>
+ <xs:element name="Location" type="xs:anyURI" minOccurs="0"/>
+ <xs:element name="Policy" type="ns:PolicyType" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="PolicyType">
+ <xs:sequence>
+ <xs:element name="Location" type="xs:anyURI"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:element name="Locators" type="ns:LocatorsType"/>
+ <xs:complexType name="LocatorsType">
+ <xs:sequence>
+ <xs:element name="Locator" type="ns:LocatorType" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:element name="Option">
+ <xs:complexType mixed="true">
+ <xs:sequence>
+ <xs:any namespace="##other" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="Name" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="LocatorType">
+ <xs:sequence>
+ <xs:element ref="ns:Option" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="Name" type="xs:string"/>
+ </xs:complexType>
+</xs:schema>
Added: projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/config/basicPolicySetConfig.xml
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/config/basicPolicySetConfig.xml (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/config/basicPolicySetConfig.xml 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,12 @@
+<ns:jbosspdp xmlns:ns="urn:jboss:xacml:2.0">
+ <ns:Policies>
+ <ns:PolicySet>
+ <ns:Location>file://SomeLocation</ns:Location>
+ </ns:PolicySet>
+ </ns:Policies>
+ <ns:Locators>
+ <ns:Locator Name="org.jboss.test.security.xacml.MyLocator">
+ <ns:Option Name="option1">1</ns:Option>
+ </ns:Locator>
+ </ns:Locators>
+</ns:jbosspdp>
\ No newline at end of file
Added: projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/config/interopPolicySetConfig.xml
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/config/interopPolicySetConfig.xml (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/config/interopPolicySetConfig.xml 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,12 @@
+<ns:jbosspdp xmlns:ns="urn:jboss:xacml:2.0">
+ <ns:Policies>
+ <ns:PolicySet>
+ <ns:Location>test/policies/interop/xacml-policySet.xml</ns:Location>
+ </ns:PolicySet>
+ </ns:Policies>
+ <ns:Locators>
+ <ns:Locator Name="org.jboss.test.security.xacml.MyLocator">
+ <ns:Option Name="option1">1</ns:Option>
+ </ns:Locator>
+ </ns:Locators>
+</ns:jbosspdp>
\ No newline at end of file
Added: projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/policies/interop/xacml-policy2.xml
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/policies/interop/xacml-policy2.xml (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/policies/interop/xacml-policy2.xml 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,176 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Policy
+ xmlns="urn:oasis:names:tc:xacml:2.0:policy:schema:os"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:oasis:names:tc:xacml:2.0:policy:schema:os
+ http://docs.oasis-open.org/xacml/access_control-xacml-2.0-policy-schema-os.xsd"
+ PolicyId="urn:xacml:2.0:interop:example:policyid:02"
+ RuleCombiningAlgId=
+ "urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:permit-overrides">
+ <Description>
+ XACML 2.0 Interop Example Policy 02: Only allow a customer whose id matches the
+ account owner-id to access the account and only if the account status is active.
+ Only allow trades that have value within credit-line and trade-limit restrictions.
+ </Description>
+ <Target/>
+ <VariableDefinition VariableId="urn:xacml:2.0:interop:example:variableid:01.2">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
+ <SubjectAttributeDesignator
+ AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id"
+ DataType="http://www.w3.org/2001/XMLSchema#string"/>
+ </Apply>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
+ <ResourceAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:resource:owner-id"
+ DataType="http://www.w3.org/2001/XMLSchema#string"/>
+ </Apply>
+ </Apply>
+ </VariableDefinition>
+ <VariableDefinition VariableId="urn:xacml:2.0:interop:example:variableid:02">
+ <!-- Function to evaluate: -->
+ <!-- ((buy-num-shares x buy-offer-price) lt -->
+ <!-- (credit-line - current-credit) ) and -->
+ <!-- ((buy-num-shares x buy-offer-price) lt trade-limit) -->
+ <!-- If both the above expressions true, then Request within limits -->
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:and">
+ <Apply FunctionId=
+ "urn:oasis:names:tc:xacml:1.0:function:integer-less-than-or-equal">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-multiply">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
+ <SubjectAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:subject:buy-num-shares"
+ DataType="http://www.w3.org/2001/XMLSchema#integer"/>
+ </Apply>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
+ <SubjectAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:subject:buy-offer-price"
+ DataType="http://www.w3.org/2001/XMLSchema#integer"/>
+ </Apply>
+ </Apply>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-subtract">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
+ <ResourceAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:resource:credit-line"
+ DataType="http://www.w3.org/2001/XMLSchema#integer"/>
+ </Apply>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
+ <ResourceAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:resource:current-credit"
+ DataType="http://www.w3.org/2001/XMLSchema#integer"/>
+ </Apply>
+ </Apply>
+ </Apply>
+ <Apply FunctionId=
+ "urn:oasis:names:tc:xacml:1.0:function:integer-less-than-or-equal">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-multiply">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
+ <SubjectAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:subject:buy-num-shares"
+ DataType="http://www.w3.org/2001/XMLSchema#integer"/>
+ </Apply>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
+ <SubjectAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:subject:buy-offer-price"
+ DataType="http://www.w3.org/2001/XMLSchema#integer"/>
+ </Apply>
+ </Apply>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
+ <ResourceAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:resource:trade-limit"
+ DataType="http://www.w3.org/2001/XMLSchema#integer"/>
+ </Apply>
+ </Apply>
+ </Apply>
+ </VariableDefinition>
+ <Rule RuleId="urn:xacml:2.0:interop:example:ruleid:02"
+ Effect="Permit">
+ <Description>
+ XACML 2.0 Interop Example Rule 02: Only allow a customer whose id matches the
+ account owner-id to access the account and only if the account status is active.
+ </Description>
+ <Target>
+ <!-- This rule permits access to CustomerAccount resources -->
+ <Resources>
+ <!-- CustomerAccount -->
+ <Resource>
+ <ResourceMatch
+ MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
+ <AttributeValue
+ DataType="http://www.w3.org/2001/XMLSchema#string"
+ >CustomerAccount</AttributeValue>
+ <ResourceAttributeDesignator
+ AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id"
+ DataType="http://www.w3.org/2001/XMLSchema#string"/>
+ </ResourceMatch>
+ <!-- Account must have Active status -->
+ <ResourceMatch
+ MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
+ <AttributeValue
+ DataType="http://www.w3.org/2001/XMLSchema#string"
+ >Active</AttributeValue>
+ <ResourceAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:resource:account-status"
+ DataType="http://www.w3.org/2001/XMLSchema#string"/>
+ </ResourceMatch>
+ </Resource>
+ </Resources>
+ <!-- This rule only applies to the ViewAccount action -->
+ <Actions>
+ <Action>
+ <ActionMatch
+ MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
+ <AttributeValue
+ DataType="http://www.w3.org/2001/XMLSchema#string"
+ >Buy</AttributeValue>
+ <ActionAttributeDesignator
+ AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"
+ DataType="http://www.w3.org/2001/XMLSchema#string"/>
+ </ActionMatch>
+ </Action>
+ </Actions>
+ </Target>
+ <Condition>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:and">
+ <VariableReference VariableId="urn:xacml:2.0:interop:example:variableid:01.2"/>
+ <VariableReference VariableId="urn:xacml:2.0:interop:example:variableid:02"/>
+ </Apply>
+ </Condition>
+ </Rule>
+ <Rule RuleId="urn:xacml:2.0:interop:example:ruleid:deny02" Effect="Deny">
+ <Description>
+ This Policy is permit-overrides, therefore if a rule above evaluated to
+ Permit this Rule will be skipped. However, if no Permit was obtained, this
+ Rule evaluates to true and so produces a Deny. Therefore evaluation of this
+ Policy results in either a Permit or Deny which is the intended effect.
+ </Description>
+ <Target/>
+ </Rule>
+ <Obligations>
+ <!-- These obligations tell PEP to provide specific data items to the response -->
+ <!-- This obligation says provide the xacml:Decision data to the response -->
+ <Obligation
+ ObligationId="urn:xacml:2.0:interop:example:obligation:decision"
+ FulfillOn="Permit"/>
+ <!-- This obligation says provide the xacml:StatusCode data to the response -->
+ <Obligation
+ ObligationId="urn:xacml:2.0:interop:example:obligation:status-code"
+ FulfillOn="Permit"/>
+ <!-- This obligation says provide the xacml:StatusMessage data to the response -->
+ <Obligation
+ ObligationId="urn:xacml:2.0:interop:example:obligation:status-message"
+ FulfillOn="Permit"/>
+ <!-- This obligation says provide the xacml:Decision data to the response -->
+ <Obligation
+ ObligationId="urn:xacml:2.0:interop:example:obligation:decision"
+ FulfillOn="Deny"/>
+ <!-- This obligation says provide the xacml:StatusCode data to the response -->
+ <Obligation
+ ObligationId="urn:xacml:2.0:interop:example:obligation:status-code"
+ FulfillOn="Deny"/>
+ <!-- This obligation says provide the xacml:StatusMessage data to the response -->
+ <Obligation
+ ObligationId="urn:xacml:2.0:interop:example:obligation:status-message"
+ FulfillOn="Deny"/>
+ </Obligations>
+</Policy>
\ No newline at end of file
Added: projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/policies/interop/xacml-policy3.xml
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/policies/interop/xacml-policy3.xml (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/policies/interop/xacml-policy3.xml 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Policy
+ xmlns="urn:oasis:names:tc:xacml:2.0:policy:schema:os"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:oasis:names:tc:xacml:2.0:policy:schema:os
+ http://docs.oasis-open.org/xacml/access_control-xacml-2.0-policy-schema-os.xsd"
+ PolicyId="urn:xacml:2.0:interop:example:policyid:03"
+ RuleCombiningAlgId=
+ "urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:permit-overrides">
+ <Description>
+ XACML 2.0 Interop Example Policy 03: Only allow a customer whose id matches the
+ account owner-id to access the account and only if the account status is active.
+ Only allow trades that have value exceeding trade-limit
+ and req-trade-approval = true.
+ </Description>
+ <Target/>
+ <VariableDefinition VariableId="urn:xacml:2.0:interop:example:variableid:01.3">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
+ <SubjectAttributeDesignator
+ AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id"
+ DataType="http://www.w3.org/2001/XMLSchema#string"/>
+ </Apply>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
+ <ResourceAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:resource:owner-id"
+ DataType="http://www.w3.org/2001/XMLSchema#string"/>
+ </Apply>
+ </Apply>
+ </VariableDefinition>
+ <VariableDefinition VariableId="urn:xacml:2.0:interop:example:variableid:03">
+ <!-- TBD: Function to evaluate: -->
+ <!-- buy-num-shares x buy-offer-price gt trade-limit, -->
+ <!-- AND req-trade-approval = true -->
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:and">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-greater-than">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-multiply">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
+ <SubjectAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:subject:buy-num-shares"
+ DataType="http://www.w3.org/2001/XMLSchema#integer"/>
+ </Apply>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
+ <SubjectAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:subject:buy-offer-price"
+ DataType="http://www.w3.org/2001/XMLSchema#integer"/>
+ </Apply>
+ </Apply>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
+ <ResourceAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:resource:trade-limit"
+ DataType="http://www.w3.org/2001/XMLSchema#integer"/>
+ </Apply>
+ </Apply>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
+ <AttributeValue
+ DataType="http://www.w3.org/2001/XMLSchema#string"
+ >true</AttributeValue>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
+ <SubjectAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:subject:req-trade-approval"
+ DataType="http://www.w3.org/2001/XMLSchema#string"/>
+ </Apply>
+ </Apply>
+ </Apply>
+ </VariableDefinition>
+ <Rule RuleId="urn:xacml:2.0:interop:example:ruleid:03"
+ Effect="Permit">
+ <Description>
+ XACML 2.0 Interop Example Rule 03: Only allow a customer whose id matches the
+ account owner-id to access the account and only if the account status is active.
+ </Description>
+ <Target>
+ <!-- This rule permits access to CustomerAccount resources -->
+ <Resources>
+ <!-- CustomerAccount -->
+ <Resource>
+ <ResourceMatch
+ MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
+ <AttributeValue
+ DataType="http://www.w3.org/2001/XMLSchema#string"
+ >CustomerAccount</AttributeValue>
+ <ResourceAttributeDesignator
+ AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id"
+ DataType="http://www.w3.org/2001/XMLSchema#string"/>
+ </ResourceMatch>
+ <!-- Account must have Active status -->
+ <ResourceMatch
+ MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
+ <AttributeValue
+ DataType="http://www.w3.org/2001/XMLSchema#string"
+ >Active</AttributeValue>
+ <ResourceAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:resource:account-status"
+ DataType="http://www.w3.org/2001/XMLSchema#string"/>
+ </ResourceMatch>
+ </Resource>
+ </Resources>
+ <!-- This rule only applies to the ViewAccount action -->
+ <Actions>
+ <Action>
+ <ActionMatch
+ MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
+ <AttributeValue
+ DataType="http://www.w3.org/2001/XMLSchema#string"
+ >Buy</AttributeValue>
+ <ActionAttributeDesignator
+ AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"
+ DataType="http://www.w3.org/2001/XMLSchema#string"/>
+ </ActionMatch>
+ </Action>
+ </Actions>
+ </Target>
+ <Condition>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:and">
+ <VariableReference VariableId="urn:xacml:2.0:interop:example:variableid:01.3"/>
+ <VariableReference VariableId="urn:xacml:2.0:interop:example:variableid:03"/>
+ </Apply>
+ </Condition>
+ </Rule>
+ <Obligations>
+ <!-- These obligations tell PEP to provide specific data items to the response -->
+ <Obligation
+ ObligationId="urn:xacml:2.0:interop:example:obligation:trade-approval"
+ FulfillOn="Permit"/>
+ </Obligations>
+</Policy>
\ No newline at end of file
Added: projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/policies/interop/xacml-policy4.xml
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/policies/interop/xacml-policy4.xml (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/policies/interop/xacml-policy4.xml 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Policy
+ xmlns="urn:oasis:names:tc:xacml:2.0:policy:schema:os"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:oasis:names:tc:xacml:2.0:policy:schema:os
+ http://docs.oasis-open.org/xacml/access_control-xacml-2.0-policy-schema-os.xsd"
+ PolicyId="urn:xacml:2.0:interop:example:policyid:04"
+ RuleCombiningAlgId=
+ "urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:permit-overrides">
+ <Description>
+ XACML 2.0 Interop Example Policy 04: Only allow a customer whose id matches the
+ account owner-id to access the account and only if the account status is active.
+ Only allow trades that have value exceeding credit-limit
+ and req-credit-ext-approval = true.
+ </Description>
+ <Target/>
+ <VariableDefinition VariableId="urn:xacml:2.0:interop:example:variableid:01.4">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
+ <SubjectAttributeDesignator
+ AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id"
+ DataType="http://www.w3.org/2001/XMLSchema#string"/>
+ </Apply>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
+ <ResourceAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:resource:owner-id"
+ DataType="http://www.w3.org/2001/XMLSchema#string"/>
+ </Apply>
+ </Apply>
+ </VariableDefinition>
+ <VariableDefinition VariableId="urn:xacml:2.0:interop:example:variableid:04">
+ <!-- TBD: Function to evaluate: -->
+ <!-- ( buy-num-shares x buy-offer-price ) gt -->
+ <!-- ( credit-line - current-credit ) ) -->
+ <!-- AND req-credit-ext-approval = true -->
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:and">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-greater-than">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-multiply">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
+ <SubjectAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:subject:buy-num-shares"
+ DataType="http://www.w3.org/2001/XMLSchema#integer"/>
+ </Apply>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
+ <SubjectAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:subject:buy-offer-price"
+ DataType="http://www.w3.org/2001/XMLSchema#integer"/>
+ </Apply>
+ </Apply>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-subtract">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
+ <ResourceAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:resource:credit-line"
+ DataType="http://www.w3.org/2001/XMLSchema#integer"/>
+ </Apply>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
+ <ResourceAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:resource:current-credit"
+ DataType="http://www.w3.org/2001/XMLSchema#integer"/>
+ </Apply>
+ </Apply>
+ </Apply>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
+ <AttributeValue
+ DataType="http://www.w3.org/2001/XMLSchema#string"
+ >true</AttributeValue>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
+ <SubjectAttributeDesignator AttributeId=
+ "urn:xacml:2.0:interop:example:subject:req-credit-ext-approval"
+ DataType="http://www.w3.org/2001/XMLSchema#string"/>
+ </Apply>
+ </Apply>
+ </Apply>
+ </VariableDefinition>
+ <Rule RuleId="urn:xacml:2.0:interop:example:ruleid:04"
+ Effect="Permit">
+ <Description>
+ XACML 2.0 Interop Example Rule 04: Only allow a customer whose id matches the
+ account owner-id to access the account and only if the account status is active.
+ </Description>
+ <Target>
+ <!-- This rule permits access to CustomerAccount resources -->
+ <Resources>
+ <!-- CustomerAccount -->
+ <Resource>
+ <ResourceMatch
+ MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
+ <AttributeValue
+ DataType="http://www.w3.org/2001/XMLSchema#string"
+ >CustomerAccount</AttributeValue>
+ <ResourceAttributeDesignator
+ AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id"
+ DataType="http://www.w3.org/2001/XMLSchema#string"/>
+ </ResourceMatch>
+ <!-- Account must have Active status -->
+ <ResourceMatch
+ MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
+ <AttributeValue
+ DataType="http://www.w3.org/2001/XMLSchema#string"
+ >Active</AttributeValue>
+ <ResourceAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:resource:account-status"
+ DataType="http://www.w3.org/2001/XMLSchema#string"/>
+ </ResourceMatch>
+ </Resource>
+ </Resources>
+ <!-- This rule only applies to the Buy action -->
+ <Actions>
+ <Action>
+ <ActionMatch
+ MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
+ <AttributeValue
+ DataType="http://www.w3.org/2001/XMLSchema#string"
+ >Buy</AttributeValue>
+ <ActionAttributeDesignator
+ AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"
+ DataType="http://www.w3.org/2001/XMLSchema#string"/>
+ </ActionMatch>
+ </Action>
+ </Actions>
+ </Target>
+ <Condition>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:and">
+ <VariableReference VariableId="urn:xacml:2.0:interop:example:variableid:01.4"/>
+ <VariableReference VariableId="urn:xacml:2.0:interop:example:variableid:04"/>
+ </Apply>
+ </Condition>
+ </Rule>
+ <Obligations>
+ <!-- These obligations tell PEP to provide specific data items to the response -->
+ <Obligation
+ ObligationId="urn:xacml:2.0:interop:example:obligation:credit-ext-approval"
+ FulfillOn="Permit"/>
+ </Obligations>
+</Policy>
\ No newline at end of file
Added: projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/policies/interop/xacml-policy5.xml
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/policies/interop/xacml-policy5.xml (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/policies/interop/xacml-policy5.xml 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,179 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Policy
+ xmlns="urn:oasis:names:tc:xacml:2.0:policy:schema:os"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:oasis:names:tc:xacml:2.0:policy:schema:os
+ http://docs.oasis-open.org/xacml/access_control-xacml-2.0-policy-schema-os.xsd"
+ PolicyId="urn:xacml:2.0:interop:example:policyid:05"
+ RuleCombiningAlgId=
+ "urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:deny-overrides">
+ <Description>
+ XACML 2.0 Interop Example Policy 05: Only allow a customer whose id matches the
+ account owner-id to access the account and only if the account status is active.
+ Disallow trades that have value exceeding a limit without the associated
+ Request for approval = true.
+ </Description>
+ <Target/>
+ <VariableDefinition VariableId="urn:xacml:2.0:interop:example:variableid:01.5">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
+ <SubjectAttributeDesignator
+ AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id"
+ DataType="http://www.w3.org/2001/XMLSchema#string"/>
+ </Apply>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
+ <ResourceAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:resource:owner-id"
+ DataType="http://www.w3.org/2001/XMLSchema#string"/>
+ </Apply>
+ </Apply>
+ </VariableDefinition>
+ <VariableDefinition VariableId="urn:xacml:2.0:interop:example:variableid:05">
+ <!-- TBD: Function to evaluate: -->
+ <!-- ( ( ( buy-num-shares x buy-offer-price ) gt -->
+ <!-- ( credit-line - current-credit ) ) AND -->
+ <!-- ( req-credit-ext-approval == false ) ) -->
+ <!-- OR ( buy-num-shares x buy-offer-price gt trade-limit, -->
+ <!-- AND req-trade-approval == false ) -->
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:or">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:and">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-greater-than">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-multiply">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
+ <SubjectAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:subject:buy-num-shares"
+ DataType="http://www.w3.org/2001/XMLSchema#integer"/>
+ </Apply>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
+ <SubjectAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:subject:buy-offer-price"
+ DataType="http://www.w3.org/2001/XMLSchema#integer"/>
+ </Apply>
+ </Apply>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-subtract">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
+ <ResourceAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:resource:credit-line"
+ DataType="http://www.w3.org/2001/XMLSchema#integer"/>
+ </Apply>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
+ <ResourceAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:resource:current-credit"
+ DataType="http://www.w3.org/2001/XMLSchema#integer"/>
+ </Apply>
+ </Apply>
+ </Apply>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
+ <AttributeValue
+ DataType="http://www.w3.org/2001/XMLSchema#string"
+ >false</AttributeValue>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
+ <SubjectAttributeDesignator AttributeId=
+ "urn:xacml:2.0:interop:example:subject:req-credit-ext-approval"
+ DataType="http://www.w3.org/2001/XMLSchema#string"/>
+ </Apply>
+ </Apply>
+ </Apply>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:and">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-greater-than">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-multiply">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
+ <SubjectAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:subject:buy-num-shares"
+ DataType="http://www.w3.org/2001/XMLSchema#integer"/>
+ </Apply>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
+ <SubjectAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:subject:buy-offer-price"
+ DataType="http://www.w3.org/2001/XMLSchema#integer"/>
+ </Apply>
+ </Apply>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
+ <ResourceAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:resource:trade-limit"
+ DataType="http://www.w3.org/2001/XMLSchema#integer"/>
+ </Apply>
+ </Apply>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
+ <AttributeValue
+ DataType="http://www.w3.org/2001/XMLSchema#string"
+ >false</AttributeValue>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
+ <SubjectAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:subject:req-trade-approval"
+ DataType="http://www.w3.org/2001/XMLSchema#string"/>
+ </Apply>
+ </Apply>
+ </Apply>
+ </Apply>
+ </VariableDefinition>
+ <Rule RuleId="urn:xacml:2.0:interop:example:ruleid:05"
+ Effect="Deny">
+ <Description>
+ XACML 2.0 Interop Example Rule 05: Only allow a customer whose id matches the
+ account owner-id to access the account and only if the account status is active.
+ </Description>
+ <Target>
+ <!-- This rule permits access to CustomerAccount resources -->
+ <Resources>
+ <!-- CustomerAccount -->
+ <Resource>
+ <ResourceMatch
+ MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
+ <AttributeValue
+ DataType="http://www.w3.org/2001/XMLSchema#string"
+ >CustomerAccount</AttributeValue>
+ <ResourceAttributeDesignator
+ AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id"
+ DataType="http://www.w3.org/2001/XMLSchema#string"/>
+ </ResourceMatch>
+ <!-- Account must have Active status -->
+ <ResourceMatch
+ MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
+ <AttributeValue
+ DataType="http://www.w3.org/2001/XMLSchema#string"
+ >Active</AttributeValue>
+ <ResourceAttributeDesignator
+ AttributeId="urn:xacml:2.0:interop:example:resource:account-status"
+ DataType="http://www.w3.org/2001/XMLSchema#string"/>
+ </ResourceMatch>
+ </Resource>
+ </Resources>
+ <!-- This rule only applies to the ViewAccount action -->
+ <Actions>
+ <Action>
+ <ActionMatch
+ MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
+ <AttributeValue
+ DataType="http://www.w3.org/2001/XMLSchema#string"
+ >Buy</AttributeValue>
+ <ActionAttributeDesignator
+ AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"
+ DataType="http://www.w3.org/2001/XMLSchema#string"/>
+ </ActionMatch>
+ </Action>
+ </Actions>
+ </Target>
+ <Condition>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:and">
+ <VariableReference VariableId="urn:xacml:2.0:interop:example:variableid:01.5"/>
+ <VariableReference VariableId="urn:xacml:2.0:interop:example:variableid:05"/>
+ </Apply>
+ </Condition>
+ </Rule>
+ <Obligations>
+ <!-- These obligations tell PEP to provide specific data items to the response -->
+ <!-- This obligation says provide the xacml:Decision data to the response -->
+ <Obligation
+ ObligationId="urn:xacml:2.0:interop:example:obligation:decision"
+ FulfillOn="Deny"/>
+ <!-- This obligation says provide the xacml:StatusCode data to the response -->
+ <Obligation
+ ObligationId="urn:xacml:2.0:interop:example:obligation:status-code"
+ FulfillOn="Deny"/>
+ <!-- This obligation says provide the xacml:StatusMessage data to the response -->
+ <Obligation
+ ObligationId="urn:xacml:2.0:interop:example:obligation:status-message"
+ FulfillOn="Deny"/>
+ </Obligations>
+</Policy>
\ No newline at end of file
Added: projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/policies/interop/xacml-policySet.xml
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/policies/interop/xacml-policySet.xml (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/resources/test/policies/interop/xacml-policySet.xml 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<PolicySet
+ xmlns="urn:oasis:names:tc:xacml:2.0:policy:schema:os"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:oasis:names:tc:xacml:2.0:policy:schema:os
+ http://docs.oasis-open.org/xacml/access_control-xacml-2.0-policy-schema-os.xsd"
+ PolicySetId="urn:xacml:2.0:interop:example:policysetid:01"
+ PolicyCombiningAlgId=
+ "urn:oasis:names:tc:xacml:1.0:policy-combining-algorithm:permit-overrides">
+ <Description>
+ Policyset to evaluate trade-limit and credit-ext restrictions
+ </Description>
+ <Target/>
+ <PolicyIdReference
+ >urn:xacml:2.0:interop:example:policyid:02</PolicyIdReference>
+ <PolicySet
+ PolicySetId="urn:xacml:2.0:interop:example:policysetid:06"
+ PolicyCombiningAlgId=
+ "urn:oasis:names:tc:xacml:1.0:policy-combining-algorithm:deny-overrides">
+ <Description>
+ Policy for picking up trade-limit or credit-ext obligations
+ </Description>
+ <Target/>
+ <PolicyIdReference
+ >urn:xacml:2.0:interop:example:policyid:03</PolicyIdReference>
+ <PolicyIdReference
+ >urn:xacml:2.0:interop:example:policyid:04</PolicyIdReference>
+ <PolicyIdReference
+ >urn:xacml:2.0:interop:example:policyid:05</PolicyIdReference>
+ <Obligations>
+ <!-- These obligations tell PEP to provide specific data items to the response -->
+ <!-- This obligation says provide the xacml:Decision data to the response -->
+ <Obligation
+ ObligationId="urn:xacml:2.0:interop:example:obligation:decision"
+ FulfillOn="Permit"/>
+ <!-- This obligation says provide the xacml:StatusCode data to the response -->
+ <Obligation
+ ObligationId="urn:xacml:2.0:interop:example:obligation:status-code"
+ FulfillOn="Permit"/>
+ <!-- This obligation says provide the xacml:StatusMessage data to the response -->
+ <Obligation
+ ObligationId="urn:xacml:2.0:interop:example:obligation:status-message"
+ FulfillOn="Permit"/>
+ </Obligations>
+ </PolicySet>
+</PolicySet>
Added: projects/security/security-xacml/trunk/jboss-xacml/src/tests/org/jboss/test/security/xacml/config/JBossXACMLConfigUnitTestCase.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/tests/org/jboss/test/security/xacml/config/JBossXACMLConfigUnitTestCase.java (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/tests/org/jboss/test/security/xacml/config/JBossXACMLConfigUnitTestCase.java 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,88 @@
+/*
+ * 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.test.security.xacml.config;
+
+import java.net.URL;
+import java.util.List;
+
+import javax.xml.XMLConstants;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import junit.framework.TestCase;
+
+import org.jboss.security.xacml.jaxb.LocatorType;
+import org.jboss.security.xacml.jaxb.LocatorsType;
+import org.jboss.security.xacml.jaxb.PDP;
+import org.jboss.security.xacml.jaxb.PoliciesType;
+import org.jboss.security.xacml.jaxb.PolicySetType;
+
+//$Id$
+
+/**
+ * Test the import of the config file driving JBossXACML
+ * @author Anil.Saldhana at redhat.com
+ * @since Jul 5, 2007
+ * @version $Revision$
+ */
+public class JBossXACMLConfigUnitTestCase extends TestCase
+{
+ public void testBasicPolicySetConfig() throws Exception
+ {
+ JAXBContext jc = JAXBContext.newInstance( "org.jboss.security.xacml.jaxb" );
+ assertNotNull("JAXBContext is !null", jc);
+ Unmarshaller u = jc.createUnmarshaller();
+ //Validate against schema
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ URL schemaURL = tcl.getResource("schema/jbossxacml-2.0.xsd");
+ assertNotNull("Schema URL != null", schemaURL);
+ SchemaFactory scFact = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = scFact.newSchema(schemaURL);
+ u.setSchema(schema);
+
+ URL configFile = tcl.getResource("test/config/basicPolicySetConfig.xml");
+ JAXBElement<?> j = (JAXBElement<?>) u.unmarshal(configFile);
+ assertNotNull("JAXBElement is !null", j);
+ PDP pdp = (PDP) j.getValue();
+ assertNotNull("PDP is not null", pdp);
+
+ //Validate Policies
+ PoliciesType pts = pdp.getPolicies();
+ assertNotNull("PoliciesType is not null", pts);
+ List<PolicySetType> pst = pts.getPolicySet();
+ assertNotNull("PolicySetType is not null", pst);
+ assertEquals("1 PolicySet", 1, pst.size());
+ PolicySetType psetType = pst.get(0);
+ String loc = psetType.getLocation();
+ assertEquals("Location of PolicySet is file://SomeLocation", "file://SomeLocation", loc);
+ assertEquals("PolicyType is null", 0,pts.getPolicy().size());
+
+ //Validate Locators
+ LocatorsType lts = pdp.getLocators();
+ assertNotNull("LocatorsType != null", lts);
+ LocatorType lt = lts.getLocator();
+ assertNotNull("LocatorType != null", lt);
+ }
+}
Added: projects/security/security-xacml/trunk/jboss-xacml/src/tests/org/jboss/test/security/xacml/factories/PolicyFactoryUnitTestCase.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/tests/org/jboss/test/security/xacml/factories/PolicyFactoryUnitTestCase.java (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/tests/org/jboss/test/security/xacml/factories/PolicyFactoryUnitTestCase.java 2007-07-06 07:19:22 UTC (rev 63861)
@@ -0,0 +1,49 @@
+/*
+ * 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.test.security.xacml.factories;
+
+import java.io.InputStream;
+
+import org.jboss.security.xacml.factories.PolicyFactory;
+import org.jboss.security.xacml.interfaces.XACMLPolicy;
+
+import junit.framework.TestCase;
+
+//$Id$
+
+/**
+ * Unit Tests for the PolicyFactory
+ * @author Anil.Saldhana at redhat.com
+ * @since Jul 6, 2007
+ * @version $Revision$
+ */
+public class PolicyFactoryUnitTestCase extends TestCase
+{
+ public void testPolicySet() throws Exception
+ {
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ InputStream is = tcl.getResourceAsStream("test/policies/interop/xacml-policySet.xml");
+ XACMLPolicy xacmlPolicy = PolicyFactory.createPolicySet(is);
+ assertNotNull("XACML PolicySet != null", xacmlPolicy);
+ assertEquals("PolicySet?", xacmlPolicy.getType(), XACMLPolicy.POLICYSET);
+ }
+}
More information about the jboss-cvs-commits
mailing list