This solution aims to simplify the implementation of login using SPID or similar services, such as CIE and eIDAS

Overview

SPID Enablement Solution

This solution aims to simplify the implementation of login using SPID or similar services, such as CIE and eIDAS. It supports both the use of ADFS and B2C as identity federators.

What's SPID

SPID is the Digital Identity Public System which allow all the italian citizens to access online public services (such as INPS, INAIL, AdE, etc) with only one set of credentials.

Why this repo

Besides AgID asserts that the SPID authentication system is SAML2 compliant, it isn't. Moreover, in the SPID Technical Regulations (https://docs.italia.it/italia/spid/spid-regole-tecniche/it/stabile/index.html), there are a few mandatory requirements which break the SAML2 protocol itself. For this reason, all the SAML2 solutions/products/libraries can't be used out of the box with SPID. So we developed the such called SPIDProxy which proxies the SAMLRequests/SAMLResponses between a Federator (ADFS or AAD B2C in our case) and the SPID IdPs.

Not only SPID

We started the project with the objective of supporting SPID, and we reached that goal different years ago. Throughout the years, AgID announced different authentication systems such as CNS (Carta Nazionale dei Servizi), CIE (Carta Identità Elettronica) and eIDAS (electronic IDentification Authentication and Signature). SPID, CIE and CNS are mandatory for every italian public accessible online service, while eIDAS should be used if you want to make your online service accessible to EU citizens, using their SPID corrispective identities. To support such authentication systems we extended the SPIDProxy to support CIE and eIDAS, while we developed another component (CNS.Auth.Web) to enable CNS authentication.

What's inside the repo

Inside this repo you'll find:

  • The SPIDProxy source code
  • The CNS.Auth.Web source code
  • Powershell scripts to configure ADFS to support SPID/CIE/eIDAS authentication
  • Pre-configured AAD B2C Custom Policies for supporting SPID/CIE/eIDAS/CNS authentication
  • AgID compliant Custom UIs for ADFS and AAD B2C
  • (kinda old) Install documentation

Contributing

All the contributions are welcome. Check the open issues, create a branch and open a PR. If you notice bugs or potential improvements, don't be shy and open a new issue!

Trademark Notice

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft’s Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party’s policies.

License

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the MIT license.

Comments
  • Issue with certificates with 3k key lenght

    Issue with certificates with 3k key lenght

    I've faced an issue trying to use certificates with a 3k key length. Problem faced were:

    • SPID Proxy Web App unable to open certificate private key with error "certificate password incorrect"
    • Azure AD B2C user flow unable to open certificate private key for SAML message signing

    Opening the certificate with MMC or openSSL worked without issues and the password was correctly accepted.

    Recreating the certificate with same settings, but 2048 key length resolved all the issues.

    wontfix 
    opened by MarcoL-4wardPRO 5
  • Add support to reverse proxies

    Add support to reverse proxies

    We actually generate the AssertionConsumerServiceUrl using the HTTP Request host. This won't work in scenarios where reverse proxies are used, since the request host will be different from the "public" host that users can reach.

    We basically need to change the following line https://github.com/microsoft/SPID-and-Digital-Identity-Enabler/blob/63ef10fe45b82566d90d4fc0101f0a254603be5d/WebApps/Proxy/Microsoft.SPID.Proxy/Services/Implementations/SAMLService.cs#L32-L36

    We could use the x-forwarded-host header (https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/proxy-load-balancer?view=aspnetcore-6.0) or, eventually, just put the right host in config.

    enhancement good first issue 
    opened by fume 2
  • Wrong cert data inserted in the metadata files by the Get-SPIDMetadatas PS script

    Wrong cert data inserted in the metadata files by the Get-SPIDMetadatas PS script

    The Get-SPIDMetadatas PS script use the following code to load the certificate: $cert = (New-Object System.IO.StreamReader($certificateFilePath)).ReadToEnd() This code considers that the certificate file contains the plain certificate in base64. Unfortunately usually .cer file format is defined as follow -----BEGIN CERTIFICATE----- <base64 certificate> -----END CERTIFICATE----- So, at current time, the PS script generates the XML metadata as follows <md:KeyDescriptor use="signing"> <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> <ds:X509Data> <ds:X509Certificate>-----BEGIN CERTIFICATE----- ..... -----END CERTIFICATE----- </ds:X509Certificate> This is a not valid certificate data inside the XML metadata

    opened by vifani 1
  • Should we change the category filters for AppInsights and disable Sampling by default?

    Should we change the category filters for AppInsights and disable Sampling by default?

    TL;DR;
    I'm willing to reduce the logs sent to AppInsights changing the category filters. At the same time i would like to disable the AdaptiveSampling by default to avoid loosing important logs which are mandatory for AgID.

    Details
    With the actual default configuration, we send Information logs to AppInsights for every single category:

    {
    	"Logging": {
    		"ApplicationInsights": {
    			"LogLevel": {
    				"Default": "Information"
    			}
    		}
           }
    }
    

    With this configuration we are also sending framework logs such as the following, which are not really useful and could produce a lot of data-ingestion image

    Should we change the category filters for AppInsights to send Information logs and above for the Microsoft.SPID cateogory and sending only Warning and above logs for the Default category? Something like this:

    {
    	"Logging": {
    		"ApplicationInsights": {
    			"LogLevel": {
    				"Default": "Warning",
                                    "Microsoft.SPID": "Information"
    			}
    		}
           }
    }
    

    We could increase the verbosity at any-time by overriding the setting via Configuration. I would like to reduce the telemetry sent to AppInsights because AgID requires to store logs for 24 months. We can change the retention of the Application Insights instance to achieve the objective (via the linked LAW or on the AppInsights instance directly), but it has an extra-cost per-GB/per-Month.

    Moreover, we have Adaptive Sampling enabled by default. Whene there are a lot of concurrent requets towards the SPIDProxy, sampling is applied hence we loose log details but still have correct numbers (thanks to the itemCount). I would like to disable Sampling by default since we could sample a log which is required by AgID and which we should retain for 24 months. We can do so by adding the following in the appsettings.json, as also shown here https://docs.microsoft.com/en-us/azure/azure-monitor/app/asp-net-core#configuration-recommendation-for-microsoftapplicationinsightsaspnetcore-sdk-2150-and-later:

    {
        "ApplicationInsights": {
            "EnableAdaptiveSampling": false
        }
    }
    

    What do you think @tommasodotNET, @MarcoZama, @PaoloCastAway ?

    enhancement question 
    opened by fume 1
  • 27 write installation steps in readmemd

    27 write installation steps in readmemd

    I create this installation steps, i write the readme that guides the user in this step:

    • How to deploy the custom policies in AAD B2C
    • How to deploy and configure the SPIDProxy
    • How to get started with the demo.spid.gov.it environment
    opened by MarcoZama 0
  • Add CIEEntityId

    Add CIEEntityId

    If the SAMLRequest destination is a CIE environment, then you can use a specific entityId via CIEEntityId setting. This is useful in the case you have different EntityId set in CIE and SPID metadatas.

    opened by fume 0
  • Use different EntityId for SPID and CIE requests

    Use different EntityId for SPID and CIE requests

    As of today, if we have to use two different Issuers for SAMLRequests for CIE and SPID, we must deploy two parallel SPIDProxies. Would be great to have a configuration to achieve the same. I.e., whend sending SAMLReuqests to spid use spid.entity.id and when sending SAMLRequests to CIE use cie.entity.id. We already have a configuration to use different AttributeConsumingServiceIndex for SPID and CIE, so we could use the same approach.

    cc: @mtagliaferri86

    opened by fume 0
  • Add Keyvault support for the signing certificate

    Add Keyvault support for the signing certificate

    thanks @vifani for the main contribution.

    Added optional KeyVault Configuration Provider support Added Certificate load switch from server file storage or KeyVault

    opened by fume 0
  • samlp:Extensions should be placed after Issuer tag

    samlp:Extensions should be placed after Issuer tag

    SAMLRequest schema dictates to have the Extensions tag right after the Signature, hence we must add it after the Issuer tag.

    The code to change is here: https://github.com/microsoft/SPID-and-Digital-Identity-Enabler/blob/ada2d5fc94686d23e882f0bc443ae8a534d45ce3/WebApps/Proxy/Microsoft.SPID.Proxy/Models/Extensions/RequestSAMLAsXMLExtensions.cs#L175

    Instead of appending the Extensions to rootEl, we should InsertAfter the Issuer tag, which we should retrieve.

    bug 
    opened by fume 0
  • Add a flag to skip SAMLResponse signature validation

    Add a flag to skip SAMLResponse signature validation

    Having a flag to disable SAMLResponse signature validation entirely could be useful for testing pruposes. As of now, we have such a flag to skip Assertion signature validation only.

    opened by fume 0
  • Add option to log decoded SAMLResponse

    Add option to log decoded SAMLResponse

    • Add LoggingOptions class with LogDecodedSamlResponse prop (defaults to false)
    • Add SPIDProxyLogging section in appsettings.json
    • Move LogAccess section inside SPIDProxyLogging section
    • Change Configure methods accordingly
    • Add INCOMING_SAML_RESPONSE_DECODED event

    Fixes #9

    opened by fume 0
  • Write installation steps in readme.md

    Write installation steps in readme.md

    While waiting for the deployment automation (#6), we should write the installation steps in the readme:

    • How to deploy the custom policies in AAD B2C
    • How to deploy and configure the SPIDProxy
    • How to get started with the demo.spid.gov.it environment
    documentation help wanted 
    opened by fume 0
  • Retrieve SPIDProxy configuration from metadatas

    Retrieve SPIDProxy configuration from metadatas

    When we install the SPIDProxy, we must configure the "Federator" section manually with appropriate EntityIDs and appropriate AttributeConsumerServiceUrl. Such informations could be retrieved from the Federator metadata and from the metadata shared with AgID. We could add the chance to just configure metadatas urls and retrieve such informations on the fly on startup.

    enhancement 
    opened by fume 0
  • Use CertStore to retrieve certificate instead of reading from FileSystem

    Use CertStore to retrieve certificate instead of reading from FileSystem

    Reading from Cert Store is a better option even when SPIDProxy is deployed in Azure. Cert is stored in KeyVault, then imported into App Service (see Import a certificate from your vault to your app). The good thing is that you update the Cert in KeyVault, and then it's automatically imported into App Service.

    You need just to declare in Configuration the Tumbprint of certificates to be made available to code. Then, you use the approach described here (Use a TLS/SSL certificate in your code in App Service): this approach doesn't make any assumption code is running in Azure, so it satisfies the requirement.

    enhancement good first issue 
    opened by fume 0
Owner
Microsoft
Open source projects and samples from Microsoft
Microsoft
This is a Chrome extension that aims to encourage accessibility awareness while using GitHub

github-a11y This is a Google Chrome extension that runs a simple JavaScript snippet on github.com domain and aims to encourage accessibility mindfulne

Kate Higa 9 Jul 24, 2022
Recipe providing mobile app, User selects ingredients in pantry and is then provided recipes for those ingredients. App contains a signup/login, meal planner and grocery list pages.

Recipog Student Information Name Connor de Bruyn Username Destiro Assignment SWEN325 A2 Description “Recipog” is a recipe providing app that allows th

Connor de Bruyn 1 Dec 26, 2021
Boilerplate for a NextJS and Supabase Project. Including full authentication with sign up, login and password recovery.

NextJS x Supabase Boilerplate Getting Started Environment variables Create the enviroment variables with the following command cp .env.local.dist .env

Dominik Amrugiewicz 9 Jun 13, 2022
The Bookstore is a website similar to the "Awesome Books" website. Here we will create an MVP version of it that allows you to: Display a list of books, Add a book and Remove a selected book.

Book Store This is Book Store project. Built With HTML CSS JavaScript React Screenshot Live Demo Go Live ?? Getting Started Open dev branch Open VSCod

Tadesse Alemayehu 5 May 3, 2022
The Project is a test that simulates a website of recipes for healthy foods. Inside it has a Registration and Login system.

GCB Test: Healthy Eating The Project is a test that simulates a website of recipes for healthy foods. Inside it has a Registration and Login system. C

Kayke Alves Fujinaka 8 Nov 20, 2022
Basic React Project with React Router, ContextAPI and Login

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 26 Jan 3, 2023
Open-source project which generates the Fortnite Item Shop in an image similar to the in-game design.

Fort-Shop Fort-Shop is a unique project which generates the current Fortnite Item Shop into a stylized image, similar to the new In-Game design (refer

im2rnado 25 Jan 5, 2023
The Bookstore is a website similar to the "Awesome Books" website built in the previous module. You will create an MVP version of it that allows you to: Display a list of books. Add a book. Remove a selected book.

Bookstore The Bookstore is a website similar to the "Awesome Books" website built in the previous module. You will create an MVP version of it that al

Anuar Shaidenov 6 Jun 12, 2022
DashGo é uma aplicação em React para dashboard's em geral com paginas e paginação, login e sistema de inclusão de usuarios

Ignite - Trilha ReactJS Sobre o projeto O projeto foi baseado no 4º módulo da trilha ReactJS do Ignite. Além do que foi construído na aula, foi criado

Gabriel Fiusa 53 Nov 23, 2022
DashGo é uma aplicação em React para dashboard's em geral com paginas e paginação, login e sistema de inclusão de usuarios

Ignite - Trilha ReactJS Sobre o projeto O projeto foi baseado no 4º módulo da trilha ReactJS do Ignite. Além do que foi construído na aula, foi criado

Gabriel Fiusa 53 Nov 23, 2022
Very simple app to decode your Vaccination Proof QR Code (such as the one provided by government of Quebec) - Compatible with SHC (Smart Health Card standard)

shc-covid19-decoder Visit simple hosted version on your phone (does NOT transmit any data, all remains in your browser) https://fproulx.github.io/shc-

François Proulx 148 Sep 23, 2022
This is a custom recipe app called chefMaster. which contains a lot of interesting such as many apis requests, filter, search , add posts. Property design

In the project directory, you can run: npm start Runs the app in the development mode. Open http://localhost:3000 to view it in the browser. The page

Andrew Smal 0 Nov 9, 2022
A web application for a company that provides commercial and scientific space travel services. The application allows users to book rockets and join selected space missions.

Space Travelers' Hub A web application for a company that provides commercial and scientific space travel services. The application allows users to bo

Manel Hammouche 8 Oct 14, 2022
A web application for a company that provides commercial and scientific space travel services.

Space Traveler's Hub Space Traveler's Hub is a project built with React redux, implemented with Ducks files structure and, React Router to interact be

Ismael Antonio 6 Mar 15, 2022
A web application for a company that provides commercial and scientific space travel services

A web application for a company that provides commercial and scientific space travel services. The application allows users to book rockets and join selected space missions using real live data from the SpaceX API.

Leonardo Albornoz 9 Apr 5, 2022
📦 noov.js for react ssr solution

noov.js ?? 快速、通用、轻量级的 SSR 解决方案 功能 ?? 支持热更新 ?? 服务端数据预取 ?? 支持 redux ?? 自定义 layout 组件 ⚡️ 支持自定义 TDK 配置 快速开始 npm i npm run dev API asyncData 你可能想要在服务器端获取并渲

art-design 17 Mar 30, 2022
An implementation of GitHub's Primer Design System using React

Primer React A React implementation of GitHub's Primer Design System Documentation Our documentation site lives at primer.style/react. You'll be able

Primer 2.2k Dec 26, 2022
This command line helps you create components, pages and even redux implementation for your react project

react-help-create This command line helps you create components, pages and even redux implementation for your react project. How to install it? To ins

Omar 27 Dec 10, 2022
Plock is a responsive masonry layout implementation for React. Very simple to use and easy to understand.

About Plock ?? Plock is a responsive masonry layout implementation for React. Very simple to use and easy to understand. Can I see a demo? ?? The demo

Renato Pozzi 130 Dec 9, 2022