- when local:
    - reginfo:
        authority: https://md.fidus.skolverket.se/test/
        policy:
           en: https://fidus.skolverket.se/
    - break
- when clean:
    - xslt:
       stylesheet: tidy.xsl
    - check_xml_namespaces
    - break
- when remote:
    - xslt:
       stylesheet: tidy.xsl
    - filter:
       - "!//md:EntityDescriptor[md:IDPSSODescriptor]"
       - https://sp.swamid.se/shibboleth
       - https://test.fidus.sunet.se/shibboleth
       - https://fidustest.skolverket.se/shibboleth
       - https://sso.uat.skolverket.sonet.com.au/module.php/saml/sp/metadata.php/sp1
       - https://sso.skolverket.sonet.com.au/module.php/saml/sp/metadata.php/sp1
       - https://sso.am.uat.skolverket.sonet.com.au/module.php/saml/sp/metadata.php/sp1
       - https://am-sso-int.skol.sonet.net.au/module.php/saml/sp/metadata.php/sp1
       - https://am-sso-utb.skol.sonet.net.au/module.php/saml/sp/metadata.php/sp1
       - https://am-sso.skol.sonet.net.au/module.php/saml/sp/metadata.php/sp1
       - https://am-sso-uat.skol.sonet.net.au/module.php/saml/sp/metadata.php/sp1
       - https://humhub-idp-proxy.sunet.se/sp
    - break
- when update:
    - load:
        - https://mds.swamid.se/md/swamid-registered.xml cleanup remote
        - https://md.swefed.se/skolfederation/idp.xml cleanup remote
        - /opt/metadata/test-idp cleanup clean via local
        - /opt/metadata/test-sp cleanup clean via local
    - select
    - fork:
        - select as /downstream:
           - https://sp.swamid.se/shibboleth
           - https://sso.uat.skolverket.sonet.com.au/module.php/saml/sp/metadata.php/sp1
           - https://sso.skolverket.sonet.com.au/module.php/saml/sp/metadata.php/sp1
           - https://sso.am.uat.skolverket.sonet.com.au/module.php/saml/sp/metadata.php/sp1
           - https://am-sso-int.skol.sonet.net.au/module.php/saml/sp/metadata.php/sp1
           - https://am-sso-utb.skol.sonet.net.au/module.php/saml/sp/metadata.php/sp1
           - https://fidustest.skolverket.se/shibboleth
           - https://am-sso.skol.sonet.net.au/module.php/saml/sp/metadata.php/sp1
           - https://am-sso-uat.skol.sonet.net.au/module.php/saml/sp/metadata.php/sp1
           - https://humhub-idp-proxy.sunet.se/sp
        - break
    - fork:
        - select as /ds
        - break
    - break
- when request:
    - select
    - pipe:
        - when accept application/xml:
             - xslt:
                 stylesheet: tidy.xsl
             - pubinfo:
                 publisher: https://md.fidus.skolverket.se/test/
             - when request mdq:
                 - first
             - finalize:
                 baseURL: https://md.fidus.skolverket.se/test/
                 cacheDuration: PT5H
                 validUntil: P10D
             - sign:
                 key: /etc/credentials/metadata.key
                 cert: /etc/credentials/metadata.crt
             - emit application/xml
             - break
        - when accept application/json:
             - discojson
             - emit application/json:
             - break
