SlideShare a Scribd company logo
1 of 32
18 Novembre 2016
Single Sign On con Identity Server
Mauro Servienti
A volte ritornano
ho fatto una sessione simile
la prima volta a
Windows Developer Conference
nel 2012
Mauro Servienti
appassionato di cibo e sport
lo sport è in funzione del cibo
la tecnologia mi annoia
Dicono di me: era un bravo programmatore (cit. Ema)
pretend to be an architect
Coming out
ho un biglietto per i Depeche
e ho appena visto i Cure
Sicurezza, ovunque sicurezza.
Torniamo seri che la sicurezza è importante
…e Trenitalia non sa cosa sia.
Password in chiaro, case insentive. #ciaone
Autenticazione e Autorizzazione
• Autenticazione: verifica che siate chi dite di essere
• Ad esempio tramite una combinazione di Username e Password
• Autorizzazione: verifica che possiate fare quello che cercate di fare
• Ad esempio tramite ruoli e claim
«claim» questi sconosciuti
• Abbiamo sempre pensato in termini di Gruppi/ACL
• .NET ha introdotto nel 2001 i «ruoli»
• Mai decisione fu più nefasta :-)
• Finalmente i «claim» cercano di mettere ordine nel caos
• È semplicemente un attributo dell’utente
• Il nome, lo user-id, la mail, i ruoli, l’età possono essere tutti «claim»
• È compito, come è ovvio che sia, del client decidere come
interpretarlo
Profiles
Claims
Come funziona di solito
Applicazione Backend/FBA
Users
È veramente un problema nostro?
• Date le seguenti «robe»:
• Utenti
• Claim
• Profili
• Ce ne dobbiamo occupare noi?
• No, o meglio non proprio:
• Utenti: no
• Claim: probabilmente in parte
• Profili: si
Perché gli utenti no
• smazzarsi la gestione sicura di username e password è noioso
• Quanti di voi fanno hashing con salt random delle password?
• Quanti di voi hanno il supporto per 2FA?
• Quanti di voi hanno SSL EV?
• Quanti di voi hanno 2FA per il cambio password?
• gli utenti odiano creare un altro utente per usare un servizio
• la privacy è una rottura che non volete gestire
Perché i claim in parte si
• Molti claim comuni a tanti utenti a prescindere
• altri no sono peculiari
• Non è quindi detto che quello che ci troviamo a disposizione basti
Perché i profili si
• Il profilo è un problema totalmente applicativo
• Un «utente», inteso come user, rappresenta l’utente in generale
• Un profilo rappresenta un utente nel contesto applicativo
la federazione
It’s a long way to the top if you wanna rock ‘n’ roll…
La federazione
App Backend/FBA
Trusted
3rd party
STS
Nonèunproblemanostro
Profiles
Claims
Users
nameidentifier
nameidentifier
STS (security token service)
• Non è un problema nostro: ci limitiamo alla fiducia
• Il suo unico ruolo è emettere Security Token
• Tipicamente dopo aver verificato le credenziali, qualsiasi esse siano
• Un Security Token:
• È crittografato e firmato
• La fiducia di cui sopra dice che lo possiamo spacchettare
• Contiene tutte le informazioni relative all’utente
Il flusso federato
• L’utente si presenta e non è autenticato
• L’applicazione lo rimbalza verso l’STS
• Dandogli un token che identifica l’applicazione
• Token che solo l’STS può spacchettare
• L’utente si presenta all’STS con il token
• L’STS a questo punto sa da dove arriva l’utente
• L’utente si autentica con le sue credenziali
• L’STS genera un security token valido e con una scadenza
• L’utente torna dall’applicazione
• L’applicazione spacchetta il security token e sa che l’utente è buono
Applicazione Autorizzazione Applicazione
Autenticazione e
richiesta di accesso
Generazione
del Token
Accesso all’API con il Token
La federazione
App Backend/FBA
Trusted
3rd party
STS
Nonèunproblemanostro
Profiles
Claims
Users
nameidentifier
nameidentifier
Uno solo!?111?1?!!!
Gomblotto :-)
Abbiamo abituato bene i nostri utenti…
Un STS non ci basta più
• Abbiamo bisogno di un ACS
• Access Control Service
• Fa da proxy verso uno o più STS
• Noi ci fidiamo dell’ACS, lui si fida degli STS
• E per proprietà transitiva siamo tutti felici
• Possiamo fare self-hosting dell’ACS
• APS.Net 4 lo faceva
• Possiamo delegare a terze parti come l’IdentityServer di Thinktecture
• Di cui a sua volta si può fare self-hosting
FacebookGoogle Account
La federazione
App Backend
Custom FBA
Profiles
IdentityServer
ACS
Active Directory MS Account
nameidentifier
Nonèunproblemanostro
Twitter
FacebookGoogle Account
Ad ognuno il suo protocollo
Custom FBA
IdentityServer
ACS
Active Directory MS Account Twitter
Applicazione Autorizzazione Applicazione
Autenticazione e
richiesta di accesso
Generazione
del Token
Accesso all’API con il Token
Azure ACS
Autenticazione
Consenso
Codice di Accesso
Codice di Accesso
Ma non è così semplice
Lei e lui
• Gli attori sono due
• Utente
• ApplicazioneUtente Applicazione
STS/ACS
Lei, lui e l’altra
• Gli attori sono tre
• Utente
• Applicazione
• API
• L’utente vuole accedere all’API
• Attraverso l’applicazione
• Una SPA deve funzionare così
• Tipicamente si parla di OAuth
Utente Applicazione
STS/ACS
API
OAuth
Una piccola nota di redazione…
The problem is that OAuth 2.0 is a
Delegated Authorization protocol, and not
a Authentication protocol. ...
OAuth provides an access token to a client, so
that it can access a protected resource, based on
the permission of the resource owner.
Fonte: http://www.thread-safe.com/2012/01/problem-with-oauth-for-authentication.html
Demo
Grazie
Mauro Servienti
Solution Architect @ Particular Software | @mauroservienti | //blogs.ugidotnet.org/topics/

More Related Content

Viewers also liked

NServiceBus - building a distributed system based on a messaging infrastructure
NServiceBus - building a distributed system based on a messaging infrastructureNServiceBus - building a distributed system based on a messaging infrastructure
NServiceBus - building a distributed system based on a messaging infrastructureMauro Servienti
 
Building APIs with MVC 6 and OAuth
Building APIs with MVC 6 and OAuthBuilding APIs with MVC 6 and OAuth
Building APIs with MVC 6 and OAuthFilip Ekberg
 
Approccio Pratico al Domain Driven Design
Approccio Pratico al Domain Driven DesignApproccio Pratico al Domain Driven Design
Approccio Pratico al Domain Driven DesignLuca Milan
 
Securing your apps with OAuth2 and OpenID Connect - Roland Guijt - Codemotion...
Securing your apps with OAuth2 and OpenID Connect - Roland Guijt - Codemotion...Securing your apps with OAuth2 and OpenID Connect - Roland Guijt - Codemotion...
Securing your apps with OAuth2 and OpenID Connect - Roland Guijt - Codemotion...Codemotion
 
Angular Rebooted: Components Everywhere
Angular Rebooted: Components EverywhereAngular Rebooted: Components Everywhere
Angular Rebooted: Components EverywhereCarlo Bonamico
 
OAuth2 and IdentityServer3
OAuth2 and IdentityServer3OAuth2 and IdentityServer3
OAuth2 and IdentityServer3Paul Glavich
 
Keep calm and deploy
Keep calm and deployKeep calm and deploy
Keep calm and deployKlab
 
Il cielo è sempre più azure
Il cielo è sempre più azureIl cielo è sempre più azure
Il cielo è sempre più azureKlab
 
Code metrics
Code metricsCode metrics
Code metricsKlab
 
On working in Particular
On working in ParticularOn working in Particular
On working in ParticularMauro Servienti
 
Universal app ma universal per davvero
Universal app ma universal per davveroUniversal app ma universal per davvero
Universal app ma universal per davveroKlab
 
There is a bot for that
There is a bot for thatThere is a bot for that
There is a bot for thatKlab
 
Approccio prestazionale antincendio nelle caserme
Approccio prestazionale antincendio nelle casermeApproccio prestazionale antincendio nelle caserme
Approccio prestazionale antincendio nelle casermeMarcello Mangione
 

Viewers also liked (15)

NServiceBus - building a distributed system based on a messaging infrastructure
NServiceBus - building a distributed system based on a messaging infrastructureNServiceBus - building a distributed system based on a messaging infrastructure
NServiceBus - building a distributed system based on a messaging infrastructure
 
Building APIs with MVC 6 and OAuth
Building APIs with MVC 6 and OAuthBuilding APIs with MVC 6 and OAuth
Building APIs with MVC 6 and OAuth
 
Approccio Pratico al Domain Driven Design
Approccio Pratico al Domain Driven DesignApproccio Pratico al Domain Driven Design
Approccio Pratico al Domain Driven Design
 
Securing your apps with OAuth2 and OpenID Connect - Roland Guijt - Codemotion...
Securing your apps with OAuth2 and OpenID Connect - Roland Guijt - Codemotion...Securing your apps with OAuth2 and OpenID Connect - Roland Guijt - Codemotion...
Securing your apps with OAuth2 and OpenID Connect - Roland Guijt - Codemotion...
 
Angular Rebooted: Components Everywhere
Angular Rebooted: Components EverywhereAngular Rebooted: Components Everywhere
Angular Rebooted: Components Everywhere
 
Ddd brutto sporco e cattivo
Ddd brutto sporco e cattivoDdd brutto sporco e cattivo
Ddd brutto sporco e cattivo
 
m-v-vm @ dotNetMarche
m-v-vm @ dotNetMarchem-v-vm @ dotNetMarche
m-v-vm @ dotNetMarche
 
OAuth2 and IdentityServer3
OAuth2 and IdentityServer3OAuth2 and IdentityServer3
OAuth2 and IdentityServer3
 
Keep calm and deploy
Keep calm and deployKeep calm and deploy
Keep calm and deploy
 
Il cielo è sempre più azure
Il cielo è sempre più azureIl cielo è sempre più azure
Il cielo è sempre più azure
 
Code metrics
Code metricsCode metrics
Code metrics
 
On working in Particular
On working in ParticularOn working in Particular
On working in Particular
 
Universal app ma universal per davvero
Universal app ma universal per davveroUniversal app ma universal per davvero
Universal app ma universal per davvero
 
There is a bot for that
There is a bot for thatThere is a bot for that
There is a bot for that
 
Approccio prestazionale antincendio nelle caserme
Approccio prestazionale antincendio nelle casermeApproccio prestazionale antincendio nelle caserme
Approccio prestazionale antincendio nelle caserme
 

Similar to Single Sign On con IdentityServer

Introduzione a CardSpace
Introduzione a CardSpaceIntroduzione a CardSpace
Introduzione a CardSpaceDotNetMarche
 
CQRS ed Event Sourcing su Windows Azure: Applicazioni Distribuite, Scalabilit...
CQRS ed Event Sourcing su Windows Azure: Applicazioni Distribuite, Scalabilit...CQRS ed Event Sourcing su Windows Azure: Applicazioni Distribuite, Scalabilit...
CQRS ed Event Sourcing su Windows Azure: Applicazioni Distribuite, Scalabilit...DotNetMarche
 
Corso IFTS CyberSecurity Expert - Attacco di Armando e Operazione Black Tulip
Corso IFTS CyberSecurity Expert - Attacco di Armando e Operazione Black TulipCorso IFTS CyberSecurity Expert - Attacco di Armando e Operazione Black Tulip
Corso IFTS CyberSecurity Expert - Attacco di Armando e Operazione Black TulipMassimiliano Masi
 
Wordpress Security Regole e Plugin base per evitare l'hacking del vostro sito...
Wordpress Security Regole e Plugin base per evitare l'hacking del vostro sito...Wordpress Security Regole e Plugin base per evitare l'hacking del vostro sito...
Wordpress Security Regole e Plugin base per evitare l'hacking del vostro sito...Silvia Cariello
 
Ugialtnet openid presentation
Ugialtnet openid presentationUgialtnet openid presentation
Ugialtnet openid presentationSamuele Reghenzi
 
CCI2017 - Protect and manage your digital transformation - Giuseppe D'Osualdo...
CCI2017 - Protect and manage your digital transformation - Giuseppe D'Osualdo...CCI2017 - Protect and manage your digital transformation - Giuseppe D'Osualdo...
CCI2017 - Protect and manage your digital transformation - Giuseppe D'Osualdo...walk2talk srl
 
Special report digital identity security
Special report digital identity securitySpecial report digital identity security
Special report digital identity securityLuigi Dessi
 
AICEL_Perché Compriamo O Non Compriamo Via Web
AICEL_Perché Compriamo O Non Compriamo Via WebAICEL_Perché Compriamo O Non Compriamo Via Web
AICEL_Perché Compriamo O Non Compriamo Via WebCultura Digitale
 
Mobile, iot e social network
Mobile, iot e social networkMobile, iot e social network
Mobile, iot e social networkLuca Di Bari
 
Intelligenza Artificiale: I trend nelle applicazioni di business - Una serie ...
Intelligenza Artificiale: I trend nelle applicazioni di business - Una serie ...Intelligenza Artificiale: I trend nelle applicazioni di business - Una serie ...
Intelligenza Artificiale: I trend nelle applicazioni di business - Una serie ...mobi-TECH
 
Presentazione corso sicurezza informatica Vicenza Software
Presentazione corso sicurezza informatica Vicenza SoftwarePresentazione corso sicurezza informatica Vicenza Software
Presentazione corso sicurezza informatica Vicenza SoftwarePiero Sbressa
 
Web Application Insecurity L D2007
Web Application Insecurity  L D2007Web Application Insecurity  L D2007
Web Application Insecurity L D2007jekil
 
Il Web del Futuro: Web Semantico + OpenID = Autenticazione Sicura e Web of Trust
Il Web del Futuro: Web Semantico + OpenID = Autenticazione Sicura e Web of TrustIl Web del Futuro: Web Semantico + OpenID = Autenticazione Sicura e Web of Trust
Il Web del Futuro: Web Semantico + OpenID = Autenticazione Sicura e Web of TrustSimone Onofri
 
Corso di buon e-commerce - Centro Produttività Veneto (Vicenza)
Corso di buon e-commerce  - Centro Produttività Veneto (Vicenza)Corso di buon e-commerce  - Centro Produttività Veneto (Vicenza)
Corso di buon e-commerce - Centro Produttività Veneto (Vicenza)Andrea Spedale
 
Mean Auth Application - Speech Slides
Mean Auth Application - Speech SlidesMean Auth Application - Speech Slides
Mean Auth Application - Speech SlidesRaul Valentini
 
Company presentation
Company presentationCompany presentation
Company presentationsciuba
 
Test Driven Development @ Xe.Net
Test Driven Development @ Xe.NetTest Driven Development @ Xe.Net
Test Driven Development @ Xe.NetMauro Servienti
 

Similar to Single Sign On con IdentityServer (20)

Introduzione a CardSpace
Introduzione a CardSpaceIntroduzione a CardSpace
Introduzione a CardSpace
 
CQRS ed Event Sourcing su Windows Azure: Applicazioni Distribuite, Scalabilit...
CQRS ed Event Sourcing su Windows Azure: Applicazioni Distribuite, Scalabilit...CQRS ed Event Sourcing su Windows Azure: Applicazioni Distribuite, Scalabilit...
CQRS ed Event Sourcing su Windows Azure: Applicazioni Distribuite, Scalabilit...
 
Corso IFTS CyberSecurity Expert - Attacco di Armando e Operazione Black Tulip
Corso IFTS CyberSecurity Expert - Attacco di Armando e Operazione Black TulipCorso IFTS CyberSecurity Expert - Attacco di Armando e Operazione Black Tulip
Corso IFTS CyberSecurity Expert - Attacco di Armando e Operazione Black Tulip
 
Wordpress Security Regole e Plugin base per evitare l'hacking del vostro sito...
Wordpress Security Regole e Plugin base per evitare l'hacking del vostro sito...Wordpress Security Regole e Plugin base per evitare l'hacking del vostro sito...
Wordpress Security Regole e Plugin base per evitare l'hacking del vostro sito...
 
Public Key Infrastructure
Public Key InfrastructurePublic Key Infrastructure
Public Key Infrastructure
 
Ugialtnet openid presentation
Ugialtnet openid presentationUgialtnet openid presentation
Ugialtnet openid presentation
 
CCI2017 - Protect and manage your digital transformation - Giuseppe D'Osualdo...
CCI2017 - Protect and manage your digital transformation - Giuseppe D'Osualdo...CCI2017 - Protect and manage your digital transformation - Giuseppe D'Osualdo...
CCI2017 - Protect and manage your digital transformation - Giuseppe D'Osualdo...
 
Lightning saml
Lightning samlLightning saml
Lightning saml
 
Special report digital identity security
Special report digital identity securitySpecial report digital identity security
Special report digital identity security
 
AICEL_Perché Compriamo O Non Compriamo Via Web
AICEL_Perché Compriamo O Non Compriamo Via WebAICEL_Perché Compriamo O Non Compriamo Via Web
AICEL_Perché Compriamo O Non Compriamo Via Web
 
Mobile, iot e social network
Mobile, iot e social networkMobile, iot e social network
Mobile, iot e social network
 
Intelligenza Artificiale: I trend nelle applicazioni di business - Una serie ...
Intelligenza Artificiale: I trend nelle applicazioni di business - Una serie ...Intelligenza Artificiale: I trend nelle applicazioni di business - Una serie ...
Intelligenza Artificiale: I trend nelle applicazioni di business - Una serie ...
 
Presentazione corso sicurezza informatica Vicenza Software
Presentazione corso sicurezza informatica Vicenza SoftwarePresentazione corso sicurezza informatica Vicenza Software
Presentazione corso sicurezza informatica Vicenza Software
 
Web Application Insecurity L D2007
Web Application Insecurity  L D2007Web Application Insecurity  L D2007
Web Application Insecurity L D2007
 
Il Web del Futuro: Web Semantico + OpenID = Autenticazione Sicura e Web of Trust
Il Web del Futuro: Web Semantico + OpenID = Autenticazione Sicura e Web of TrustIl Web del Futuro: Web Semantico + OpenID = Autenticazione Sicura e Web of Trust
Il Web del Futuro: Web Semantico + OpenID = Autenticazione Sicura e Web of Trust
 
Corso di buon e-commerce - Centro Produttività Veneto (Vicenza)
Corso di buon e-commerce  - Centro Produttività Veneto (Vicenza)Corso di buon e-commerce  - Centro Produttività Veneto (Vicenza)
Corso di buon e-commerce - Centro Produttività Veneto (Vicenza)
 
Corso Firma Digitale Mi
Corso Firma Digitale MiCorso Firma Digitale Mi
Corso Firma Digitale Mi
 
Mean Auth Application - Speech Slides
Mean Auth Application - Speech SlidesMean Auth Application - Speech Slides
Mean Auth Application - Speech Slides
 
Company presentation
Company presentationCompany presentation
Company presentation
 
Test Driven Development @ Xe.Net
Test Driven Development @ Xe.NetTest Driven Development @ Xe.Net
Test Driven Development @ Xe.Net
 

More from Mauro Servienti

Welcome to the (state) machine @ ExploreDDD 2019
Welcome to the (state) machine @ ExploreDDD 2019Welcome to the (state) machine @ ExploreDDD 2019
Welcome to the (state) machine @ ExploreDDD 2019Mauro Servienti
 
Designing a ui for microservices @ .NET Day Switzerland 2019
Designing a ui for microservices @ .NET Day Switzerland 2019Designing a ui for microservices @ .NET Day Switzerland 2019
Designing a ui for microservices @ .NET Day Switzerland 2019Mauro Servienti
 
Welcome to the (state) machine @ Xe One Day Enterprise Applications
Welcome to the (state) machine @ Xe One Day Enterprise ApplicationsWelcome to the (state) machine @ Xe One Day Enterprise Applications
Welcome to the (state) machine @ Xe One Day Enterprise ApplicationsMauro Servienti
 
All our aggregates are wrong @ NDC Copenhagen 2019
All our aggregates are wrong @ NDC Copenhagen 2019All our aggregates are wrong @ NDC Copenhagen 2019
All our aggregates are wrong @ NDC Copenhagen 2019Mauro Servienti
 
Be like water, my friend @ Agile for Innovation 2019
Be like water, my friend @ Agile for Innovation 2019Be like water, my friend @ Agile for Innovation 2019
Be like water, my friend @ Agile for Innovation 2019Mauro Servienti
 
Microservices architecture is it the right choice to design long-living syste...
Microservices architecture is it the right choice to design long-living syste...Microservices architecture is it the right choice to design long-living syste...
Microservices architecture is it the right choice to design long-living syste...Mauro Servienti
 
Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019
Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019
Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019Mauro Servienti
 
Living organizations, particular software @ do IT Better Parma
Living organizations, particular software @ do IT Better ParmaLiving organizations, particular software @ do IT Better Parma
Living organizations, particular software @ do IT Better ParmaMauro Servienti
 
Welcome to the (state) machine @ Crafted Software
Welcome to the (state) machine @ Crafted SoftwareWelcome to the (state) machine @ Crafted Software
Welcome to the (state) machine @ Crafted SoftwareMauro Servienti
 
PO is dead, long live the PO - Italian Agile Day 2018
PO is dead, long live the PO - Italian Agile Day 2018PO is dead, long live the PO - Italian Agile Day 2018
PO is dead, long live the PO - Italian Agile Day 2018Mauro Servienti
 
Design a UI for your Microservices @ Do IT Better
Design a UI for your Microservices @ Do IT BetterDesign a UI for your Microservices @ Do IT Better
Design a UI for your Microservices @ Do IT BetterMauro Servienti
 
Microservices and pineapple on pizza what do they have in common - dos and ...
Microservices and pineapple on pizza   what do they have in common - dos and ...Microservices and pineapple on pizza   what do they have in common - dos and ...
Microservices and pineapple on pizza what do they have in common - dos and ...Mauro Servienti
 
All our aggregates are wrong (ExploreDDD 2018)
All our aggregates are wrong (ExploreDDD 2018)All our aggregates are wrong (ExploreDDD 2018)
All our aggregates are wrong (ExploreDDD 2018)Mauro Servienti
 
Designing a ui for microservices
Designing a ui for microservicesDesigning a ui for microservices
Designing a ui for microservicesMauro Servienti
 
Po is dead, long live the po
Po is dead, long live the poPo is dead, long live the po
Po is dead, long live the poMauro Servienti
 
Shipping code is not the problem, deciding what to ship it is!
Shipping code is not the problem, deciding what to ship it is!Shipping code is not the problem, deciding what to ship it is!
Shipping code is not the problem, deciding what to ship it is!Mauro Servienti
 
GraphQL - Where are you from? Where are you going?
GraphQL - Where are you from? Where are you going?GraphQL - Where are you from? Where are you going?
GraphQL - Where are you from? Where are you going?Mauro Servienti
 
Dall'idea al deploy un lungo viaggio che passa per git flow e semver
Dall'idea al deploy   un lungo viaggio che passa per git flow e semverDall'idea al deploy   un lungo viaggio che passa per git flow e semver
Dall'idea al deploy un lungo viaggio che passa per git flow e semverMauro Servienti
 
Progettare una UI per i Microservices
Progettare una UI per i MicroservicesProgettare una UI per i Microservices
Progettare una UI per i MicroservicesMauro Servienti
 
The road to a Service Oriented Architecture is paved with messages
The road to a Service Oriented Architecture is paved with messagesThe road to a Service Oriented Architecture is paved with messages
The road to a Service Oriented Architecture is paved with messagesMauro Servienti
 

More from Mauro Servienti (20)

Welcome to the (state) machine @ ExploreDDD 2019
Welcome to the (state) machine @ ExploreDDD 2019Welcome to the (state) machine @ ExploreDDD 2019
Welcome to the (state) machine @ ExploreDDD 2019
 
Designing a ui for microservices @ .NET Day Switzerland 2019
Designing a ui for microservices @ .NET Day Switzerland 2019Designing a ui for microservices @ .NET Day Switzerland 2019
Designing a ui for microservices @ .NET Day Switzerland 2019
 
Welcome to the (state) machine @ Xe One Day Enterprise Applications
Welcome to the (state) machine @ Xe One Day Enterprise ApplicationsWelcome to the (state) machine @ Xe One Day Enterprise Applications
Welcome to the (state) machine @ Xe One Day Enterprise Applications
 
All our aggregates are wrong @ NDC Copenhagen 2019
All our aggregates are wrong @ NDC Copenhagen 2019All our aggregates are wrong @ NDC Copenhagen 2019
All our aggregates are wrong @ NDC Copenhagen 2019
 
Be like water, my friend @ Agile for Innovation 2019
Be like water, my friend @ Agile for Innovation 2019Be like water, my friend @ Agile for Innovation 2019
Be like water, my friend @ Agile for Innovation 2019
 
Microservices architecture is it the right choice to design long-living syste...
Microservices architecture is it the right choice to design long-living syste...Microservices architecture is it the right choice to design long-living syste...
Microservices architecture is it the right choice to design long-living syste...
 
Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019
Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019
Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019
 
Living organizations, particular software @ do IT Better Parma
Living organizations, particular software @ do IT Better ParmaLiving organizations, particular software @ do IT Better Parma
Living organizations, particular software @ do IT Better Parma
 
Welcome to the (state) machine @ Crafted Software
Welcome to the (state) machine @ Crafted SoftwareWelcome to the (state) machine @ Crafted Software
Welcome to the (state) machine @ Crafted Software
 
PO is dead, long live the PO - Italian Agile Day 2018
PO is dead, long live the PO - Italian Agile Day 2018PO is dead, long live the PO - Italian Agile Day 2018
PO is dead, long live the PO - Italian Agile Day 2018
 
Design a UI for your Microservices @ Do IT Better
Design a UI for your Microservices @ Do IT BetterDesign a UI for your Microservices @ Do IT Better
Design a UI for your Microservices @ Do IT Better
 
Microservices and pineapple on pizza what do they have in common - dos and ...
Microservices and pineapple on pizza   what do they have in common - dos and ...Microservices and pineapple on pizza   what do they have in common - dos and ...
Microservices and pineapple on pizza what do they have in common - dos and ...
 
All our aggregates are wrong (ExploreDDD 2018)
All our aggregates are wrong (ExploreDDD 2018)All our aggregates are wrong (ExploreDDD 2018)
All our aggregates are wrong (ExploreDDD 2018)
 
Designing a ui for microservices
Designing a ui for microservicesDesigning a ui for microservices
Designing a ui for microservices
 
Po is dead, long live the po
Po is dead, long live the poPo is dead, long live the po
Po is dead, long live the po
 
Shipping code is not the problem, deciding what to ship it is!
Shipping code is not the problem, deciding what to ship it is!Shipping code is not the problem, deciding what to ship it is!
Shipping code is not the problem, deciding what to ship it is!
 
GraphQL - Where are you from? Where are you going?
GraphQL - Where are you from? Where are you going?GraphQL - Where are you from? Where are you going?
GraphQL - Where are you from? Where are you going?
 
Dall'idea al deploy un lungo viaggio che passa per git flow e semver
Dall'idea al deploy   un lungo viaggio che passa per git flow e semverDall'idea al deploy   un lungo viaggio che passa per git flow e semver
Dall'idea al deploy un lungo viaggio che passa per git flow e semver
 
Progettare una UI per i Microservices
Progettare una UI per i MicroservicesProgettare una UI per i Microservices
Progettare una UI per i Microservices
 
The road to a Service Oriented Architecture is paved with messages
The road to a Service Oriented Architecture is paved with messagesThe road to a Service Oriented Architecture is paved with messages
The road to a Service Oriented Architecture is paved with messages
 

Single Sign On con IdentityServer

  • 1. 18 Novembre 2016 Single Sign On con Identity Server Mauro Servienti
  • 2. A volte ritornano ho fatto una sessione simile la prima volta a Windows Developer Conference nel 2012
  • 3. Mauro Servienti appassionato di cibo e sport lo sport è in funzione del cibo la tecnologia mi annoia Dicono di me: era un bravo programmatore (cit. Ema) pretend to be an architect
  • 4. Coming out ho un biglietto per i Depeche e ho appena visto i Cure
  • 5. Sicurezza, ovunque sicurezza. Torniamo seri che la sicurezza è importante
  • 6. …e Trenitalia non sa cosa sia. Password in chiaro, case insentive. #ciaone
  • 7. Autenticazione e Autorizzazione • Autenticazione: verifica che siate chi dite di essere • Ad esempio tramite una combinazione di Username e Password • Autorizzazione: verifica che possiate fare quello che cercate di fare • Ad esempio tramite ruoli e claim
  • 8. «claim» questi sconosciuti • Abbiamo sempre pensato in termini di Gruppi/ACL • .NET ha introdotto nel 2001 i «ruoli» • Mai decisione fu più nefasta :-) • Finalmente i «claim» cercano di mettere ordine nel caos • È semplicemente un attributo dell’utente • Il nome, lo user-id, la mail, i ruoli, l’età possono essere tutti «claim» • È compito, come è ovvio che sia, del client decidere come interpretarlo
  • 9. Profiles Claims Come funziona di solito Applicazione Backend/FBA Users
  • 10. È veramente un problema nostro? • Date le seguenti «robe»: • Utenti • Claim • Profili • Ce ne dobbiamo occupare noi? • No, o meglio non proprio: • Utenti: no • Claim: probabilmente in parte • Profili: si
  • 11. Perché gli utenti no • smazzarsi la gestione sicura di username e password è noioso • Quanti di voi fanno hashing con salt random delle password? • Quanti di voi hanno il supporto per 2FA? • Quanti di voi hanno SSL EV? • Quanti di voi hanno 2FA per il cambio password? • gli utenti odiano creare un altro utente per usare un servizio • la privacy è una rottura che non volete gestire
  • 12. Perché i claim in parte si • Molti claim comuni a tanti utenti a prescindere • altri no sono peculiari • Non è quindi detto che quello che ci troviamo a disposizione basti
  • 13. Perché i profili si • Il profilo è un problema totalmente applicativo • Un «utente», inteso come user, rappresenta l’utente in generale • Un profilo rappresenta un utente nel contesto applicativo
  • 14. la federazione It’s a long way to the top if you wanna rock ‘n’ roll…
  • 15. La federazione App Backend/FBA Trusted 3rd party STS Nonèunproblemanostro Profiles Claims Users nameidentifier nameidentifier
  • 16. STS (security token service) • Non è un problema nostro: ci limitiamo alla fiducia • Il suo unico ruolo è emettere Security Token • Tipicamente dopo aver verificato le credenziali, qualsiasi esse siano • Un Security Token: • È crittografato e firmato • La fiducia di cui sopra dice che lo possiamo spacchettare • Contiene tutte le informazioni relative all’utente
  • 17. Il flusso federato • L’utente si presenta e non è autenticato • L’applicazione lo rimbalza verso l’STS • Dandogli un token che identifica l’applicazione • Token che solo l’STS può spacchettare • L’utente si presenta all’STS con il token • L’STS a questo punto sa da dove arriva l’utente • L’utente si autentica con le sue credenziali • L’STS genera un security token valido e con una scadenza • L’utente torna dall’applicazione • L’applicazione spacchetta il security token e sa che l’utente è buono
  • 18. Applicazione Autorizzazione Applicazione Autenticazione e richiesta di accesso Generazione del Token Accesso all’API con il Token
  • 19. La federazione App Backend/FBA Trusted 3rd party STS Nonèunproblemanostro Profiles Claims Users nameidentifier nameidentifier
  • 21. Abbiamo abituato bene i nostri utenti…
  • 22. Un STS non ci basta più • Abbiamo bisogno di un ACS • Access Control Service • Fa da proxy verso uno o più STS • Noi ci fidiamo dell’ACS, lui si fida degli STS • E per proprietà transitiva siamo tutti felici • Possiamo fare self-hosting dell’ACS • APS.Net 4 lo faceva • Possiamo delegare a terze parti come l’IdentityServer di Thinktecture • Di cui a sua volta si può fare self-hosting
  • 23. FacebookGoogle Account La federazione App Backend Custom FBA Profiles IdentityServer ACS Active Directory MS Account nameidentifier Nonèunproblemanostro Twitter
  • 24. FacebookGoogle Account Ad ognuno il suo protocollo Custom FBA IdentityServer ACS Active Directory MS Account Twitter
  • 25. Applicazione Autorizzazione Applicazione Autenticazione e richiesta di accesso Generazione del Token Accesso all’API con il Token Azure ACS Autenticazione Consenso Codice di Accesso Codice di Accesso
  • 26. Ma non è così semplice
  • 27. Lei e lui • Gli attori sono due • Utente • ApplicazioneUtente Applicazione STS/ACS
  • 28. Lei, lui e l’altra • Gli attori sono tre • Utente • Applicazione • API • L’utente vuole accedere all’API • Attraverso l’applicazione • Una SPA deve funzionare così • Tipicamente si parla di OAuth Utente Applicazione STS/ACS API
  • 29. OAuth Una piccola nota di redazione…
  • 30. The problem is that OAuth 2.0 is a Delegated Authorization protocol, and not a Authentication protocol. ... OAuth provides an access token to a client, so that it can access a protected resource, based on the permission of the resource owner. Fonte: http://www.thread-safe.com/2012/01/problem-with-oauth-for-authentication.html
  • 31. Demo
  • 32. Grazie Mauro Servienti Solution Architect @ Particular Software | @mauroservienti | //blogs.ugidotnet.org/topics/