Skip to content

Commit 565a3bb

Browse files
author
Rebecka Gulliksson
committed
Added support for endpoints as lists (read directly from JSON arrays instead of Python tuples) and UIInfo in SPSSO descriptor.
Also some cleanup of error message.
1 parent e2a07fa commit 565a3bb

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/saml2/metadata.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ def do_uiinfo(_uiinfo):
312312
except KeyError:
313313
pass
314314
else:
315-
raise SAMLError("Configuration error: ui_info logo")
315+
raise SAMLError("Configuration error: ui_info keywords")
316316
inst.append(keyw)
317317
elif isinstance(val, dict):
318318
keyw = mdui.Keywords()
@@ -323,7 +323,7 @@ def do_uiinfo(_uiinfo):
323323
pass
324324
inst.append(keyw)
325325
else:
326-
raise SAMLError("Configuration Error: ui_info logo")
326+
raise SAMLError("Configuration Error: ui_info keywords")
327327
except KeyError:
328328
pass
329329

@@ -416,7 +416,7 @@ def do_endpoints(conf, endpoints):
416416
if isinstance(args, basestring): # Assume it's the location
417417
args = {"location": args,
418418
"binding": DEFAULT_BINDING[endpoint]}
419-
elif isinstance(args, tuple):
419+
elif isinstance(args, tuple) or isinstance(args, list):
420420
if len(args) == 2: # (location, binding)
421421
args = {"location": args[0], "binding": args[1]}
422422
elif len(args) == 3: # (location, binding, index)
@@ -530,6 +530,12 @@ def do_spsso_descriptor(conf, cert=None):
530530
for val in vals:
531531
spsso.extensions.add_extension_element(val)
532532

533+
ui_info = conf.getattr("ui_info", "sp")
534+
if ui_info:
535+
if spsso.extensions is None:
536+
spsso.extensions = md.Extensions()
537+
spsso.extensions.add_extension_element(do_uiinfo(ui_info))
538+
533539
if cert:
534540
encryption_type = conf.encryption_type
535541
spsso.key_descriptor = do_key_descriptor(cert, encryption_type)

0 commit comments

Comments
 (0)