Changeset 6770
- Timestamp:
- 24/03/10 14:21:17 (11 years ago)
- Location:
- TI12-security/trunk/NDG_XACML/ndg/xacml
- Files:
-
- 2 added
- 1 deleted
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
TI12-security/trunk/NDG_XACML/ndg/xacml/core/__init__.py
r6753 r6770 13 13 14 14 15 class PolicyComponent(object):15 class XacmlCoreBase(object): 16 16 """Base class for Policy and Policy subelements""" 17 17 XACML_2_0_XMLNS = "urn:oasis:names:tc:xacml:2.0:policy:schema:os" … … 22 22 23 23 def __init__(self): 24 self.__xmlns = PolicyComponent.XACML_2_0_XMLNS24 self.__xmlns = XacmlCoreBase.XACML_2_0_XMLNS 25 25 self.__reader = None 26 26 self.__writer = None … … 44 44 @property 45 45 def isValidXmlns(self): 46 return self.xmlns in PolicyComponent.XMLNS46 return self.xmlns in XacmlCoreBase.XMLNS 47 47 48 48 def read(self, obj): … … 68 68 69 69 70 class RequestPropertyBase(PolicyComponent): 71 """Base type for Subject, Resource, Action and Environment types""" 70 class TargetChildBase(XacmlCoreBase): 71 """Base type for XACML Policy Subject, Resource, Action and Environment 72 types""" 72 73 MATCH_TYPE = None 73 74 -
TI12-security/trunk/NDG_XACML/ndg/xacml/core/action.py
r6746 r6770 10 10 __contact__ = "Philip.Kershaw@stfc.ac.uk" 11 11 __revision__ = "$Id: $" 12 from ndg.xacml.core import RequestPropertyBase12 from ndg.xacml.core import TargetChildBase 13 13 from ndg.xacml.core.match import ActionMatch 14 14 15 15 16 class Action( RequestPropertyBase):16 class Action(TargetChildBase): 17 17 MATCH_TYPE = ActionMatch 18 18 ELEMENT_LOCAL_NAME = 'Action' -
TI12-security/trunk/NDG_XACML/ndg/xacml/core/attributedesignator.py
r6754 r6770 1 ''' 2 Created on 16 Mar 2010 1 """NDG XACML AttributeDesignator 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 6 13 from ndg.xacml.core.expression import Expression 7 14 -
TI12-security/trunk/NDG_XACML/ndg/xacml/core/condition.py
r6754 r6770 10 10 __contact__ = "Philip.Kershaw@stfc.ac.uk" 11 11 __revision__ = "$Id: $" 12 from ndg.xacml.core import PolicyComponent12 from ndg.xacml.core import XacmlCoreBase 13 13 from ndg.xacml.core.expression import Expression 14 14 15 15 16 class Condition( PolicyComponent):16 class Condition(XacmlCoreBase): 17 17 """XACML Rule Condition""" 18 18 ELEMENT_LOCAL_NAME = 'Condition' -
TI12-security/trunk/NDG_XACML/ndg/xacml/core/context/__init__.py
r6766 r6770 5 5 """ 6 6 __author__ = "P J Kershaw" 7 __date__ = "2 3/03/10"7 __date__ = "24/03/10" 8 8 __copyright__ = "(C) 2010 Science and Technology Facilities Council" 9 9 __contact__ = "Philip.Kershaw@stfc.ac.uk" … … 11 11 __contact__ = "Philip.Kershaw@stfc.ac.uk" 12 12 __revision__ = "$Id: $" 13 from ndg.xacml.utils import TypedList 14 13 15 class XacmlContextBase(object): 14 16 """Base class for XACML Request and Response types""" 15 17 __slots__ = () 16 18 19 20 class RequestChildBase(XacmlContextBase): 21 """Base class for XACML Context Subject, Resource, Action and Environment 22 types""" 23 __slots__ = ('__attributes', ) 24 25 def __init__(self): 26 self.__attributes = TypedList(Attribute) 27 -
TI12-security/trunk/NDG_XACML/ndg/xacml/core/context/response.py
r6766 r6770 20 20 class Response(XacmlContextBase): 21 21 """XACML Response type""" 22 ELEMENT_LOCAL_NAME = 'Response' 23 22 24 __slots__ = ('__results', ) 23 25 -
TI12-security/trunk/NDG_XACML/ndg/xacml/core/context/result.py
r6766 r6770 14 14 15 15 from ndg.xacml.core.context import XacmlContextBase 16 from ndg.xacml.core.obligation import Obligation 17 18 19 class StatusCode(XacmlContextBase): 20 '''XACML Response Result StatusCode.''' 21 22 # Local Name of StatusCode. 23 ELEMENT_LOCAL_NAME = "StatusCode" 24 25 26 __slots__ = ('__value', '__childStatusCode',) 27 28 def __init__(self, **kw): 29 super(StatusCode, self).__init__(**kw) 30 31 # Value attribute URI. 32 self.__value = None 33 34 # Nested secondary StatusCode child element. 35 self.__childStatusCode = None 36 37 def _getStatusCode(self): 38 return self.__childStatusCode 39 40 def _setStatusCode(self, value): 41 if not isinstance(value, StatusCode): 42 raise TypeError('Child "statusCode" must be a %r derived type, ' 43 "got %r" % (StatusCode, type(value))) 44 45 self.__childStatusCode = value 46 47 value = property(fget=_getStatusCode, 48 fset=_setStatusCode, 49 doc="Child Status code") 50 51 def _getValue(self): 52 return self.__value 53 54 def _setValue(self, value): 55 if not isinstance(value, basestring): 56 raise TypeError("\"value\" must be a basestring derived type, " 57 "got %r" % value.__class__) 58 59 self.__value = value 60 61 value = property(fget=_getValue, fset=_setValue, doc="Status code value") 62 63 64 class Status(XacmlContextBase): 65 '''XACML Response Result Status''' 66 67 # Local Name of Status. 68 ELEMENT_LOCAL_NAME = "Status" 69 70 __slots__ = ('__statusCode', '__statusMessage', '__statusDetail', ) 71 72 def __init__(self, **kw): 73 super(Status, self).__init__(**kw) 74 75 # StatusCode element. 76 self.__statusCode = None 77 78 # StatusMessage element. 79 self.__statusMessage = None 80 81 # StatusDetail element. 82 self.__statusDetail = None 83 84 def _getStatusCode(self): 85 ''' 86 Gets the Code of this Status. 87 88 @return: Status StatusCode 89 ''' 90 return self.__statusCode 91 92 def _setStatusCode(self, value): 93 ''' 94 Sets the Code of this Status. 95 96 @param value: the Code of this Status 97 ''' 98 if not isinstance(value, StatusCode): 99 raise TypeError('"statusCode" must be a %r derived type, ' 100 "got %r" % (StatusCode, type(value))) 101 102 self.__statusCode = value 103 104 statusCode = property(fget=_getStatusCode, 105 fset=_setStatusCode, 106 doc="status code object") 107 108 def _getStatusMessage(self): 109 ''' 110 Gets the Message of this Status. 111 112 @return: Status StatusMessage 113 ''' 114 return self.__statusMessage 115 116 def _setStatusMessage(self, value): 117 ''' 118 Sets the Message of this Status. 119 120 @param value: the Message of this Status 121 ''' 122 if not isinstance(value, basestring): 123 raise TypeError('"statusMessage" must be a %r derived type, ' 124 "got %r" % (basestring, type(value))) 125 126 self.__statusMessage = value 127 128 statusMessage = property(fget=_getStatusMessage, 129 fset=_setStatusMessage, 130 doc="status message") 131 132 def _getStatusDetail(self): 133 ''' 134 Gets the Detail of this Status. 135 136 @return: Status StatusDetail 137 ''' 138 return self.__statusDetail 139 140 def _setStatusDetail(self, value): 141 ''' 142 Sets the Detail of this Status. 143 144 @param value: the Detail of this Status 145 ''' 146 self.__statusDetail = value 147 148 statusDetail = property(fget=_getStatusDetail, 149 fset=_setStatusDetail, 150 doc="status message") 151 152 153 class Decision(object): 154 """Define decision types for Response Result""" 155 156 # "Permit" decision type 157 PERMIT_STR = "Permit" 158 159 # "Deny" decision type 160 DENY_STR = "Deny" 161 162 # "Indeterminate" decision type 163 INDETERMINATE_STR = "Indeterminate" 164 165 NOT_APPLICABLE_STR = "NotApplicable" 166 167 TYPES = (PERMIT_STR, DENY_STR, INDETERMINATE_STR, NOT_APPLICABLE_STR) 168 169 __slots__ = ('__value',) 170 171 def __init__(self, decisionType): 172 self.__value = None 173 self.value = decisionType 174 175 def __getstate__(self): 176 '''Enable pickling''' 177 _dict = {} 178 for attrName in Decision.__slots__: 179 # Ugly hack to allow for derived classes setting private member 180 # variables 181 if attrName.startswith('__'): 182 attrName = "_Decision" + attrName 183 184 _dict[attrName] = getattr(self, attrName) 185 186 return _dict 187 188 def __setstate__(self, attrDict): 189 '''Enable pickling''' 190 for attrName, val in attrDict.items(): 191 setattr(self, attrName, val) 192 193 def _setValue(self, value): 194 if isinstance(value, Decision): 195 # Cast to string 196 value = str(value) 197 198 elif not isinstance(value, basestring): 199 raise TypeError('Expecting string or Decision instance for ' 200 '"value" attribute; got %r instead' % type(value)) 201 202 if value not in self.__class__.TYPES: 203 raise AttributeError('Permissable decision types are %r; got ' 204 '%r instead' % (Decision.TYPES, value)) 205 self.__value = value 206 207 def _getValue(self): 208 return self.__value 209 210 value = property(fget=_getValue, fset=_setValue, doc="Decision value") 211 212 def __str__(self): 213 return self.__value 214 215 def __eq__(self, decision): 216 if isinstance(decision, Decision): 217 # Cast to string 218 value = decision.value 219 220 elif isinstance(decision, basestring): 221 value = decision 222 223 else: 224 raise TypeError('Expecting string or Decision instance for ' 225 'input decision value; got %r instead' % type(value)) 226 227 if value not in self.__class__.TYPES: 228 raise AttributeError('Permissable decision types are %r; got ' 229 '%r instead' % (Decision.TYPES, value)) 230 231 return self.__value == value 232 233 234 class PermitDecision(Decision): 235 """Permit authorisation Decision""" 236 __slots__ = () 237 238 def __init__(self): 239 super(PermitDecision, self).__init__(Decision.PERMIT_STR) 240 241 def _setValue(self): 242 raise AttributeError("can't set attribute") 243 244 245 class DenyDecision(Decision): 246 """Deny authorisation Decision""" 247 __slots__ = () 248 249 def __init__(self): 250 super(DenyDecision, self).__init__(Decision.DENY_STR) 251 252 def _setValue(self, value): 253 raise AttributeError("can't set attribute") 254 255 256 class IndeterminateDecision(Decision): 257 """Indeterminate authorisation Decision""" 258 __slots__ = () 259 260 def __init__(self): 261 super(IndeterminateDecision, self).__init__(Decision.INDETERMINATE_STR) 262 263 def _setValue(self, value): 264 raise AttributeError("can't set attribute") 265 266 267 class NotApplicableDecision(Decision): 268 """NotApplicable authorisation Decision""" 269 __slots__ = () 270 271 def __init__(self): 272 super(NotApplicableDecision, self).__init__(Decision.NOT_APPLICABLE_STR) 273 274 def _setValue(self, value): 275 raise AttributeError("can't set attribute") 276 277 278 # Add instances of each for convenience 279 Decision.PERMIT = PermitDecision() 280 Decision.DENY = DenyDecision() 281 Decision.INDETERMINATE = IndeterminateDecision() 282 Decision.NOT_APPLICABLE = NotApplicableDecision() 16 283 17 284 18 285 class Result(XacmlContextBase): 19 286 """XACML Result type - element in a Response""" 20 __slots__ = ('__resourceId', '__decision', '__status') 287 __slots__ = ('__resourceId', '__decision', '__status', '__obligations') 288 289 ELEMENT_LOCAL_NAME = 'Result' 290 REOSURCE_ID_ATTRIB_NAME = 'ResourceId' 21 291 22 292 def __init__(self): … … 24 294 self.__status = None 25 295 self.__resourceId = None 296 self.__obligations = None 26 297 27 298 @property … … 62 333 raise TypeError('Expecting %r type for result "status" ' 63 334 'attribute; got %r' % (Status, type(value))) 335 336 @property 337 def obligation(self): 338 """Result obligation""" 339 return self.__obligation 340 341 @obligation.setter 342 def obligation(self, value): 343 """Result obligation""" 344 if not isinstance(value, Obligation): 345 raise TypeError('Expecting %r type for result "obligation" ' 346 'attribute; got %r' % (Obligation, type(value))) -
TI12-security/trunk/NDG_XACML/ndg/xacml/core/environment.py
r6746 r6770 10 10 __contact__ = "Philip.Kershaw@stfc.ac.uk" 11 11 __revision__ = "$Id: $" 12 from ndg.xacml.core import RequestPropertyBase12 from ndg.xacml.core import TargetChildBase 13 13 from ndg.xacml.core.match import EnvironmentMatch 14 14 15 15 16 class Environment( RequestPropertyBase):16 class Environment(TargetChildBase): 17 17 MATCH_TYPE = EnvironmentMatch 18 18 ELEMENT_LOCAL_NAME = 'Environment' -
TI12-security/trunk/NDG_XACML/ndg/xacml/core/expression.py
r6753 r6770 10 10 __contact__ = "Philip.Kershaw@stfc.ac.uk" 11 11 __revision__ = "$Id: $" 12 from ndg.xacml.core import PolicyComponent12 from ndg.xacml.core import XacmlCoreBase 13 13 14 14 15 class Expression( PolicyComponent):15 class Expression(XacmlCoreBase): 16 16 """XACML Expression type""" 17 17 ELEMENT_LOCAL_NAME = None -
TI12-security/trunk/NDG_XACML/ndg/xacml/core/match.py
r6750 r6770 10 10 __contact__ = "Philip.Kershaw@stfc.ac.uk" 11 11 __revision__ = "$Id: $" 12 from ndg.xacml.core import PolicyComponent12 from ndg.xacml.core import XacmlCoreBase 13 13 from ndg.xacml.core.attributedesignator import AttributeDesignator 14 14 from ndg.xacml.core.attributeselector import AttributeSelector … … 16 16 17 17 18 class MatchBase( PolicyComponent):18 class MatchBase(XacmlCoreBase): 19 19 ELEMENT_LOCAL_NAME = None 20 20 MATCH_ID_ATTRIB_NAME = 'MatchId' … … 37 37 self.__matchId = None 38 38 39 def _get_attributeValue(self):40 return self.__attributeValue41 42 def _set_attributeValue(self, value):43 if not isinstance(value, AttributeValue):44 raise TypeError('Expecting %r type for "attributeValue" '45 'attribute; got %r' % (AttributeValue, type(value)))46 47 self.__attributeValue = value48 49 attributeValue = property(_get_attributeValue, _set_attributeValue, None,50 "attribute value")51 39 52 40 @property -
TI12-security/trunk/NDG_XACML/ndg/xacml/core/obligation.py
r6746 r6770 11 11 __revision__ = "$Id: $" 12 12 from ndg.xacml.utils import TypedList 13 from ndg.xacml.core import PolicyComponent 13 from ndg.xacml.core import XacmlCoreBase 14 from ndg.xacml.core.attributevalue import AttributeValue 14 15 15 16 16 class Obligation(PolicyComponent): 17 __slots__ = () 17 class AttributeAssignment(AttributeValue): 18 """XCAML AttributeAssignment type""" 19 20 21 class Effect(object): 22 """Define effect type for Obligation""" 23 24 # "Permit" effect type 25 PERMIT_STR = "Permit" 26 27 # "Deny" effect type 28 DENY_STR = "Deny" 29 30 TYPES = (PERMIT_STR, DENY_STR) 31 32 __slots__ = ('__value',) 33 34 def __init__(self, effectType): 35 self.__value = None 36 self.value = effectType 37 38 def __getstate__(self): 39 '''Enable pickling''' 40 _dict = {} 41 for attrName in Effect.__slots__: 42 # Ugly hack to allow for derived classes setting private member 43 # variables 44 if attrName.startswith('__'): 45 attrName = "_Effect" + attrName 46 47 _dict[attrName] = getattr(self, attrName) 48 49 return _dict 50 51 def __setstate__(self, attrDict): 52 '''Enable pickling''' 53 for attrName, val in attrDict.items(): 54 setattr(self, attrName, val) 55 56 def _setValue(self, value): 57 if isinstance(value, Effect): 58 # Cast to string 59 value = str(value) 60 61 elif not isinstance(value, basestring): 62 raise TypeError('Expecting string or Effect instance for ' 63 '"value" attribute; got %r instead' % type(value)) 64 65 if value not in self.__class__.TYPES: 66 raise AttributeError('Permissable effect types are %r; got ' 67 '%r instead' % (Effect.TYPES, value)) 68 self.__value = value 69 70 def _getValue(self): 71 return self.__value 72 73 value = property(fget=_getValue, fset=_setValue, doc="Effect value") 74 75 def __str__(self): 76 return self.__value 77 78 def __eq__(self, effect): 79 if isinstance(effect, Effect): 80 # Cast to string 81 value = effect.value 82 83 elif isinstance(effect, basestring): 84 value = effect 85 86 else: 87 raise TypeError('Expecting string or Effect instance for ' 88 'input effect value; got %r instead' % type(value)) 89 90 if value not in self.__class__.TYPES: 91 raise AttributeError('Permissable effect types are %r; got ' 92 '%r instead' % (Effect.TYPES, value)) 93 94 return self.__value == value 95 96 97 class Obligation(XacmlCoreBase): 98 """XACML Obligation type""" 99 ELEMENT_LOCAL_NAME = 'Obligation' 100 ATTRIBUTE_ASSIGNMENTS_ELEMENT_LOCAL_NAME = 'AttributeAssignment' 101 FULFILLON_ELEMENT_LOCAL_NAME = 'FulfillOn' 102 OBLIGATION_ID_ATTRIB_NAME = 'ObligationId' 103 104 __slots__ = ('__attributeAssignments', '__obligationId', '__fulfillOn') 105 18 106 def __init__(self): 19 pass 107 self.__attributeAssignments = TypedList(AttributeAssignment) 108 self.__obligationId = None 109 self.__fulfillOn = None 110 111 @property 112 def attributeAssignments(self): 113 """Obligation attribute assignments""" 114 return self.__attributeAssignments 115 116 @property 117 def obligationId(self): 118 """obligation Id""" 119 return self.__obligationId 20 120 121 @obligationId.setter 122 def obligationId(self, value): 123 """obligation Id""" 124 if not isinstance(value, basestring): 125 raise TypeError('Expecting %r type for "obligationId" attribute; ' 126 'got %r' % (basestring, type(value))) 127 128 self.__obligationId = value 129 130 @property 131 def fulfillOn(self): 132 """Fulfill obligation on the given effect Permit/Deny""" 133 return self.__fulfillOn 21 134 135 @fulfillOn.setter 136 def fulfillOn(self, value): 137 """Fulfill obligation on the given effect Permit/Deny""" 138 if not isinstance(value, basestring): 139 raise TypeError('Expecting %r type for "fulfillOn" attribute; got ' 140 '%r' % (Effect, type(value))) 141 142 self.__fulfillOn = value 143 -
TI12-security/trunk/NDG_XACML/ndg/xacml/core/policy.py
r6754 r6770 11 11 __revision__ = "$Id: $" 12 12 from ndg.xacml.utils import TypedList 13 from ndg.xacml.core import PolicyComponent13 from ndg.xacml.core import XacmlCoreBase 14 14 from ndg.xacml.core.policydefaults import PolicyDefaults 15 15 from ndg.xacml.core.target import Target … … 26 26 27 27 28 class Policy( PolicyComponent):28 class Policy(XacmlCoreBase): 29 29 """NDG MSI Policy.""" 30 30 DEFAULT_XACML_VERSION = "1.0" -
TI12-security/trunk/NDG_XACML/ndg/xacml/core/policydefaults.py
r6754 r6770 10 10 __contact__ = "Philip.Kershaw@stfc.ac.uk" 11 11 __revision__ = "$Id: $" 12 from ndg.xacml.core import PolicyComponent12 from ndg.xacml.core import XacmlCoreBase 13 13 14 14 15 class PolicyDefaults( PolicyComponent):15 class PolicyDefaults(XacmlCoreBase): 16 16 """XACML PolicyDefaults type""" 17 17 ELEMENT_LOCAL_NAME = 'PolicyDefaults' -
TI12-security/trunk/NDG_XACML/ndg/xacml/core/resource.py
r6746 r6770 10 10 __contact__ = "Philip.Kershaw@stfc.ac.uk" 11 11 __revision__ = "$Id: $" 12 from ndg.xacml.core import RequestPropertyBase12 from ndg.xacml.core import TargetChildBase 13 13 from ndg.xacml.core.match import ResourceMatch 14 14 15 15 16 class Resource( RequestPropertyBase):16 class Resource(TargetChildBase): 17 17 MATCH_TYPE = ResourceMatch 18 18 ELEMENT_LOCAL_NAME = 'Resource' -
TI12-security/trunk/NDG_XACML/ndg/xacml/core/rule.py
r6746 r6770 11 11 __revision__ = "$Id: $" 12 12 from ndg.xacml.utils import TypedList 13 from ndg.xacml.core import PolicyComponent13 from ndg.xacml.core import XacmlCoreBase 14 14 from ndg.xacml.core.target import Target 15 15 from ndg.xacml.core.condition import Condition 16 16 17 17 18 class Rule( PolicyComponent):18 class Rule(XacmlCoreBase): 19 19 """XACML Policy Rule""" 20 20 ELEMENT_LOCAL_NAME = 'Rule' -
TI12-security/trunk/NDG_XACML/ndg/xacml/core/subject.py
r6746 r6770 10 10 __contact__ = "Philip.Kershaw@stfc.ac.uk" 11 11 __revision__ = "$Id: $" 12 from ndg.xacml.core import RequestPropertyBase12 from ndg.xacml.core import TargetChildBase 13 13 from ndg.xacml.core.match import SubjectMatch 14 14 15 class Subject( RequestPropertyBase):15 class Subject(TargetChildBase): 16 16 MATCH_TYPE = SubjectMatch 17 17 ELEMENT_LOCAL_NAME = 'Subject' -
TI12-security/trunk/NDG_XACML/ndg/xacml/core/target.py
r6746 r6770 16 16 __contact__ = "Philip.Kershaw@stfc.ac.uk" 17 17 __revision__ = "$Id: $" 18 from ndg.xacml.core import PolicyComponent18 from ndg.xacml.core import XacmlCoreBase 19 19 from ndg.xacml.core.action import Action 20 20 from ndg.xacml.core.resource import Resource … … 23 23 24 24 25 class Target( PolicyComponent):25 class Target(XacmlCoreBase): 26 26 ELEMENT_LOCAL_NAME = "Target" 27 27 SUBJECTS_ELEMENT_LOCAL_NAME = "Subjects" … … 55 55 56 56 57 class _Target( PolicyComponent):57 class _Target(XacmlCoreBase): 58 58 """Define access behaviour for a resource match a given URI pattern""" 59 59 URI_PATTERN_LOCALNAME = "URIPattern" -
TI12-security/trunk/NDG_XACML/ndg/xacml/parsers/__init__.py
r6746 r6770 47 47 @type obj: string, stream or other 48 48 @return: new XACML object 49 @rtype: PolicyComponentsub type49 @rtype: XacmlCoreBase sub type 50 50 """ 51 51 reader = cls() -
TI12-security/trunk/NDG_XACML/ndg/xacml/parsers/etree/reader.py
r6752 r6770 15 15 from xml.etree import ElementTree 16 16 17 from ndg.xacml.core import PolicyComponent17 from ndg.xacml.core import XacmlCoreBase 18 18 from ndg.xacml.parsers import AbstractReader 19 19 … … 32 32 33 33 self.__namespace_map_backup = ElementTree._namespace_map.copy() 34 ElementTree._namespace_map[''] = PolicyComponent.XACML_2_0_XMLNS34 ElementTree._namespace_map[''] = XacmlCoreBase.XACML_2_0_XMLNS 35 35 36 36 def __del__(self): -
TI12-security/trunk/NDG_XACML/ndg/xacml/test/test_xacml.py
r6754 r6770 20 20 from ndg.xacml.parsers.etree.factory import ReaderFactory 21 21 22 23 class XACMLTestCase(unittest.TestCase): 24 THIS_DIR = path.dirname(__file__) 22 from ndg.xacml.core.context.request import Request 23 from ndg.xacml.core.subject import Subject 24 from ndg.xacml.core.resource import Resource 25 from ndg.xacml.core.action import Action 26 27 THIS_DIR = path.dirname(__file__) 28 29 30 class XACMLPolicyTestCase(unittest.TestCase): 25 31 XACML_TEST1_FILENAME = "rule1.xml" 26 32 XACML_TEST1_FILEPATH = path.join(THIS_DIR, XACML_TEST1_FILENAME) … … 255 261 self.assert_(policy) 256 262 263 264 class XACMLContextTestCase(unittest.TestCase): 265 """Test PDP, PAP, PIP and Context handler""" 266 267 def test01(self): 268 request = Request() 269 270 subject = Subject() 271 subject. 272 request.subjects.append(subject) 273 274 request.resources.append(Resource()) 275 request.action = Action() 276 277 257 278 258 279 if __name__ == "__main__":
Note: See TracChangeset
for help on using the changeset viewer.