Merge remote-tracking branch 'upstream/master'
This commit is contained in:
2
setup.py
2
setup.py
@@ -87,7 +87,7 @@ setup(
|
||||
"Topic :: Software Development :: Libraries :: Python Modules"],
|
||||
|
||||
scripts=["tools/parse_xsd2.py", "tools/make_metadata.py",
|
||||
"tools/mdexport.py"],
|
||||
"tools/mdexport.py", "tools/merge_metadata.py"],
|
||||
|
||||
tests_require=tests_require,
|
||||
extras_require={
|
||||
|
||||
@@ -6,6 +6,7 @@ from hashlib import sha1
|
||||
from saml2.httpbase import HTTPBase
|
||||
from saml2.extension.idpdisc import BINDING_DISCO
|
||||
from saml2.extension.idpdisc import DiscoveryResponse
|
||||
from saml2.md import EntitiesDescriptor
|
||||
|
||||
from saml2.mdie import to_dict
|
||||
|
||||
@@ -871,3 +872,24 @@ class MetadataStore(object):
|
||||
|
||||
def attribute_authorities(self):
|
||||
return self._providers("attribute_authority")
|
||||
|
||||
def dumps(self, format="local"):
|
||||
"""
|
||||
Dumps the content in standard metadata format or the pysaml2 metadata
|
||||
format
|
||||
|
||||
:param format: Which format to dump in
|
||||
:return: a string
|
||||
"""
|
||||
if format == "local":
|
||||
res = EntitiesDescriptor()
|
||||
for _md in self.metadata.values():
|
||||
try:
|
||||
res.entity_descriptor.extend(_md.entities_descr.entity_descriptor)
|
||||
except AttributeError:
|
||||
res.entity_descriptor.append(_md.entity_descr)
|
||||
|
||||
return "%s" % res
|
||||
elif format == "md":
|
||||
return json.dumps(self.items(), indent=2)
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
from saml2.md import EntitiesDescriptor
|
||||
from saml2.sigver import _get_xmlsec_cryptobackend, SecurityContext
|
||||
from saml2.httpbase import HTTPBase
|
||||
|
||||
@@ -18,7 +17,7 @@ import xmlenc
|
||||
|
||||
import argparse
|
||||
|
||||
from saml2.mdstore import MetaDataFile, MetaDataExtern
|
||||
from saml2.mdstore import MetaDataFile, MetaDataExtern, MetadataStore
|
||||
|
||||
__author__ = 'rolandh'
|
||||
|
||||
@@ -52,8 +51,6 @@ args = parser.parse_args()
|
||||
|
||||
metad = None
|
||||
|
||||
output = EntitiesDescriptor()
|
||||
|
||||
# config file format
|
||||
#
|
||||
# local <local file name>
|
||||
@@ -66,6 +63,10 @@ output = EntitiesDescriptor()
|
||||
#remote https://kalmar2.org/simplesaml/module.php/aggregator/?id=kalmarcentral2&set=saml2 kalmar2.pem
|
||||
#
|
||||
|
||||
ATTRCONV = ac_factory(args.attrsmap)
|
||||
|
||||
mds = MetadataStore(ONTS.values(), None, None)
|
||||
|
||||
for line in open(args.conf).readlines():
|
||||
line = line.strip()
|
||||
if line[0] == "#":
|
||||
@@ -93,9 +94,8 @@ for line in open(args.conf).readlines():
|
||||
except:
|
||||
raise
|
||||
|
||||
output.entity_descriptor.extend(metad.entities_descr.entity_descriptor)
|
||||
|
||||
print output
|
||||
mds.metadata[spec[1]] = metad
|
||||
|
||||
print mds.dumps(args.output)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user