SlideShare a Scribd company logo
Authentication and Authorisation in
Microservice Systems
David Borsos
Authentication and Authorisation in
Microservice Systems
David Borsos
End-user
Authentication and Authorisation in
Microservice Systems
David Borsos
Introduction
David Borsos
With OpenCredo since 2013
Working on microservices since then
Email: david.borsos@opencredo.com
Twitter: @davib0
http://www.opencredo.com
Why?
Traditional “monolithic” architecture
Traditional “monolithic” architecture
Traditional “monolithic” architecture
μServices!
μServices!
● Composing functionality
● Self-contained services
● “Bounded context”
● Independent scaling
● Independent deployment
○ Containers
○ Schedulers
■ Kubernetes
■ Mesos + Marathon
μServices
μServices - Let’s try the same pattern
μServices - Let’s try the same pattern
Problem #1 - shared user database
μServices are distributed
μServices
Problem #1 - shared user database
μServices
Problem #1 - shared user database
Solution #1 - distribute!
μServices
Problem #1 - shared user database
Solution #1 - distribute!
Problem #2 - who owns the credentials?
Single Responsibility
μServices
Problem #1 - shared user database
Solution #1 - distribute!
Problem #2 - who owns the credentials?
μServices
Problem #1 - shared user database
Solution #1 - distribute!
Problem #2 - who owns the credentials?
Solution #2 - Authentication Service
μServices
Problem #1 - shared user database
Solution #1 - distribute!
Problem #2 - who owns the credentials?
Solution #2 - Authentication Service
Problem #3 - switching services
Authenticate every time?
Obviously not
Transparency
vs.
μServices - what do we want?
● “Secure”
○ Security is complex (Nicki’s talk)
○ Client-side
○ Sharing secrets?
● Stateless services
○ Multiple instances
● No single point of failure
○ On every request
μServices
1. Use SSO solutions
2. Distributed session
3. Client-side token
4. Client-side token + API Gateway
1.Using SSO
Detour: how do these work?
SSO mechanism
1. User requests access
2. Not authenticated
3. User authenticates with SSO Server
4. Authentication successful, grant token
5. User uses token
6. Application uses token to get user details
7. Auth Server returns details
+1 Auth server maintains global “login”
+2 μServices maintain local “login”
Using SSO solutions
● SSO “login” state is usually opaque
● SSO Service becomes SPOF
● Chatty traffic
● Every switch potentially requires SSO
○ Optimise with local “login” caching
Using SSO solutions
Security As good as the chosen SSO ✔
Secret sharing No ✔
Statelessness Relies on HTTP sessions ✘
SPOF @ service switch Authentication server ✘
Bottlenecks Authentication server (switch only) !
Transparent Yes ✔
Logout Complex ✘
Technologies CAS, OAuth2* ✔
Integration Good library support ✔
Implementation Fairly high complexity ✘
2. Distributed sessions
Distributed sessions
1. User requests access
2. Not authenticated
3. User authenticates with Auth Service
4. Authentication successful
a. Write state to distributed Session Store
i. User X is logged in
ii. Sets TTL
b. Sets Session ID on client side
5. User uses Session ID
Distributed sessions
Security Opaque, rotatable Session ID ✔
Secret sharing Access to session store ✘
Statelessness Shared state ✔
SPOF @ service switch Session store* !
Bottlenecks Session store (every request) ✘
Transparent Yes ✔
Logout Trivial - delete shared session ✔
Technologies Redis, Cassandra, Hazelcast, Riak ✘
Integration Custom implementation ✘
Implementation Medium/High complexity !
3. Client-side tokens
Client side tokens
1. User requests access
2. Not authenticated
3. User authenticates with Auth Server
4. Authentication successful
a. Set ID token on the client side
i. Self-contained
ii. Signed
iii. TTL
5. Services understand ID token
Detour: JSON Web Tokens (JWT)
JWT
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzd
WIiOiJteVVzZXJJZCIsIm5hbWUiOiJKb2huIERv
ZSJ9.00q6RI76-
oOyQIoshomTVIfmebQPGoDV2znTErEJjjo
Header
{
"alg": "HS256",
"typ": "JWT"
}
Body
{
"sub": "myUserId",
"name": "John Doe"
}
Signature
JWT
● Standard
● Simple
● Extensible
● Can use a variety of signatures (SHA or RSA)
● Good library support
● Symmetric or Public/Private key signatures
● http://jwt.io
Client side tokens
1. User requests access
2. Not authenticated
3. User authenticates with Auth Server
4. Authentication successful
a. Set ID token on the client side
i. Self-contained
ii. Signed
iii. TTL
5. Services understand ID token
But wait...
...token is valid until TTL...
...and μServices accept it...
… so, logout?
Client-side tokens: Logout
● Remove token from client-side store
● Periodically check with Auth Service (“renew token”)
● CRL-style revocation
○ Maintain list of revoked tokens
○ Distribute list across μServices (messaging middleware)
● Use short-lived (15m) tokens
Client-side tokens
Security Potentially exposing User IDs !
Secret sharing Depends on signature algorithm !
Statelessness Completely stateless ✔
SPOF @ service switch None ✔
Bottlenecks None ✔
Transparent Yes ✔
Logout Complex* (for server-side) !
Technologies JWT, OpenID Connect ✔
Integration Good library support ✔
Implementation Simple ✔
4. Client-side tokens
+
API Gateway
Client-side tokens + API Gateway
1. User requests access
2. Not authenticated
3. User authenticates with Auth Server
4. Authentication successful
a. Set ID token on the client side
i. Self-contained
ii. Signed
iii. TTL
5. API Gateway translates to opaque token
API Gateways
● Proxying all user-facing communication
● Fairly simple
● Needs data store
● Not a distributed session
○ μServices don’t interact with token store
○ μServices are not API Gateway-aware
● Logout
○ Revoke tokens in API Gateway’s token store
Client-side tokens + API Gateway
Security Opaque, rotatable Session ID ✔
Secret sharing Depends on signature algorithm !
Statelessness Some state held in API GW !
SPOF @ service switch None ✔
Bottlenecks API Gateway !
Transparent Yes ✔
Logout Trivial ✔
Technologies JWT, nginx, distributed DB, Kong !
Integration Good library support ✔
Implementation Fairly high complexity ✘
Summary
SSO Distributed Session JWT API GW
Security ✔ ✔ ! ✔
Secret sharing ✔ ✘ ! !
Statelessness ✘ ✔ ✔ !
SPOF @
service switch
✘ ! ✔ ✔
Bottlenecks ! ✘ ✔ !
Transparent ✔ ✔ ✔ ✔
Logout ✘ ✔ ! ✔
Technologies ✔ ✘ ✔ !
Integration ✔ ✘ ✔ ✔
Implementation ✘ ! ✔ ✘
Email: david.borsos@opencredo.com
Twitter: @davib0
http://www.opencredo.com
Questions?

More Related Content

PDF
API Gateway How-To: The Many Ways to Apply the Gateway Pattern
PDF
muCon 2016: Authentication in Microservice Systems By David Borsos
PDF
Demystifying SAML 2.0,Oauth 2.0, OpenID Connect
PDF
SAML VS OAuth 2.0 VS OpenID Connect
PPTX
MTLS - Securing Microservice Architecture with Mutual TLS Authentication
PPT
Intro to Amazon S3
PPTX
Monoliths and Microservices
PPTX
How to Move from Monitoring to Observability, On-Premises and in a Multi-Clou...
API Gateway How-To: The Many Ways to Apply the Gateway Pattern
muCon 2016: Authentication in Microservice Systems By David Borsos
Demystifying SAML 2.0,Oauth 2.0, OpenID Connect
SAML VS OAuth 2.0 VS OpenID Connect
MTLS - Securing Microservice Architecture with Mutual TLS Authentication
Intro to Amazon S3
Monoliths and Microservices
How to Move from Monitoring to Observability, On-Premises and in a Multi-Clou...

What's hot (20)

PPTX
Amazon SQS overview
PPTX
What is an API Gateway?
PPTX
Stability Patterns for Microservices
PDF
Az 104 session 2 implement and manage azure webapps and container
PPTX
Azure Key Vault - Getting Started
PPTX
Microservices Security
PPTX
AWS Cloud Watch
ODP
OAuth2 - Introduction
PDF
Az 104 session 4: azure storage
PPTX
Azure WAF
PPT
Secure code practices
PDF
The basics of fluentd
PPTX
Azure Messaging Services #1
PDF
Practical DevSecOps: Fundamentals of Successful Programs
PDF
Api Gateway
PDF
Apache NiFi SDLC Improvements
PPTX
Introduction to microservices
PDF
Monoliths to microservices workshop
PPTX
Microservices in the Apache Kafka Ecosystem
Amazon SQS overview
What is an API Gateway?
Stability Patterns for Microservices
Az 104 session 2 implement and manage azure webapps and container
Azure Key Vault - Getting Started
Microservices Security
AWS Cloud Watch
OAuth2 - Introduction
Az 104 session 4: azure storage
Azure WAF
Secure code practices
The basics of fluentd
Azure Messaging Services #1
Practical DevSecOps: Fundamentals of Successful Programs
Api Gateway
Apache NiFi SDLC Improvements
Introduction to microservices
Monoliths to microservices workshop
Microservices in the Apache Kafka Ecosystem
Ad

Viewers also liked (20)

PPTX
An Authentication and Authorization Architecture for a Microservices World
PDF
Stateless authentication for microservices
PDF
OAuth and OpenID Connect for Microservices
PDF
Stateless authentication for microservices - Spring I/O 2015
PDF
Evolving Project Management: from the sin to the virtue by Antonio Cobo
PDF
Stateless authentication for microservices - GR8Conf 2015
PDF
ServerlessConf: Serverless for the Enterprise - Rafal Gancarz
PDF
Stateless authentication with OAuth 2 and JWT - JavaZone 2015
PDF
QCON London 2017 - Monitoring Serverless Architectures by Rafal Gancarz
PDF
Microservices Manchester: Microservices and Macro-Economics - A Shorty Histor...
PDF
GOTO LONDON 2016: Concursus Event sourcing Evolved (Updated)
PDF
Haufe #msaday - Seven More Deadly Sins of Microservices by Daniel Bryant
PDF
Voxxed Bristol 2017 - From C to Q, one event at a time: Event Sourcing illust...
PDF
Vault: Beyond secret storage - Using Vault to harden your infrastructure
PDF
Reactive Microservices By Lorenzo Nicora
PPTX
O'Reilly 2016: "Continuous Delivery with Containers: The Trials and Tribulati...
PDF
Microservices Manchester: Security, Microservces and Vault by Nicki Watt
PDF
Haufe #msaday - Building a Microservice Ecosystem by Daniel Bryant
PDF
High Load Strategy 2016 - Project Management: from Stone Age to DevOps
PDF
A Visual Introduction to Event Sourcing and CQRS by Lorenzo Nicora
An Authentication and Authorization Architecture for a Microservices World
Stateless authentication for microservices
OAuth and OpenID Connect for Microservices
Stateless authentication for microservices - Spring I/O 2015
Evolving Project Management: from the sin to the virtue by Antonio Cobo
Stateless authentication for microservices - GR8Conf 2015
ServerlessConf: Serverless for the Enterprise - Rafal Gancarz
Stateless authentication with OAuth 2 and JWT - JavaZone 2015
QCON London 2017 - Monitoring Serverless Architectures by Rafal Gancarz
Microservices Manchester: Microservices and Macro-Economics - A Shorty Histor...
GOTO LONDON 2016: Concursus Event sourcing Evolved (Updated)
Haufe #msaday - Seven More Deadly Sins of Microservices by Daniel Bryant
Voxxed Bristol 2017 - From C to Q, one event at a time: Event Sourcing illust...
Vault: Beyond secret storage - Using Vault to harden your infrastructure
Reactive Microservices By Lorenzo Nicora
O'Reilly 2016: "Continuous Delivery with Containers: The Trials and Tribulati...
Microservices Manchester: Security, Microservces and Vault by Nicki Watt
Haufe #msaday - Building a Microservice Ecosystem by Daniel Bryant
High Load Strategy 2016 - Project Management: from Stone Age to DevOps
A Visual Introduction to Event Sourcing and CQRS by Lorenzo Nicora
Ad

Similar to Microservices Manchester: Authentication in Microservice Systems by David Borsos (20)

PDF
Authentication in microservice systems
PDF
Talk Microservices to Me: The Role of IAM in Microservice Architecture
PDF
API Security In Cloud Native Era
PDF
Eliminating Secret Sprawl in the Cloud with HashiCorp Vault - 07.11.2018
PDF
Using MCollective with Chef - cfgmgmtcamp.eu 2014
PDF
apidays LIVE Australia 2021 - Levelling up database security by thinking in A...
PDF
DCEU 18: From Monolith to Microservices
PDF
#MFSummit2016 Secure: Is your mainframe less secure than your fileserver
PPTX
Service Mesh CTO Forum (Draft 3)
PPTX
HTTP Services & REST API Security
PDF
Security Considerations for Microservices and Multi cloud
PDF
[WSO2Con Asia 2018] Talk Microservices to Me: The Role of IAM in Microservice...
PPTX
.NET microservices with Azure Service Fabric
PDF
Introduction-to-Service-Mesh-with-Istio-and-Kiali-OSS-Japan-July-2019.pdf
PDF
Introduction-to-Service-Mesh-with-Istio-and-Kiali-OSS-Japan-July-2019.pdf
PDF
SFScon 2020 - Alex Lanz Martin Malfertheiner - OAuth2 OpenID
PDF
Luniverse Partners Day - Jay
PDF
Building a secure BFF at Postman
PPTX
cookie attributes and tokens,jwt tokens1.ppt
PDF
Microservices
Authentication in microservice systems
Talk Microservices to Me: The Role of IAM in Microservice Architecture
API Security In Cloud Native Era
Eliminating Secret Sprawl in the Cloud with HashiCorp Vault - 07.11.2018
Using MCollective with Chef - cfgmgmtcamp.eu 2014
apidays LIVE Australia 2021 - Levelling up database security by thinking in A...
DCEU 18: From Monolith to Microservices
#MFSummit2016 Secure: Is your mainframe less secure than your fileserver
Service Mesh CTO Forum (Draft 3)
HTTP Services & REST API Security
Security Considerations for Microservices and Multi cloud
[WSO2Con Asia 2018] Talk Microservices to Me: The Role of IAM in Microservice...
.NET microservices with Azure Service Fabric
Introduction-to-Service-Mesh-with-Istio-and-Kiali-OSS-Japan-July-2019.pdf
Introduction-to-Service-Mesh-with-Istio-and-Kiali-OSS-Japan-July-2019.pdf
SFScon 2020 - Alex Lanz Martin Malfertheiner - OAuth2 OpenID
Luniverse Partners Day - Jay
Building a secure BFF at Postman
cookie attributes and tokens,jwt tokens1.ppt
Microservices

More from OpenCredo (16)

PDF
Webinar - Design Thinking for Platform Engineering
PDF
MuCon 2019: Exploring Your Microservices Architecture Through Network Science...
PDF
Goto Chicago; Journeys To Cloud Native Architecture: Sun, Sea And Emergencies...
PPTX
Mucon 2018: Heuristics for Identifying Microservice Boundaries By Erich Eichi...
PDF
Journeys To Cloud Native Architecture: Sun, Sea And Emergencies - Nicki Watt
PDF
Machine Learning Game Changer for IT - Maartens Lourens
PDF
Kafka Summit 2018: A Journey Building Kafka Connectors - Pegerto Fernandez
PDF
MuCon 2017: A not So(A) Trivial Question by Tareq Abedrabbo
PDF
DevOpsCon Berlin 2017: Project Management from Stone Age to DevOps By Antoni...
PDF
Hashidays London 2017 - Evolving your Infrastructure with Terraform By Nicki ...
PDF
Succeeding with DevOps Transformation - Rafal Gancarz
PDF
Progscon 2017: Serverless Architectures - Rafal Gancarz
PDF
London Hashicorp Meetup #8 - Testing Programmable Infrastructure By Matt Long
PDF
Haufe #msaday - The Actor model: an alternative approach to concurrency By Lo...
PPTX
ThingMonk 2016 - Concursus Event sourcing for the IOT By Tareq Abedrabbo & Do...
PDF
Spring Boot Microservices vs Akka Actor Cluster
Webinar - Design Thinking for Platform Engineering
MuCon 2019: Exploring Your Microservices Architecture Through Network Science...
Goto Chicago; Journeys To Cloud Native Architecture: Sun, Sea And Emergencies...
Mucon 2018: Heuristics for Identifying Microservice Boundaries By Erich Eichi...
Journeys To Cloud Native Architecture: Sun, Sea And Emergencies - Nicki Watt
Machine Learning Game Changer for IT - Maartens Lourens
Kafka Summit 2018: A Journey Building Kafka Connectors - Pegerto Fernandez
MuCon 2017: A not So(A) Trivial Question by Tareq Abedrabbo
DevOpsCon Berlin 2017: Project Management from Stone Age to DevOps By Antoni...
Hashidays London 2017 - Evolving your Infrastructure with Terraform By Nicki ...
Succeeding with DevOps Transformation - Rafal Gancarz
Progscon 2017: Serverless Architectures - Rafal Gancarz
London Hashicorp Meetup #8 - Testing Programmable Infrastructure By Matt Long
Haufe #msaday - The Actor model: an alternative approach to concurrency By Lo...
ThingMonk 2016 - Concursus Event sourcing for the IOT By Tareq Abedrabbo & Do...
Spring Boot Microservices vs Akka Actor Cluster

Recently uploaded (20)

PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
A Presentation on Artificial Intelligence
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPT
Teaching material agriculture food technology
PDF
Approach and Philosophy of On baking technology
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Modernizing your data center with Dell and AMD
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
KodekX | Application Modernization Development
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Encapsulation theory and applications.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Electronic commerce courselecture one. Pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
CIFDAQ's Market Insight: SEC Turns Pro Crypto
20250228 LYD VKU AI Blended-Learning.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Spectral efficient network and resource selection model in 5G networks
NewMind AI Monthly Chronicles - July 2025
Diabetes mellitus diagnosis method based random forest with bat algorithm
A Presentation on Artificial Intelligence
Mobile App Security Testing_ A Comprehensive Guide.pdf
Teaching material agriculture food technology
Approach and Philosophy of On baking technology
“AI and Expert System Decision Support & Business Intelligence Systems”
Modernizing your data center with Dell and AMD
Understanding_Digital_Forensics_Presentation.pptx
KodekX | Application Modernization Development
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Encapsulation theory and applications.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Electronic commerce courselecture one. Pdf

Microservices Manchester: Authentication in Microservice Systems by David Borsos