Ignore:
Timestamp:
25/06/10 13:14:03 (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/functions
Files:
4 edited

Legend:

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

    r7087 r7088  
    2323 
    2424class AbstractFunction(object): 
    25     """Base class for all XACML matching functions""" 
    26      
     25    """Abstract Base class for all XACML matching functions 
     26    @cvar FUNCTION_NS: namespace for the given function 
     27    @type FUNCTION_NS: NoneType (must be string in derived type) 
     28     
     29    @cvar V1_0_FUNCTION_NS: XACML 1.0 function namespace prefix 
     30    @type V1_0_FUNCTION_NS: string 
     31     
     32    @cvar V2_0_FUNCTION_NS: XACML 2.0 function namespace prefix 
     33    @type V2_0_FUNCTION_NS: string 
     34    """ 
    2735    __metaclass__ = ABCMeta 
     36     
    2837    FUNCTION_NS = None 
    2938    V1_0_FUNCTION_NS = "urn:oasis:names:tc:xacml:1.0:function:" 
     
    3140     
    3241    def __init__(self): 
     42        """ 
     43        @raise TypeError: if FUNCTION_NS not set correctly 
     44        """ 
    3345        if self.__class__.FUNCTION_NS is None: 
    3446            raise TypeError('"FUNCTION_NS" class variable must be defined in ' 
     
    3850    def evaluate(self, *inputs): 
    3951        """Evaluate the function from the given input arguments and context 
     52         
    4053        @param inputs: input arguments need to evaluate the function 
    4154        @type inputs: tuple 
    42         @return: True for match, False otherwise 
    43         @rtype: bool 
     55        @return: derived type should return True for match, False otherwise 
     56        @rtype: bool (derived type), NoneType for THIS implementation 
    4457        """ 
    4558         
    4659class XacmlFunctionNames(object): 
    47     """XACML standard match function names""" 
     60    """XACML standard match function names 
     61     
     62    @cvar FUNCTION_NAMES: list of all the XACML function URNs 
     63    @type FUNCTION_NAMES: tuple     
     64    """ 
    4865    FUNCTION_NAMES = ( 
    4966'urn:oasis:names:tc:xacml:1.0:function:string-equal', 
     
    275292        @return: at least one member of class corresponding to the given input 
    276293        identifier 
    277         @rtype: AbstractFunction derived type or None if no match is  
    278         found 
     294        @rtype: AbstractFunction derived type or NoneType if no match is found 
    279295        ''' 
    280296        return None 
     
    462478    FunctionClassFactoryInterface implementations so that a function class can  
    463479    be obtained directly from a given XACML function URN.   
     480     
     481    @cvar FUNCTION_PKG_PREFIX: python package path for functions package 
     482    @type FUNCTION_PKG_PREFIX: string 
     483     
     484    @cvar V1_0_PKG_PREFIX: python package path for XACML 1.0 functions package 
     485    @type V1_0_PKG_PREFIX: string 
     486     
     487    @cvar V2_0_PKG_PREFIX: python package path for XACML 2.0 functions package 
     488    @type V2_0_PKG_PREFIX: string 
     489     
     490    @cvar SUPPORTED_NSS: mapping of function URN prefix to Python package 
     491    @type SUPPORTED_NSS: dict 
     492     
     493    @cvar FUNCTION_CLASS_FACTORY_CLASSNAME: standard name for class factory 
     494    which should be present in each generic function module.  This factory is  
     495    invoked to create the function class for any given function URN related to 
     496    that module 
     497    @type FUNCTION_CLASS_FACTORY_CLASSNAME: string 
    464498    """ 
    465499    FUNCTION_PKG_PREFIX = 'ndg.xacml.core.functions.' 
     
    496530    @staticmethod 
    497531    def keyFilter(key): 
    498         """Enforce string type keys""" 
     532        """Enforce string type keys 
     533         
     534        @param key: function URN 
     535        @type key: basestring 
     536        @return: True for valid key type 
     537        @rtype: bool 
     538        @raise TypeError: invalid key type 
     539        """ 
    499540        if not isinstance(key, basestring): 
    500541            raise TypeError('Expecting %r type for key; got %r' %  
     
    505546    @staticmethod 
    506547    def valueFilter(value): 
    507         """Enforce AbstractFunction derived types for match functions""" 
     548        """Enforce AbstractFunction derived types for match functions 
     549         
     550        @param value: function URN 
     551        @type value: ndg.xacml.core.functions.AbstractFunction / NotImplemented 
     552        @return: True for valid function type 
     553        @rtype: bool 
     554        @raise TypeError: invlaid key type 
     555        """ 
    508556        if value is NotImplemented: 
    509557            return True 
     
    580628        """Override base class implementation to load and cache function classes 
    581629        if they don't otherwise exist 
     630         
     631        @param key: function URN 
     632        @type key: basestring 
     633        @return: function class 
     634        @rtype: ndg.xacml.core.functions.AbstractFunction / NotImplemented 
    582635        """ 
    583636        functionClass = VettedDict.get(self, key) 
     
    590643        """Likewise to __getitem__, enable loading and caching of function  
    591644        classes if they don't otherwise exist 
     645         
     646        @param key: XACML function URN 
     647        @type key: basestring 
     648        @param *arg: set a single additional argument if required which is  
     649        used as the default value should the key not be found in the map 
     650        @type *arg: tuple 
     651        @return: function class 
     652        @rtype: ndg.xacml.core.functions.AbstractFunction / NotImplemented 
    592653        """ 
    593654        functionClass = VettedDict.get(self, key, *arg) 
  • TI12-security/trunk/ndg_xacml/ndg/xacml/core/functions/v1/regexp_match.py

    r7087 r7088  
    1919class RegexpMatchBase(AbstractFunction): 
    2020    """XACML 2.0 Regular Expression matching base class function 
     21     
     22    @cvar TYPE: attribute type for the given implementation.  Derived classes 
     23    should set appropriately 
     24    @type TYPE: NoneType 
     25     
     26    @cvar FUNCTION_SUFFIX: suffix for all regular expression type function class 
     27    names 
     28    @type FUNCTION_SUFFIX: string 
     29     
     30    @cvar FUNCTION_NS_SUFFIX: generic suffix for regular expression type  
     31    function URNs 
     32    @type FUNCTION_NS_SUFFIX: string 
     33     
     34    @cvar CLASS_NAME_SUFFIX: suffix for all regular expression class names 
     35    @type CLASS_NAME_SUFFIX: string 
    2136    """ 
    2237    FUNCTION_NS = None 
     
    5166class StringRegexMatch(RegexpMatchBase): 
    5267    """String regular expression match function class representation 
     68     
     69    @cvar FUNCTION_NS: String regular expression match function URN 
     70    @type FUNCTION_NS: string 
     71     
     72    @cvar TYPE: string attribute value type 
     73    @type TYPE: dynamically generated string type derived from  
     74    ndg.xacml.core.attributevalue.AttributeValue 
    5375    """ 
    5476    FUNCTION_NS = 'urn:oasis:names:tc:xacml:1.0:function:string-regexp-match' 
  • TI12-security/trunk/ndg_xacml/ndg/xacml/core/functions/v1/round.py

    r7087 r7088  
    1515 
    1616class Round(AbstractFunction): 
    17     """Base class for XACML <type>-round functions""" 
     17    """Base class for XACML <type>-round functions 
     18     
     19    @cvar FUNCTION_NS: namespace for this function 
     20    @type FUNCTION_NS: string 
     21    """ 
    1822    FUNCTION_NS = AbstractFunction.V1_0_FUNCTION_NS + 'round' 
    1923     
     
    2125        """Check a bag has one element only and return it 
    2226         
    23         @param bag: bag containing one element 
    24         @rtype: bool 
     27        @param num: number to round up 
     28        @type num: int / long / float 
     29        @rtype: float 
     30        @raise TypeError: incorrect type for input 
    2531        """ 
    2632        try: 
  • TI12-security/trunk/ndg_xacml/ndg/xacml/core/functions/v2/regexp_match.py

    r7087 r7088  
    1717class FunctionClassFactory(FunctionClassFactoryBase): 
    1818    """Class Factory for *-regexp-match XACML function classes 
     19     
     20    @cvar FUNCTION_NAMES: regular expression match function URNs 
     21    @type FUNCTION_NAMES: tuple 
     22     
     23    @cvar FUNCTION_NS_SUFFIX: generic suffix for one and only function URNs 
     24    @type FUNCTION_NS_SUFFIX: string 
     25     
     26    @cvar FUNCTION_BASE_CLASS: base class for regular expression match function  
     27    classes  
     28    @type FUNCTION_BASE_CLASS: ndg.xacml.core.functions.v1.RegexMatchBase 
    1929    """ 
    2030    FUNCTION_NS_SUFFIX = RegexpMatchBase.FUNCTION_NS_SUFFIX 
Note: See TracChangeset for help on using the changeset viewer.