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

Python metadata.entity_descriptor函数代码示例

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

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



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

示例1: __init__

    def __init__(self, cargs, kwargs):
        self.nspair = {"xs": "http://www.w3.org/2001/XMLSchema"}

        _cnf = kwargs['conf']
        res = read_multi_conf(_cnf, True)
        eds = []
        for key, cnf in res.items():
            eds.append(entity_descriptor(cnf))

        valid_for = 0

        """
            Setting things to None here that are now unused, but might be useful someday
        """
        conf = Config()
        conf.key_file = None
        conf.cert_file = None
        conf.debug = 1
        conf.xmlsec_binary = None
        args_name = None
        args_id = None
        args_sign = None
        secc = security_context(conf)

        desc, xmldoc = entities_descriptor(eds, valid_for, args_name, args_id,
                                           args_sign, secc)
        valid_instance(desc)

        self.desc = desc
        self.xmldoc = xmldoc
开发者ID:identinetics,项目名称:saml2test2,代码行数:30,代码来源:metadata.py


示例2: metadata

def metadata(request, config_loader_path=None, valid_for=None):
    """Returns an XML with the SAML 2.0 metadata for this
    SP as configured in the settings.py file.
    """
    conf = get_config(config_loader_path, request)
    metadata = entity_descriptor(conf)
    return HttpResponse(content=str(metadata), content_type="text/xml; charset=utf8")
开发者ID:writepython,项目名称:djangosaml2,代码行数:7,代码来源:views.py


示例3: metadata

def metadata(request):
    """Returns an XML with the SAML 2.0 metadata for this
    SP as configured in the settings.py file.
    """
    conf = get_saml2_config(
        request.registry.settings.get('saml2.settings_module'))
    metadata = entity_descriptor(conf)
    return Response(body=str(metadata), content_type="text/xml; charset=utf8")
开发者ID:Ratler,项目名称:eduid-dashboard,代码行数:8,代码来源:views.py


示例4: get_metadata

 def get_metadata(self):
     """Returns SAML Identity Provider Metadata"""
     edesc = entity_descriptor(self._config, 24)
     if self._config.key_file:
         edesc = sign_entity_descriptor(edesc, 24, None, security_context(self._config))
     response = make_response(str(edesc))
     response.headers['Content-type'] = 'text/xml; charset=utf-8'
     return response
开发者ID:dellintosh,项目名称:flask_pysaml2,代码行数:8,代码来源:flask_pysaml2.py


示例5: metadata

def metadata():
    """
    Returns an XML with the SAML 2.0 metadata for this
    SP as configured in the saml2_settings.py file.
    """
    metadata = entity_descriptor(current_app.saml2_config)
    response = make_response(metadata.to_string(), 200)
    response.headers['Content-Type'] = "text/xml; charset=utf8"
    return response
开发者ID:SUNET,项目名称:eduid-webapp,代码行数:9,代码来源:views.py


示例6: test_requested_attribute_name_format

def test_requested_attribute_name_format():
    cnf = SPConfig().load(sp_conf, metadata_construction=True)
    ed = entity_descriptor(cnf)

    assert len(ed.spsso_descriptor.attribute_consuming_service) == 1
    acs = ed.spsso_descriptor.attribute_consuming_service[0]
    assert len(acs.requested_attribute) == 4
    for req_attr in acs.requested_attribute:
        assert req_attr.name_format == NAME_FORMAT_URI

    sp2 = copy.copy(sp_conf)
    sp2["service"]["sp"]["requested_attribute_name_format"] = NAME_FORMAT_BASIC

    cnf2 = SPConfig().load(sp2, metadata_construction=True)
    ed = entity_descriptor(cnf2)
    acs = ed.spsso_descriptor.attribute_consuming_service[0]
    assert len(acs.requested_attribute) == 4
    for req_attr in acs.requested_attribute:
        assert req_attr.name_format == NAME_FORMAT_BASIC
开发者ID:Amli,项目名称:pysaml2,代码行数:19,代码来源:test_39_metadata.py


示例7: test_entity_description

def test_entity_description():
    #confd = eval(open("../tests/server.config").read())
    confd = SPConfig().load_file("server_conf")
    print confd.attribute_converters
    entd = metadata.entity_descriptor(confd)
    assert entd is not None
    print entd.keyswv()
    assert _eq(entd.keyswv(), ['valid_until', 'entity_id', 'contact_person',
                                'spsso_descriptor', 'organization'])
    print entd
    assert entd.entity_id == "urn:mace:example.com:saml:roland:sp"
开发者ID:paulftw,项目名称:pysaml2,代码行数:11,代码来源:test_61_makemeta.py


示例8: metadata

def metadata(request, config_loader_path=None, valid_for=None):
    """Returns an XML with the SAML 2.0 metadata for this
    SP as configured in the settings.py file.
    """
    conf = get_config(config_loader_path, request)
    valid_for = valid_for or get_custom_setting("SAML_VALID_FOR", 24)
    metadata = entity_descriptor(conf, valid_for)

    saml_token = request.GET.get("saml_token")
    if saml_token:
        # inject the saml token to the sp urls
        for descriptor in metadata.spsso_descriptor.assertion_consumer_service:
            descriptor.location += "?saml_token=%s" % saml_token
        for descriptor in metadata.spsso_descriptor.single_logout_service:
            descriptor.location += "?saml_token=%s" % saml_token

    return HttpResponse(content=str(metadata), content_type="text/xml; charset=utf8")
开发者ID:BetterWorks,项目名称:djangosaml2,代码行数:17,代码来源:views.py


示例9: write_metadata

def write_metadata(sp_configs):
    """
    Generate SAML XML metadata from the pysaml2 JSON format.
    :param base: base url of the svs node
    :return: dictionary with the config for the two SP's
    """

    for _, config in sp_configs.iteritems():
        cnf = Config().load(config, metadata_construction=True)
        eid = entity_descriptor(cnf)
        valid_instance(eid)
        nspair = {"xs": "http://www.w3.org/2001/XMLSchema"}
        xmldoc = metadata_tostring_fix(eid, nspair, None)

        entity_id = config["entityid"]
        path = urlparse.urlparse(entity_id).path
        filename = os.path.basename(path)
        with open(filename, "w") as output_file:
            output_file.write(xmldoc)
开发者ID:SvHu,项目名称:svs,代码行数:19,代码来源:sp_metadata.py


示例10: _make_metadata

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,代码行数:43,代码来源:make_satosa_saml_metadata.py


示例11: _parse_metadata_dict_to_inline

def _parse_metadata_dict_to_inline(metadata):
    """Convert any metadata included as dict to PySAML2's `inline` type.

    Currently PySAML supports remote, local files, and string IdP metadata to
    be included in the SP config dict as XML. It is also possible to pull your
    IdP metadata from local JSON files (the format of the JSON is nearly
    unparsable for any normal human).

    This function adds the ability to include the IdP metadata directly in the
    SP config as a dict of IdP attributes by hacking around this PySAML2
    limitation and converting the dict into XML via PySAML2's IdPConfig class.

    Note: In the process of trying to find an alternative which will allow us
        to NOT be hacking around PySAML so rudely in order to load IdP metadata
        from a Python dict. https://github.com/rohe/pysaml2/issues/172

    Args:
        metadata (dict): The IdP metadata this SP is configured for.

    Returns:
        (dict) config where any metadata `inline_dict` data has been
            converted to `inline` XML.
    """
    if metadata.get('inline_dict', None):
        metadata['inline'] = metadata.get('inline', [])
        for _idp in metadata.get('inline_dict'):
            idp_config = IdPConfig()
            idp_config.load(_idp)
            entity_desc = entity_descriptor(idp_config)
            # Hack for supporting multiple certificates.
            if _idp.get('certs'):
                # `certs` config directive overrides `cert_file`.
                entity_desc.idpsso_descriptor.key_descriptor = \
                    _parse_key_descriptors(_idp['certs'])
            idp_metadata_str = str(entity_desc)
            LOGGER.debug("IdP XML Metadata for %s: %s",
                         _idp['entityid'], idp_metadata_str)
            metadata['inline'].append(idp_metadata_str)
        del metadata['inline_dict']
    return metadata
开发者ID:KaviCorp,项目名称:flask_pysaml2,代码行数:40,代码来源:flask_pysaml2.py


示例12: __init__

    def __init__(self, config, attribute_map=None):
        """Initialize SAML Service Provider.

        Args:
            config (dict): Service Provider config info in dict form
            attribute_map (dict): Mapping of attribute keys to user data
        """
        self._config = SPConfig()
        self._config.load(config)
        if config['metadata'].get('config'):
            # Hacked in a way to get the IdP metadata from a python dict
            # rather than having to resort to loading XML from file or http.
            idp_config = IdPConfig()
            idp_config.load(config['metadata']['config'][0])
            idp_entityid = config['metadata']['config'][0]['entityid']
            idp_metadata_str = str(entity_descriptor(idp_config, 24))
            LOGGER.debug('IdP XML Metadata for %s: %s' % (
                idp_entityid, idp_metadata_str))
            self._config.metadata.import_metadata(
                idp_metadata_str, idp_entityid)
        self.attribute_map = {}
        if attribute_map is not None:
            self.attribute_map = attribute_map
开发者ID:dellintosh,项目名称:flask_pysaml2,代码行数:23,代码来源:flask_pysaml2.py


示例13: create_metadata_from_config_dict

def create_metadata_from_config_dict(config):
    nspair = {"xs": "http://www.w3.org/2001/XMLSchema"}
    conf = Config().load(config, metadata_construction=True)
    return entity_descriptor(conf).to_string(nspair).decode("utf-8")
开发者ID:SUNET,项目名称:SATOSA,代码行数:4,代码来源:util.py


示例14: int

    # translate into hours
    valid_for = int(args.valid) * 24
if args.xmlsec:
    xmlsec = args.xmlsec
else:
    xmlsec = get_xmlsec_binary(paths)

eds = []
for filespec in args.config:
    bas, fil = os.path.split(filespec)
    if bas != "":
        sys.path.insert(0, bas)
    if fil.endswith(".py"):
        fil = fil[:-3]
    cnf = Config().load_file(fil, metadata_construction=True)
    eds.append(entity_descriptor(cnf))

secc = SecurityContext(xmlsec, args.keyfile, cert_file=args.cert)
if args.id:
    desc = entities_descriptor(eds, valid_for, args.name, args.id,
                               args.sign, secc)
    valid_instance(desc)
    print desc.to_string(nspair)
else:
    for eid in eds:
        if args.sign:
            desc = sign_entity_descriptor(eid, id, secc)
        else:
            desc = eid
        valid_instance(desc)
        print desc.to_string(nspair)
开发者ID:FluidReview,项目名称:saml2,代码行数:31,代码来源:make_metadata.py


示例15: create_metadata

def create_metadata(config):
    return entity_descriptor(config)
开发者ID:SUNET,项目名称:eduid-webapp,代码行数:2,代码来源:helpers.py


示例16: saml_metadata

def saml_metadata():
    ed = entity_descriptor(sec_config)
    return metadata_tostring_fix(ed, {"xs": "http://www.w3.org/2001/XMLSchema"}, None)
开发者ID:carbonblack,项目名称:cb-2fa-login,代码行数:3,代码来源:__init__.py


示例17: Config

from saml2.config import Config
from saml2.metadata import entity_descriptor

__author__ = 'roland'

fil = "sp_mdext_conf.py"

cnf = Config().load_file(fil, metadata_construction=True)
ed = entity_descriptor(cnf)

print(ed)

assert ed.spsso_descriptor.extensions
assert len(ed.spsso_descriptor.extensions.extension_elements) == 3
开发者ID:SpamapS,项目名称:pysaml2,代码行数:14,代码来源:test_83_md_extensions.py


示例18: entity_desc

 def entity_desc(self, sp_conf):
     return entity_descriptor(SPConfig().load(sp_conf, metadata_construction=True))
开发者ID:SUNET,项目名称:SATOSA,代码行数:2,代码来源:test_saml_metadata.py


示例19: make_meta

 def make_meta(self):
     self.sp_configure(True)
     print(entity_descriptor(self.sp_config))
开发者ID:jchysk,项目名称:pysaml2,代码行数:3,代码来源:__init__.py


示例20: _create_entity_descriptor

def _create_entity_descriptor(entity_config):
    cnf = Config().load(copy.deepcopy(entity_config), metadata_construction=True)
    return entity_descriptor(cnf)
开发者ID:SUNET,项目名称:SATOSA,代码行数:3,代码来源:saml_metadata.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python population.Population类代码示例发布时间:2022-05-27
下一篇:
Python metadata.create_metadata_string函数代码示例发布时间: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