SlideShare a Scribd company logo
@sometorin
Implementing Authorization
@sometorin@sometorin
Torin Sandall
● Engineer @ Styra
● Co-founder @ Open Policy Agent
@sometorin
"Undifferentiated Heavy Lifting"
- Jeff Bezos (Amazon CEO, 2006)
@sometorin
Authorization is heavy lifting.
@sometorin
...but every app needs authorization.
@sometorin
Rethink how you implement authorization.
@sometorin
Ship secure projects faster.
@sometorin
Authentication != Authorization
Verify identity Verify permission
(auth/n) (auth/z)
@sometorin
Authentication standards
{
"iss": https://example.com
"sub": bob
"aud": retail
"nbf": 123456789,
"exp": 123456789,
"amr": ["password", "otp"]
}
<saml:Assertion>
<saml:Subject>
<saml:NameID abcdef>
</saml:NameID>
<saml:SubjectConfirmation
Method="urn:...:bearer">
<saml:SubjectConfirmation
Data NotOnOrAfter=../>
</saml:SubjectConfirmation>
<saml:Conditions>...
spiffe://acmecorp/a/b/c
SAML OpenID Connect SPIFFE
Enterprise Consumer Infrastructure
@sometorin
Authentication verifies identity & produces attributes.
Human
Machine
Authentication Verified Identity
{
iss: acmecorp
sub: bob
aud: retail
nbf: 123456789
exp: 123456789
amr: [
password
otp
]
}
credentials
@sometorin@sometorin
Attribute
semantics are
beyond the
scope of the
specification.
### 2.2. Path
The path component of a SPIFFE ID allows for the
unique identification of a given workload. The
meaning behind the path is left open ended and the
responsibility of the administrator to define.
Paths MAY be hierarchical - similar to filesystem
paths. The specific meaning of paths is reserved as
an exercise to the implementer and are outside the
SVID specification. However some examples and
conventions are expressed below.
2. ID Token [...]
The definition of particular values to be used in the amr
Claim is beyond the scope of this specification. Parties
using this claim will need to agree upon the meanings of
the values used, which may be context-specific. [...]
ID Tokens MAY contain other Claims.
@sometorin
App must decide how identity attributes
map to functionality, privileges, etc.
@sometorin@sometorin
What about OAuth?
RFC 6749
The OAuth 2.0 Authorization Framework
Abstract
The OAuth 2.0 authorization framework enables a
third-party application to obtain limited access to
an HTTP service, either on behalf of a resource owner
by orchestrating an approval interaction between the
resource owner and the HTTP service, or by allowing
the third-party application to obtain access on its
own behalf.
@sometorin@sometorin
OAuth 2.0 enables
delegation.
"Power of Attorney" for
web and mobile
applications. Source: https://backstage.forgerock.com/docs/am/5/oauth2-guide/
@sometorin@sometorin
Application of access tokens
is beyond the scope of the
specification.
RFC 6749 Section 7
The client accesses protected resources by presenting
the access token to the resource server. The resource
server MUST validate the access token and ensure that
it has not expired and that its scope covers the
requested resource. The methods used by the resource
server to validate the access token (as well as any
error responses) are beyond the scope of this
specification but generally involve an interaction or
coordination between the resource server and the
authorization server.
@sometorin
How does the app decide what to do
with incoming requests, identity
attributes, and access tokens?
@sometorin
Can identity I do operation O on resource R?
Authorization: Problem Statement
@sometorin
Example Authorization Scenario
"Employees should be able to read
their own salary and the salary of
employees they manage."
HTTP API
GET /salary/bob
Authorization: alice
@sometorin
@route("GET", "/salaries/{employee_id}")
def get_salary(req):
if not authorized(req):
return error(403)
return db.read_salary(req.emp_id)
def authorized(req):
if req.user == req.emp_id:
return True
if req.user in managers_of(req.emp_id):
return True
return False
app code
authorization code
@sometorin
@route("GET", "/salaries/{employee_id}")
def get_salary(req):
if not authorized(req):
return error(403)
return db.read_salary(req.emp_id)
def authorized(req):
if req.user == req.emp_id:
return True
if req.user in managers_of(req.emp_id):
return True
return False
This code raises questions!
● How do you enforce policies from security or legal departments?
● How do you delegate control to your end-users?
● How do you roll-out policy changes?
● How do you access HR database or other sources of context?
● How do you render the UI based on the user's permissions?
● How do you audit and test your policies for correctness?
● How do you audit enforcement of the policies?
● What about 100+ other services written in Java, Go, and Ruby?
@sometorin
Can identity I do operation O on resource R?
Authorization: Problem Statement
Goal: Solve for any combination of I, O, and R.
Enforce in any language, framework, or environment.
@sometorin
Authorization: Common Approaches
ACLs
- deny by default
- admin controlled
- user, action, resource
@sometorin
RBAC
- deny by default
- group users
- grant groups permissions
- inheritance
- separation of duty (SOD)
Authorization: Common Approaches
ACLs
- deny by default
- admin controlled
- user, action, resource
@sometorin
RBAC
- deny by default
- group users
- grant groups permissions
- inheritance
- separation of duty (SOD)
Authorization: Common Approaches
IAM
- allow and deny
- users, groups, resources
- negation & built-ins
ACLs
- deny by default
- admin controlled
- user, action, resource
@sometorin
RBAC
- deny by default
- group users
- grant groups permissions
- inheritance
- separation of duty (SOD)
Authorization: Common Approaches
IAM
- allow and deny
- users, groups, resources
- negation & built-ins
ACLs
- deny by default
- admin controlled
- user, action, resource
ABAC
- boolean logic
- context
- relationships
@sometorin
Authorization: Trade-offs
ACLs RBAC IAM ABAC
Ease of use Flexibility
@sometorin
ACLs, RBAC, and IAM are not enough.
"QA must sign-off on images
deployed to the production
namespace." "Analysts can read client data but
PII must be redacted."
"Restrict employees from accessing
the service outside of work hours."
"Allow all HTTP requests
from 10.1.2.0/24."
"Restrict ELB changes to senior
SREs that are on-call."
"Give developers SSH access to machines
listed in JIRA tickets assigned to them."
"Prevent developers from running
containers with privileged security
contexts in the production
namespace." "Workloads for euro-bank must be
deployed on PCI-certified clusters in
the EU."
@sometorin
Open Policy Agent (OPA) is a
general-purpose policy engine.
Service
OPA
Policy
(rego)
Data
(json)
Policy
Query
Policy
Decision
Enforcement
@sometorin
Service
OPA
Policy
(rego)
Data
(json)
Policy
Query
Policy
Decision
Enforcement
Decouple policy decisions from
enforcement and codify decisions
using a declarative language.
Open Policy Agent (OPA)
@sometorin
Open Policy Agent (OPA) Service
OPA
Policy
(rego)
Data
(json)
Policy
Query
Policy
Decision
Enforcement
Supports multiple authorization
models like ACLs, RBAC, IAM, and
ABAC.
@sometorin
Demo
@sometorin
Authorization: Where does OPA stand?
ACLs RBAC IAM ABAC
Ease of use Flexibility
@sometorin
Authorization: Where does OPA stand?
ACLs RBAC IAM ABAC
Ease of use Flexibility
@sometorin
Petdetails
GET /pets
Authorization: bob
SELECT * FROM pets
DB
name owner age
Fluffy Bob 7
Muffin Alice 3
King Janet 12
@sometorin
Petdetails
GET /pets
Authorization: bob
SELECT * FROM pets
DB
Policy
name owner age
Fluffy Bob 7
Muffin Alice 3
King Janet 12
@sometorin
Petdetails
GET /pets
Authorization: bob
SELECT * FROM pets
DB
Policy
Example Policy
"Users should only be allowed
to see details of pets they
own."
@sometorin
SELECT * FROM pets
Petdetails
GET /pets
Authorization: bob
DB
Policy
WHERE pets.owner = "bob"
Example Policy
"Users should only be allowed
to see details of pets they
own."
@sometorin
SELECT * FROM pets
Petdetails
GET /pets
Authorization: bob
DB
Policy
WHERE pets.owner = "bob"
AND pets.location = "EU"
Policy
Example Policy
"Users should only be allowed
to see details of pets they
own."
@sometorin
Petdetails OPA
policy
query
allow or deny
DB
GET /pets
Authorization: bob
SELECT * FROM pets
Policy
(rego)
@sometorin
Petdetails OPA
allow or deny
DB Requires OPA to have access to the data.
GET /pets
Authorization: bob
SELECT * FROM pets
policy
query
Policy
(rego)
@sometorin
Petdetails OPA
conditions
(SQL predicate)
DB
GET /pets
Authorization: bob
SELECT * FROM pets
WHERE pets.owner = "bob"
policy
query
Policy
(rego)
Partially Evaluate Rego & Translate into SQL.
@sometorin
Demo
@sometorin
Petdetails OPA
conditions
(SQL predicate)
DB
GET /pets
Authorization: bob
SELECT * FROM pets
WHERE pets.owner = "bob"
policy
query
Policy
(rego)
Partially Evaluate Rego & Translate into SQL.
See blog.openpolicyagent.org for details.
@sometorin
Authorization is heavy lifting.
@sometorin@sometorin
Rethink how you
implement authorization.
openpolicyagent.org
Integrated with...
...and more.
@sometorin
Thank you!
open-policy-agent/opa
slack.openpolicyagent.org
tsandall/kubecon-shanghai-2018

More Related Content

PDF
Rego Deep Dive
PDF
Open Policy Agent
PDF
How Netflix Is Solving Authorization Across Their Cloud
PDF
Enforcing Bespoke Policies in Kubernetes
PPTX
Securing APIs with Open Policy Agent
PDF
OPA: The Cloud Native Policy Engine
PDF
Open Policy Agent Deep Dive Seattle 2018
PDF
Introduction to OPA
Rego Deep Dive
Open Policy Agent
How Netflix Is Solving Authorization Across Their Cloud
Enforcing Bespoke Policies in Kubernetes
Securing APIs with Open Policy Agent
OPA: The Cloud Native Policy Engine
Open Policy Agent Deep Dive Seattle 2018
Introduction to OPA

What's hot (20)

PDF
Istio's mixer policy enforcement with custom adapters (cloud nativecon 17)
PPTX
Uygulamali Sizma Testi (Pentest) Egitimi Sunumu - 2
PPTX
Policy Enforcement on Kubernetes with Open Policy Agent
PPTX
Monitoring Solutions for APIs
PDF
Opa gatekeeper
PPTX
Secure your app with keycloak
PDF
CNCF Online - Data Protection Guardrails using Open Policy Agent (OPA).pdf
PDF
The Architecture of an API Platform
PDF
Serving ML easily with FastAPI - meme version
PPTX
API Management in Digital Transformation
PDF
Opa in the api management world
PDF
Architecting an Enterprise API Management Strategy
PDF
Spring Cloud Gateway
PPTX
Beyaz Şapkalı Hacker CEH Eğitimi - Bölüm 16, 17, 18
PDF
CNCF opa
PPTX
Understanding REST APIs in 5 Simple Steps
PPTX
Rest API Security
PPSX
Rest api standards and best practices
PPT
Modernizing an Existing SOA-based Architecture with APIs
PPTX
OpenId Connect Protocol
Istio's mixer policy enforcement with custom adapters (cloud nativecon 17)
Uygulamali Sizma Testi (Pentest) Egitimi Sunumu - 2
Policy Enforcement on Kubernetes with Open Policy Agent
Monitoring Solutions for APIs
Opa gatekeeper
Secure your app with keycloak
CNCF Online - Data Protection Guardrails using Open Policy Agent (OPA).pdf
The Architecture of an API Platform
Serving ML easily with FastAPI - meme version
API Management in Digital Transformation
Opa in the api management world
Architecting an Enterprise API Management Strategy
Spring Cloud Gateway
Beyaz Şapkalı Hacker CEH Eğitimi - Bölüm 16, 17, 18
CNCF opa
Understanding REST APIs in 5 Simple Steps
Rest API Security
Rest api standards and best practices
Modernizing an Existing SOA-based Architecture with APIs
OpenId Connect Protocol
Ad

Similar to Implementing Authorization (20)

PPTX
Challenge to Implementing "Scalable" Authorization with Keycloak
PPTX
ABAC, ReBAC, Zanzibar, ALFA… How Should I Implement AuthZ in My APIs? by Dav...
PPTX
ABAC, ReBAC, Zanzibar, ALFA… How Should I Implement AuthZ in My APIs - Nordi...
PPTX
Externalizing Authorization in Micro Services world
PPTX
How to Use Stormpath in angular js
PPTX
Don't Ask for Forgiveness, Ask for Permission
PDF
Open sso fisl9.0
PPTX
Securing APIs using OAuth 2.0
PDF
OAuth in the Real World featuring Webshell
KEY
Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...
KEY
Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...
PDF
Can you keep a secret? (XP Days 2017)
PPTX
2022 APIsecure_Why Assertion-based Access Token is preferred to Handle-based ...
PPTX
Why Assertion-based Access Token is preferred to Handle-based one?
PDF
Automating Cloud Operations - Everything you wanted to know about cURL and RE...
PDF
Finally, EE Security API JSR 375
PDF
FIWARE Global Summit - Adding Identity Management, Access Control and API Man...
PDF
apidays Helsinki & North 2023 - API authorization with Open Policy Agent, And...
PPTX
Webinar: "Entitlements: Taking Control of the Big Data Gold Rush"
PDF
Understanding Identity in the World of Web APIs – Ronnie Mitra, API Architec...
Challenge to Implementing "Scalable" Authorization with Keycloak
ABAC, ReBAC, Zanzibar, ALFA… How Should I Implement AuthZ in My APIs? by Dav...
ABAC, ReBAC, Zanzibar, ALFA… How Should I Implement AuthZ in My APIs - Nordi...
Externalizing Authorization in Micro Services world
How to Use Stormpath in angular js
Don't Ask for Forgiveness, Ask for Permission
Open sso fisl9.0
Securing APIs using OAuth 2.0
OAuth in the Real World featuring Webshell
Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...
Extend Your Use of JIRA by Solving Your Unique Concerns: An Exposé of the New...
Can you keep a secret? (XP Days 2017)
2022 APIsecure_Why Assertion-based Access Token is preferred to Handle-based ...
Why Assertion-based Access Token is preferred to Handle-based one?
Automating Cloud Operations - Everything you wanted to know about cURL and RE...
Finally, EE Security API JSR 375
FIWARE Global Summit - Adding Identity Management, Access Control and API Man...
apidays Helsinki & North 2023 - API authorization with Open Policy Agent, And...
Webinar: "Entitlements: Taking Control of the Big Data Gold Rush"
Understanding Identity in the World of Web APIs – Ronnie Mitra, API Architec...
Ad

Recently uploaded (20)

PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
System and Network Administration Chapter 2
2025 Textile ERP Trends: SAP, Odoo & Oracle
VVF-Customer-Presentation2025-Ver1.9.pptx
Design an Analysis of Algorithms I-SECS-1021-03
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Navsoft: AI-Powered Business Solutions & Custom Software Development
Operating system designcfffgfgggggggvggggggggg
CHAPTER 2 - PM Management and IT Context
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
How to Choose the Right IT Partner for Your Business in Malaysia
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Understanding Forklifts - TECH EHS Solution
Adobe Illustrator 28.6 Crack My Vision of Vector Design
How to Migrate SBCGlobal Email to Yahoo Easily
PTS Company Brochure 2025 (1).pdf.......
Odoo Companies in India – Driving Business Transformation.pdf
System and Network Administration Chapter 2

Implementing Authorization