Skip to content

Commit 17234e9

Browse files
author
Roland Hedberg
committed
Merge pull request #252 from spaceone/create_metadata
enhance create_metadata() API
2 parents 2be0571 + 6f4c070 commit 17234e9

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/saml2/metadata.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ def metadata_tostring_fix(desc, nspair, xmlstring=""):
7373
return xmlstring
7474

7575

76-
def create_metadata_string(configfile, config, valid, cert, keyfile, mid, name,
77-
sign):
76+
def create_metadata_string(configfile, config=None, valid=None, cert=None,
77+
keyfile=None, mid=None, name=None, sign=None):
7878
valid_for = 0
7979
nspair = {"xs": "http://www.w3.org/2001/XMLSchema"}
8080
#paths = [".", "/opt/local/bin"]
@@ -83,17 +83,15 @@ def create_metadata_string(configfile, config, valid, cert, keyfile, mid, name,
8383
valid_for = int(valid) # Hours
8484

8585
eds = []
86-
if config is not None:
87-
eds.append(entity_descriptor(config))
88-
else:
86+
if config is None:
8987
if configfile.endswith(".py"):
9088
configfile = configfile[:-3]
9189
config = Config().load_file(configfile, metadata_construction=True)
92-
eds.append(entity_descriptor(config))
90+
eds.append(entity_descriptor(config))
9391

9492
conf = Config()
95-
conf.key_file = keyfile
96-
conf.cert_file = cert
93+
conf.key_file = config.key_file or keyfile
94+
conf.cert_file = config.cert_file or cert
9795
conf.debug = 1
9896
conf.xmlsec_binary = config.xmlsec_binary
9997
secc = security_context(conf)

0 commit comments

Comments
 (0)