SlideShare a Scribd company logo
Complex architectures for
authentication and authorization
on AWS
Boyan Dimitrov
Director Platform Engineering @ Sixt @nathariel
September 2019
Our Focus Today
Service
?
Authenticate
& Authorize
• Key patterns for authentication
and authorization
- Client to service
- Service to service
- Service to Infra
• Focusing on the application and
more complex microservices
environments
Our Focus Today
Service
?
Authenticate
& Authorize
Service
Service
Autenticate
& Authorize
Service
Service
Service
IdP
Autenticate
& Authorize
Before we begin: The Foundations
OIDC ( OpenID Connect ) - a protocol
for Authentication built on top of
OAuth 2.0
OAUTH 2.0 –
a protocol for Authorization
Before we begin: AWS Cognito
AWS Cognito
User Pools
AWS Cognito
Federated Identities
Identity providers
Social Identity Providers
Other Identity Providers
SAML
OIDC
S3
EC2
Federate
AuthorizeFederate
Tip #1
If you are starting a new project on AWS involving
auth and you need IdP, Use Cognito
Client to service auth
Auth primer
Mobile
Client
Amazon API Gateway
Custom Authorizer
Amazon Cognito
1. Authenticate via
credentials
Service
2. Receive JWT
3. Invoke API with JWT
4. Validate JWT
6a. Check token scope
5. Return validity
6b. Invoke custom auth
function
Auth Service
7. Forward request
We live in a complex world…
Amazon API Gateway
Amazon Cognito
Service
Service
Service
Service
Service
Service Service
Service
Service
On-Prem
auth
auth
auth
auth
auth
auth
auth
Elastic Load Balancer
• I already have a / multiple IdPs, how to integrate all of that ?
• Where do we do authentication & token validation in a heterogeneous
environment with various ingress points ?
• How do we do authorization and on what level ?
• What about service to service auth?
• What about infrastructure auth ?
Auth challenges in complex architectures
Tip #2
Consider IdP Federation to simplify your problem
Authentication: Common Identity Format
Amazon Cognito
Internal Perimeter
SAML
OIDC
federate
Standard
Access Token
External Perimeter
Service Service Service Service
Authenticate
Define your authorization strategy
ACL MAC DAC RBAC ADAC PBAC …
Tip #3
If Authorization requirements are unclear, start
with RBAC and complicate as needed
ACL MAC DAC RBAC ADAC PBAC …
RBAC Authorization
Primer
Service Service Service Service
Amazon Cognito
Internal Perimeter
SAML
OIDC
External Perimeter
{
"name": "John Doe",
"email": "john.doe@foo.com",
"roles": ["finance_controller"]
…
}
If role ==„finance_controller“...
X
Amazon API Gateway
Tip #4
Do not embed volatile business roles into your
applications – implement access controls around
service capabilities instead
Delegate auth to a central auth service
User Service
POST /users
GET /users/<id>
PUT /users/<id>
DELETE /users/<id>
API Contract
Associated Permissions
users:create:any
users:read:any
users:read:own
users:update:any
users:update:own
users:delete:own
users:delete:any
{
"name": "John Doe",
"email": "john.doe @foo.com",
"roles": ["finance_controller"],
“user_id": 343242,
…
}
Auth
Service
GET /users/343242
finance_controller -> users:read:own
Role Permission
Authorised?
Centralised Auth Service
User Service
Auth
Service
Advantages
• Externalised auth decisions and
business roles management
• Easier to manage and change
• Single source of truth
Disadvantages
• Another synchronous dependency
• Additional latency
• Single point of failure?
• Manual effort in keeping permissions up to date
Centralised Auth Service Optimisations: automate permission
discovery
User ServiceAuth
Service
Associated Permissions
users:create:any
users:read:any
users:read:own
users:update:any
users:update:own
users:delete:own
users:delete:any
Register permissions on startup
Service:Permissions Map
com.x.service.user users:create:any
com.x.service.user users:read:any
com.x.service.user users:read:own
com.x.service.user users:update:any
com.x.service.user users:update:own
com.x.service.user users:delete:own
com.x.service.user users:delete:any
Centralised Auth Service Optimisations: caching associated roles
Associated Permissions
users:create:any
users:read:any
users:read:own
users:update:any
users:update:own
users:delete:own
users:delete:any
User ServiceAuth
Service
finance_controller -> com.x.service.user users:read:own
Role Permission
Centralised Auth Service Optimisations: caching associated roles
Associated Permissions and Roles
users:create:any
users:read:any
finance_controller -> users:read:own
users:update:any
users:update:all
users:delete:own
users:delete:any
finance_controller ALLOW com.x.service.user users:read:own
Role Permission
1. On Startup user service caches relevant
roles for its permissions
2. Receive live updates during runtime
User ServiceAuth
Service
Centralised Auth Service Optimisations: caching auth result
User Service
Auth
Service
Associated Permissions
users:create:any
users:read:any
users:read:own
users:update:any
users:update:all
users:delete:own
users:delete:any
{
"name": "John Doe",
"email": "john.doe @foo.com",
"roles": ["finance_controller"],
“user_id": 343242,
“jti“: 21312e1d123
…
}
User Service
Auth
Service
1. Authorize operation
2. Cache authorization response
with TTL
Permissions and Cached Policy Result
users:create:any
users:read:any
21312e1d123 -> users:read:own
users:update:any
users:update:all
users:delete:own
users:delete:any
{
"name": "John Doe",
"email": "john.doe @foo.com",
"roles": ["finance_controller"],
“user_id": 343242,
“jti“: 21312e1d123
…
}
Centralised Auth Service Optimisations: caching auth result
Bonus: Local token validation
User Service
Cache the access token JWK
for local validation
Amazon Cognito
{
"name": "John Doe",
"email": "john.doe @foo.com",
"roles": ["finance_controller"],
…
“kid": "5689example"
}
{
“keys": [{
“kid": "5689example",
“alg": "RS256"
}, {
…
}]}
Authorization
Service Service Service Service
Amazon Cognito
Internal Perimeter
SAML
OIDC
External Perimeter
Auth Service
“Decentralised“ authorisation
Centralised Auth Service
User Service
Auth
Service
Advantages
• Externalised auth decisions and
business roles management
• Easier to manage and change
• Single source of truth
• Decentralised token validation and auth
Disadvantages
• Another synchronous dependency
• Additional latency
• Single point of failure?
• Manual effort in keeping permissions up to date
DEMO
Demo Architecture
Auth Service Hello World Service
Amazon Cognito
User Pool
Register a user & Authenticate
Authorize hello request
• Automated permission registration
• Auth rules caching
• Decentralised authorization
• Local token validation
Fetch IdP JWK
Demo WebappAdmin Webapp
Manage Permissions
So far we covered…
Service
?
Authenticate
& Authorize
Service
Service
Autenticate
& Authorize
Service
Service
Service
IdP
Autenticate
& Authorize
Service 2 Service Auth
Why do we need S2S Auth?
• Authorize service calls without user context ( batch jobs, async operations..)
• Protect applications storing senstive information for internal actors too
• Multi-tenant environments
Service to service auth
User Service
Amazon Cognito
Email Service
1. Auth using creds
{
“service":“com.x.service.user,
…
}
Auth Service
com.x.service.user ALLOW com.x.service.email email:send:any
Service Permission
2. Get an identitiy
3. Send identity token with
requests
Tip #5
Give identity to your applications and automate
the credential management!
Client 2 Service and Service 2 Service Auth
Service Service Service Service
Amazon Cognito
Internal Perimeter
SAML
OIDC
External Perimeter
Auth Service
S3
?
(AWS) Infra Auth
Cognito Federated Identities to the rescue
User Service
Amazon Cognito
User Pool
Amazon Cognito
Identity Federation
1. Get Identity
Token
2. Exchange
Token for
IAM
Creds
3. Access AWS
Services
That’s all
Service
?
Authenticate
& Authorize
Service
Service
Autenticate
& Authorize
Service
Service
Service
IdP
Autenticate
& Authorize
Thank you!

More Related Content

PDF
Designing APIs with OpenAPI Spec
PDF
OAuth 2.0
PPTX
Intro to OAuth2 and OpenID Connect
PDF
Amazon Cognito를 활용한 모바일 인증 및 보안, 자원 접근 제어 기법 - AWS Summit Seoul 2017
PDF
Writing REST APIs with OpenAPI and Swagger Ada
PDF
Security enforcement of Java Microservices with Apiman & Keycloak
PDF
OpenAPI 3.0, And What It Means for the Future of Swagger
PDF
OpenID Connect Explained
Designing APIs with OpenAPI Spec
OAuth 2.0
Intro to OAuth2 and OpenID Connect
Amazon Cognito를 활용한 모바일 인증 및 보안, 자원 접근 제어 기법 - AWS Summit Seoul 2017
Writing REST APIs with OpenAPI and Swagger Ada
Security enforcement of Java Microservices with Apiman & Keycloak
OpenAPI 3.0, And What It Means for the Future of Swagger
OpenID Connect Explained

What's hot (20)

PDF
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
PPT
OAuth 2.0 and OpenId Connect
PPTX
Api Testing
PDF
OPA: The Cloud Native Policy Engine
PDF
Real Life Clean Architecture
PPTX
An introduction to OAuth 2
PDF
Api Gateway
ODP
Kong API Gateway
PPTX
Spring Security 5
PPSX
Rest api standards and best practices
PPTX
PDF
Microservices Design Patterns | Edureka
PDF
Spring Data JPA from 0-100 in 60 minutes
PPTX
OpenID Connect: An Overview
PDF
Secure your SPA with Auth0
PPTX
OAuth2 + API Security
PDF
API Trends & Use Cases
PDF
OPA open policy agent
PPTX
Api-First service design
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
OAuth 2.0 and OpenId Connect
Api Testing
OPA: The Cloud Native Policy Engine
Real Life Clean Architecture
An introduction to OAuth 2
Api Gateway
Kong API Gateway
Spring Security 5
Rest api standards and best practices
Microservices Design Patterns | Edureka
Spring Data JPA from 0-100 in 60 minutes
OpenID Connect: An Overview
Secure your SPA with Auth0
OAuth2 + API Security
API Trends & Use Cases
OPA open policy agent
Api-First service design
Ad

Similar to Complex architectures for authentication and authorization on AWS (20)

PPTX
Complex architectures for authentication and authorization on AWS
PDF
Serverless Meetup - Authentication for Serverless Applications [Jul 2020]
PPTX
ACDKOCHI19 - Enterprise grade security for web and mobile applications on AWS
PDF
Serverless Meetup - Getting started with AWS Cognito [Jul 2020]
PDF
Implementing Authorization
PPTX
Externalizing Authorization in Micro Services world
PDF
Centralise legacy auth at the ingress gateway
PDF
amazon-cognito-auth-in-minutes
PPTX
Building Cloud-powered Mobile Apps
PDF
Jeff Lombardo - Enforcing access control in depth with AWS - v1.2.pdf
PDF
Who’s Knocking? Identity for APIs, Web and Mobile
PDF
Building Cloud-powered Mobile Apps
PDF
APIsecure 2023 - OAuth, OIDC and protecting third-party credentials, Ed Olson...
PPTX
Microservices security - jpmc tech fest 2018
PDF
apidays Helsinki & North 2023 - API authorization with Open Policy Agent, And...
PPTX
Aws iam best practices to live by
PDF
Distributed Authorization with Open Policy Agent.pdf
PPTX
Standard Based API Security, Access Control and AI Based Attack - API Days Pa...
PPTX
Identity federation with AWS Cognito
PDF
Create a Uniform Login Experience with a Centralized Cloud Authentication Sys...
Complex architectures for authentication and authorization on AWS
Serverless Meetup - Authentication for Serverless Applications [Jul 2020]
ACDKOCHI19 - Enterprise grade security for web and mobile applications on AWS
Serverless Meetup - Getting started with AWS Cognito [Jul 2020]
Implementing Authorization
Externalizing Authorization in Micro Services world
Centralise legacy auth at the ingress gateway
amazon-cognito-auth-in-minutes
Building Cloud-powered Mobile Apps
Jeff Lombardo - Enforcing access control in depth with AWS - v1.2.pdf
Who’s Knocking? Identity for APIs, Web and Mobile
Building Cloud-powered Mobile Apps
APIsecure 2023 - OAuth, OIDC and protecting third-party credentials, Ed Olson...
Microservices security - jpmc tech fest 2018
apidays Helsinki & North 2023 - API authorization with Open Policy Agent, And...
Aws iam best practices to live by
Distributed Authorization with Open Policy Agent.pdf
Standard Based API Security, Access Control and AI Based Attack - API Days Pa...
Identity federation with AWS Cognito
Create a Uniform Login Experience with a Centralized Cloud Authentication Sys...
Ad

More from Boyan Dimitrov (10)

PPTX
Building Highly Sophisticated Environments for Security and Compliance on AWS
PDF
Observability foundations in dynamically evolving architectures
PDF
Anatomy of the modern application stack
PPTX
Microservices: next-steps
PPTX
Moving to microservices – a technology and organisation transformational journey
PPTX
Patterns for building resilient and scalable microservices platform on AWS
PDF
Microservices and elastic resource pools with Amazon EC2 Container Service
PDF
Monitoring microservices platform
PPTX
Scaling micro-services Architecture on AWS
PPTX
Scaling from 1 to 10 million users - Hailo
Building Highly Sophisticated Environments for Security and Compliance on AWS
Observability foundations in dynamically evolving architectures
Anatomy of the modern application stack
Microservices: next-steps
Moving to microservices – a technology and organisation transformational journey
Patterns for building resilient and scalable microservices platform on AWS
Microservices and elastic resource pools with Amazon EC2 Container Service
Monitoring microservices platform
Scaling micro-services Architecture on AWS
Scaling from 1 to 10 million users - Hailo

Recently uploaded (20)

PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
NewMind AI Monthly Chronicles - July 2025
PPT
Teaching material agriculture food technology
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
KodekX | Application Modernization Development
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Big Data Technologies - Introduction.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Empathic Computing: Creating Shared Understanding
PDF
Electronic commerce courselecture one. Pdf
PDF
Encapsulation theory and applications.pdf
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
NewMind AI Monthly Chronicles - July 2025
Teaching material agriculture food technology
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Understanding_Digital_Forensics_Presentation.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
KodekX | Application Modernization Development
20250228 LYD VKU AI Blended-Learning.pptx
Big Data Technologies - Introduction.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
Empathic Computing: Creating Shared Understanding
Electronic commerce courselecture one. Pdf
Encapsulation theory and applications.pdf
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Review of recent advances in non-invasive hemoglobin estimation
Agricultural_Statistics_at_a_Glance_2022_0.pdf

Complex architectures for authentication and authorization on AWS

  • 1. Complex architectures for authentication and authorization on AWS Boyan Dimitrov Director Platform Engineering @ Sixt @nathariel September 2019
  • 2. Our Focus Today Service ? Authenticate & Authorize • Key patterns for authentication and authorization - Client to service - Service to service - Service to Infra • Focusing on the application and more complex microservices environments
  • 3. Our Focus Today Service ? Authenticate & Authorize Service Service Autenticate & Authorize Service Service Service IdP Autenticate & Authorize
  • 4. Before we begin: The Foundations OIDC ( OpenID Connect ) - a protocol for Authentication built on top of OAuth 2.0 OAUTH 2.0 – a protocol for Authorization
  • 5. Before we begin: AWS Cognito AWS Cognito User Pools AWS Cognito Federated Identities Identity providers Social Identity Providers Other Identity Providers SAML OIDC S3 EC2 Federate AuthorizeFederate
  • 6. Tip #1 If you are starting a new project on AWS involving auth and you need IdP, Use Cognito
  • 8. Auth primer Mobile Client Amazon API Gateway Custom Authorizer Amazon Cognito 1. Authenticate via credentials Service 2. Receive JWT 3. Invoke API with JWT 4. Validate JWT 6a. Check token scope 5. Return validity 6b. Invoke custom auth function Auth Service 7. Forward request
  • 9. We live in a complex world… Amazon API Gateway Amazon Cognito Service Service Service Service Service Service Service Service Service On-Prem auth auth auth auth auth auth auth Elastic Load Balancer
  • 10. • I already have a / multiple IdPs, how to integrate all of that ? • Where do we do authentication & token validation in a heterogeneous environment with various ingress points ? • How do we do authorization and on what level ? • What about service to service auth? • What about infrastructure auth ? Auth challenges in complex architectures
  • 11. Tip #2 Consider IdP Federation to simplify your problem
  • 12. Authentication: Common Identity Format Amazon Cognito Internal Perimeter SAML OIDC federate Standard Access Token External Perimeter Service Service Service Service Authenticate
  • 13. Define your authorization strategy ACL MAC DAC RBAC ADAC PBAC …
  • 14. Tip #3 If Authorization requirements are unclear, start with RBAC and complicate as needed ACL MAC DAC RBAC ADAC PBAC …
  • 15. RBAC Authorization Primer Service Service Service Service Amazon Cognito Internal Perimeter SAML OIDC External Perimeter { "name": "John Doe", "email": "john.doe@foo.com", "roles": ["finance_controller"] … } If role ==„finance_controller“... X Amazon API Gateway
  • 16. Tip #4 Do not embed volatile business roles into your applications – implement access controls around service capabilities instead
  • 17. Delegate auth to a central auth service User Service POST /users GET /users/<id> PUT /users/<id> DELETE /users/<id> API Contract Associated Permissions users:create:any users:read:any users:read:own users:update:any users:update:own users:delete:own users:delete:any { "name": "John Doe", "email": "john.doe @foo.com", "roles": ["finance_controller"], “user_id": 343242, … } Auth Service GET /users/343242 finance_controller -> users:read:own Role Permission Authorised?
  • 18. Centralised Auth Service User Service Auth Service Advantages • Externalised auth decisions and business roles management • Easier to manage and change • Single source of truth Disadvantages • Another synchronous dependency • Additional latency • Single point of failure? • Manual effort in keeping permissions up to date
  • 19. Centralised Auth Service Optimisations: automate permission discovery User ServiceAuth Service Associated Permissions users:create:any users:read:any users:read:own users:update:any users:update:own users:delete:own users:delete:any Register permissions on startup Service:Permissions Map com.x.service.user users:create:any com.x.service.user users:read:any com.x.service.user users:read:own com.x.service.user users:update:any com.x.service.user users:update:own com.x.service.user users:delete:own com.x.service.user users:delete:any
  • 20. Centralised Auth Service Optimisations: caching associated roles Associated Permissions users:create:any users:read:any users:read:own users:update:any users:update:own users:delete:own users:delete:any User ServiceAuth Service finance_controller -> com.x.service.user users:read:own Role Permission
  • 21. Centralised Auth Service Optimisations: caching associated roles Associated Permissions and Roles users:create:any users:read:any finance_controller -> users:read:own users:update:any users:update:all users:delete:own users:delete:any finance_controller ALLOW com.x.service.user users:read:own Role Permission 1. On Startup user service caches relevant roles for its permissions 2. Receive live updates during runtime User ServiceAuth Service
  • 22. Centralised Auth Service Optimisations: caching auth result User Service Auth Service Associated Permissions users:create:any users:read:any users:read:own users:update:any users:update:all users:delete:own users:delete:any { "name": "John Doe", "email": "john.doe @foo.com", "roles": ["finance_controller"], “user_id": 343242, “jti“: 21312e1d123 … }
  • 23. User Service Auth Service 1. Authorize operation 2. Cache authorization response with TTL Permissions and Cached Policy Result users:create:any users:read:any 21312e1d123 -> users:read:own users:update:any users:update:all users:delete:own users:delete:any { "name": "John Doe", "email": "john.doe @foo.com", "roles": ["finance_controller"], “user_id": 343242, “jti“: 21312e1d123 … } Centralised Auth Service Optimisations: caching auth result
  • 24. Bonus: Local token validation User Service Cache the access token JWK for local validation Amazon Cognito { "name": "John Doe", "email": "john.doe @foo.com", "roles": ["finance_controller"], … “kid": "5689example" } { “keys": [{ “kid": "5689example", “alg": "RS256" }, { … }]}
  • 25. Authorization Service Service Service Service Amazon Cognito Internal Perimeter SAML OIDC External Perimeter Auth Service “Decentralised“ authorisation
  • 26. Centralised Auth Service User Service Auth Service Advantages • Externalised auth decisions and business roles management • Easier to manage and change • Single source of truth • Decentralised token validation and auth Disadvantages • Another synchronous dependency • Additional latency • Single point of failure? • Manual effort in keeping permissions up to date
  • 27. DEMO
  • 28. Demo Architecture Auth Service Hello World Service Amazon Cognito User Pool Register a user & Authenticate Authorize hello request • Automated permission registration • Auth rules caching • Decentralised authorization • Local token validation Fetch IdP JWK Demo WebappAdmin Webapp Manage Permissions
  • 29. So far we covered… Service ? Authenticate & Authorize Service Service Autenticate & Authorize Service Service Service IdP Autenticate & Authorize
  • 31. Why do we need S2S Auth? • Authorize service calls without user context ( batch jobs, async operations..) • Protect applications storing senstive information for internal actors too • Multi-tenant environments
  • 32. Service to service auth User Service Amazon Cognito Email Service 1. Auth using creds { “service":“com.x.service.user, … } Auth Service com.x.service.user ALLOW com.x.service.email email:send:any Service Permission 2. Get an identitiy 3. Send identity token with requests
  • 33. Tip #5 Give identity to your applications and automate the credential management!
  • 34. Client 2 Service and Service 2 Service Auth Service Service Service Service Amazon Cognito Internal Perimeter SAML OIDC External Perimeter Auth Service S3 ?
  • 36. Cognito Federated Identities to the rescue User Service Amazon Cognito User Pool Amazon Cognito Identity Federation 1. Get Identity Token 2. Exchange Token for IAM Creds 3. Access AWS Services
  • 37. That’s all Service ? Authenticate & Authorize Service Service Autenticate & Authorize Service Service Service IdP Autenticate & Authorize