- when swamid:
    - reginfo:
        authority: http://www.swamid.se/
        policy: 
           en: http://www.swamid.se/download/18.248ad5af12aa8136533800012293/SWAMID+Metadata+Registration+Practice+Statement-20110714.pdf
    - break
- when update:
    - load:
        - /opt/swamid-metadata/swamid-2.0 via swamid
        - /opt/swamid-metadata/externals.xrd
        #- http://md.registry.swamid.se/role/sp.xml via swamid
    - fork:
        - select as /md/swamid-2.0:
        - break
    - fork:
        - select as /md/swamid-registered-2.0:
            - "!//md:EntityDescriptor[md:Extensions[mdrpi:RegistrationInfo[@registrationAuthority='http://www.swamid.se/']]]"
        - break
    - fork:
        - select as /md/swamid-idp:
            - /md/swamid-registered-2.0+http://pyff-project.org/role=idp
        - break
    - fork:
        - select as /md/swamid-idp-transitive:
            - /md/swamid-2.0+http://pyff-project.org/role=idp
        - break
    - fork:
        - select as /md/swamid-kalmar-1.0:
            - https://idp.umu.se/saml2/idp/metadata.php
            - https://connect.sunet.se/shibboleth
            - https://sp.swamid.se/shibboleth
            - https://idp.it.gu.se/idp/shibboleth
            - https://www.diva-portal.org/shibboleth
            - https://crowd.nordu.net/shibboleth
            - https://idp.nordu.net/idp/shibboleth
            - https://beta.lobber.se/shibboleth
            - https://nordunet.tv/shibboleth
            - https://mailfilter.nordu.net/shibboleth
            - https://jabber.nordu.net/shibboleth
            - https://meetingtools.nordu.net/shibboleth
            - https://connect-beta.sunet.se/shibboleth
            - https://connect-stable.sunet.se/shibboleth
            - https://webinar.nordu.net/shibboleth
            - https://box-idp.nordu.net/simplesaml/module.php/saml/sp/metadata.php/default-sp
            - https://se.timeedit.net/lapinamk-generic-sp
        - break
    - fork:
        - select as /md/swamid-edugain-1.0:
            - https://connect.sunet.se/shibboleth
            - https://connect-beta.sunet.se/shibboleth
            - https://webinar.nordu.net/shibboleth
            - https://sp.swamid.se/shibboleth
            - https://idp.nordu.net/idp/shibboleth
            - https://sp-test.swamid.se/shibboleth
            - https://weblogin.uu.se/idp/shibboleth
            - https://identity.mdh.se/idp/shibboleth
            - https://idp2.kau.se/idp/shibboleth
            - https://idp.it.gu.se/idp/shibboleth
            - https://kiidp.ki.se/idp/shibboleth
            - https://e5.onthehub.com
            - https://login.liu.se/idp/shibboleth
            - https://keybucket.app.nordu.net/saml2/sp/metadata
            - https://idp.it.su.se/idp/shibboleth
            - https://shib-idp-1.oru.se/idp/shibboleth
            - https://saml-1.sys.kth.se/idp/shibboleth
            - https://idp.hig.se/idp/shibboleth
            - https://egiswamid.egi.kth.se/shibboleth
            - https://hbidp.hb.se/idp/shibboleth
            - https://idp.student.bth.se/idp/shibboleth
            - https://idp.bth.se/idp/shibboleth
            - https://login.du.se/idp/shibboleth
            - https://idp.kb.se/idp/shibboleth
            - https://box-idp.nordu.net/simplesaml/module.php/saml/sp/metadata.php/default-sp
            - https://wiki.edugain.org/shibboleth
            - https://shibb1.hj.se/idp/shibboleth
            - http://test-adfs.geant.net/adfs/services/trust
            - https://idp2-1.slu.se/idp/shibboleth
            - https://login.idp.hhs.se/idp/shibboleth
            - https://shibbo.ltu.se/idp/shibboleth           
    - break
- when request:
    - select
    - pipe:
        - when accept application/xml:
             - xslt:
                 stylesheet: tidy.xsl
             - pubinfo:
                 publisher: http://www.swamid.se/
             - first
             - finalize:
                 cacheDuration: PT5H
                 validUntil: P10D
             - sign:
                 key: default.key
                 cert: default.crt
             - emit application/xml
             - break
        - when accept application/json:
             - xslt:
                 stylesheet: discojson.xsl
             - emit application/json:
             - break