Skip to content

Commit 4efe674

Browse files
committed
feat: saml name and logo collected as arrays
1 parent 1d77df4 commit 4efe674

2 files changed

Lines changed: 43 additions & 10 deletions

File tree

src/swamid_plugins/metainfo/collectors/oidc.py

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ def collect_entity_metadata(mdstore, entity_id):
55
"privacy_statement": get_privacy_statement(mdstore, entity_id),
66
"contacts": get_contacts(mdstore, entity_id),
77
"entity_categories": get_entity_categories(mdstore, entity_id),
8-
"supported_entity_categories": get_supported_entity_categories(mdstore, entity_id),
8+
"supported_entity_categories": get_supported_entity_categories(
9+
mdstore, entity_id
10+
),
911
"assurance_certifications": get_assurance_certifications(mdstore, entity_id),
1012
"registration_info": get_registration_info(mdstore, entity_id),
1113
"error_url": get_error_url(mdstore, entity_id),
@@ -19,9 +21,25 @@ def get_display_name(mdstore, entity_id):
1921
return display_name
2022

2123

24+
def get_display_names_lang(mdstore, entity_id):
25+
langs = ["en", "cs"]
26+
display_names = []
27+
for lang in langs:
28+
if mdstore.get("client_name#" + lang, None):
29+
display_names.append(
30+
{"text": mdstore.get("client_name#" + lang), "lang": lang}
31+
)
32+
display_name = mdstore.get("client_name")
33+
return display_name
34+
35+
2236
def get_logo(mdstore, entity_id):
37+
ret_logo = []
2338
logo = mdstore.get("logo_uri")
24-
return logo
39+
width = mdstore.get("logo_width")
40+
height = mdstore.get("logo_height")
41+
ret_logo.append({"text": logo, "height": height, "width": width})
42+
return ret_logo
2543

2644

2745
def get_privacy_statement(mdstore, entity_id):
@@ -39,23 +57,23 @@ def get_contacts(mdstore, entity_id):
3957
"mailto:{contact}".format(contact=email)
4058
for email in (mdstore.get("contacts") or [])
4159
],
42-
"given_name": ""
60+
"given_name": "",
4361
},
4462
{
4563
"contact_type": "technical",
4664
"email_address": [
4765
"mailto:{contact}".format(contact=email)
4866
for email in (mdstore.get("technical_contacts") or [])
4967
],
50-
"given_name": ""
68+
"given_name": "",
5169
},
5270
{
5371
"contact_type": "security",
5472
"email_address": [
5573
"mailto:{contact}".format(contact=email)
5674
for email in (mdstore.get("security_contacts") or [])
5775
],
58-
"given_name": ""
76+
"given_name": "",
5977
},
6078
]
6179
if contact["email_address"]
@@ -65,8 +83,8 @@ def get_contacts(mdstore, entity_id):
6583

6684
def get_entity_categories(mdstore, entity_id):
6785
entity_categories_translation = {
68-
'research_and_scholarship': 'http://refeds.org/category/research-and-scholarship',
69-
'geant_coco': 'http://www.geant.net/uri/dataprotection-code-of-conduct/v1',
86+
"research_and_scholarship": "http://refeds.org/category/research-and-scholarship",
87+
"geant_coco": "http://www.geant.net/uri/dataprotection-code-of-conduct/v1",
7088
}
7189
entity_categories = [
7290
category
@@ -83,7 +101,7 @@ def get_supported_entity_categories(mdstore, entity_id):
83101

84102
def get_assurance_certifications(mdstore, entity_id):
85103
assurance_certifications_translations = {
86-
'sirtfi': 'https://refeds.org/sirtfi',
104+
"sirtfi": "https://refeds.org/sirtfi",
87105
}
88106
assurance_certifications = [
89107
certification

src/swamid_plugins/metainfo/collectors/saml.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,25 @@ def get_display_name(mdstore, entity_id):
2121
)
2222
return display_name
2323

24+
def get_display_names_lang(mdstore, entity_id):
25+
uiinfos = mdstore.mdui_uiinfo(entity_id)
26+
cls = "urn:oasis:names:tc:SAML:metadata:ui&DisplayName"
27+
elements = (
28+
element
29+
for uiinfo in uiinfos
30+
for element_key, elements in uiinfo.items()
31+
if element_key != "__class__"
32+
for element in elements
33+
if element.get("__class__") == cls
34+
)
35+
display_names = list(mdstore.mdui_uiinfo_display_name(entity_id, None))
36+
return display_names
37+
2438

2539
def get_logo(mdstore, entity_id):
26-
logo = next(mdstore.mdui_uiinfo_logo(entity_id), None)
27-
return logo
40+
logos = list(mdstore.mdui_uiinfo_logo(entity_id))
41+
map(lambda logo: logo.pop("__class__", None), logos)
42+
return logos
2843

2944

3045
def get_privacy_statement(mdstore, entity_id):

0 commit comments

Comments
 (0)