Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add DiscoveryResponse info to SPs in discojson #262

Merged
merged 1 commit into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions NEWS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,6 @@ to sign using HSMs. The only mandatory non-python dependency now is lxml.
* Fix random seeding
* Fix for data handling related to non-Z timezones in metadata

2.1.3
-----
* Add DiscoveryResponse info to SPs in discojson
1 change: 1 addition & 0 deletions src/pyff/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
ser="http://eidas.europa.eu/metadata/servicelist",
eidas="http://eidas.europa.eu/saml-extensions",
ti="https://seamlessaccess.org/NS/trustinfo",
idpdisc="urn:oasis:names:tc:SAML:profiles:SSO:idp-discovery-protocol",
)

#: These are the attribute aliases pyFF knows about. These are used to build URI paths, populate the index
Expand Down
12 changes: 12 additions & 0 deletions src/pyff/samlmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,14 @@ def registration_authority(entity):
return regauth_el.attrib.get('registrationAuthority')


def discovery_responses(entity):
responses = None
responses_els = entity.findall(".//{%s}DiscoveryResponse" % NS['idpdisc'])
if len(responses_els) > 0:
responses = [el.attrib.get('Location') for el in responses_els]
return responses


def entity_extended_display(entity, langs=None):
"""Utility-method for computing a displayable string for a given entity.

Expand Down Expand Up @@ -875,6 +883,7 @@ def discojson(e, sources=None, langs=None, fallback_to_favicon=False, icon_store
categories = entity_attribute(e, "http://macedir.org/entity-category")
certifications = entity_attribute(e, "urn:oasis:names:tc:SAML:attribute:assurance-certification")
cat_support = entity_attribute(e, "http://macedir.org/entity-category-support")
disc_responses = discovery_responses(e)

d = dict(
title=title,
Expand All @@ -900,6 +909,9 @@ def discojson(e, sources=None, langs=None, fallback_to_favicon=False, icon_store
if sources is not None:
d['md_source'] = sources

if disc_responses is not None:
d["discovery_responses"] = disc_responses

eattr = entity_attribute_dict(e)
if 'idp' in eattr[ATTRS['role']]:
d['type'] = 'idp'
Expand Down