Changeset 7103 for TI12-security


Ignore:
Timestamp:
25/06/10 22:03:35 (9 years ago)
Author:
pjkersha
Message:

Incomplete - task 2: XACML-Security Integration

  • updating epydoc ready for release.
Location:
TI12-security/trunk/ndg_xacml/ndg/xacml/core
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/ndg_xacml/ndg/xacml/core/expression.py

    r7087 r7103  
    1616 
    1717class Expression(XacmlCoreBase): 
    18     """XACML Expression type""" 
     18    """XACML Expression type 
     19     
     20    @cvar ELEMENT_LOCAL_NAME: XML local name for this element 
     21    @type ELEMENT_LOCAL_NAME: string 
     22    @cvar DATA_TYPE_ATTRIB_NAME: XML attribute name for data type 
     23    @type DATA_TYPE_ATTRIB_NAME: string 
     24     
     25    @ivar __dataType: data type for this expression 
     26    @type __dataType: None / basestring 
     27    """ 
    1928    __metaclass__ = ABCMeta 
    2029    ELEMENT_LOCAL_NAME = None 
  • TI12-security/trunk/ndg_xacml/ndg/xacml/core/match.py

    r7087 r7103  
    2626    """Base class for representation of SubjectMatch, ResourceMatch,  
    2727    ActionMatch and EnvironmentMatch Target elements 
     28     
     29    @cvar ELEMENT_LOCAL_NAME: XML Local Name of this element  
     30    @type ELEMENT_LOCAL_NAME: string 
     31    
     32    @cvar MATCH_ID_ATTRIB_NAME: XML attribute name for match ID 
     33    @type MATCH_ID_ATTRIB_NAME: string 
     34    
     35    @cvar ATTRIBUTE_VALUE_ELEMENT_LOCAL_NAME: XML Local Name of attribute value 
     36    child element  
     37    @type ATTRIBUTE_VALUE_ELEMENT_LOCAL_NAME: string 
     38 
     39    @ivar __attributeValue: attribute value associated with this match 
     40    @type __attributeValue: ndg.xacml.core.attributevalue.AttributeValue 
     41    @ivar __attributeDesignator: attribute designator - only a designator or  
     42    selector may be set for a given instance not both 
     43    @type __attributeDesignator: ndg.xacml.core.attributedesignator.AttributeDesignator 
     44    @ivar __attributeSelector: attribute selector - only a designator or  
     45    selector may be set for a given instance not both 
     46    @type __attributeSelector: ndg.xacml.core.attributeselector.AttributeSelector 
     47    @ivar __matchId: match identifier 
     48    @type __matchId: NoneType / basestring 
     49    @ivar __function: function to be applied 
     50    @type __function: ndg.xacml.core.functions.AbstractFunction derived type 
     51    @ivar __functionMap: function mapping object to map URNs to function class 
     52    implementations 
     53    @type __functionMap: ndg.xacml.core.functions.FunctionMap 
     54    @ivar __loadFunctionFromId: boolean determines whether or not to load 
     55    function classes for given function URN in functionId set property method 
     56    @type __loadFunctionFromId: bool 
    2857    """ 
    2958    ELEMENT_LOCAL_NAME = None 
     
    5988    @property 
    6089    def attributeValue(self): 
    61         """Match attribute value""" 
     90        """Match attribute value 
     91         
     92        @return: attribute value 
     93        @rtype: ndg.xacml.core.attributevalue.Attribute""" 
    6294        return self.__attributeValue 
    6395     
     
    6597    def attributeValue(self, value): 
    6698        """Set match attribute value. 
     99        @param value: attribute value 
     100        @type value: ndg.xacml.core.attributevalue.AttributeValue 
     101        @raise TypeError: incorrect type set 
    67102        """ 
    68103        if not isinstance(value, AttributeValue): 
     
    75110    @property 
    76111    def attributeDesignator(self): 
     112        """@return: attribute designator - only a designator or  
     113        selector may be set for a given instance not both 
     114        @rtype: ndg.xacml.core.attributedesignator.AttributeDesignator 
     115        """ 
    77116        return self.__attributeDesignator 
    78117     
     
    82121        attributeDesignator or an attributeSelector setting a designator DELETES 
    83122        any attributeSelector previously set 
     123         
     124        @param value: attribute selector - only a designator or  
     125        selector may be set for a given instance not both 
     126        @type value: ndg.xacml.core.attributeselector.AttributeSelector   
     127        @raise TypeError: incorrect type for input value       
    84128        """ 
    85129        if not isinstance(value, AttributeDesignator): 
     
    93137    @property 
    94138    def attributeSelector(self): 
     139        ''' 
     140        @return: attribute selector 
     141        @rtype: ndg.xacml.core.attributeselector.AttributeSelector 
     142        ''' 
    95143        return self.__attributeSelector 
    96144     
     
    100148        attributeDesignator or an attributeSelector setting a selector DELETES 
    101149        any attributeDesignator previously set 
     150         
     151        @param value: attribute selector 
     152        @type value: ndg.xacml.core.attributeselector.AttributeSelector 
    102153        """ 
    103154        if not isinstance(value, AttributeSelector): 
     
    110161                        
    111162    def _getMatchId(self): 
    112         """Match identifier for match function""" 
     163        """Match identifier for match function 
     164        @return: match identifier 
     165        @rtype: NoneType / basestring 
     166        """ 
    113167        return self.__matchId 
    114168 
    115169    def _setMatchId(self, value): 
    116         """Match identifier for match function""" 
     170        """Match identifier for match function 
     171        @param value: match identifier 
     172        @type value: basestring 
     173        @raise TypeError: if incorrect input type 
     174        """ 
    117175        if not isinstance(value, basestring): 
    118176            raise TypeError('Expecting string type for "matchId" ' 
     
    131189    def loadFunctionFromId(self): 
    132190        """Set to False to stop the functionId property set method automatically 
    133         trying to load the corresponding function for the given functionId"""  
     191        trying to load the corresponding function for the given functionId  
     192 
     193        @return: boolean determines whether or not to load 
     194        function classes for given function URN in functionId set property  
     195        method 
     196        @rtype: bool 
     197        """ 
    134198        return self.__loadFunctionFromId 
    135199     
    136200    @loadFunctionFromId.setter 
    137201    def loadFunctionFromId(self, value): 
     202        """ 
     203        @param value: boolean determines whether or not to load 
     204        function classes for given function URN in functionId set property  
     205        method 
     206        @type value: bool 
     207        """ 
    138208        if not isinstance(value, bool): 
    139209            raise TypeError('Expecting %r type for "loadFunctionFromId" ' 
     
    150220        loadFunctionFromId = False 
    151221         
     222        @param functionMap: mapping of function URNs to function classes 
     223        @type functionMap: dict like object 
    152224        @raise UnsupportedStdFunctionError: policy references a function type  
    153225        which is in the XACML spec. but is not supported by this implementation 
     
    175247    def functionMap(self): 
    176248        """functionMap object for PDP to retrieve functions from given XACML 
    177         function URNs""" 
     249        function URNs 
     250        @return: function mapping object to map URNs to function  
     251        class implementations 
     252        @rtype: ndg.xacml.core.functions.FunctionMap 
     253        """ 
    178254        return self.__functionMap 
    179255     
     
    181257    def functionMap(self, value): 
    182258        '''functionMap object for PDP to retrieve functions from given XACML 
    183         function URNs''' 
     259        function URNs 
     260         
     261        @param value: function mapping object to map URNs to function class 
     262        implementations 
     263        @type value: ndg.xacml.core.functions.FunctionMap 
     264        @raise TypeError: raise if input value is incorrect type 
     265        ''' 
    184266        if not isinstance(value, FunctionMap): 
    185267            raise TypeError('Expecting %r derived type for "functionMap" ' 
     
    190272    @property   
    191273    def function(self): 
    192         "Function for this <Apply> instance" 
     274        """Function for this <Apply> instance 
     275        @return: function to be applied 
     276        @rtype: ndg.xacml.core.functions.AbstractFunction derived type 
     277        """ 
    193278        return self.__function 
    194279         
     
    196281        """Evaluate the match object against the relevant element in the request 
    197282        context 
     283         
     284        @param context: the request context 
     285        @type context: ndg.xacml.core.context.request.Request 
     286        @return: match status 
     287        @rtype: bool 
    198288        """ 
    199289         
  • TI12-security/trunk/ndg_xacml/ndg/xacml/core/obligation.py

    r7087 r7103  
    1616 
    1717class AttributeAssignment(AttributeValue): 
    18     """XCAML AttributeAssignment type""" 
     18    """XACML AttributeAssignment type""" 
    1919        
    2020 
    2121class Effect(object): 
    22     """Define effect type for Obligation""" 
     22    """Define effect type for Obligation 
     23     
     24    @cvar PERMIT_STR: permit decision string 
     25    @type PERMIT_STR: string 
     26     
     27    @cvar DENY_STR: deny decision string 
     28    @type DENY_STR: string 
     29     
     30    @cvar TYPES: list of valid effect strings 
     31    @type TYPES: tuple 
     32     
     33    @ivar __value: obligation effect 
     34    @type value: None / basestring 
     35    """ 
    2336     
    2437    # "Permit" effect type 
     
    3346     
    3447    def __init__(self, effectType): 
     48        """Initialise attributes giving an effect type 
     49        @param effectType:  
     50        @type effectType:  
     51        """ 
    3552        self.__value = None 
    3653        self.value = effectType 
    3754 
    3855    def __getstate__(self): 
    39         '''Enable pickling''' 
     56        '''Enable pickling 
     57         
     58        @return: instance attributes dictionary 
     59        @rtype: dict 
     60        ''' 
    4061        _dict = {} 
    4162        for attrName in Effect.__slots__: 
     
    5071   
    5172    def __setstate__(self, attrDict): 
    52         '''Enable pickling''' 
     73        '''Enable pickling 
     74        @param attrDict: instance attributes dictionary 
     75        @type attrDict: dict 
     76        ''' 
    5377        for attrName, val in attrDict.items(): 
    5478            setattr(self, attrName, val) 
    5579             
    5680    def _setValue(self, value): 
     81        """Set effect 
     82         
     83        @param value: effect 
     84        @type value: ndg.xacml.core.obligation.Effect or basestring 
     85        @raise TypeError: incorrect type for input 
     86        @raise AttributeError: effect value not recognised 
     87        """ 
    5788        if isinstance(value, Effect): 
    5889            # Cast to string 
     
    69100         
    70101    def _getValue(self): 
     102        """Get effect 
     103         
     104        @return: effect value 
     105        @rtype: ndg.xacml.core.obligation.Effect 
     106        """ 
    71107        return self.__value 
    72108     
     
    74110     
    75111    def __str__(self): 
     112        """ 
     113        @return: effect as a string 
     114        @rtype: basestring 
     115        """ 
    76116        return self.__value 
    77117 
    78118    def __eq__(self, effect): 
     119        """ 
     120        @param effect: ndg.xacml.core.obligation.Effect or basestring 
     121        @raise TypeError: incorrect type for input 
     122        @raise AttributeError: effect value not recognised 
     123        """ 
    79124        if isinstance(effect, Effect): 
    80125            # Cast to string 
     
    96141 
    97142class Obligation(XacmlCoreBase): 
    98     """XACML Obligation type""" 
     143    """XACML Obligation type 
     144     
     145    @cvar ELEMENT_LOCAL_NAME: XML element local name 
     146    @type ELEMENT_LOCAL_NAME: string 
     147    @cvar ATTRIBUTE_ASSIGNMENTS_ELEMENT_LOCAL_NAME: attribute assignments XML  
     148    attribute name 
     149    @type ATTRIBUTE_ASSIGNMENTS_ELEMENT_LOCAL_NAME: string 
     150    @cvar OBLIGATION_ID_ATTRIB_NAME: obligation ID XML attribute name 
     151    @type OBLIGATION_ID_ATTRIB_NAME: string 
     152     
     153    @ivar __attributeAssignments: list of attribute assignments 
     154    @type __attributeAssignments: ndg.xacml.utils.TypedList 
     155    @ivar __obligationId: obligation id 
     156    @type __obligationId: NoneType / basestring 
     157    @ivar __fulfillOn: fulfil on condition 
     158    @type __fulfillOn: NoneType / basestring 
     159    """ 
    99160    ELEMENT_LOCAL_NAME = 'Obligation' 
    100161    ATTRIBUTE_ASSIGNMENTS_ELEMENT_LOCAL_NAME = 'AttributeAssignment' 
     
    105166     
    106167    def __init__(self): 
     168        """Initialise attributes""" 
    107169        self.__attributeAssignments = TypedList(AttributeAssignment) 
    108170        self.__obligationId = None 
     
    111173    @property 
    112174    def attributeAssignments(self): 
    113         """Obligation attribute assignments""" 
     175        """Obligation attribute assignments 
     176        @return: attribute assignments 
     177        @rtype: ndg.xacml.utils.TypedList 
     178        """ 
    114179        return self.__attributeAssignments 
    115180     
    116181    @property 
    117182    def obligationId(self): 
    118         """obligation Id""" 
     183        """obligation Id 
     184        @return: obligation id 
     185        @rtype: NoneType / basestring 
     186        """ 
    119187        return self.__obligationId 
    120188 
    121189    @obligationId.setter 
    122190    def obligationId(self, value): 
    123         """obligation Id""" 
     191        """obligation Id 
     192         
     193        @param value: obligation id 
     194        @type value: NoneType / basestring 
     195        @raise TypeError: incorrect input type 
     196        """ 
    124197        if not isinstance(value, basestring): 
    125198            raise TypeError('Expecting %r type for "obligationId" attribute; ' 
     
    130203    @property 
    131204    def fulfillOn(self): 
    132         """Fulfill obligation on the given effect Permit/Deny""" 
     205        """Fulfill obligation on the given effect Permit/Deny 
     206         
     207        @return: fulfil condition 
     208        @rtype: NoneType / basestring 
     209        """ 
    133210        return self.__fulfillOn 
    134211 
    135212    @fulfillOn.setter 
    136213    def fulfillOn(self, value): 
    137         """Fulfill obligation on the given effect Permit/Deny""" 
     214        """Fulfill obligation on the given effect Permit/Deny 
     215        @param value: fulfil condition 
     216        @type value: NoneType / basestring 
     217        @raise TypeError: incorrect type for input 
     218        """ 
    138219        if not isinstance(value, basestring): 
    139220            raise TypeError('Expecting %r type for "fulfillOn" attribute; got ' 
  • TI12-security/trunk/ndg_xacml/ndg/xacml/core/policy.py

    r7087 r7103  
    4141 
    4242class Policy(XacmlCoreBase): 
    43     """NDG MSI Policy."""  
    44     DEFAULT_XACML_VERSION = "1.0" 
     43    """NDG MSI Policy. 
     44     
     45    @cvar DEFAULT_XACML_VERSION: default is 2.0 
     46    @type DEFAULT_XACML_VERSION: string 
     47    @cvar ELEMENT_LOCAL_NAME: XML local name for this element 
     48    @type ELEMENT_LOCAL_NAME: string 
     49    @cvar POLICY_ID_ATTRIB_NAME: policy id XML attribute name 
     50    @type POLICY_ID_ATTRIB_NAME: string 
     51    @cvar RULE_COMBINING_ALG_ID_ATTRIB_NAME: rule combining algorithm id XML 
     52    attribute name 
     53    @type RULE_COMBINING_ALG_ID_ATTRIB_NAME: string 
     54    @cvar VERSION_ATTRIB_NAME: version XML attribute name 
     55    @type VERSION_ATTRIB_NAME: string 
     56    @cvar DESCRIPTION_LOCAL_NAME: description XML element local name 
     57    @type DESCRIPTION_LOCAL_NAME: string 
     58    @cvar POLICY_DEFAULTS_LOCAL_NAME: policy defaults XML element local name 
     59    @type POLICY_DEFAULTS_LOCAL_NAME: string 
     60    @cvar COMBINER_PARAMETERS_LOCAL_NAME: combiner parameter XML element local 
     61    name 
     62    @type COMBINER_PARAMETERS_LOCAL_NAME: string 
     63    @cvar RULE_COMBINER_PARAMETERS_LOCAL_NAME: rule combiner parameter XML 
     64    element local name 
     65    @type RULE_COMBINER_PARAMETERS_LOCAL_NAME: string 
     66    @cvar OBLIGATIONS_LOCAL_NAME: obligations XML element local name 
     67    @type OBLIGATIONS_LOCAL_NAME: string 
     68     
     69    @ivar __policyId: policy id 
     70    @type __policyId: NoneType / basestring 
     71    @ivar __version: policy version 
     72    @type __version: NoneType / basestring 
     73    @ivar __ruleCombiningAlgId: rule combining algorithm ID 
     74    @type __ruleCombiningAlgId: NoneType / basestring 
     75    @ivar __description: policy decription text 
     76    @type __description: NoneType / basestring 
     77    @ivar __target: target element 
     78    @type __target: NoneType / basestring 
     79    @ivar __attr: attribute 
     80    @type __attr: NoneType / basestring 
     81    @ivar __obligations: obligations 
     82    @type __obligations: NoneType / basestring 
     83    @ivar __ruleCombiningAlgFactory: rule combining algorithm factory 
     84    @type __ruleCombiningAlgFactory: NoneType / basestring 
     85    @ivar __ruleCombiningAlg: rule combining algorithm 
     86    @type __ruleCombiningAlg: NoneType / basestring 
     87 
     88    """  
     89    DEFAULT_XACML_VERSION = "2.0" 
    4590    ELEMENT_LOCAL_NAME = "Policy" 
    4691    POLICY_ID_ATTRIB_NAME = "PolicyId" 
     
    72117        property is set in order to create the corresponding combining algorithm 
    73118        object 
     119         
     120        @param ruleCombiningAlgFactory: factory object for return a rule  
     121        combining algorithm class for a given URI.  Defaults to  
     122        @type ruleCombiningAlgFactory: NoneType / defaults to  
     123        ndg.xacml.core.rule_combining_alg.RuleCombiningAlgClassFactory 
    74124        """ 
    75125        super(Policy, self).__init__() 
Note: See TracChangeset for help on using the changeset viewer.