Enabling Cloud Native Security with OAuth2 and Multi-Tenant UAA

Will Tran
Will TranAlmost internet famous. at Autonomic.ai
Enabling Cloud Native Security
with Multi-Tenant UAA
William Tran, Pivotal
Agenda
• Introductions
• Why use UAA for Cloud Native Applications
• Advantages of Multi-tenant UAA
• How to get started
Introductions
About Me
• Spring user since version 2.0 (2007)
• Joined Pivotal October 2013
• Based in Toronto, Canada
• Working on Pivotal CF Services
– Mobile Services API Gateway
– Pivotal SSO
– Spring Cloud Services
• Committer on UAA
About UAA
• User Account and Authorization server
• Secures all CF components
• OAuth2 and OpenID Connect
• SCIM API for user management in internal
user database
• Integration with SAML 2.0 and LDAP
• OAuth2 client registration API
About OAuth2
• Delegated Authorization
• 4 Actors
– The Authorization Server
– User
– Client
– Resource Server
• Clients act on behalf of users
– Authorization Code Grant
– Resource Owner Password Grant
– Implicit Grant
• Clients act on their own
– Client Credentials Grant
OAuth2 In Cloudfoundry
• Apps Manager (PWS or PCF)
OAuth2 In Cloudfoundry
• Apps Manager
– Go to apps.cfdomain in the browser
UAA
(login.)
Apps
Manager
(apps.)
Cloud
Controller
(api.)
Browser
OAuth2 In Cloudfoundry
• Apps Manager
– Apps manager redirects you to UAA
UAA
(login.)
Apps
Manager
(apps.)
Cloud
Controller
(api.)
Browser
Not logged
in!
OAuth2 In Cloudfoundry
• Apps Manager
– Apps manager redirects you to UAA
UAA
(login.)
Apps
Manager
(apps.)
Cloud
Controller
(api.)
Browser
OAuth2 In Cloudfoundry
• Apps Manager
– UAA asks for username and password
UAA
(login.)
Apps
Manager
(apps.)
Cloud
Controller
(api.)
Browser
Please log in
OAuth2 In Cloudfoundry
• Apps Manager
– User logs in
UAA
(login.)
Apps
Manager
(apps.)
Cloud
Controller
(api.)
Browser
Here is the
username and
password
OAuth2 In Cloudfoundry
• Apps Manager
– UAA redirects back to Apps Manager with a one
time code
UAA
(login.)
Apps
Manager
(apps.)
Cloud
Controller
(api.)
Browser
Here is an
authorization
code
OAuth2 In Cloudfoundry
• Apps Manager
– UAA redirects back to Apps Manager with a one
time code
UAA
(login.)
Apps
Manager
(apps.)
Cloud
Controller
(api.)
Browser
Here is an
authorization
code
OAuth2 In Cloudfoundry
• Apps Manager
– Apps Manager gives the code back to UAA
UAA
(login.)
Apps
Manager
(apps.)
Cloud
Controller
(api.)
Browser
Here is the same
authorization code
OAuth2 In Cloudfoundry
• Apps Manager
– UAA exchanges the code for an access token
UAA
(login.)
Apps
Manager
(apps.)
Cloud
Controller
(api.)
Browser
The code is the same,
here is a token
OAuth2 In Cloudfoundry
• Apps Manager
– Apps manager uses the access token to access
the CC API
UAA
(login.)
Apps
Manager
(apps.)
Cloud
Controller
(api.)
Browser
/v2/apps -H
“Authorization: bearer
eyJhbGci…”
OAuth2 In Cloudfoundry
• Apps Manager
– Apps manager renders the page
UAA
(login.)
Apps
Manager
(apps.)
Cloud
Controller
(api.)
Browser
Here is the the
pretty screen,
finally!
OAuth2 In Cloudfoundry
• Apps Manager
– Authorization Code Grant
– Typical of web applications
– Apps manager webapp is the client
OAuth2 In Cloudfoundry
• CF CLI
cf target api.cfdomain
cf login
cf apps
OAuth2 In Cloudfoundry
• CF CLI
– cf login
UAA
(login.)
Cloud
Controller
(api.)
CF CLI
Here is the
username and
password
OAuth2 In Cloudfoundry
• CF CLI
– cf login
UAA
(login.)
Cloud
Controller
(api.)
CF CLI
Here is a token
OAuth2 In Cloudfoundry
• CF CLI
– cf login
UAA
(login.)
Cloud
Controller
(api.)
CF CLI
/v2/apps -H
“Authorization: bearer
eyJhbGci…”
OAuth2 In Cloudfoundry
• CF CLI
– Resource Owner Password Grant
– Typical of CLI, Mobile Apps, non-browser user
apps
– CF CLI is the client
OAuth2 In Cloudfoundry
• Autoscaling Service (PCF)
my-appAutoscaler
I’m getting very busy!
OAuth2 In Cloudfoundry
• Autoscaling Service (PCF)
my-appAutoscaler
Don’t worry, I’ll create
more instances
OAuth2 In Cloudfoundry
• Autoscaling Service (PCF)
my-appAutoscaler
my-app
OAuth2 In Cloudfoundry
• Autoscaling Service (PCF)
my-appAutoscaler
my-app
my-app
OAuth2 In Cloudfoundry
• Autoscaling Service (PCF)
UAA
(login.)
Cloud
Controller
(api.)
Autoscaler
Time to check
status!
OAuth2 In Cloudfoundry
• Autoscaling Service (PCF)
UAA
(login.)
Cloud
Controller
(api.)
Autoscaler
Here is my
client_id and
client_secret
OAuth2 In Cloudfoundry
• Autoscaling Service (PCF)
UAA
(login.)
Cloud
Controller
(api.)
Autoscaler
Here is a token
OAuth2 In Cloudfoundry
• Autoscaling Service (PCF)
UAA
(login.)
Cloud
Controller
(api.)
Autoscaler
/v2/apps/1234/stats
-H “Authorization: bearer eyJhbGci…”
OAuth2 In Cloudfoundry
• Autoscaling Service (PCF)
UAA
(login.)
Cloud
Controller
(api.)
Autoscaler
CPU at
80%!
OAuth2 In Cloudfoundry
• Autoscaling Service (PCF)
UAA
(login.)
Cloud
Controller
(api.)
Autoscaler
PUT /v2/apps/1234
-H “Authorization: bearer eyJhbGci…”
-d ‘{"instances":2}’
OAuth2 In Cloudfoundry
• Autoscaling Service (PCF)
UAA
(login.)
Cloud
Controller
(api.)
Autoscaler
OK, creating
more
instances
OAuth2 In Cloudfoundry
• Autoscaling Service (PCF)
– Client Credentials Grant
– Typical of apps that act without a user’s
involvement
– Autoscaling Service is the client
OAuth2 In Cloudfoundry
• The CF platform has many more examples of
using OAuth2
• UAA is the key
– Manages users
– Manages clients
– Grants and verifies access tokens
UAA is the perfect fit for
Cloud Native Security*
UAA for Cloud Native Security
• *In CF there’s more to security than just UAA
– Network security / security groups
– Cross container traffic / trusted workloads
– No End to end TLS
• UAA is for application-level security
• It works for us, so it’ll work for you*
So you want to secure your apps
• Example
– You want to host your API application on Cloud
Foundry
my-cloudfoundry.cn
So you want to secure your apps
• Example
– You want to host your API application on Cloud
Foundry
my-cloudfoundry.cn
my-api
So you want to secure your apps
• Example
– It will be accessed by a web app hosted on CF
my-cloudfoundry.cn
my-api
my-
webapp
browser
So you want to secure your apps
• Example
– It will be accessed through a mobile app as well
my-cloudfoundry.cn
my-api
my-
webapp
browser
Mobile
app
So you want to secure your apps
• Perfect! Use UAA
my-cloudfoundry.cn
my-api
my-
webapp
browser
Mobile
app
UAA
So you want to secure your apps
• Perfect! Use UAA
– Client for web app  authcode grant
So you want to secure your apps
• Perfect! Use UAA
– Client for web app  authcode grant
– Client for mobile app  password grant
So you want to secure your apps
• Perfect! Use UAA
– Client for web app  authcode grant
– Client for mobile app  password grant
– API app token verification  JWT signature
So you want to secure your apps
• Perfect! Use UAA
– Client for web app  authcode grant
– Client for mobile app  password grant
– API app token verification  JWT signature
• API app can validate token on its own
Who are your end users?
• SpaceDevelopers, OrgManagers
– Platform users, no problem
Who are your end users?
• SpaceDevelopers, OrgManagers
– Platform users, no problem
• That sales guy
– Not a platform user, PROBLEM
Who are your end users?
jsmith jsmyth
cf set-space-role 
jsmyth the-org the-space SpaceDeveloper
oops
Who are your end users?
jsmith jsmyth
My app is too
slow
Who are your end users?
jsmith jsmyth
cf login –u jsmyth ...
cf scale sales-api –m 10G
I can fix that!
The Principle of Least Privilege
• You (or the application, process, module, etc)
should have the minimum level of access
required for performing their job
The Principle of Least Privilege
• You (or the application, process, module, etc)
should have the minimum level of access
required for performing their job
• Salesguy should not have been added to the
platform UAA
Solutions?
• Create your own authorization server
• Deploy your own UAA
So you want to secure your products
• Example
– You want to build a product that’s packaged as a
CF service
my-cloudfoundry.cn
my-service
So you want to secure your products
• Example
– When apps bind to the service…
my-cloudfoundry.cn
my-service my-app
cf bind-service
So you want to secure your products
• Example
– Create an oauth client
my-cloudfoundry.cn
my-service my-app
UAA
POST
/oauth/client
So you want to secure your products
• Example
– Create an oauth client
my-cloudfoundry.cn
my-service my-app
UAA 201: Created
my-cloudfoundry.cn
So you want to secure your products
• Example
– So that the app to service communication can be
secured by OAuth2 client credentials grant
my-service my-app
UAA
The client_id and
client_secret are in
VCAP_SERVICES
my-cloudfoundry.cn
So you want to secure your products
• Example
– So that the app to service communication can be
secured by OAuth2 client credentials grant
my-service my-app
UAA
GET /api/foo
-H ‘Authorization:
bearer eyJhbGci…’
So you want to secure your products
• Perfect! Use UAA
– App to app communication  client credentials
– Token verification  JWT signature
– Every app gets their own credentials
• Super secure right?
How do you create clients in UAA?
• POST /oauth/clients
– Token must have scope clients.write
• Creating clients with authorities
– Eg the app gets a token with my-service.read
scope
– Requires clients.write and uaa.admin
• So give your service admin credentials?
Admin-Level Credentials
my-service
• client_id: my-service
• client_secret: 123xyz
• authorities: clients.write,
uaa.admin
• authorized_grant_types:
client_credentials
Admin-Level Credentials
my-service
• CLIENT_ID: my-service
• CLIENT_SECRET: 123xyz
Admin-Level Credentials
my-service
• CLIENT_ID: my-service
• CLIENT_SECRET: 123xyz
I got root, yo.
Admin-Level Credentials
my-service
• CLIENT_ID: my-service
• CLIENT_SECRET: 123xyz
This job sucks.
cf env my-service
Admin-Level Credentials
$ uaac target uaa.my-cloudfoundry.cn
$ uaac token client get my-service 
-s 123xyz
$ uaac client add my-admin-client 
–authorities cloud_controller.admin
Admin-Level Credentials
I got root yo. Lets
have some fun.
The Principle of Least Privilege
• You (or the application, process, module, etc)
should have the minimum level of access
required for performing their job
The Principle of Least Privilege
• You (or the application, process, module, etc)
should have the minimum level of access
required for performing their job
• Giving admin level credentials to applications
is dangerous
Solutions?
• Create your own authorization server
• Deploy your own UAA
How do you deploy your own UAA?
• cf push cloudfoundry-identity-uaa.war
• Yaml config
• Bootstrap users
• Provision DB
• Do the above manually, or as part of a Bosh
deployment
Running your own UAA
• Pros:
– Principle of least privilege
– You can fork it
• Cons:
– Overhead
– Manual upgrades
– “yak shaving” a bosh release
Running your own UAA
• Pros:
– Principle of least privilege
• Systems secured by your UAA cannot affect systems
secured by the platform UAA
Running your own UAA
• Pros:
– Principle of least privilege
Your UAA
Running your own UAA
• Pros:
– Principle of least privilege
Your UAA
Platform UAA
Running your own UAA
• Pros:
– Principle of least privilege
Your UAA
Platform UAA
Impossible!
Running your own UAA
• Pros:
– Principle of least privilege
– You can fork it
• Cons:
– Overhead
– Manual upgrades
– “yak shaving” a bosh release
Multitenant UAA
What is Multitenant UAA
• CF v208 +
• The built-in UAA with subdomains
• Subdomain maps to Identity Zone
• Total segregation between Identity Zones
• API for creating Identity Zones
• Existing API stays the same
Zone administrators
• UAA users with god-like powers in an identity
zone
• Requires scope zone.[zone-id].admin
• Instead of targeting zone via subdomain, use
X-Identity-Zone-Id header
– POST uaa.domain.com/oauth/clients  create a
client in the UAA zone
– POST uaa.domain.com/oauth/clients -H “X-
Identity-Zone-Id:12345”  create a client in the
Identity Zone with id 12345
Multitenant UAA
• Pros:
– Principle of least privilege
– API calls for creating a new tenant (aka Identity
Zone)
– Zone administrators instead of bootstrap users
• Cons:
– Overhead
– Manual upgrades
– “yak shaving” a bosh release
– You can’t fork it
Let’s Use It
Multitenant UAA with UAAC
• Setup can be cumbersome
– When acting as zone admin with X-Identity-Zone-
Id header, you can only uaac curl
• Once you have an admin client in the zone,
uaac works great
• Future enhancements
– Creating initial users / clients when the Identity
Zone is created
– -z global option to target a zone via header
Summary
• UAA is great for securing Cloud Native
Applications
• Always use the principle of least privilege
– Don’t add non-platform users to the platform
– Don’t give out platform admin abilities to other
apps
• You can deploy your own UAA
– but multitenant UAA is an API call away
• Tooling needs to catch up
– But once you get that admin client set up, its easy
Stay In Touch
Stay in touch
• Me
– Twitter: @fivetenwill
– github.com/william-tran
– wtran@pivotal.io
• CF Identity PM
– Sree Tummidi: stummidi@pivotal.io
• CF Identity Team
– Issues: github.com/cloudfoundry/uaa
– Discussion: lists.cloudfoundry.org
1 of 89

Recommended

Stateless authentication for microservices by
Stateless authentication for microservicesStateless authentication for microservices
Stateless authentication for microservicesAlvaro Sanchez-Mariscal
61.2K views78 slides
Modern Security with OAuth 2.0 and JWT and Spring by Dmitry Buzdin by
Modern Security with OAuth 2.0 and JWT and Spring by Dmitry BuzdinModern Security with OAuth 2.0 and JWT and Spring by Dmitry Buzdin
Modern Security with OAuth 2.0 and JWT and Spring by Dmitry BuzdinJava User Group Latvia
5.4K views58 slides
Stateless Auth using OAuth2 & JWT by
Stateless Auth using OAuth2 & JWTStateless Auth using OAuth2 & JWT
Stateless Auth using OAuth2 & JWTGaurav Roy
11.5K views73 slides
Stateless authentication for microservices - GR8Conf 2015 by
Stateless authentication for microservices - GR8Conf 2015Stateless authentication for microservices - GR8Conf 2015
Stateless authentication for microservices - GR8Conf 2015Alvaro Sanchez-Mariscal
5K views86 slides
Single-Page-Application & REST security by
Single-Page-Application & REST securitySingle-Page-Application & REST security
Single-Page-Application & REST securityIgor Bossenko
21K views43 slides
Stateless authentication with OAuth 2 and JWT - JavaZone 2015 by
Stateless authentication with OAuth 2 and JWT - JavaZone 2015Stateless authentication with OAuth 2 and JWT - JavaZone 2015
Stateless authentication with OAuth 2 and JWT - JavaZone 2015Alvaro Sanchez-Mariscal
28.3K views81 slides

More Related Content

What's hot

An Authentication and Authorization Architecture for a Microservices World by
An Authentication and Authorization Architecture for a Microservices WorldAn Authentication and Authorization Architecture for a Microservices World
An Authentication and Authorization Architecture for a Microservices WorldVMware Tanzu
12.6K views16 slides
OAuth2 - Introduction by
OAuth2 - IntroductionOAuth2 - Introduction
OAuth2 - IntroductionKnoldus Inc.
6.3K views12 slides
OAuth 2.0 and Mobile Devices: Is that a token in your phone in your pocket or... by
OAuth 2.0 and Mobile Devices: Is that a token in your phone in your pocket or...OAuth 2.0 and Mobile Devices: Is that a token in your phone in your pocket or...
OAuth 2.0 and Mobile Devices: Is that a token in your phone in your pocket or...Brian Campbell
62.2K views26 slides
Stateless authentication for microservices - Spring I/O 2015 by
Stateless authentication for microservices  - Spring I/O 2015Stateless authentication for microservices  - Spring I/O 2015
Stateless authentication for microservices - Spring I/O 2015Alvaro Sanchez-Mariscal
9.5K views86 slides
ConFoo 2015 - Securing RESTful resources with OAuth2 by
ConFoo 2015 - Securing RESTful resources with OAuth2ConFoo 2015 - Securing RESTful resources with OAuth2
ConFoo 2015 - Securing RESTful resources with OAuth2Rodrigo Cândido da Silva
5K views35 slides
API Security & Federation Patterns - Francois Lascelles, Chief Architect, Lay... by
API Security & Federation Patterns - Francois Lascelles, Chief Architect, Lay...API Security & Federation Patterns - Francois Lascelles, Chief Architect, Lay...
API Security & Federation Patterns - Francois Lascelles, Chief Architect, Lay...CA API Management
4.1K views41 slides

What's hot(20)

An Authentication and Authorization Architecture for a Microservices World by VMware Tanzu
An Authentication and Authorization Architecture for a Microservices WorldAn Authentication and Authorization Architecture for a Microservices World
An Authentication and Authorization Architecture for a Microservices World
VMware Tanzu12.6K views
OAuth2 - Introduction by Knoldus Inc.
OAuth2 - IntroductionOAuth2 - Introduction
OAuth2 - Introduction
Knoldus Inc.6.3K views
OAuth 2.0 and Mobile Devices: Is that a token in your phone in your pocket or... by Brian Campbell
OAuth 2.0 and Mobile Devices: Is that a token in your phone in your pocket or...OAuth 2.0 and Mobile Devices: Is that a token in your phone in your pocket or...
OAuth 2.0 and Mobile Devices: Is that a token in your phone in your pocket or...
Brian Campbell62.2K views
API Security & Federation Patterns - Francois Lascelles, Chief Architect, Lay... by CA API Management
API Security & Federation Patterns - Francois Lascelles, Chief Architect, Lay...API Security & Federation Patterns - Francois Lascelles, Chief Architect, Lay...
API Security & Federation Patterns - Francois Lascelles, Chief Architect, Lay...
CA API Management4.1K views
Rest API Security by Stormpath
Rest API SecurityRest API Security
Rest API Security
Stormpath11.7K views
OAuth2 and Spring Security by Orest Ivasiv
OAuth2 and Spring SecurityOAuth2 and Spring Security
OAuth2 and Spring Security
Orest Ivasiv8.5K views
OAuth - Open API Authentication by leahculver
OAuth - Open API AuthenticationOAuth - Open API Authentication
OAuth - Open API Authentication
leahculver22.3K views
Stateless token-based authentication for pure front-end applications by Alvaro Sanchez-Mariscal
Stateless token-based authentication for pure front-end applicationsStateless token-based authentication for pure front-end applications
Stateless token-based authentication for pure front-end applications
Best Practices in Building an API Security Ecosystem by Prabath Siriwardena
Best Practices in Building an API Security EcosystemBest Practices in Building an API Security Ecosystem
Best Practices in Building an API Security Ecosystem
Prabath Siriwardena1.4K views
Securing your APIs with OAuth, OpenID, and OpenID Connect by Manish Pandit
Securing your APIs with OAuth, OpenID, and OpenID ConnectSecuring your APIs with OAuth, OpenID, and OpenID Connect
Securing your APIs with OAuth, OpenID, and OpenID Connect
Manish Pandit4K views
The Ultimate Guide to Mobile API Security by Stormpath
The Ultimate Guide to Mobile API SecurityThe Ultimate Guide to Mobile API Security
The Ultimate Guide to Mobile API Security
Stormpath2.2K views
An Introduction to OAuth 2 by Aaron Parecki
An Introduction to OAuth 2An Introduction to OAuth 2
An Introduction to OAuth 2
Aaron Parecki108.2K views
REST Service Authetication with TLS & JWTs by Jon Todd
REST Service Authetication with TLS & JWTsREST Service Authetication with TLS & JWTs
REST Service Authetication with TLS & JWTs
Jon Todd8K views
Oauth2 and OWSM OAuth2 support by Gaurav Sharma
Oauth2 and OWSM OAuth2 supportOauth2 and OWSM OAuth2 support
Oauth2 and OWSM OAuth2 support
Gaurav Sharma4K views

Similar to Enabling Cloud Native Security with OAuth2 and Multi-Tenant UAA

Дмитрий Хоревич "Cloud native security with UAA \ Как защитить микросервисы с... by
Дмитрий Хоревич "Cloud native security with UAA \ Как защитить микросервисы с...Дмитрий Хоревич "Cloud native security with UAA \ Как защитить микросервисы с...
Дмитрий Хоревич "Cloud native security with UAA \ Как защитить микросервисы с...Tanya Denisyuk
175 views42 slides
Security as a Service - Tian Wang by
Security as a Service - Tian WangSecurity as a Service - Tian Wang
Security as a Service - Tian WangVMware Tanzu
299 views33 slides
Operating Your Production API by
Operating Your Production APIOperating Your Production API
Operating Your Production APIAmazon Web Services
1.3K views46 slides
Operating your Production API by
Operating your Production APIOperating your Production API
Operating your Production APIAmazon Web Services
1.2K views54 slides
Azure API Management - why should I care? by
Azure API Management - why should I care?Azure API Management - why should I care?
Azure API Management - why should I care?Jouni Heikniemi
1.8K views63 slides
The Datacenter API by
The Datacenter APIThe Datacenter API
The Datacenter APIAkana
329 views24 slides

Similar to Enabling Cloud Native Security with OAuth2 and Multi-Tenant UAA (20)

Дмитрий Хоревич "Cloud native security with UAA \ Как защитить микросервисы с... by Tanya Denisyuk
Дмитрий Хоревич "Cloud native security with UAA \ Как защитить микросервисы с...Дмитрий Хоревич "Cloud native security with UAA \ Как защитить микросервисы с...
Дмитрий Хоревич "Cloud native security with UAA \ Как защитить микросервисы с...
Tanya Denisyuk175 views
Security as a Service - Tian Wang by VMware Tanzu
Security as a Service - Tian WangSecurity as a Service - Tian Wang
Security as a Service - Tian Wang
VMware Tanzu299 views
Azure API Management - why should I care? by Jouni Heikniemi
Azure API Management - why should I care?Azure API Management - why should I care?
Azure API Management - why should I care?
Jouni Heikniemi1.8K views
The Datacenter API by Akana
The Datacenter APIThe Datacenter API
The Datacenter API
Akana329 views
The Datacenter API by Akana
The Datacenter APIThe Datacenter API
The Datacenter API
Akana1.1K views
#1922 rest-push2 ap-im-v6 by Jack Carnes
#1922 rest-push2 ap-im-v6#1922 rest-push2 ap-im-v6
#1922 rest-push2 ap-im-v6
Jack Carnes864 views
Developing Apps with Azure AD by SharePointRadi
Developing Apps with Azure ADDeveloping Apps with Azure AD
Developing Apps with Azure AD
SharePointRadi790 views
Token Management using Stormpath inside Mule by RaviShankar Mishra
Token Management using Stormpath inside MuleToken Management using Stormpath inside Mule
Token Management using Stormpath inside Mule
RaviShankar Mishra353 views
AWS Summit Barcelona 2015 - Introducing Amazon API Gateway by Vadim Zendejas
AWS Summit Barcelona 2015 - Introducing Amazon API GatewayAWS Summit Barcelona 2015 - Introducing Amazon API Gateway
AWS Summit Barcelona 2015 - Introducing Amazon API Gateway
Vadim Zendejas82 views
Aws Technical Day 2015 - Amazon API Gateway by aws-marketing-il
Aws Technical Day 2015 - Amazon API GatewayAws Technical Day 2015 - Amazon API Gateway
Aws Technical Day 2015 - Amazon API Gateway
aws-marketing-il327 views
AWS re:Invent 2016: Building SaaS Offerings for Desktop Apps with Amazon AppS... by Amazon Web Services
AWS re:Invent 2016: Building SaaS Offerings for Desktop Apps with Amazon AppS...AWS re:Invent 2016: Building SaaS Offerings for Desktop Apps with Amazon AppS...
AWS re:Invent 2016: Building SaaS Offerings for Desktop Apps with Amazon AppS...
Amazon Web Services1.5K views
Authorization Architecture Patterns: How to Avoid Pitfalls in #OAuth / #OIDC ... by Tatsuo Kudo
Authorization Architecture Patterns: How to Avoid Pitfalls in #OAuth / #OIDC ...Authorization Architecture Patterns: How to Avoid Pitfalls in #OAuth / #OIDC ...
Authorization Architecture Patterns: How to Avoid Pitfalls in #OAuth / #OIDC ...
Tatsuo Kudo5.1K views
API, Integration, and SOA Convergence by Kasun Indrasiri
API, Integration, and SOA ConvergenceAPI, Integration, and SOA Convergence
API, Integration, and SOA Convergence
Kasun Indrasiri2.8K views

Recently uploaded

Bootstrapping vs Venture Capital.pptx by
Bootstrapping vs Venture Capital.pptxBootstrapping vs Venture Capital.pptx
Bootstrapping vs Venture Capital.pptxZeljko Svedic
12 views17 slides
Page Object Model by
Page Object ModelPage Object Model
Page Object Modelartembondar5
6 views5 slides
DRYiCE™ iAutomate: AI-enhanced Intelligent Runbook Automation by
DRYiCE™ iAutomate: AI-enhanced Intelligent Runbook AutomationDRYiCE™ iAutomate: AI-enhanced Intelligent Runbook Automation
DRYiCE™ iAutomate: AI-enhanced Intelligent Runbook AutomationHCLSoftware
6 views8 slides
FIMA 2023 Neo4j & FS - Entity Resolution.pptx by
FIMA 2023 Neo4j & FS - Entity Resolution.pptxFIMA 2023 Neo4j & FS - Entity Resolution.pptx
FIMA 2023 Neo4j & FS - Entity Resolution.pptxNeo4j
12 views26 slides
Dapr Unleashed: Accelerating Microservice Development by
Dapr Unleashed: Accelerating Microservice DevelopmentDapr Unleashed: Accelerating Microservice Development
Dapr Unleashed: Accelerating Microservice DevelopmentMiroslav Janeski
12 views29 slides
AI and Ml presentation .pptx by
AI and Ml presentation .pptxAI and Ml presentation .pptx
AI and Ml presentation .pptxFayazAli87
12 views15 slides

Recently uploaded(20)

Bootstrapping vs Venture Capital.pptx by Zeljko Svedic
Bootstrapping vs Venture Capital.pptxBootstrapping vs Venture Capital.pptx
Bootstrapping vs Venture Capital.pptx
Zeljko Svedic12 views
DRYiCE™ iAutomate: AI-enhanced Intelligent Runbook Automation by HCLSoftware
DRYiCE™ iAutomate: AI-enhanced Intelligent Runbook AutomationDRYiCE™ iAutomate: AI-enhanced Intelligent Runbook Automation
DRYiCE™ iAutomate: AI-enhanced Intelligent Runbook Automation
HCLSoftware6 views
FIMA 2023 Neo4j & FS - Entity Resolution.pptx by Neo4j
FIMA 2023 Neo4j & FS - Entity Resolution.pptxFIMA 2023 Neo4j & FS - Entity Resolution.pptx
FIMA 2023 Neo4j & FS - Entity Resolution.pptx
Neo4j12 views
Dapr Unleashed: Accelerating Microservice Development by Miroslav Janeski
Dapr Unleashed: Accelerating Microservice DevelopmentDapr Unleashed: Accelerating Microservice Development
Dapr Unleashed: Accelerating Microservice Development
Miroslav Janeski12 views
AI and Ml presentation .pptx by FayazAli87
AI and Ml presentation .pptxAI and Ml presentation .pptx
AI and Ml presentation .pptx
FayazAli8712 views
predicting-m3-devopsconMunich-2023-v2.pptx by Tier1 app
predicting-m3-devopsconMunich-2023-v2.pptxpredicting-m3-devopsconMunich-2023-v2.pptx
predicting-m3-devopsconMunich-2023-v2.pptx
Tier1 app8 views
360 graden fabriek by info33492
360 graden fabriek360 graden fabriek
360 graden fabriek
info33492138 views
Software evolution understanding: Automatic extraction of software identifier... by Ra'Fat Al-Msie'deen
Software evolution understanding: Automatic extraction of software identifier...Software evolution understanding: Automatic extraction of software identifier...
Software evolution understanding: Automatic extraction of software identifier...
Introduction to Git Source Control by John Valentino
Introduction to Git Source ControlIntroduction to Git Source Control
Introduction to Git Source Control
John Valentino5 views
Navigating container technology for enhanced security by Niklas Saari by Metosin Oy
Navigating container technology for enhanced security by Niklas SaariNavigating container technology for enhanced security by Niklas Saari
Navigating container technology for enhanced security by Niklas Saari
Metosin Oy14 views
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports by Ra'Fat Al-Msie'deen
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug ReportsBushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports
Top-5-production-devconMunich-2023.pptx by Tier1 app
Top-5-production-devconMunich-2023.pptxTop-5-production-devconMunich-2023.pptx
Top-5-production-devconMunich-2023.pptx
Tier1 app8 views
Quality Engineer: A Day in the Life by John Valentino
Quality Engineer: A Day in the LifeQuality Engineer: A Day in the Life
Quality Engineer: A Day in the Life
John Valentino6 views

Enabling Cloud Native Security with OAuth2 and Multi-Tenant UAA

  • 1. Enabling Cloud Native Security with Multi-Tenant UAA William Tran, Pivotal
  • 2. Agenda • Introductions • Why use UAA for Cloud Native Applications • Advantages of Multi-tenant UAA • How to get started
  • 4. About Me • Spring user since version 2.0 (2007) • Joined Pivotal October 2013 • Based in Toronto, Canada • Working on Pivotal CF Services – Mobile Services API Gateway – Pivotal SSO – Spring Cloud Services • Committer on UAA
  • 5. About UAA • User Account and Authorization server • Secures all CF components • OAuth2 and OpenID Connect • SCIM API for user management in internal user database • Integration with SAML 2.0 and LDAP • OAuth2 client registration API
  • 6. About OAuth2 • Delegated Authorization • 4 Actors – The Authorization Server – User – Client – Resource Server • Clients act on behalf of users – Authorization Code Grant – Resource Owner Password Grant – Implicit Grant • Clients act on their own – Client Credentials Grant
  • 7. OAuth2 In Cloudfoundry • Apps Manager (PWS or PCF)
  • 8. OAuth2 In Cloudfoundry • Apps Manager – Go to apps.cfdomain in the browser UAA (login.) Apps Manager (apps.) Cloud Controller (api.) Browser
  • 9. OAuth2 In Cloudfoundry • Apps Manager – Apps manager redirects you to UAA UAA (login.) Apps Manager (apps.) Cloud Controller (api.) Browser Not logged in!
  • 10. OAuth2 In Cloudfoundry • Apps Manager – Apps manager redirects you to UAA UAA (login.) Apps Manager (apps.) Cloud Controller (api.) Browser
  • 11. OAuth2 In Cloudfoundry • Apps Manager – UAA asks for username and password UAA (login.) Apps Manager (apps.) Cloud Controller (api.) Browser Please log in
  • 12. OAuth2 In Cloudfoundry • Apps Manager – User logs in UAA (login.) Apps Manager (apps.) Cloud Controller (api.) Browser Here is the username and password
  • 13. OAuth2 In Cloudfoundry • Apps Manager – UAA redirects back to Apps Manager with a one time code UAA (login.) Apps Manager (apps.) Cloud Controller (api.) Browser Here is an authorization code
  • 14. OAuth2 In Cloudfoundry • Apps Manager – UAA redirects back to Apps Manager with a one time code UAA (login.) Apps Manager (apps.) Cloud Controller (api.) Browser Here is an authorization code
  • 15. OAuth2 In Cloudfoundry • Apps Manager – Apps Manager gives the code back to UAA UAA (login.) Apps Manager (apps.) Cloud Controller (api.) Browser Here is the same authorization code
  • 16. OAuth2 In Cloudfoundry • Apps Manager – UAA exchanges the code for an access token UAA (login.) Apps Manager (apps.) Cloud Controller (api.) Browser The code is the same, here is a token
  • 17. OAuth2 In Cloudfoundry • Apps Manager – Apps manager uses the access token to access the CC API UAA (login.) Apps Manager (apps.) Cloud Controller (api.) Browser /v2/apps -H “Authorization: bearer eyJhbGci…”
  • 18. OAuth2 In Cloudfoundry • Apps Manager – Apps manager renders the page UAA (login.) Apps Manager (apps.) Cloud Controller (api.) Browser Here is the the pretty screen, finally!
  • 19. OAuth2 In Cloudfoundry • Apps Manager – Authorization Code Grant – Typical of web applications – Apps manager webapp is the client
  • 20. OAuth2 In Cloudfoundry • CF CLI cf target api.cfdomain cf login cf apps
  • 21. OAuth2 In Cloudfoundry • CF CLI – cf login UAA (login.) Cloud Controller (api.) CF CLI Here is the username and password
  • 22. OAuth2 In Cloudfoundry • CF CLI – cf login UAA (login.) Cloud Controller (api.) CF CLI Here is a token
  • 23. OAuth2 In Cloudfoundry • CF CLI – cf login UAA (login.) Cloud Controller (api.) CF CLI /v2/apps -H “Authorization: bearer eyJhbGci…”
  • 24. OAuth2 In Cloudfoundry • CF CLI – Resource Owner Password Grant – Typical of CLI, Mobile Apps, non-browser user apps – CF CLI is the client
  • 25. OAuth2 In Cloudfoundry • Autoscaling Service (PCF) my-appAutoscaler I’m getting very busy!
  • 26. OAuth2 In Cloudfoundry • Autoscaling Service (PCF) my-appAutoscaler Don’t worry, I’ll create more instances
  • 27. OAuth2 In Cloudfoundry • Autoscaling Service (PCF) my-appAutoscaler my-app
  • 28. OAuth2 In Cloudfoundry • Autoscaling Service (PCF) my-appAutoscaler my-app my-app
  • 29. OAuth2 In Cloudfoundry • Autoscaling Service (PCF) UAA (login.) Cloud Controller (api.) Autoscaler Time to check status!
  • 30. OAuth2 In Cloudfoundry • Autoscaling Service (PCF) UAA (login.) Cloud Controller (api.) Autoscaler Here is my client_id and client_secret
  • 31. OAuth2 In Cloudfoundry • Autoscaling Service (PCF) UAA (login.) Cloud Controller (api.) Autoscaler Here is a token
  • 32. OAuth2 In Cloudfoundry • Autoscaling Service (PCF) UAA (login.) Cloud Controller (api.) Autoscaler /v2/apps/1234/stats -H “Authorization: bearer eyJhbGci…”
  • 33. OAuth2 In Cloudfoundry • Autoscaling Service (PCF) UAA (login.) Cloud Controller (api.) Autoscaler CPU at 80%!
  • 34. OAuth2 In Cloudfoundry • Autoscaling Service (PCF) UAA (login.) Cloud Controller (api.) Autoscaler PUT /v2/apps/1234 -H “Authorization: bearer eyJhbGci…” -d ‘{"instances":2}’
  • 35. OAuth2 In Cloudfoundry • Autoscaling Service (PCF) UAA (login.) Cloud Controller (api.) Autoscaler OK, creating more instances
  • 36. OAuth2 In Cloudfoundry • Autoscaling Service (PCF) – Client Credentials Grant – Typical of apps that act without a user’s involvement – Autoscaling Service is the client
  • 37. OAuth2 In Cloudfoundry • The CF platform has many more examples of using OAuth2 • UAA is the key – Manages users – Manages clients – Grants and verifies access tokens
  • 38. UAA is the perfect fit for Cloud Native Security*
  • 39. UAA for Cloud Native Security • *In CF there’s more to security than just UAA – Network security / security groups – Cross container traffic / trusted workloads – No End to end TLS • UAA is for application-level security • It works for us, so it’ll work for you*
  • 40. So you want to secure your apps • Example – You want to host your API application on Cloud Foundry my-cloudfoundry.cn
  • 41. So you want to secure your apps • Example – You want to host your API application on Cloud Foundry my-cloudfoundry.cn my-api
  • 42. So you want to secure your apps • Example – It will be accessed by a web app hosted on CF my-cloudfoundry.cn my-api my- webapp browser
  • 43. So you want to secure your apps • Example – It will be accessed through a mobile app as well my-cloudfoundry.cn my-api my- webapp browser Mobile app
  • 44. So you want to secure your apps • Perfect! Use UAA my-cloudfoundry.cn my-api my- webapp browser Mobile app UAA
  • 45. So you want to secure your apps • Perfect! Use UAA – Client for web app  authcode grant
  • 46. So you want to secure your apps • Perfect! Use UAA – Client for web app  authcode grant – Client for mobile app  password grant
  • 47. So you want to secure your apps • Perfect! Use UAA – Client for web app  authcode grant – Client for mobile app  password grant – API app token verification  JWT signature
  • 48. So you want to secure your apps • Perfect! Use UAA – Client for web app  authcode grant – Client for mobile app  password grant – API app token verification  JWT signature • API app can validate token on its own
  • 49. Who are your end users? • SpaceDevelopers, OrgManagers – Platform users, no problem
  • 50. Who are your end users? • SpaceDevelopers, OrgManagers – Platform users, no problem • That sales guy – Not a platform user, PROBLEM
  • 51. Who are your end users? jsmith jsmyth cf set-space-role jsmyth the-org the-space SpaceDeveloper oops
  • 52. Who are your end users? jsmith jsmyth My app is too slow
  • 53. Who are your end users? jsmith jsmyth cf login –u jsmyth ... cf scale sales-api –m 10G I can fix that!
  • 54. The Principle of Least Privilege • You (or the application, process, module, etc) should have the minimum level of access required for performing their job
  • 55. The Principle of Least Privilege • You (or the application, process, module, etc) should have the minimum level of access required for performing their job • Salesguy should not have been added to the platform UAA
  • 56. Solutions? • Create your own authorization server • Deploy your own UAA
  • 57. So you want to secure your products • Example – You want to build a product that’s packaged as a CF service my-cloudfoundry.cn my-service
  • 58. So you want to secure your products • Example – When apps bind to the service… my-cloudfoundry.cn my-service my-app cf bind-service
  • 59. So you want to secure your products • Example – Create an oauth client my-cloudfoundry.cn my-service my-app UAA POST /oauth/client
  • 60. So you want to secure your products • Example – Create an oauth client my-cloudfoundry.cn my-service my-app UAA 201: Created
  • 61. my-cloudfoundry.cn So you want to secure your products • Example – So that the app to service communication can be secured by OAuth2 client credentials grant my-service my-app UAA The client_id and client_secret are in VCAP_SERVICES
  • 62. my-cloudfoundry.cn So you want to secure your products • Example – So that the app to service communication can be secured by OAuth2 client credentials grant my-service my-app UAA GET /api/foo -H ‘Authorization: bearer eyJhbGci…’
  • 63. So you want to secure your products • Perfect! Use UAA – App to app communication  client credentials – Token verification  JWT signature – Every app gets their own credentials • Super secure right?
  • 64. How do you create clients in UAA? • POST /oauth/clients – Token must have scope clients.write • Creating clients with authorities – Eg the app gets a token with my-service.read scope – Requires clients.write and uaa.admin • So give your service admin credentials?
  • 65. Admin-Level Credentials my-service • client_id: my-service • client_secret: 123xyz • authorities: clients.write, uaa.admin • authorized_grant_types: client_credentials
  • 66. Admin-Level Credentials my-service • CLIENT_ID: my-service • CLIENT_SECRET: 123xyz
  • 67. Admin-Level Credentials my-service • CLIENT_ID: my-service • CLIENT_SECRET: 123xyz I got root, yo.
  • 68. Admin-Level Credentials my-service • CLIENT_ID: my-service • CLIENT_SECRET: 123xyz This job sucks. cf env my-service
  • 69. Admin-Level Credentials $ uaac target uaa.my-cloudfoundry.cn $ uaac token client get my-service -s 123xyz $ uaac client add my-admin-client –authorities cloud_controller.admin
  • 70. Admin-Level Credentials I got root yo. Lets have some fun.
  • 71. The Principle of Least Privilege • You (or the application, process, module, etc) should have the minimum level of access required for performing their job
  • 72. The Principle of Least Privilege • You (or the application, process, module, etc) should have the minimum level of access required for performing their job • Giving admin level credentials to applications is dangerous
  • 73. Solutions? • Create your own authorization server • Deploy your own UAA
  • 74. How do you deploy your own UAA? • cf push cloudfoundry-identity-uaa.war • Yaml config • Bootstrap users • Provision DB • Do the above manually, or as part of a Bosh deployment
  • 75. Running your own UAA • Pros: – Principle of least privilege – You can fork it • Cons: – Overhead – Manual upgrades – “yak shaving” a bosh release
  • 76. Running your own UAA • Pros: – Principle of least privilege • Systems secured by your UAA cannot affect systems secured by the platform UAA
  • 77. Running your own UAA • Pros: – Principle of least privilege Your UAA
  • 78. Running your own UAA • Pros: – Principle of least privilege Your UAA Platform UAA
  • 79. Running your own UAA • Pros: – Principle of least privilege Your UAA Platform UAA Impossible!
  • 80. Running your own UAA • Pros: – Principle of least privilege – You can fork it • Cons: – Overhead – Manual upgrades – “yak shaving” a bosh release
  • 82. What is Multitenant UAA • CF v208 + • The built-in UAA with subdomains • Subdomain maps to Identity Zone • Total segregation between Identity Zones • API for creating Identity Zones • Existing API stays the same
  • 83. Zone administrators • UAA users with god-like powers in an identity zone • Requires scope zone.[zone-id].admin • Instead of targeting zone via subdomain, use X-Identity-Zone-Id header – POST uaa.domain.com/oauth/clients  create a client in the UAA zone – POST uaa.domain.com/oauth/clients -H “X- Identity-Zone-Id:12345”  create a client in the Identity Zone with id 12345
  • 84. Multitenant UAA • Pros: – Principle of least privilege – API calls for creating a new tenant (aka Identity Zone) – Zone administrators instead of bootstrap users • Cons: – Overhead – Manual upgrades – “yak shaving” a bosh release – You can’t fork it
  • 86. Multitenant UAA with UAAC • Setup can be cumbersome – When acting as zone admin with X-Identity-Zone- Id header, you can only uaac curl • Once you have an admin client in the zone, uaac works great • Future enhancements – Creating initial users / clients when the Identity Zone is created – -z global option to target a zone via header
  • 87. Summary • UAA is great for securing Cloud Native Applications • Always use the principle of least privilege – Don’t add non-platform users to the platform – Don’t give out platform admin abilities to other apps • You can deploy your own UAA – but multitenant UAA is an API call away • Tooling needs to catch up – But once you get that admin client set up, its easy
  • 89. Stay in touch • Me – Twitter: @fivetenwill – github.com/william-tran – wtran@pivotal.io • CF Identity PM – Sree Tummidi: stummidi@pivotal.io • CF Identity Team – Issues: github.com/cloudfoundry/uaa – Discussion: lists.cloudfoundry.org

Editor's Notes

  1. Hello everyone, thank you for coming to my talk, I’m very excited to be here.