Discovery Service JSON
The Discovery Service JSON file is primary used for Discovery services to show information about the SP and IdP when selecting an IdP. But the information can be useful for other use-cases aswell. Please not that the JSON file includes data for both SWAMID and inter-federations.
Please note that if an entity is both an IdP and a SP (like for ADFS) the entity will show up as
type: idp
.Here is an example of listing all scopes for the IdPs registered in SWAMID with curl and jq.
curl -s https://mds.swamid.se/md/swamid-transitive-ds.json | jq '.[] | select ( .registrationAuthority == "http://www.swamid.se/" and .type == "idp" ) | "\(.scope) \(.entityID)"'
And an example with python doing the same.
#!/usr/bin/env python3 import urllib.request, json with urllib.request.urlopen("https://mds.swamid.se/md/swamid-transitive-ds.json") as url: data = json.load(url) for entity in data: if ('type' in entity and 'registrationAuthority' in entity and entity['type'] == 'idp' and entity['registrationAuthority'] == 'http://www.swamid.se/') : if ('scope' in entity): scope = entity['scope'] else: scope = 'Missing' print("%s %s" % (scope, entity['entityID']))