Developers.Italia.SPID.SAML
1.0.2
See the version list below for details.
dotnet add package Developers.Italia.SPID.SAML --version 1.0.2
NuGet\Install-Package Developers.Italia.SPID.SAML -Version 1.0.2
<PackageReference Include="Developers.Italia.SPID.SAML" Version="1.0.2" />
paket add Developers.Italia.SPID.SAML --version 1.0.2
#r "nuget: Developers.Italia.SPID.SAML, 1.0.2"
// Install Developers.Italia.SPID.SAML as a Cake Addin #addin nuget:?package=Developers.Italia.SPID.SAML&version=1.0.2 // Install Developers.Italia.SPID.SAML as a Cake Tool #tool nuget:?package=Developers.Italia.SPID.SAML&version=1.0.2
Questa libreria permette di interfacciare un'applicazione ASP.NET con un IdP (Identity Provider) abilitato a SPID (Sistema Pubblico di Identità Digitale).
Tramite questa libreria è possibile effettuare l'autenticazione di un Utente registrato presso un Identity Provider attivo e richiedere alcuni dati dell'Utente (Cittadino)
Prerequisiti
Certificati per firma digitale
Per eseguire delle chiamate ad un Identity Provider (IdP) è necessario avere a disposizione un certificato per la firma della richiesta.
Nell'ambiente di test è possibile creare dei certificati self-signed tramite OpenSSL.
Linux Download:
https://www.openssl.org/source/
Windows Download:
https://slproweb.com/products/Win32OpenSSL.html
Per creare i certificati basta eseguire:
> Openssl req -newkey rsa:2048 -keyout certificati\spid-developersitalia.key -x509 -days 365 -out certificati\spid-developersitalia.crt
Una volta generato il certificato e la chiave privata esportiamo certificato e chiave in un unico file pfx:
> Openssl pkcs12 -export -out certificati\spid-developersitalia.pfx -inkey certificati\spid-developersitalia.key -in certificati\spid-developersitalia.crt
Controllo Certificato: https://www.sslshopper.com/certificate-decoder.html
Metadata Identity Provider (IdP)
Per la comunicazione verso un Identity Provider è necessario avere a disposizione i metadata che descrivono i servizi messi a disposizione dall' IdP. Le informazioni più importanti, oltre al certificato utilizzato dall' IdP, sono:
SingleSignOnService (HTTP-POST)
Entry-point per l'autenticazione tramite HTTP-POST
SingleSignOnService (HTTP-REDIRECT)
Entry-point per l'autenticazione tramite HTTP-REDIRECT
SingleLogoutService (HTTP-POST)
Entry-point per il logout tramite HTTP-POST
SingleLogoutService (HTTP-REDIRECT)
Entry-point per il logout tramite HTTP-POST
Potete trovare alcuni metadata di esempio qui: https://github.com/congiuluc/spid-dotnet-sdk/tree/master/src/Developers.Italia.SPID/SAML/Metadata/IdP/
Metadata Service Provider (SP)
Per il corretto scambio di informazioni tra IdP e SP è necessario che anche il SP invii all' IdP il metadata contenente le configurazioni dell'SP.
Oltre alle informazioni del certificato che verrà utilizzato per la firma, le principali informazioni da inserire sono:
EntityID
Identificativo Univoco del Serive Provider (normalmente identificato dall'url principale)
AssertionConsumerService
Url che l'IdP deve richiamare a dopo l'autenticazione dell'utente (può essere sia HTTP-POST che HTTP-REDIRECT)
AttributeConsumingService
Elenco degli attributi che verranno restituiti al SP dall'IdP come p.es nome, cognome, codice fiscale etc
SingleLogoutService
Url che l'IdP deve richiamare a fronte di una richiesta di Logout (può essere sia HTTP-POST che HTTP-REDIRECT)
Potete trovare un metadata di esempio qui: https://github.com/congiuluc/spid-dotnet-sdk/tree/master/src/Developers.Italia.SPID/SAML/Metadata/SP/
https://github.com/italia/spid-testenv-backoffice
ASP.NET Core 2 FIX
Ad oggi, solo per le applicazioni ASP.NET Core 2, è necessario aggiungere il feed a myget del componente System.Security.Cryptography.Xml 4.5.0 questo perchè, l'attuale versione System.Security.Cryptography.Xml non è supportata in .net core mentre la versione 4.5.0 supporta .NET STANDARD 2.0.
Per aggiungere il feed basta aprire il menù delle opzioni di Visual Studio (menu Tools > Options) e selezionare NuGet Package Manager > Package Source ed aggiungere il seguente feed myGet:
https://dotnet.myget.org/F/dotnet-core/api/v3/index.json
N.B.: Non appena sarà rilasciata la versione 4.5.0 non sarà più necessario aggiungere il feed.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net35 is compatible. net40 is compatible. net403 was computed. net45 is compatible. net451 is compatible. net452 is compatible. net46 is compatible. net461 is compatible. net462 is compatible. net463 was computed. net47 is compatible. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 3.5
- No dependencies.
-
.NETFramework 4.0
- No dependencies.
-
.NETFramework 4.5
- No dependencies.
-
.NETFramework 4.5.1
- No dependencies.
-
.NETFramework 4.5.2
- No dependencies.
-
.NETFramework 4.6
- No dependencies.
-
.NETFramework 4.6.1
- No dependencies.
-
.NETFramework 4.6.2
- No dependencies.
-
.NETFramework 4.7
- No dependencies.
-
.NETStandard 2.0
- System.Security.Cryptography.Xml (>= 4.5.0-preview2-25707-02)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Added Logout