Changeset 6754
- Timestamp:
- 22/03/10 08:30:50 (11 years ago)
- Location:
- TI12-security/trunk/NDG_XACML/ndg/xacml
- Files:
-
- 5 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
TI12-security/trunk/NDG_XACML/ndg/xacml/core/attributedesignator.py
r6753 r6754 78 78 """XACML Action Attribute Designator type""" 79 79 ELEMENT_LOCAL_NAME = 'ActionAttributeDesignator' 80 81 82 class EnvironmentAttributeDesignator(AttributeDesignator): 83 """XACML Environment Attribute Designator type""" 84 ELEMENT_LOCAL_NAME = 'EnvironmentAttributeDesignator' -
TI12-security/trunk/NDG_XACML/ndg/xacml/core/attributeselector.py
r6747 r6754 1 ''' 2 Created on 16 Mar 2010 1 """NDG XACML AttributeSelector type 3 2 4 @author: pjkersha 5 ''' 3 NERC DataGrid Project 4 """ 5 __author__ = "P J Kershaw" 6 __date__ = "16/03/10" 7 __copyright__ = "(C) 2010 Science and Technology Facilities Council" 8 __contact__ = "Philip.Kershaw@stfc.ac.uk" 9 __license__ = "BSD - see LICENSE file in top-level directory" 10 __contact__ = "Philip.Kershaw@stfc.ac.uk" 11 __revision__ = "$Id: $" 12 import logging 13 log = logging.getLogger(__name__) 6 14 7 class AttributeSelector(object): 8 ''' 9 classdocs 15 from ndg.xacml.core.expression import Expression 16 17 18 class AttributeSelector(Expression): 19 '''XACML Attribute Selector type 10 20 ''' 11 21 ELEMENT_LOCAL_NAME = 'AttributeSelector' 22 MUST_BE_PRESENT_ATTRIB_NAME = 'MustBePresent' 23 REQUEST_CONTEXT_PATH_ATTRIB_NAME = 'RequestContextPath' 24 25 __slots__ = ('__mustBePresent', '__requestContextPath') 12 26 27 def __init__(self): 28 '''XACML Attribute Selector type 29 ''' 30 super(AttributeSelector, self).__init__() 31 self.__mustBePresent = None 32 self.__requestContextPath = None 33 34 @property 35 def requestContextPath(self): 36 """Get Issuer""" 37 return self.__requestContextPath 13 38 14 def __init__(selfparams): 15 ''' 16 Constructor 17 ''' 18 39 @requestContextPath.setter 40 def requestContextPath(self, value): 41 """Set Issuer""" 42 if not isinstance(value, basestring): 43 raise TypeError('Expecting %r type for "requestContextPath" ' 44 'attribute; got %r' % (basestring, type(value))) 45 46 self.__requestContextPath = value 47 48 @property 49 def mustBePresent(self): 50 """Get Must Be Present flag""" 51 return self.__mustBePresent 52 53 @mustBePresent.setter 54 def mustBePresent(self, value): 55 """Set Must Be Present flag""" 56 if not isinstance(value, bool): 57 raise TypeError('Expecting %r type for "mustBePresent" ' 58 'attribute; got %r' % (bool, type(value))) 59 60 self.__mustBePresent = value -
TI12-security/trunk/NDG_XACML/ndg/xacml/core/condition.py
r6753 r6754 11 11 __revision__ = "$Id: $" 12 12 from ndg.xacml.core import PolicyComponent 13 from ndg.xacml.core.expression import Expression 13 14 14 15 -
TI12-security/trunk/NDG_XACML/ndg/xacml/core/policy.py
r6746 r6754 12 12 from ndg.xacml.utils import TypedList 13 13 from ndg.xacml.core import PolicyComponent 14 from ndg.xacml.core.policydefaults import PolicyDefaults 14 15 from ndg.xacml.core.target import Target 15 16 from ndg.xacml.core.rule import Rule … … 24 25 """Invalid XML namespace for policy document""" 25 26 26 '''27 <xs:complexType name="PolicyType">28 <xs:sequence>29 <xs:element ref="xacml:Description" minOccurs="0"/>30 <xs:element ref="xacml:PolicyDefaults" minOccurs="0"/>31 <xs:element ref="xacml:CombinerParameters" minOccurs="0"/>32 <xs:element ref="xacml:Target"/>33 <xs:choice maxOccurs="unbounded">34 <xs:element ref="xacml:CombinerParameters" minOccurs="0"/>35 <xs:element ref="xacml:RuleCombinerParameters" minOccurs="0"/>36 <xs:element ref="xacml:VariableDefinition"/>37 <xs:element ref="xacml:Rule"/>38 </xs:choice>39 <xs:element ref="xacml:Obligations" minOccurs="0"/>40 </xs:sequence>41 <xs:attribute name="PolicyId" type="xs:anyURI" use="required"/>42 <xs:attribute name="Version" type="xacml:VersionType" default="1.0"/>43 <xs:attribute name="RuleCombiningAlgId" type="xs:anyURI" use="required"/>44 </xs:complexType>45 '''46 27 47 28 class Policy(PolicyComponent): … … 176 157 description = property(_getDescription, _setDescription, 177 158 doc="Policy Description text") 178 159 160 def _getPolicyDefaults(self): 161 return self.__policyDefaults 162 163 def _setPolicyDefaults(self, value): 164 if not isinstance(value, PolicyDefaults): 165 raise TypeError('Expecting string type for "policyDefaults" ' 166 'attribute; got %r' % type(value)) 167 168 self.__policyDefaults = value 169 170 policyDefaults = property(_getPolicyDefaults, 171 _setPolicyDefaults, 172 None, 173 "Policy PolicyDefaults element") 179 174 def parse(self): 180 175 """Parse the policy file set in policyFilePath attribute -
TI12-security/trunk/NDG_XACML/ndg/xacml/parsers/etree/applyreader.py
r6753 r6754 10 10 __contact__ = "Philip.Kershaw@stfc.ac.uk" 11 11 __revision__ = "$Id: $" 12 import logging 13 log = logging.getLogger(__name__) 14 12 15 from ndg.xacml.core.apply import Apply 16 from ndg.xacml.core.attributeselector import AttributeSelector 13 17 from ndg.xacml.core.attributedesignator import (SubjectAttributeDesignator, 14 ResourceAttributeDesignator,18 EnvironmentAttributeDesignator, 15 19 ActionAttributeDesignator, 16 20 EnvironmentAttributeDesignator) … … 18 22 from ndg.xacml.parsers.etree import QName 19 23 from ndg.xacml.parsers.etree.reader import ETreeAbstractReader 24 from ndg.xacml.parsers.etree.expressionreader import ExpressionReader 20 25 from ndg.xacml.parsers.etree.factory import ReaderFactory 21 26 … … 56 61 # elements 57 62 for subElem in elem: 58 localName = QName.getLocalPart( elem[0].tag)63 localName = QName.getLocalPart(subElem.tag) 59 64 if localName == xacmlType.ELEMENT_LOCAL_NAME: 60 65 applyObj.expressions.append(ApplyReader.parse(subElem)) … … 65 70 applyObj.expressions.append( 66 71 SubjectAttributeDesignatorReader.parse(subElem)) 72 73 elif localName == EnvironmentAttributeDesignator.ELEMENT_LOCAL_NAME: 74 EnvironmentAttributeDesignatorReader = ReaderFactory.getReader( 75 EnvironmentAttributeDesignator) 76 applyObj.expressions.append( 77 EnvironmentAttributeDesignatorReader.parse(subElem)) 78 79 elif localName == ActionAttributeDesignator.ELEMENT_LOCAL_NAME: 80 ActionAttributeDesignatorReader = ReaderFactory.getReader( 81 ActionAttributeDesignator) 82 applyObj.expressions.append( 83 ActionAttributeDesignatorReader.parse(subElem)) 84 85 elif localName == EnvironmentAttributeDesignator.ELEMENT_LOCAL_NAME: 86 EnvironmentAttributeDesignatorReader = ReaderFactory.getReader( 87 EnvironmentAttributeDesignator) 88 applyObj.expressions.append( 89 EnvironmentAttributeDesignatorReader.parse(subElem)) 90 91 elif localName == AttributeSelector.ELEMENT_LOCAL_NAME: 92 AttributeSelectorReader = ReaderFactory.getReader( 93 AttributeSelector) 94 applyObj.expressions.append( 95 AttributeSelectorReader.parse(subElem)) 67 96 else: 68 raise XMLParseError('%r Apply sub-element not recognised' %69 localName)97 raise NotImplementedError('%r Apply sub-element not ' 98 'recognised', localName) 70 99 71 100 return applyObj -
TI12-security/trunk/NDG_XACML/ndg/xacml/parsers/etree/attributedesignatorreader.py
r6752 r6754 40 40 attributeDesignator.issuer = issuer 41 41 42 mustBePresent = elem.attrib.get(xacmlType. DATA_TYPE_ATTRIB_NAME)42 mustBePresent = elem.attrib.get(xacmlType.MUST_BE_PRESENT_ATTRIB_NAME) 43 43 if mustBePresent is not None: 44 44 attributeDesignator.mustBePresent = str2Bool(mustBePresent) -
TI12-security/trunk/NDG_XACML/ndg/xacml/parsers/etree/attributeselectorreader.py
r6750 r6754 10 10 __contact__ = "Philip.Kershaw@stfc.ac.uk" 11 11 __revision__ = "$Id: $" 12 from ndg.xacml.parsers.etree.reader import ETreeAbstractReader 12 from ndg.xacml.core.attributeselector import AttributeSelector 13 from ndg.xacml.parsers import XMLParseError 14 from ndg.xacml.parsers.etree import QName 15 from ndg.xacml.parsers.etree.expressionreader import ExpressionReader 13 16 14 17 15 class AttributeSelectorReader(ETreeAbstractReader): 16 ''' 17 classdocs 18 ''' 18 class AttributeSelectorReader(ExpressionReader): 19 '''ElementTree based parser for XACML Attribute Selector type''' 20 TYPE = AttributeSelector 21 22 def _parseExtension(self, elem, attributeSelector): 23 24 xacmlType = self.__class__.TYPE 25 26 localName = QName.getLocalPart(elem.tag) 27 if localName != xacmlType.ELEMENT_LOCAL_NAME: 28 raise XMLParseError("No \"%s\" element found" % 29 xacmlType.ELEMENT_LOCAL_NAME) 30 31 # Unpack *required* attributes from top-level element 32 attributeValues = [] 33 for attributeName in (xacmlType.REQUEST_CONTEXT_PATH_ATTRIB_NAME,): 34 attributeValue = elem.attrib.get(attributeName) 35 if attributeValue is None: 36 raise XMLParseError('No "%s" attribute found in "%s" element' % 37 (attributeName, 38 xacmlType.ELEMENT_LOCAL_NAME)) 39 40 attributeValues.append(attributeValue) 41 42 attributeSelector.requestContextPath, = attributeValues 43 44 mustBePresent = elem.attrib.get(xacmlType.MUST_BE_PRESENT_ATTRIB_NAME) 45 if mustBePresent is not None: 46 attributeSelector.mustBePresent = str2Bool(mustBePresent) 47 48 return attributeSelector 19 49 20 21 def __init__(self): 22 ''' 23 Constructor 24 ''' 25 50 -
TI12-security/trunk/NDG_XACML/ndg/xacml/parsers/etree/attributevaluereader.py
r6750 r6754 10 10 __contact__ = "Philip.Kershaw@stfc.ac.uk" 11 11 __revision__ = "$Id: $" 12 from ndg.xacml.core.attributevalue import Expression,AttributeValue12 from ndg.xacml.core.attributevalue import AttributeValue 13 13 from ndg.xacml.parsers import XMLParseError 14 14 from ndg.xacml.parsers.etree.expressionreader import ExpressionReader -
TI12-security/trunk/NDG_XACML/ndg/xacml/parsers/etree/expressionreader.py
r6752 r6754 41 41 if attributeValue is None: 42 42 raise XMLParseError('No "%s" attribute found in "%s" element' % 43 (attributeName, xacmlType.ELEMENT_LOCAL_NAME)) 43 (attributeName, 44 xacmlType.ELEMENT_LOCAL_NAME)) 44 45 45 46 attributeValues.append(attributeValue) -
TI12-security/trunk/NDG_XACML/ndg/xacml/parsers/etree/policyreader.py
r6752 r6754 12 12 from ndg.xacml.parsers import XMLParseError 13 13 from ndg.xacml.core.policy import Policy 14 from ndg.xacml.core.policydefaults import PolicyDefaults 14 15 from ndg.xacml.core.variabledefinition import VariableDefinition 15 16 from ndg.xacml.core.rule import Rule … … 68 69 69 70 elif localName == xacmlType.POLICY_DEFAULTS_LOCAL_NAME: 70 raise NotImplementedError() 71 PolicyDefaultsReader = ReaderFactory.getReader(PolicyDefaults) 72 policy.policyDefaults = PolicyDefaultsReader.parse(childElem) 71 73 72 74 elif localName == Target.ELEMENT_LOCAL_NAME: … … 90 92 91 93 elif localName == xacmlType.OBLIGATIONS_LOCAL_NAME: 92 raise NotImplementedError() 94 raise NotImplementedError('Parsing for Obligations element is ' 95 'not implemented') 93 96 94 97 else: -
TI12-security/trunk/NDG_XACML/ndg/xacml/test/rule2.xml
r6751 r6754 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 <Policy xmlns="urn:oasis:names:tc:xacml:2.0:policy:schema:os" xmlns:xacml-context="urn:oasis:names:tc:xacml:2.0:context: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" xmlns:xf="http://www.w3.org/TR/2002/WD-xquery-operators-20020816/#" xmlns:md="http:www.med.example.com/schemas/record.xsd" PolicyId="urn:oasis:names:tc:xacml:2.0:example:policyid:2" RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:deny-overrides"> 2 <Policy xmlns="urn:oasis:names:tc:xacml:2.0:policy:schema:os" 3 xmlns:xacml-context="urn:oasis:names:tc:xacml:2.0:context:schema:os" 4 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 5 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" 6 xmlns:xf="http://www.w3.org/TR/2002/WD-xquery-operators-20020816/#" 7 xmlns:md="http:www.med.example.com/schemas/record.xsd" 8 PolicyId="urn:oasis:names:tc:xacml:2.0:example:policyid:2" 9 RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:deny-overrides"> 3 10 <!-- 4 11 <PolicyDefaults> 5 12 <XPathVersion>http://www.w3.org/TR/1999/Rec-xpath-19991116</XPathVersion> 6 13 </PolicyDefaults> 14 --> 7 15 <Target/> 16 <!-- 8 17 <VariableDefinition VariableId="17590035"> 9 18 <Apply FunctionId="urn:oasis:names:tc:xacml:2.0:function:date-less-or-equal"> … … 63 72 <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal"> 64 73 <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only"> 65 <SubjectAttributeDesignator AttributeId="urn:oasis:names:tc:xacml:2.0:example:attribute: 66 parent-guardian-id" DataType="http://www.w3.org/2001/XMLSchema#string"/> 74 <SubjectAttributeDesignator 75 AttributeId="urn:oasis:names:tc:xacml:2.0:example:attribute:parent-guardian-id" 76 DataType="http://www.w3.org/2001/XMLSchema#string"/> 67 77 </Apply> 68 <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only"> 69 <AttributeSelector RequestContextPath="//md:record/md:parentGuardian/md:parentGuardianId/text()" DataType="http://www.w3.org/2001/XMLSchema#string"/> 78 <Apply 79 FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only"> 80 <AttributeSelector 81 RequestContextPath="//md:record/md:parentGuardian/md:parentGuardianId/text()" 82 DataType="http://www.w3.org/2001/XMLSchema#string"/> 70 83 </Apply> 71 84 </Apply> 85 <!-- 72 86 <VariableReference VariableId="17590035"/> 87 --> 73 88 </Apply> 74 89 </Condition> -
TI12-security/trunk/NDG_XACML/ndg/xacml/test/test_xacml.py
r6752 r6754 12 12 import unittest 13 13 from os import path 14 import logging 15 logging.basicConfig(level=logging.DEBUG) 14 16 15 17 from ndg.xacml.core.policy import Policy 18 from ndg.xacml.core.attributedesignator import SubjectAttributeDesignator 19 from ndg.xacml.core.attributeselector import AttributeSelector 16 20 from ndg.xacml.parsers.etree.factory import ReaderFactory 17 21 … … 23 27 XACML_TEST2_FILENAME = "rule2.xml" 24 28 XACML_TEST2_FILEPATH = path.join(THIS_DIR, XACML_TEST2_FILENAME) 29 XACML_TEST3_FILENAME = "rule3.xml" 30 XACML_TEST3_FILEPATH = path.join(THIS_DIR, XACML_TEST3_FILENAME) 31 XACML_TEST4_FILENAME = "rule4.xml" 32 XACML_TEST4_FILEPATH = path.join(THIS_DIR, XACML_TEST4_FILENAME) 33 XACML_NDGTEST1_FILENAME = "ndg1.xml" 34 XACML_NDGTEST1_FILEPATH = path.join(THIS_DIR, XACML_NDGTEST1_FILENAME) 25 35 26 36 def test01ETreeParseRule1Policy(self): … … 77 87 policy = PolicyReader.parse(XACMLTestCase.XACML_TEST2_FILEPATH) 78 88 self.assert_(policy) 79 80 89 90 self.assert_( 91 policy.policyId == "urn:oasis:names:tc:xacml:2.0:example:policyid:2") 92 93 self.assert_(policy.ruleCombiningAlgId == \ 94 "urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:deny-overrides") 95 96 self.assert_(policy.description is None) 97 98 self.assert_(len(policy.target.actions) == 0) 99 100 self.assert_(policy.rules[0].id == \ 101 "urn:oasis:names:tc:xacml:2.0:example:ruleid:2") 102 103 self.assert_(policy.rules[0].effect == 'Permit') 104 105 self.assert_(policy.rules[0].description == """\ 106 A person may read any medical record in the 107 http://www.med.example.com/records.xsd namespace 108 for which he or she is the designated parent or guardian, 109 and for which the patient is under 16 years of age""") 110 111 self.assert_(len(policy.rules[0].target.subjects) == 0) 112 self.assert_(len(policy.rules[0].target.actions) == 1) 113 self.assert_(len(policy.rules[0].target.resources) == 1) 114 self.assert_(len(policy.rules[0].target.environments) == 0) 115 116 self.assert_(len(policy.rules[0].target.resources[0 117 ].resourceMatches) == 2) 118 119 self.assert_(policy.rules[0].target.resources[0].resourceMatches[0 120 ].matchId == "urn:oasis:names:tc:xacml:1.0:function:string-equal") 121 122 self.assert_(policy.rules[0].target.resources[0].resourceMatches[0 123 ].attributeValue.dataType == \ 124 "http://www.w3.org/2001/XMLSchema#string") 125 126 self.assert_(policy.rules[0].target.resources[0].resourceMatches[0 127 ].attributeValue.value == 'urn:med:example:schemas:record') 128 129 self.assert_(policy.rules[0].target.resources[0].resourceMatches[0 130 ].attributeDesignator.dataType == \ 131 "http://www.w3.org/2001/XMLSchema#string") 132 133 self.assert_(policy.rules[0].target.resources[0].resourceMatches[1 134 ].attributeDesignator.attributeId == \ 135 "urn:oasis:names:tc:xacml:1.0:resource:xpath") 136 self.assert_(policy.rules[0].target.resources[0].resourceMatches[1 137 ].matchId == \ 138 "urn:oasis:names:tc:xacml:1.0:function:xpath-node-match") 139 140 self.assert_(policy.rules[0].target.resources[0].resourceMatches[1 141 ].attributeValue.dataType == \ 142 "http://www.w3.org/2001/XMLSchema#string") 143 144 self.assert_(policy.rules[0].target.resources[0].resourceMatches[1 145 ].attributeValue.value == '/md:record') 146 147 self.assert_(policy.rules[0].target.resources[0].resourceMatches[1 148 ].attributeDesignator.dataType == \ 149 "http://www.w3.org/2001/XMLSchema#string") 150 151 self.assert_(policy.rules[0].target.resources[0].resourceMatches[1 152 ].attributeDesignator.attributeId == \ 153 "urn:oasis:names:tc:xacml:1.0:resource:xpath") 154 155 # Verify Action 156 self.assert_(len(policy.rules[0].target.actions[0 157 ].actionMatches) == 1) 158 159 self.assert_(policy.rules[0].target.actions[0].actionMatches[0 160 ].matchId == "urn:oasis:names:tc:xacml:1.0:function:string-equal") 161 162 self.assert_(policy.rules[0].target.actions[0].actionMatches[0 163 ].attributeValue.dataType == \ 164 "http://www.w3.org/2001/XMLSchema#string") 165 166 self.assert_(policy.rules[0].target.actions[0].actionMatches[0 167 ].attributeValue.value == "read") 168 169 self.assert_(policy.rules[0].target.actions[0].actionMatches[0 170 ].attributeDesignator.dataType == \ 171 "http://www.w3.org/2001/XMLSchema#string") 172 173 self.assert_(policy.rules[0].target.actions[0].actionMatches[0 174 ].attributeDesignator.attributeId == \ 175 "urn:oasis:names:tc:xacml:1.0:action:action-id") 176 177 self.assert_(policy.rules[0].condition) 178 self.assert_(policy.rules[0].condition.expression.functionId == \ 179 "urn:oasis:names:tc:xacml:1.0:function:and") 180 181 self.assert_(len(policy.rules[0].condition.expression.expressions) == 1) 182 183 self.assert_(policy.rules[0].condition.expression.expressions[0 184 ].functionId == \ 185 'urn:oasis:names:tc:xacml:1.0:function:string-equal') 186 187 self.assert_(len(policy.rules[0].condition.expression.expressions) == 1) 188 189 self.assert_(len(policy.rules[0].condition.expression.expressions[0 190 ].expressions) == 2) 191 192 self.assert_(policy.rules[0].condition.expression.expressions[0 193 ].expressions[0].functionId == \ 194 "urn:oasis:names:tc:xacml:1.0:function:string-one-and-only") 195 196 self.assert_(isinstance( 197 policy.rules[0].condition.expression.expressions[0 198 ].expressions[0 199 ].expressions[0], SubjectAttributeDesignator)) 200 201 self.assert_(policy.rules[0].condition.expression.expressions[0 202 ].expressions[0 203 ].expressions[0].attributeId == \ 204 "urn:oasis:names:tc:xacml:2.0:example:attribute:" 205 "parent-guardian-id") 206 207 self.assert_(policy.rules[0].condition.expression.expressions[0 208 ].expressions[0 209 ].expressions[0].dataType == \ 210 "http://www.w3.org/2001/XMLSchema#string") 211 212 self.assert_(policy.rules[0].condition.expression.expressions[0 213 ].expressions[0 214 ].expressions[0].attributeId == \ 215 "urn:oasis:names:tc:xacml:2.0:example:attribute:" 216 "parent-guardian-id") 217 218 self.assert_(isinstance(policy.rules[0 219 ].condition.expression.expressions[0 220 ].expressions[1 221 ].expressions[0], AttributeSelector)) 222 223 self.assert_(policy.rules[0 224 ].condition.expression.expressions[0 225 ].expressions[1 226 ].expressions[0].requestContextPath == \ 227 "//md:record/md:parentGuardian/md:parentGuardianId/" 228 "text()") 229 230 self.assert_(policy.rules[0 231 ].condition.expression.expressions[0 232 ].expressions[1 233 ].expressions[0].dataType == \ 234 "http://www.w3.org/2001/XMLSchema#string") 235 236 def test03ETreeParseRule3Policy(self): 237 PolicyReader = ReaderFactory.getReader(Policy) 238 239 try: 240 policy = PolicyReader.parse(XACMLTestCase.XACML_TEST3_FILEPATH) 241 self.assert_(policy) 242 except NotImplementedError, e: 243 print("Expecting Obligations not implemented exception: %s" %e) 244 245 def test04ETreeParseRule4Policy(self): 246 PolicyReader = ReaderFactory.getReader(Policy) 247 policy = PolicyReader.parse(XACMLTestCase.XACML_TEST4_FILEPATH) 248 self.assert_(policy) 249 250 def test05ETreeParseNdg1Policy(self): 251 # Example policy for URI Regular expression based matching of 252 # resources for NDG 253 PolicyReader = ReaderFactory.getReader(Policy) 254 policy = PolicyReader.parse(XACMLTestCase.XACML_NDGTEST1_FILEPATH) 255 self.assert_(policy) 256 257 81 258 if __name__ == "__main__": 82 259 unittest.main()
Note: See TracChangeset
for help on using the changeset viewer.