[jboss-cvs] JBossAS SVN: r86469 - in projects/security/security-xacml/trunk/jboss-sunxacml/src: test/java/org/jboss/test/security/sunxacml and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Mar 30 09:13:14 EDT 2009
Author: anil.saldhana at jboss.com
Date: 2009-03-30 09:13:14 -0400 (Mon, 30 Mar 2009)
New Revision: 86469
Added:
projects/security/security-xacml/trunk/jboss-sunxacml/src/test/java/org/jboss/test/security/sunxacml/request/
projects/security/security-xacml/trunk/jboss-sunxacml/src/test/java/org/jboss/test/security/sunxacml/request/RequestReadUnitTestCase.java
projects/security/security-xacml/trunk/jboss-sunxacml/src/test/resources/requests/
projects/security/security-xacml/trunk/jboss-sunxacml/src/test/resources/requests/multiple-resourceid.xml
Modified:
projects/security/security-xacml/trunk/jboss-sunxacml/src/main/java/org/jboss/security/xacml/sunxacml/BasicEvaluationCtx.java
Log:
SECURITY-403: multiple resource id
Modified: projects/security/security-xacml/trunk/jboss-sunxacml/src/main/java/org/jboss/security/xacml/sunxacml/BasicEvaluationCtx.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-sunxacml/src/main/java/org/jboss/security/xacml/sunxacml/BasicEvaluationCtx.java 2009-03-30 11:02:19 UTC (rev 86468)
+++ projects/security/security-xacml/trunk/jboss-sunxacml/src/main/java/org/jboss/security/xacml/sunxacml/BasicEvaluationCtx.java 2009-03-30 13:13:14 UTC (rev 86469)
@@ -276,7 +276,7 @@
if (! resourceMap.containsKey(RESOURCE_ID)) {
System.err.println("Resource must contain resource-id attr");
//throw new ParsingException("resource missing resource-id");
- } else {
+ } /*else {
// make sure there's only one value for this
Set set = (Set)(resourceMap.get(RESOURCE_ID));
if (set.size() > 1) {
@@ -288,7 +288,7 @@
resourceId = ((Attribute)(set.iterator().next())).getValue();
}
- }
+ } */
//SECURITY-162: Relax resource-id requirement
if(this.resourceId == null)
Added: projects/security/security-xacml/trunk/jboss-sunxacml/src/test/java/org/jboss/test/security/sunxacml/request/RequestReadUnitTestCase.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-sunxacml/src/test/java/org/jboss/test/security/sunxacml/request/RequestReadUnitTestCase.java (rev 0)
+++ projects/security/security-xacml/trunk/jboss-sunxacml/src/test/java/org/jboss/test/security/sunxacml/request/RequestReadUnitTestCase.java 2009-03-30 13:13:14 UTC (rev 86469)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.sunxacml.request;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.Set;
+
+import org.jboss.security.xacml.sunxacml.ctx.RequestCtx;
+
+import junit.framework.TestCase;
+
+/**
+ * Unit test to read xacml requests
+ * @author Anil.Saldhana at redhat.com
+ * @since Mar 30, 2009
+ */
+public class RequestReadUnitTestCase extends TestCase
+{
+
+ public void testMultipleResourceIds() throws Exception
+ {
+ String fileName = "src/test/resources/requests/multiple-resourceid.xml";
+
+ RequestCtx req = RequestCtx.getInstance(new FileInputStream(new File(fileName)));
+ assertNotNull("Request is not null", req);
+ Set resources = req.getResource();
+ assertTrue("Multiple resources", resources.size() > 1);
+ }
+}
\ No newline at end of file
Added: projects/security/security-xacml/trunk/jboss-sunxacml/src/test/resources/requests/multiple-resourceid.xml
===================================================================
--- projects/security/security-xacml/trunk/jboss-sunxacml/src/test/resources/requests/multiple-resourceid.xml (rev 0)
+++ projects/security/security-xacml/trunk/jboss-sunxacml/src/test/resources/requests/multiple-resourceid.xml 2009-03-30 13:13:14 UTC (rev 86469)
@@ -0,0 +1,28 @@
+<Request>
+<Subject SubjectCategory="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject">
+<Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id" DataType="http://www.w3.org/2001/XMLSchema#string"><AttributeValue>xxxxxx</AttributeValue></Attribute>
+<Attribute AttributeId="urn:oasis:names:tc:xacml:2.0:subject:role" DataType="http://www.w3.org/2001/XMLSchema#anyURI"><AttributeValue>urn:jboss:role-values:ADMIN</AttributeValue><AttributeValue>urn:jboss:aa:role-values:ALLOW-ALL</AttributeValue><AttributeValue>urn:jboss:aa:role-values:OTHER</AttributeValue></Attribute>
+<Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id-qualifier" DataType="http://www.w3.org/2001/XMLSchema#string"><AttributeValue>aa</AttributeValue></Attribute>
+</Subject>
+<Subject SubjectCategory="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject"
+>
+<Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id" DataType="http://www.w3.org/2001/XMLSchema#string"><AttributeValue>123456</AttributeValue></Attribute>
+<Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id-qualifier" DataType="http://www.w3.org/2001/XMLSchema#string"><AttributeValue>AXA-CH</AttributeValue></Attribute>
+</Subject>
+
+<Resource>
+<Attribute AttributeId="urn:jboss:test:contract_domain:contract:contract_info" DataType="http://www.w3.org/2001/XMLSchema#string"><AttributeValue>some contract info</AttributeValue></Attribute>
+<Attribute AttributeId="urn:jboss:test:contract_domain:contract:alternateID" DataType="http://www.w3.org/2001/XMLSchema#string"><AttributeValue>1</AttributeValue></Attribute>
+<Attribute AttributeId="urn:jboss:test:contract_domain:contract:expiry-date" DataType="http://www.w3.org/2001/XMLSchema#dateTime"><AttributeValue>2009-03-30T10:14:10.285000000+02:00</AttributeValue></Attribute>
+<Attribute AttributeId="urn:jboss:test:contract_domain:contract:number" DataType="http://www.w3.org/2001/XMLSchema#integer"><AttributeValue>1</AttributeValue></Attribute>
+<Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#anyURI"><AttributeValue>urn:jboss:test:contract_domain:contract:alternateID:1</AttributeValue></Attribute>
+<Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#anyURI"><AttributeValue>urn:jboss:test:contract_domain:contract:ID:1</AttributeValue></Attribute>
+<Attribute AttributeId="urn:jboss:test:contract_domain:contract:ID" DataType="http://www.w3.org/2001/XMLSchema#string"><AttributeValue>1</AttributeValue></Attribute>
+</Resource>
+<Action>
+
+<Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" DataType="http://www.w3.org/2001/XMLSchema#string"><AttributeValue>read</AttributeValue></Attribute>
+</Action>
+<Environment>
+</Environment>
+</Request>
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list