<?xml version="1.0" encoding="UTF-8"?>

<Services xmlns="urn:mace:shibboleth:2.0:services"
          xmlns:attribute-afp="urn:mace:shibboleth:2.0:afp"
          xmlns:attribute-authority="urn:mace:shibboleth:2.0:attribute:authority"
          xmlns:attribute-resolver="urn:mace:shibboleth:2.0:resolver"
          xmlns:profile="urn:mace:shibboleth:2.0:idp:profile-handler"
          xmlns:relyingParty="urn:mace:shibboleth:2.0:relying-party"
          xmlns:resource="urn:mace:shibboleth:2.0:resource" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="urn:mace:shibboleth:2.0:services classpath:/schema/shibboleth-2.0-services.xsd
                              urn:mace:shibboleth:2.0:afp classpath:/schema/shibboleth-2.0-afp.xsd
                              urn:mace:shibboleth:2.0:attribute:authority classpath:/schema/shibboleth-2.0-attribute-authority.xsd
                              urn:mace:shibboleth:2.0:resolver classpath:/schema/shibboleth-2.0-attribute-resolver.xsd
                              urn:mace:shibboleth:2.0:idp:profile-handler classpath:/schema/shibboleth-2.0-idp-profile-handler.xsd
                              urn:mace:shibboleth:2.0:relying-party classpath:/schema/shibboleth-2.0-relying-party.xsd
                              urn:mace:shibboleth:2.0:resource classpath:/schema/shibboleth-2.0-resource.xsd">

    <Service id="shibboleth.AttributeResolver"
             xsi:type="attribute-resolver:ShibbolethAttributeResolver">
        <ConfigurationResource file="/usr/local/shibboleth-idp/conf/attribute-resolver.xml" xsi:type="resource:FilesystemResource" />
    </Service>

    <!-- RAB: see https://spaces.internet2.edu/display/SHIB2/IdPConfigConfig -->
    <!-- configurationResourcePollingFrequency is in milliseconds (poll for changes) -->
    <!-- bug: must also specify configurationResourcePollingRetryAttempts -->
    <!-- https://bugs.internet2.edu/jira/browse/SC-79 -->
    <Service id="shibboleth.AttributeFilterEngine"
             xsi:type="attribute-afp:ShibbolethAttributeFilteringEngine"
             configurationResourcePollingFrequency="30000"
             configurationResourcePollingRetryAttempts="3">
        <ConfigurationResource file="/usr/local/shibboleth-idp/conf/attribute-filter.xml" xsi:type="resource:FilesystemResource" />
    </Service>
    
    <Service id="shibboleth.SAML1AttributeAuthority"
             xsi:type="attribute-authority:SAML1AttributeAuthority"
             depends-on="shibboleth.AttributeResolver shibboleth.AttributeFilterEngine"
             resolver="shibboleth.AttributeResolver"
             filter="shibboleth.AttributeFilterEngine" />
             
    <Service id="shibboleth.SAML2AttributeAuthority"
             xsi:type="attribute-authority:SAML2AttributeAuthority"
             depends-on="shibboleth.AttributeResolver shibboleth.AttributeFilterEngine"
             resolver="shibboleth.AttributeResolver"
             filter="shibboleth.AttributeFilterEngine" />

    <Service id="shibboleth.RelyingPartyConfigurationManager"
             xsi:type="relyingParty:SAMLMDRelyingPartyConfigurationManager"
             configurationResourcePollingFrequency="30000"
             configurationResourcePollingRetryAttempts="3"
             depends-on="shibboleth.SAML1AttributeAuthority shibboleth.SAML2AttributeAuthority">
        <ConfigurationResource file="/usr/local/shibboleth-idp/conf/relying-party.xml" xsi:type="resource:FilesystemResource" />
    </Service>

    <Service id="shibboleth.HandlerManager"
             depends-on="shibboleth.RelyingPartyConfigurationManager"
             xsi:type="profile:IdPProfileHandlerManager">
        <ConfigurationResource file="/usr/local/shibboleth-idp/conf/handler.xml" xsi:type="resource:FilesystemResource" />
    </Service>
    
    <!-- 
        A special service that exports all services upon which it depends into the ServletContext as an attribute 
        with the same name as the service's ID.
    -->
    <Service id="shibboleth.ServiceServletContextAttributeExporter"
             depends-on="shibboleth.AttributeResolver shibboleth.AttributeFilterEngine
                         shibboleth.SAML1AttributeAuthority shibboleth.SAML2AttributeAuthority 
                         shibboleth.RelyingPartyConfigurationManager shibboleth.HandlerManager
                         shibboleth.StorageService"
             xsi:type="ServletContextAttributeExporter" />
</Services>
