def main(): item = MDIMPORT[sys.argv[1]] metad = None if item["type"] == "local": metad = MetaDataFile(sys.argv[1], ONTS.values(), item["file"]) elif item["type"] == "external": metad = MetaDataExtern(sys.argv[1], ONTS.values(), item["url"], "/opt/local/bin/xmlsec1", item["cert"]) if metad: metad.load() print metad.dumps()
parser.add_argument('-o', dest='output') parser.add_argument('-x', dest='xmlsec') parser.add_argument(dest="item") args = parser.parse_args() metad = None if args.type == "local": metad = MetaDataFile(ONTS.values(), args.item, args.item) elif args.type == "external": ATTRCONV = ac_factory(args.attrsmap) httpc = HTTPBase() crypto = _get_xmlsec_cryptobackend(args.xmlsec) sc = SecurityContext(crypto) metad = MetaDataExtern(ONTS.values(), ATTRCONV, args.url, sc, cert=args.cert, http=httpc) if metad is not None: metad.load() txt = metad.dumps() if args.output: f = open(args.output, "w") f.write(txt) f.close() else: print(txt)
MDIMPORT = { "swamid": { "url": "https://kalmar2.org/simplesaml/module.php/aggregator/?id=kalmarcentral2&set=saml2", "cert": "kalmar2.pem", "type": "external" }, "incommon": { "file": "InCommon-metadata.xml", "type": "local" }, "test": { "file": "mdtest.xml", "type": "local" } } item = MDIMPORT[sys.argv[1]] metad = None if item["type"] == "local": metad = MetaDataFile(sys.argv[1], list(ONTS.values()), item["file"]) elif item["type"] == "external": metad = MetaDataExtern(sys.argv[1], list(ONTS.values()), item["url"], "/opt/local/bin/xmlsec1", item["cert"]) if metad: metad.load() print(metad.dumps())
"type": "local" } } ONTS = { saml.NAMESPACE: saml, mdui.NAMESPACE: mdui, mdattr.NAMESPACE: mdattr, dri.NAMESPACE: dri, ui.NAMESPACE: ui, idpdisc.NAMESPACE: idpdisc, md.NAMESPACE: md, xmldsig.NAMESPACE: xmldsig, xmlenc.NAMESPACE: xmlenc } item = MDIMPORT[sys.argv[1]] metad = None if item["type"] == "local": metad = MetaDataFile(sys.argv[1], ONTS.values(), item["file"]) elif item["type"] == "external": metad = MetaDataExtern(sys.argv[1], ONTS.values(), item["url"], "/opt/local/bin/xmlsec1", item["cert"]) if metad: metad.load() print metad.dumps()
idpdisc.NAMESPACE: idpdisc, md.NAMESPACE: md, xmldsig.NAMESPACE: xmldsig, xmlenc.NAMESPACE: xmlenc, shibmd.NAMESPACE: shibmd, } MDIMPORT = { "swamid": { "url": "https://kalmar2.org/simplesaml/module.php/aggregator/?id=kalmarcentral2&set=saml2", "cert": "kalmar2.pem", "type": "external", }, "incommon": {"file": "InCommon-metadata.xml", "type": "local"}, "test": {"file": "mdtest.xml", "type": "local"}, } item = MDIMPORT[sys.argv[1]] metad = None if item["type"] == "local": metad = MetaDataFile(sys.argv[1], list(ONTS.values()), item["file"]) elif item["type"] == "external": metad = MetaDataExtern(sys.argv[1], list(ONTS.values()), item["url"], "/opt/local/bin/xmlsec1", item["cert"]) if metad: metad.load() print(metad.dumps())
parser = argparse.ArgumentParser() parser.add_argument("-t", dest="type") parser.add_argument("-u", dest="url") parser.add_argument("-c", dest="cert") parser.add_argument("-a", dest="attrsmap") parser.add_argument("-o", dest="output") parser.add_argument(dest="item") args = parser.parse_args() metad = None if args.type == "local": metad = MetaDataFile(ONTS.values(), args.item, args.item) elif args.type == "external": ATTRCONV = ac_factory(args.attrsmap) httpc = HTTPBase() crypto = _get_xmlsec_cryptobackend("/opt/local/bin/xmlsec1") sc = SecurityContext(crypto) metad = MetaDataExtern(ONTS.values(), ATTRCONV, args.url, sc, cert=args.cert, http=httpc) if metad: metad.load() txt = metad.dumps() if args.output: f = open(args.output, "w") f.write(txt) f.close() else: print txt
"file": "mdtest.xml", "type": "local" } } ONTS = { saml.NAMESPACE: saml, mdui.NAMESPACE: mdui, mdattr.NAMESPACE: mdattr, dri.NAMESPACE: dri, ui.NAMESPACE: ui, idpdisc.NAMESPACE: idpdisc, md.NAMESPACE: md, xmldsig.NAMESPACE: xmldsig, xmlenc.NAMESPACE: xmlenc } item = MDIMPORT[sys.argv[1]] metad = None if item["type"] == "local": metad = MetaDataFile(sys.argv[1], ONTS.values(), item["file"]) elif item["type"] == "external": metad = MetaDataExtern(sys.argv[1], ONTS.values(), item["url"], "/opt/local/bin/xmlsec1", item["cert"]) if metad: metad.load() print metad.dumps()