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


Python MetadataStore.metadata[entityId]方法代码示例

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


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

示例1: handleMetadataVerifyJson

# 需要导入模块: from saml2.mdstore import MetadataStore [as 别名]
# 或者: from saml2.mdstore.MetadataStore import metadata[entityId] [as 别名]
 def handleMetadataVerifyJson(self, environ, start_response, qs):
     """
     Handles JSON metadata verifications.
     The post body must contains a JSON message like { 'xml' : 'a metadata file'}
     :param environ: wsgi enviroment
     :param start_response: wsgi start respons
     :param qs: Query parameters in a dictionary.
     :return: wsgi response contaning a JSON response. The JSON message will contain the parameter ok and services.
             ok will contain true if the metadata file can be parsed, otherwise false.
             services will contain a list of all the service names contained in the metadata file.
     """
     ok = False
     services = "[]"
     try:
         if MetadataGeneration.CONST_BODY in qs:
             jsonMessage = json.loads(qs[MetadataGeneration.CONST_BODY])
             if "xml" in jsonMessage:
                 xml = jsonMessage["xml"]
                 xml = xml.strip()
                 metadataOK = False
                 ci = None
                 try:
                     mds = MetadataStore(MetadataGeneration.CONST_ONTS.values(),
                                         MetadataGeneration.CONST_ATTRCONV, self.xmlsec_path,
                                         disable_ssl_certificate_validation=True)
                     md = MetaData(MetadataGeneration.CONST_ONTS.values(), MetadataGeneration.CONST_ATTRCONV, metadata=xml)
                     md.load()
                     entityId = md.entity.keys()[0]
                     mds.metadata[entityId] = md
                     args = {"metad": mds, "dkeys": {"rsa": [self.privateKey]}}
                     ci = utils.ConsumerInfo(['metadata'], **args)
                     metadataOK = True
                 except:
                     self.logger.info('Could not parse the metadata file in handleMetadataVerifyJSON.',
                                       exc_info=True)
                 services = "["
                 first = True
                 if ci is not None:
                     for item in ci._info:
                         if item._ava is not None and entityId in item._ava:
                             for social in item._ava[entityId]:
                                 if not first:
                                     services += ","
                                 else:
                                     first = False
                                 services += '"' + social + '"'
                 services += "]"
                 if metadataOK:
                     ok = True
     except:
         self.logger.fatal('Unknown error in handleMetadataVerifyJSON.',
                           exc_info=True)
     resp = Response('{"ok":"' + str(ok) + '", "services":' + services + '}', headers=[('Content-Type', MetadataGeneration.CONST_TYPEJSON)])
     return resp(environ, start_response)
开发者ID:HaToHo,项目名称:IdPproxy,代码行数:56,代码来源:secret.py


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