• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python pdp.PDP类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中ndg.xacml.core.context.pdp.PDP的典型用法代码示例。如果您正苦于以下问题:Python PDP类的具体用法?Python PDP怎么用?Python PDP使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了PDP类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: load_org_policy_rules

    def load_org_policy_rules(self, rules_text):
        log.debug("Loading policies for org")

        #Simply create a new PDP object for the service
        #TODO - make sure this is thread safe with the evaluation that uses it.
        input_source = StringIO(rules_text)
        self.org_pdp = PDP.fromPolicySource(input_source, ReaderFactory)
开发者ID:oldpatricka,项目名称:pyon,代码行数:7,代码来源:policy_decision.py


示例2: load_policy_rules

    def load_policy_rules(self, resource_policy, rules_text):
        log.debug("Loading rules for service: %s" % resource_policy)

        #Simply create a new PDP object for the service
        #TODO - make sure this is thread safe with the evaluation that uses it.
        input_source = StringIO(rules_text)
        self.policy_decision_point[resource_policy] = PDP.fromPolicySource(input_source, ReaderFactory)
开发者ID:tgiguere,项目名称:pyon,代码行数:7,代码来源:policy_decision.py


示例3: initialise

    def initialise(self, prefix='', **kw):
        '''Initialise object from keyword settings
        
        :type prefix: basestring
        :param prefix: prefix for configuration items
        :type kw: dict        
        :param kw: configuration settings
        dictionary
        :raise SamlPepFilterConfigError: missing option setting(s)
        '''
        # Parse other options
        for name in SamlPepFilter.PARAM_NAMES:
            paramName = prefix + name
            value = kw.get(paramName)
            
            if value is not None:
                setattr(self, name, value)
                
            elif name != self.__class__.LOCAL_POLICY_FILEPATH_PARAM_NAME:
                # Policy file setting is optional
                raise SamlPepFilterConfigError('Missing option %r' % paramName)
            

        # Parse authorisation decision query options
        queryPrefix = prefix + self.__class__.AUTHZ_DECISION_QUERY_PARAMS_PREFIX
        self.client.parseKeywords(prefix=queryPrefix, **kw)

        # Initialise the local PDP  
        if self.localPolicyFilePath:
            self.__localPdp = PDP.fromPolicySource(self.localPolicyFilePath, 
                                                   XacmlPolicyReaderFactory)
开发者ID:philipkershaw,项目名称:ndg_security_server,代码行数:31,代码来源:pep.py


示例4: __init__

    def __init__(self, governance_controller):
        self.resource_policy_decision_point = dict()
        self.service_policy_decision_point = dict()

        self.empty_pdp = PDP.fromPolicySource(path.join(THIS_DIR, XACML_EMPTY_POLICY_FILENAME), ReaderFactory)
        self.load_common_service_policy_rules('')

        self.governance_controller = governance_controller


        #Create and register an Attribute Value derived class to handle a dict type used for the messages
        _className = 'Dict' + AttributeValue.CLASS_NAME_SUFFIX
        _classVars = {'TYPE': dict, 'IDENTIFIER': DICT_TYPE_URI}
        _attributeValueClass = type(_className, (AttributeValue, ), _classVars)
        AttributeValue.register(_attributeValueClass)
        attributeValueFactory.addClass(DICT_TYPE_URI, _attributeValueClass)

        self.DictAttributeValue = attributeValueFactory(DICT_TYPE_URI)


        #Create and register an Attribute Value derived class to handle any object
        _className = 'Object' + AttributeValue.CLASS_NAME_SUFFIX
        _classVars = {'TYPE': object, 'IDENTIFIER': OBJECT_TYPE_URI}
        _attributeValueClass = type(_className, (AttributeValue, ), _classVars)
        AttributeValue.register(_attributeValueClass)
        attributeValueFactory.addClass(OBJECT_TYPE_URI, _attributeValueClass)

        self.ObjectAttributeValue = attributeValueFactory(OBJECT_TYPE_URI)

        #Create and add new function for evaluating functions that take the message as a dict
        from pyon.core.governance.policy.evaluate import EvaluateCode, EvaluateFunction
        functionMap['urn:oasis:names:tc:xacml:1.0:function:evaluate-code'] = EvaluateCode
        functionMap['urn:oasis:names:tc:xacml:1.0:function:evaluate-function'] = EvaluateFunction
开发者ID:ooici,项目名称:pyon,代码行数:33,代码来源:policy_decision.py


示例5: __init__

    def __init__(self, governance_controller):
        self.resource_policy_decision_point = dict()
        self.service_policy_decision_point = dict()

        self.empty_pdp = PDP.fromPolicySource(path.join(THIS_DIR, XACML_EMPTY_POLICY_FILENAME), ReaderFactory)
        self.load_common_service_policy_rules('')

        self.governance_controller = governance_controller
开发者ID:daf,项目名称:pyon,代码行数:8,代码来源:policy_decision.py


示例6: __init__

    def __init__(self, *args, **kwargs):
        self.policy_decision_point = dict()
        self.org_pdp = PDP.fromPolicySource(path.join(THIS_DIR, XACML_EMPTY_POLICY_FILENAME), ReaderFactory)

        #Adding an not function to XACML
        from pyon.core.governance.policy.xacml.not_function import Not
        from pyon.core.governance.policy.xacml.and_function import And
        functionMap['urn:oasis:names:tc:xacml:ooi:function:not'] = Not
        functionMap['urn:oasis:names:tc:xacml:ooi:function:and'] = And
开发者ID:oldpatricka,项目名称:pyon,代码行数:9,代码来源:policy_decision.py


示例7: test02_03And1ArgFalse

 def test02_03And1ArgFalse(self):
     self.pdp = PDP.fromPolicySource(XACML_ANDTEST_FILEPATH, ReaderFactory)
     request = self._createRequestCtx(
                         self.__class__.RESOURCE3_ID,
                         subjectRoles=('role1',))
     response = self.pdp.evaluate(request)
     self.failIf(response is None, "Null response")
     for result in response.results:
         self.failIf(result.decision != Decision.DENY,
                     "Expecting Deny decision")
开发者ID:LiangLinCn,项目名称:ndg_xacml,代码行数:10,代码来源:test_logical_functions.py


示例8: test02_04And2ArgsTrue

 def test02_04And2ArgsTrue(self):
     self.pdp = PDP.fromPolicySource(XACML_ANDTEST_FILEPATH, ReaderFactory)
     request = self._createRequestCtx(
                         self.__class__.RESOURCE4_ID,
                         subjectRoles=('role1', 'role2'))
     response = self.pdp.evaluate(request)
     self.failIf(response is None, "Null response")
     for result in response.results:
         self.failIf(result.decision != Decision.PERMIT,
                     "Expecting Permit decision")
开发者ID:LiangLinCn,项目名称:ndg_xacml,代码行数:10,代码来源:test_logical_functions.py


示例9: get_pdp

    def get_pdp(self, resource_id):

        if self.policy_decision_point.has_key(resource_id):
            return self.policy_decision_point[resource_id]

        # If a PDP does not exist for this resource - then return default.
        if self.default_pdp is None:
            # Loads a blank policy set as the default or an unknown resource_policy
            self.default_pdp = PDP.fromPolicySource(path.join(THIS_DIR, XACML_EMPTY_POLICY_FILENAME), ReaderFactory)

        return self.default_pdp
开发者ID:ooici-dm,项目名称:pyon,代码行数:11,代码来源:policy_decision.py


示例10: createPDP

    def createPDP(self):
        """Create PDP from ion agents policy file"""

        log.debug("Creating a new PDP")
        # TODO - May need to implement a not function here.
        #from pyon.core.governance.ndg_xacml.ooi_and import And
        #functionMap['urn:oasis:names:tc:xacml:ooi:function:and'] = And

        self.policy_decision_point = PDP.fromPolicySource(path.join(THIS_DIR, XACML_ION_POLICY_FILENAME), ReaderFactory)

        return self.policy_decision_point
开发者ID:dstuebe,项目名称:pyon,代码行数:11,代码来源:policy_decision.py


示例11: test02_02AnyUriUrlencode

 def test02_02AnyUriUrlencode(self):
     """Test URL encoding of a URI value resulting in a deny decision.
     """
     self.pdp = PDP.fromPolicySource(XACML_CUSTOM_FUNCTION_TEST_FILEPATH,
                                     ReaderFactory)
     request = self._createRequestCtx(self.__class__.RESOURCE4_ID,
                                      subjectRoles=('role1',))
     response = self.pdp.evaluate(request)
     self.failIf(response is None, "Null response")
     for result in response.results:
         self.failIf(result.decision != Decision.DENY,
                     "Expecting Deny decision")
开发者ID:LiangLinCn,项目名称:ndg_xacml,代码行数:12,代码来源:test_custom_function.py


示例12: test01_01StringUrlencode

 def test01_01StringUrlencode(self):
     """Test URL encoding of a string value resulting in a permit decision.
     """
     self.pdp = PDP.fromPolicySource(XACML_CUSTOM_FUNCTION_TEST_FILEPATH,
                                     ReaderFactory)
     request = self._createRequestCtx(self.__class__.RESOURCE1_ID,
                                      subjectRoles=('role1',))
     response = self.pdp.evaluate(request)
     self.failIf(response is None, "Null response")
     for result in response.results:
         self.failIf(result.decision != Decision.PERMIT,
                     "Expecting Permit decision")
开发者ID:LiangLinCn,项目名称:ndg_xacml,代码行数:12,代码来源:test_custom_function.py


示例13: load_resource_policy_rules

    def load_resource_policy_rules(self, resource_key, rules_text):

        if not rules_text and not self.resource_policy_decision_point.has_key(resource_key):
            return

        log.info("Loading policies for resource: %s" % resource_key)

        self.clear_resource_policy(resource_key)

        #Simply create a new PDP object for the service
        input_source = StringIO(self.create_policy_from_rules(resource_key, rules_text))
        self.resource_policy_decision_point[resource_key] = PDP.fromPolicySource(input_source, ReaderFactory)
开发者ID:daf,项目名称:pyon,代码行数:12,代码来源:policy_decision.py


示例14: test01_04StringConcatenate4Values

 def test01_04StringConcatenate4Values(self):
     """Test concatenation of 4 string values resulting in deny decision.
     """
     self.pdp = PDP.fromPolicySource(XACML_CONCATENATE_TEST_FILEPATH,
                                     ReaderFactory)
     request = self._createRequestCtx(self.__class__.RESOURCE4_ID,
                                      subjectRoles=('role1',))
     response = self.pdp.evaluate(request)
     self.failIf(response is None, "Null response")
     for result in response.results:
         self.failIf(result.decision != Decision.DENY,
                     "Expecting Deny decision")
开发者ID:LiangLinCn,项目名称:ndg_xacml,代码行数:12,代码来源:test_string_functions.py


示例15: set_resource_policy_rules

    def set_resource_policy_rules(self, resource_key, policy_list):
        log.debug("Loading policies for resource: %s" % resource_key)

        self.clear_resource_policy(resource_key)

        if not policy_list:
            self.resource_policy_decision_point[resource_key] = None
            return

        # Create a new PDP object for the resource
        rules_text = self._get_rules_text(policy_list)
        input_source = StringIO(self.create_resource_policy_from_rules(resource_key, rules_text))
        self.resource_policy_decision_point[resource_key] = PDP.fromPolicySource(input_source, ReaderFactory)
开发者ID:edwardhunter,项目名称:scioncc,代码行数:13,代码来源:policy_decision.py


示例16: set_service_policy_rules

    def set_service_policy_rules(self, service_name, policy_list):
        log.debug("Loading policies for service: %s" % service_name)

        self.clear_service_policy(service_name)

        if not policy_list:
            self.service_policy_decision_point[service_name] = None
            return

        # Create a new PDP object for the service
        rules_text = self._get_rules_text(policy_list)
        input_source = StringIO(self.create_policy_from_rules(service_name, rules_text))
        self.service_policy_decision_point[service_name] = PDP.fromPolicySource(input_source, ReaderFactory)
开发者ID:edwardhunter,项目名称:scioncc,代码行数:13,代码来源:policy_decision.py


示例17: test02_01UrlStringConcatenate2Values

 def test02_01UrlStringConcatenate2Values(self):
     """Test concatenation of URI and 1 string value resulting in permit
     decision.
     """
     self.pdp = PDP.fromPolicySource(XACML_CONCATENATE_TEST_FILEPATH,
                                     ReaderFactory)
     request = self._createRequestCtx(self.__class__.RESOURCE5_ID,
                                      subjectRoles=('role1',))
     response = self.pdp.evaluate(request)
     self.failIf(response is None, "Null response")
     for result in response.results:
         self.failIf(result.decision != Decision.PERMIT,
                     "Expecting Permit decision")
开发者ID:LiangLinCn,项目名称:ndg_xacml,代码行数:13,代码来源:test_string_functions.py


示例18: load_service_policy_rules

    def load_service_policy_rules(self, service_name, rules_text):

        if not rules_text and not self.service_policy_decision_point.has_key(service_name):
            return

        log.debug("Loading policies for service: %s" % service_name)

        self.clear_service_policy(service_name)
        service_rule_set = self.common_service_rules + rules_text

        #Simply create a new PDP object for the service
        input_source = StringIO(self.create_policy_from_rules(service_name, service_rule_set))
        self.service_policy_decision_point[service_name] = PDP.fromPolicySource(input_source, ReaderFactory)
开发者ID:ooici,项目名称:pyon,代码行数:13,代码来源:policy_decision.py


示例19: test01NotApplicable

 def test01NotApplicable(self):
     self.pdp = PDP.fromPolicySource(XACML_ATTRIBUTESELECTOR1_FILEPATH,
                                     ReaderFactory)
     resourceContent = self._make_resource_content_element(
                                 self.__class__.RESOURCE_CONTENT_VERSION_100)
     request = self._createRequestCtx(
                                 self.__class__.NOT_APPLICABLE_RESOURCE_ID,
                                 resourceContent=resourceContent)
     request.elem = RequestElementTree.toXML(request)
     request.attributeSelector = EtreeXPathSelector(request.elem)
     response = self.pdp.evaluate(request)
     self.failIf(response is None, "Null response")
     for result in response.results:
         self.failIf(result.decision != Decision.NOT_APPLICABLE,
                     "Expecting not applicable decision")
开发者ID:LiangLinCn,项目名称:ndg_xacml,代码行数:15,代码来源:test_pdp_with_attributeselector.py


示例20: test06ExecuteConditionPermit

 def test06ExecuteConditionPermit(self):
     self.pdp = PDP.fromPolicySource(XACML_ATTRIBUTESELECTOR3_FILEPATH,
                                     ReaderFactory)
     resourceContent = self._make_resource_content_element(
                                 self.__class__.RESOURCE_CONTENT_EXECUTE)
     request = self._createRequestCtx(
                                 self.__class__.PUBLIC_RESOURCE_ID,
                                 resourceContent=resourceContent)
     request.elem = RequestElementTree.toXML(request)
     request.attributeSelector = EtreeXPathSelector(request.elem)
     response = self.pdp.evaluate(request)
     self.failIf(response is None, "Null response")
     for result in response.results:
         self.failIf(result.decision != Decision.PERMIT,
                     "Expecting permit decision")
开发者ID:LiangLinCn,项目名称:ndg_xacml,代码行数:15,代码来源:test_pdp_with_attributeselector.py



注:本文中的ndg.xacml.core.context.pdp.PDP类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python nearpy.Engine类代码示例发布时间:2022-05-27
下一篇:
Python tasklets.get_context函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap