3.1 Configure Shibboleth SP - shibboleth2.xml

We have prepared two files with reasonable defaults for connecting an SP to SWAMID. One is for a shibboleth SP behind an Apache web server and the other is for a shibboleth SP behind an IIS web server. You should only need to change example.org in the file to the public FQDN (Fully Qualified Domain Name) of your host. Note that registering a fully functional SP with SWAMID usually requires you to have a FQDN for your service in DNS that is visible on the public Internet. It is possible to register internal development instances in the SWAMID testing metadata that points to localhost or other internal DNS names but this is discouraged for production services. 

If you have followed the installation guides in this wiki so far, you should rename the downloaded file, edit it and rename it to shibboleth2.xml and put it in the SHIB_HOME directory (/etc/shibboleth on linux c:\opt\shibboleth-sp\etc\shibboleth on Windows, if you haven't changed that during installation). 

The swamid-apache-shibboleth2.xml file can be downloaded here.

The swamid-IIS-shibboleth2.xml file can be downloaded here.

You can see the contents of the files in the code block below. All comments that is in the files above are filtered out.

swamid-apache-shibboleth2.xml without comments and examples
<SPConfig xmlns="urn:mace:shibboleth:3.0:native:sp:config"
    xmlns:conf="urn:mace:shibboleth:3.0:native:sp:config"
    xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
    xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"    
    xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
    clockSkew="180">
    <ApplicationDefaults entityID="https://swamidsp.example.org"
                         HTTP_REMOTE_USER="eppn persistent-id targeted-id"
                         metadataAttributePrefix="Meta-">

        <Sessions lifetime="28800" timeout="3600" relayState="ss:mem"
                  checkAddress="false" handlerSSL="true" cookieProps="http">

            <Logout>SAML2 Local</Logout>

	<SessionInitiator type="Chaining" Location="/DS/Login" id="swamid-ds-default" relayState="cookie">
	   <SessionInitiator type="SAML2" defaultACSIndex="1" acsByIndex="false" template="bindingTemplate.html"/>
	   <SessionInitiator type="Shib1" defaultACSIndex="5"/>
	   <SessionInitiator type="SAMLDS" URL="https://md.nordu.net/role/idp.ds"/>
	</SessionInitiator>

            <md:AssertionConsumerService Location="/SAML2/POST" index="1"
                Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
                conf:ignoreNoPassive="true"/>

            <Handler type="MetadataGenerator" Location="/Metadata" signing="false"/>
            <Handler type="Status" Location="/Status" acl="127.0.0.1 ::1"/>
            <Handler type="Session" Location="/Session" showAttributeValues="false"/>
            <Handler type="DiscoveryFeed" Location="/DiscoFeed"/>

            <md:ArtifactResolutionService Location="/Artifact/SOAP" index="1"
                Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"/>

        </Sessions>

        <Errors supportContact="webmaster@example.org"
            helpLocation="/about.html"
            styleSheet="/shibboleth-sp/main.css"/>

        <MetadataProvider 
                type="XML" 
                url="https://mds.swamid.se/md/swamid-idp-transitive.xml"
                backingFilePath="swamid-idp-transitive.xml" reloadInterval="300">
             <SignatureMetadataFilter certificate="md-signer2.crt"/>
 		</MetadataProvider>

       <AttributeExtractor type="XML" validate="true" reloadChanges="false" path="attribute-map.xml"/>

        <AttributeResolver type="Query" subjectMatch="true"/>

        <AttributeFilter type="XML" validate="true" path="attribute-policy.xml"/>

        <CredentialResolver type="File" key="sp-key.pem" certificate="sp-cert.pem"/>
    </ApplicationDefaults>
    <SecurityPolicyProvider type="XML" validate="true" path="security-policy.xml"/>

    <ProtocolProvider type="XML" validate="true" reloadChanges="false" path="protocols.xml"/>

</SPConfig>
swamid-IIS-shibboleth2.xml
<SPConfig xmlns="urn:mace:shibboleth:3.0:native:sp:config"
    xmlns:conf="urn:mace:shibboleth:3.0:native:sp:config"
    xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
    xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"    
    xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
    clockSkew="180">

    <InProcess logger="native.logger">
        <ISAPI normalizeRequest="true" safeHeaderNames="true">
            <Site id="1" name="swamidsp.example.org" scheme="https" port="443"/>
        </ISAPI>
    </InProcess>

    <RequestMapper type="Native">
        <RequestMap>
            <Host name="swamidsp.example.org">
                <Path name="myswamidapp" requireSession="true"  authType="shibboleth"/>
            </Host>
        </RequestMap>
    </RequestMapper>

    <ApplicationDefaults entityID="https://swamidsp.example.org"
                         REMOTE_USER="eppn persistent-id targeted-id"
                         metadataAttributePrefix="Meta-">
        <Sessions lifetime="28800" timeout="3600" relayState="ss:mem"
                  checkAddress="false" handlerSSL="true" cookieProps="http">

            <Logout>SAML2 Local</Logout>

	<SessionInitiator type="Chaining" Location="/DS/Login" id="swamid-ds-default" relayState="cookie">
	   <SessionInitiator type="SAML2" defaultACSIndex="1" acsByIndex="false" template="bindingTemplate.html"/>
	   <SessionInitiator type="Shib1" defaultACSIndex="5"/>
	   <SessionInitiator type="SAMLDS" URL="https://md.nordu.net/role/idp.ds"/>
	</SessionInitiator>

            <md:AssertionConsumerService Location="/SAML2/POST" index="1"
                Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
                conf:ignoreNoPassive="true"/>

            <Handler type="MetadataGenerator" Location="/Metadata" signing="false"/>
            <Handler type="Status" Location="/Status" acl="127.0.0.1 ::1"/>

            <Handler type="Session" Location="/Session" showAttributeValues="false"/>

            <Handler type="DiscoveryFeed" Location="/DiscoFeed"/>

            
            <md:ArtifactResolutionService Location="/Artifact/SOAP" index="1"
                Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"/>
        </Sessions>

        <Errors supportContact="webmaster@example.org"
            helpLocation="/about.html"
            styleSheet="/shibboleth-sp/main.css"/>

        <MetadataProvider 
                type="XML" 
                url="https://mds.swamid.se/md/swamid-idp-transitive.xml"
                backingFilePath="swamid-idp-transitive.xml" reloadInterval="300">
             <SignatureMetadataFilter certificate="md-signer2.crt"/>
 </MetadataProvider>

       <AttributeExtractor type="XML" validate="true" reloadChanges="false" path="attribute-map.xml"/>
        <AttributeResolver type="Query" subjectMatch="true"/>

        <AttributeFilter type="XML" validate="true" path="attribute-policy.xml"/>

        <CredentialResolver type="File" key="sp-key.pem" certificate="sp-cert.pem"/>

    </ApplicationDefaults>

    <SecurityPolicyProvider type="XML" validate="true" path="security-policy.xml"/>

    <ProtocolProvider type="XML" validate="true" reloadChanges="false" path="protocols.xml"/>

</SPConfig>



The two example configuration files uses SWAMIDs standard Discovery Service (DS) which means that it will be possible to login from all Identity Providers within eduGAIN but you won't get attributes from all of them due to that not all Identity Providers supports entity categories. If you only want have Identity Providers within SWAMID you change "https://md.nordu.net/role/idp.ds" to "https://md.nordu.net/swamid.ds" in row 19 in swamid-apache-shibboleth2.xml or in row 33 in swamid-IIS-shibboleth2.xml.

The "<Errors .... /> assumes that http://example.org/about.html leads to some form of help page and that webmaster@example.org is the right contact address for your service. Change according to taste.

After you save this file as /etc/shibboleth/shibboleth2.xml, download https://mds.swamid.se/md/md-signer2.crt and save as /etc/shibboleth/md-signer.crt (or your windows equivalent). Take care to verify the fingerprint of this certificate as published on https://mds.swamid.se/md/. Finally you must generate a keypair for your SP. This keypair is not the same as the certificate of your service and is used to secure SAML protocol messages between SWAMID IdPs and your service. Usually you do this by running the following command

shibboleth key generation
# shib-keygen -h example.com

At this point you should be able to restart the shibd process. If you get errors or if shibd refuses to start, make sure you don't have syntax error in any of your XML files. The system logs should provide clues about what may have gone wrong. If necessary increase the shibboleth log level to DEBUG. 

If shibd restarts ok, you should be able to point a browser at (or use curl to download) https://example.com/Shibboleth.sso/Metadata which should contain a PEM encoded version of your newly generated SP keypair. At this point you are read to register this metadata with SWAMID.