Verificare che nel Site opportuno, nella sezione “Modules” abbia le i moduli nativi Shibboleth (32/64 bit)
(cambiare cartella in C:\opt\shibboleth-sp\etc\shibboleth)
(Sezioni da personalizzare) Site id deve corrpispondere all'ID presente in IIS; il Site name corrisponde all'host (FQDN)
<ISAPI normalizeRequest="true" safeHeaderNames="true"> <!-- Maps IIS Instance ID values to the host scheme/name/port. The name is required so that the proper <Host> in the request map above is found without having to cover every possible DNS/IP combination the user might enter. --> <Site id="1" name="app-infocad-dev2016.unipr.it"/> <!-- When the port and scheme are omitted, the HTTP request's port and scheme are used. If these are wrong because of virtualization, they can be explicitly set here to ensure proper redirect generation. --> <!-- <Site id="42" name="virtual.example.org" scheme="https" port="443"/> --> </ISAPI>
Host name corrisponde sempre all'host FQDN; con path si indica la location da proteggere mediante shibboleth (in questo esempio la location protetta è /secure)
<RequestMapper type="Native"> <RequestMap> <!-- The example requires a session for documents in /secure on the containing host with http and https on the default ports. Note that the name and port in the <Host> elements MUST match Apache's ServerName and Port directives or the IIS Site name in the <ISAPI> element above. --> <Host name="app-infocad-dev2016.unipr.it"> <Path name="secure" authType="shibboleth" requireSession="true"/> </Host> <!-- Example of a second vhost mapped to a different applicationId. --> <!-- <Host name="admin.example.org" applicationId="admin" authType="shibboleth" requireSession="true"/> --> </RequestMap> </RequestMapper>
Configurare l'entityID del proprio shibboleth service provider (è una label, che di norma corrisponde al proprio schema+FQDN+/shibboleth → https://app-infocad-dev2016.unipr.it/shibboleth):
<ApplicationDefaults entityID="https://app-infocad-dev2016.unipr.it/shibboleth" REMOTE_USER="eppn subject-id pairwise-id persistent-id" cipherSuites="DEFAULT:!EXP:!LOW:!aNULL:!eNULL:!DES:!IDEA:!SEED:!RC4:!3DES:!kRSA:!SSLv2:!SSLv3:!TLSv1:!TLSv1.1"> <!--
Inoltre configurare opportunamente l'elemento Sessions e valorizzare l'entityID di riferimento per le autenticazioni, in questo caso dell'IdP UNIPR https://shibidp.unipr.it/idp/shibboleth
<Sessions lifetime="28800" timeout="3600" relayState="ss:mem" checkAddress="true" handlerSSL="true" cookieProps="https"> <!-- Configures SSO for a default IdP. To properly allow for >1 IdP, remove entityID property and adjust discoveryURL to point to discovery service. You can also override entityID on /Login query string, or in RequestMap/htaccess. --> <SSO entityID="https://shibidp.unipr.it/idp/shibboleth"> SAML2 </SSO>
Configurare il MetadataProvider (in questo caso staticamente via file)
<!-- Example of locally maintained metadata. --> <MetadataProvider type="XML" validate="true" path="partner-metadata.xml"/>
In questo caso nel file partner-metadata.xml andrà salvato il metadata IdP UNIPR scaricabile dal link https://shibidp.unipr.it/idp/shibboleth
Includere gli elementi Attributi necessari e richiesti durante la fase di accreditamento, come da istruzioni presenti al seguenti link Service Provider: HowTo Shibboleth
Esempio:
<Attribute name="urn:oid:2.5.4.3" id="cn"/> <Attribute name="urn:oid:2.5.4.4" id="sn"/> <Attribute name="urn:oid:2.5.4.42" id="givenName"/> <Attribute name="urn:oid:2.16.840.1.113730.3.1.241" id="displayName"/> <Attribute name="urn:oid:0.9.2342.19200300.100.1.1" id="uid"/> <Attribute name="urn:oid:0.9.2342.19200300.100.1.3" id="mail"/>
I ceritifcati generati localmente per mezzo del tool “seckeygen.bat” presente in C:\opt\shibboleth-sp\etc\shibboleth, servono esclusivamente per la firma e la crittografia delle asserzioni e dopo la generazione saranno presenti in linea nel metadata del service provider, che dovrà successivamente essere scaricato ed inviato all'IdP UNIPR come da istruzioni presenti qui Service Provider: HowTo Shibboleth
C:\opt\shibboleth-sp\etc\shibboleth>keygen.bat --help usage: keygen [-h hostname for cert] [-y years to issue cert] [-e entityID to embed in cert] [-n filename prefix] [-o output dir]
Esempio:
keygen.bat -h app-infocad-dev2016.unipr.it -y 10 -e https://app-infocad-dev2016.unipr.it/shibboleth -n sp-signing -INVIO- keygen.bat -h app-infocad-dev2016.unipr.it -y 10 -e https://app-infocad-dev2016.unipr.it/shibboleth -n sp-encrypt -INVIO-
In questo modo si generano due certificati rispettivamente dedicati per la firma e per la crittografia.
Questi saranno referenziati nel file shibboleth2.xml nella sezione
<!-- Simple file-based resolvers for separate signing/encryption keys. --> <CredentialResolver type="File" use="signing" key="sp-signing-key.pem" certificate="sp-signing-cert.pem"/> <CredentialResolver type="File" use="encryption" key="sp-encrypt-key.pem" certificate="sp-encrypt-cert.pem"/> </ApplicationDefaults>
E' possibile scaricare una versione del Metadata relativo al proprio SP direttamente dal link del proprio server su cui avete installato il service provider shibboleth:
https://<fqdn_server_shibboleth_SP>/Shibboleth.sso/Metadata
Esempio di pagina ASP per raccogliere gli attributi rilasciati dell'IdP in variabili server:
<%@ language="javascript"%> <!DOCTYPE html> <html> <body> <% Response.Write("<h1>Variabili Server</h1>") Response.Write("Cognome: "+ Request.ServerVariables["sn"]) Response.Write("<br>"); Response.Write("Nome: "+ Request.ServerVariables["givenName"]) Response.Write("<br>"); Response.Write("CF: "+ Request.ServerVariables["codicefiscale"]) Response.Write("<br>"); Response.Write("Email: "+ Request.ServerVariables["mail"]) Response.Write("<br>"); Response.Write("OU: "+ Request.ServerVariables["organizationalUnit"]) %> </body> </html>
Alcune versioni o combinazioni di versioni di sistema operativo e shibboleth service provider potrebbero rilasciare i valori degli attributi duplicati, pertanto la soluzione per recuperare valori singoli degli attributi è la seguente:
<%@ language="javascript"%> <!DOCTYPE html> <html> <body> <% Response.Write("<h1>Variabili Server</h1>") Response.Write("Cognome: "+ Request.ServerVariables["sn"].split(';')[0]) Response.Write("<br>"); Response.Write("Nome: "+ Request.ServerVariables["givenName"].split(';')[0]) Response.Write("<br>"); Response.Write("CF: "+ Request.ServerVariables["codicefiscale"].split(';')[0]) Response.Write("<br>"); Response.Write("Email: "+ Request.ServerVariables["mail"].split(';')[0]) Response.Write("<br>"); Response.Write("OU: "+ Request.ServerVariables["organizationalUnit"].split(';')[0]) %> </body> </html>