Changeset 7256
- Timestamp:
- 29/07/10 21:29:29 (9 years ago)
- Location:
- TI12-security/trunk/ndg_xacml/ndg/xacml/core
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TI12-security/trunk/ndg_xacml/ndg/xacml/core/context/handler.py
r7087 r7256 11 11 __revision__ = "$Id$" 12 12 from abc import ABCMeta, abstractmethod 13 14 from ndg.xacml.core.context.pdpinterface import PDPInterface 15 from ndg.xacml.core.context.pipinterface import PIPInterface 13 16 14 17 … … 52 55 """ 53 56 return [] 57 58 59 class CtxHandlerBase(CtxHandlerInterface): 60 """Base class for Context handlers - extends Context handler interface to 61 include Policy Decision Point and Policy Information Point references 62 """ 63 64 __slots__ = ( 65 '__pip', 66 '__pdp', 67 ) 68 69 def __init__(self): 70 self.__pip = None 71 self.__pdp = None 54 72 73 def _getPip(self): 74 return self.__pip 75 76 def _setPip(self, value): 77 if not isinstance(value, PIPInterface): 78 raise TypeError('Expecting %r type for "pip" attribute; got %r ' 79 'instead' % 80 (PDPInterface, value)) 81 82 self.__pip = value 83 84 pip = property(_getPip, _setPip, None, "Policy Information Point") 85 86 def _getPdp(self): 87 return self.__pdp 88 89 def _setPdp(self, value): 90 if not isinstance(value, PDPInterface): 91 raise TypeError('Expecting %r type for "pdp" attribute; got %r ' 92 'instead' % 93 (PDPInterface, value)) 94 95 self.__pdp = value 96 97 pdp = property(_getPdp, _setPdp, None, "Policy Decision Point") 98 -
TI12-security/trunk/ndg_xacml/ndg/xacml/core/context/pdp.py
r7109 r7256 48 48 """ 49 49 pdp = cls() 50 pdp. policy = Policy.fromSource(source, readerFactory)50 pdp.setPolicyFromSource(source, readerFactory) 51 51 return pdp 52 52 53 def setPolicyFromSource(self, source, readerFactory): 54 """initialise PDP with the given policy 55 @param source: source for policy 56 @type source: type (dependent on the reader set, it could be for example 57 a file path string, file object, XML element instance) 58 @param readerFactory: reader factory returns the reader to use to read 59 this policy 60 @type readerFactory: ndg.xacml.parsers.AbstractReader derived type 61 """ 62 self.policy = Policy.fromSource(source, readerFactory) 63 53 64 @property 54 65 def policy(self): -
TI12-security/trunk/ndg_xacml/ndg/xacml/core/context/pip.py
r7087 r7256 1 """NDG SecurityPolicy Information Point type definition1 """NDG XACML Policy Information Point type definition 2 2 3 NERC DataGrid4 3 """ 5 4 __author__ = "P J Kershaw" -
TI12-security/trunk/ndg_xacml/ndg/xacml/core/functions/v1/equal.py
r7087 r7256 23 23 TYPE = None 24 24 25 def evaluate(self, string1, string2):26 """Match input strings25 def evaluate(self, attribute1, attribute2): 26 """Match input attribute values 27 27 28 @param string1: first of two strings to match29 @type string1: basestring30 @param string2: second string31 @type string2: basestring32 @return: True if strings match, False otherwise28 @param attribute1: first of two attributes to match 29 @type attribute1: ndg.xacml.core.attributevalue.AttributeValue derived 30 @param attribute2: second attribute 31 @type attribute2: ndg.xacml.core.attributevalue.AttributeValue derived 32 @return: True if attributes match, False otherwise 33 33 @rtype: bool 34 34 """ 35 if not isinstance( string1, basestring):35 if not isinstance(attribute1, self.__class__.TYPE): 36 36 raise XacmlContextTypeError('Expecting %r derived type for ' 37 '" string1"; got %r' %37 '"attribute1"; got %r' % 38 38 (self.__class__.TYPE, 39 type( string1)))39 type(attribute1))) 40 40 41 if not isinstance( string2, self.__class__.TYPE):41 if not isinstance(attribute2, self.__class__.TYPE): 42 42 raise XacmlContextTypeError('Expecting %r derived type for ' 43 '" string2"; got %r' %43 '"attribute2"; got %r' % 44 44 (self.__class__.TYPE, 45 type( string2)))45 type(attribute2))) 46 46 47 return string1 == string247 return attribute1.value == attribute2.value 48 48 49 49
Note: See TracChangeset
for help on using the changeset viewer.