当前位置: 首页>>代码示例>>Python>>正文


Python Config.load方法代码示例

本文整理汇总了Python中saml2.config.Config.load方法的典型用法代码示例。如果您正苦于以下问题:Python Config.load方法的具体用法?Python Config.load怎么用?Python Config.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在saml2.config.Config的用法示例。


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

示例1: _make_metadata

# 需要导入模块: from saml2.config import Config [as 别名]
# 或者: from saml2.config.Config import load [as 别名]
def _make_metadata(config_dict, option):
    """
    Creates metadata from the given idp config

    :type config_dict: dict[str, Any]
    :type option: vopaas.metadata_creation.make_vopaas_metadata.MetadataOption
    :rtype: str

    :param config_dict: config
    :param option: metadata creation settings
    :return: A xml string
    """
    eds = []
    cnf = Config()
    cnf.load(copy.deepcopy(config_dict), metadata_construction=True)

    if option.valid:
        cnf.valid_for = option.valid
    eds.append(entity_descriptor(cnf))

    conf = Config()
    conf.key_file = option.keyfile
    conf.cert_file = option.cert
    conf.debug = 1
    conf.xmlsec_binary = option.xmlsec
    secc = security_context(conf)

    if option.id:
        desc, xmldoc = entities_descriptor(eds, option.valid, option.name, option.id, option.sign, secc)
        valid_instance(desc)
        print(desc.to_string(NSPAIR))
    else:
        for eid in eds:
            if option.sign:
                assert conf.key_file
                assert conf.cert_file
                eid, xmldoc = sign_entity_descriptor(eid, option.id, secc)
            else:
                xmldoc = None

            valid_instance(eid)
            xmldoc = metadata_tostring_fix(eid, NSPAIR, xmldoc).decode()
            return xmldoc
开发者ID:borgand,项目名称:SATOSA,代码行数:45,代码来源:make_satosa_saml_metadata.py

示例2: _saml2_config

# 需要导入模块: from saml2.config import Config [as 别名]
# 或者: from saml2.config.Config import load [as 别名]
 def _saml2_config(self):
     if hasattr(self, '_v_cached_config') and self._v_cached_config:
         return self._v_cached_config
     config = Config()
     conf=sp_config.copy()
     metadata_file = self.config['metadata_file']
     if not metadata_file:
         path = os.path.dirname(__file__)
         metadata_file = os.path.join(path, 'metadata.xml')
     conf['metadata']['local'] = [metadata_file]
     config.load(conf)
     config['entityid'] = self.config['portal_url']
     config['service']['sp']['name'] = self.config['portal_name']
     config['service']['sp']['url'] = self.config['portal_url']
     required_attributes = []
     for attribute in self.config['required_attributes'].split('\r\n'):
         name = attributes.get(attribute, None)
         if name:
             required_attributes.append(name)
         elif attribute in attributes.values():
             required_attributes.append(attribute)
     optional_attributes = []
     for attribute in self.config['optional_attributes'].split('\r\n'):
         name = attributes.get(attribute, None)
         if name:
             optional_attributes.append(name)
         elif attribute in attributes.values():
             optional_attributes.append(attribute)
     config['service']['sp']['required_attributes'] = required_attributes
     config['service']['sp']['optional_attributes'] = optional_attributes
     config['service']['sp']['privacy_notice'] = self.config['privacy_notice']
     config['key_file'] = self.config['key_file']
     config['cert_file'] = self.config['cert_file']
     config['xmlsec_binary'] = self.config['xmlsec_binary']
     
     # Get Idps from the metadata
     config['service']['sp']['idp'] = {}
     for location in config['metadata'].locations():
         name = config['metadata'].name(location)
         config['service']['sp']['idp'][name] = location 
                 
     self._v_cached_config = config
     return self._v_cached_config
开发者ID:seantis,项目名称:pas.plugins.suisseid,代码行数:45,代码来源:plugin.py

示例3: test_load_local

# 需要导入模块: from saml2.config import Config [as 别名]
# 或者: from saml2.config.Config import load [as 别名]
def test_load_local():
    # string representation of XML idp definition
    idp_metadata = open(full_path("metadata.xml")).read()

    saml_config = Config()

    config_dict = {
        "metadata": {"inline": [idp_metadata]}
    }
    cfg = saml_config.load(config_dict)
    assert cfg
开发者ID:HaToHo,项目名称:pysaml2,代码行数:13,代码来源:test_30_mdstore.py


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