SlideShare a Scribd company logo
AUTHENTICATION, AUTHORIZATION,
AND FINE-GRAINED ACCESS CONTROL
AndyMiller| | |amiller@objectpartners.com @opiamiller
www.objectpartners.com
Dev objecttives-2015 auth-auth-fine-grained-slides
Dev objecttives-2015 auth-auth-fine-grained-slides
HAVE YOU EVER SEEN AN OLD PHOTO
OF YOURSELF...
...AND BEEN EMBARRASSED AT
THE WAY YOU LOOKED?
HAVE YOU LOOKED AT OLD CODE YOU
WROTE...
... what the ****?
|
PROGRAMMAIN | SUBROUTINESUB1(X,DUMSUB)
INTEGERN,X | INTEGERN,X
EXTERNALSUB1 | EXTERNALDUMSUB
COMMON/GLOBALS/N | COMMON/GLOBALS/N
X=0 | IF(X.LT.N)THEN
PRINT*,'Enternumberofrepeats' | X=X+1
READ(*,*)N | PRINT*,'x=',X
CALLSUB1(X,SUB1) | CALLDUMSUB(X,DUMSUB)
END | ENDIF
| END
|
HAVE YOU LOOKED AT OLD PROJECT
PLANS AND BUDGETS...
...AND BEEN EMBARRASSED AT HOW MUCH
MONEY YOU SPENT ON THE THINGS THAT TODAY
ARE SO EASY?
THE TRUTH IS WE SPENT ENTIRE PROJECT
BUDGETS ON WHAT, THEN, WAS HARD STUFF...
figuring out how to organize source code
figuring out dependency management
figuring out build automation
figuring out how to save data in a database
figuring out test automation
...
Looking back, it's amazing we had time (or money) left over to work on the important things...
LIKE WHAT THE SOFTWARE WAS
ACTUALLY SUPPOSED TO DO!
WHEN BUILDING A SYSTEM...
Dev objecttives-2015 auth-auth-fine-grained-slides
Dev objecttives-2015 auth-auth-fine-grained-slides
Dev objecttives-2015 auth-auth-fine-grained-slides
Dev objecttives-2015 auth-auth-fine-grained-slides
Dev objecttives-2015 auth-auth-fine-grained-slides
Dev objecttives-2015 auth-auth-fine-grained-slides
Dev objecttives-2015 auth-auth-fine-grained-slides
PATTERN LANGUAGES
WE'VE "SOLVED" SOME STUFF...
structuring the vertical slice
organizing source code
dependency management
build automation
persistence
schema evolution
test automation
BUT SOME THINGS ARE STILL HARD...
Requirements management
Integrating with other systems
Asynchronous processing
Application security
Batch processing
Functional testing
Working with money
...
SOME THINGS ARE JUST "HARD"...
Requirements management
Integrating with other systems
Asynchronous processing
APPLICATION SECURITY
Batch processing
Functional testing
Working with money
...
APPLICATION SECURITY
0. anonymous (no security)
1. authentication of multiple users
2. authentication of multiple tenants
3. user authentication AND user authorization
4. fine grained user authorization varying across resources
5. data security (at the query level)
6. api security
These are complex, multi-dimensional problems. Cool! I like complex problems, but they're only fun
to solve once (or maybe two or three times.)
So let's look a little deeper...
PATTERN LANGUAGE
security
anonymous | authorized | restricted | unrestricted
secured | unsecured
authentication | username | password
roles/permissions/authorities
fine grained security
API | API consumer | bearer token
USERS & ROLES
Anonymous : No security necessary.
Single User : one step beyond "anonymous". Address this situation by using the @Secured
annotation (provided by the spring-security-core plugin) to secure controller actions.
Multipe Users : As soon as you've secured an application you'll discover you can do things
with the knowledge of who's logged in. Things like audit logging are possible (who did
what/when.)
Multipe Users / Multiple Roles
@Secured(["isFullyAuthenticated()"])
USERS & ROLES
Multipe Users / Multiple Roles: With multiple users you'll find that you want to allow some
users to do somethings and other users to do other things. This too can be handled with the
@Secured annotation
@Secured(["ROLE_SUPERUSER"])
defrmMinusRStar(Stringpathname){
...
}
@Secured(["ROLE_MOM"])
defmakeGoodCookies(Integercount){
(count*2).times{
...
}
}
MULTIPLE TENANTS
multiple users
multiple resources
each resource is owned by a single user
"OWNER" can grant access to other users
Eventually we're going to need to store data for multiple customers/tenants in the same database.
HOW DO WE HANDLE THIS?
Roles are great for implementing details like "Only the superuser can run with scissors" and "Never
let Mom touch this feature!"
But roles can't capture variation across resources.
Fine-grained Access Control
==
Variation of access across users and resources
FINE-GRAINED ACCESS CONTROL
I want a simple way to discuss this with product ownsers
...so let's extend the pattern language.
and
I want the implementation to be just as simple...
no room for stupid coding mistakes!
...so let's build another annotation.
LEVELS OF AUTHORIZATION
Class level authorization: grant users ability to create new instances
Instance level authorization: allow users to work with individual domain objects
@Secured(["isFullyAuthenticated()"])
defshow(Projectorg){
...
}
@Secured(["isFullyAuthenticated()"])
@Authorized(clazz=Project,idParam="id",permission="VIEWER")
defshow(Projectorg){
...
}
WHEN "ROLES" VARY ACROSS
MULTIPLE TENANTS
0. anonymous (no security)
1. authentication of multiple clients (bearer tokens to secure a rest api)
2. authentication of multiple users (spring security to restrict access to ctrl/action)
3. user authentication AND user authorization (spring security "authorities" to restrict acces to
ctrl/action)
4. user authorization that varies across different data elements == fine grained security
5. data security (at the query level)
Dev objecttives-2015 auth-auth-fine-grained-slides
Dev objecttives-2015 auth-auth-fine-grained-slides
FINE GRAINED SECURITY EXAMPLE
1. I (a user) can create new resources
2. I "own" resources that I've created
3. I am a "VIEWER" for some resources
4. I can grant "OWNER", "VIEWER", and so on to other users
usage example: class level authorization
@Authorized(clazz=Project,permission="OWNER")
defcreate(){
...
}
@Authorized(clazz=Project,permission="OWNER")
defsave(){
...
}
usage example: instance level authorization
@Authorized(clazz=Project,idParam="id",permission="OWNER")
defedit(Projectproject){
rendertemplate:"edit",model:[project:project]
}
@Authorized(clazz=Project,idParam="id",permission="OWNER")
defupdate(Projectproject){
...
}
usage example: list of authorized instances
deflist(){
defuser=springSecurityService.currentUser
defprojectList=authorizationService.authorizedInstances(
user?.id,
Project,
params
)
defprojectTotal=authorizationService.authorizedInstanceCount(
user?.id,
Project
)
[projectList:projectList,projectTotal:projectTotal,]
}
IMPLEMENTATION...
@Authorizedannotation
DomainAuthorizationFilters
AuthorizationService
Authorization(domain object)
AuthorizationTagLib
github.com/onetribeyoyo/grails-domain-authorization
API SECURITY
A REST API can be secured with a two part process...
1. authentication is handled with an OATH 2 style process
2. and authorization is handled with @Authorized annotation
API SECURITY
Figure1from sumsitupnicely...
Note:Webapphandlesallthreeserver-sideroles.
self-issued.info/docs/draft-ietf-oauth-v2-bearer.html
+--------+ +---------------+
| |--(A)-AuthorizationRequest->| Resource |
| | | Owner |
| |<-(B)--AuthorizationGrant---| |
| | +---------------+
| |
| | +---------------+
| |--(C)--AuthorizationGrant-->|Authorization|
|Client| | Server |
| |<-(D)-----AccessCode--------| |
| | +---------------+
| |
| | +---------------+
| |--(E)-----AccessCode------->| Resource |
| | | Server |
| |<-(F)---ProtectedResource---| |
+--------+ +---------------+
@Secured(["IS_AUTHENTICATED_ANONYMOUSLY"])
@SecuredApi
defapiGet(StringprojectCode){
....
}
ApiConsumer{
booleanvalidateResource(Stringrsrc){
if(!rsrc?.trim()){
returnfalse
}elseif(!isActive()){
returnfalse
}elseif(!scope){
returnfalse
}else{
returnscope.find{pattern->matchUriPattern(rsrc,pattern)}
}
}
BEARER TOKEN?
"authorization" http request header field formatted like...
where
"bearerb64token"
b64token=1*(ALPHA/DIGIT/"-"/"."/"_"/"~"/"+"/"/")*"="
ApiConsumerSpec{
CODEEXAMPLES
PATTERN LANGUAGE
The words we use to discuss difficult topics should be the same when we talk about requirements,
talk about technical concepts, and when we talk about code.
QUESTIONS?
Slides + Src:
grails-domain-authorizationplugin
magic-task-machine(exampleapp)
AndyMiller| | |
github.com/onetribeyoyo/dev-objecttives-2015
github.com/onetribeyoyo/grails-domain-authorization
github.com/onetribeyoyo/mtm
amiller@objectpartners.com @opiamiller

More Related Content

PPTX
Sencha Touch - Introduction
PPT
Introduction to the ExtJS Javascript framework for rich apps in every browser
PPTX
Basics of Ext JS
PDF
Hey my web app is slow where is the problem
PDF
In The Trenches With Tomster, Upgrading Ember.js & Ember Data
PDF
Realtime with-websockets-2015
PPTX
ColdFusion builder 3 making the awesome
PDF
Software craftsmanship
Sencha Touch - Introduction
Introduction to the ExtJS Javascript framework for rich apps in every browser
Basics of Ext JS
Hey my web app is slow where is the problem
In The Trenches With Tomster, Upgrading Ember.js & Ember Data
Realtime with-websockets-2015
ColdFusion builder 3 making the awesome
Software craftsmanship

Viewers also liked (20)

PDF
Monetizing Business Models: ColdFusion and APIS
PDF
Marketing for developers
PPTX
Preso slidedeck
PDF
Test box bdd
PDF
Refactor Large applications with Backbone
PPTX
2014 cf summit_clustering
PDF
This is how we REST
PDF
Accessible Video Anywhere with ColdFusion an AWS
PDF
Language enhancements in cold fusion 11
PDF
Who Owns Software Security?
PDF
Dependency Injection
PDF
Web hackingtools 2015
PDF
Front end-modernization
PDF
Paying off-emotional-debt-2
PDF
Get Gulping with Javascript Task Runners
PDF
Expand Your ColdFusion App Power with AWS
PDF
Relationships are hard
PDF
Dependency Injection Why is it awesome and Why should I care?
PDF
2015 in tothebox-introtddbdd
PDF
Everyones invited! Meet accesibility requirements with ColdFusion
Monetizing Business Models: ColdFusion and APIS
Marketing for developers
Preso slidedeck
Test box bdd
Refactor Large applications with Backbone
2014 cf summit_clustering
This is how we REST
Accessible Video Anywhere with ColdFusion an AWS
Language enhancements in cold fusion 11
Who Owns Software Security?
Dependency Injection
Web hackingtools 2015
Front end-modernization
Paying off-emotional-debt-2
Get Gulping with Javascript Task Runners
Expand Your ColdFusion App Power with AWS
Relationships are hard
Dependency Injection Why is it awesome and Why should I care?
2015 in tothebox-introtddbdd
Everyones invited! Meet accesibility requirements with ColdFusion
Ad

Similar to Dev objecttives-2015 auth-auth-fine-grained-slides (20)

ODP
CISSP Week 13
PPTX
Platform Security IRL: Busting Buzzwords & Building Better
PDF
The hidden gems of Spring Security
PPTX
Introduction To Building Enterprise Web Application With Spring Mvc
PDF
API Security Best Practices & Guidelines
PDF
Spring Security in Action 1st Edition Laurentiu Spilca Spilcă Laurenţiu
PDF
WebApp_to_Container_Security.pdf
PDF
Spring security jwt tutorial toptal
PDF
How to code securely: a crash course for non-coders
PDF
Spring Security in Action 1st Edition Laurentiu Spilca
PPTX
Securing Microservices with Spring Cloud Security
KEY
Pyramid Security
PPTX
Unit 3_detailed_automotiving_mobiles.pptx
PDF
API Security Best Practices & Guidelines
PDF
Secured REST Microservices with Spring Cloud
PPT
Spring Security Introduction
PDF
Designing Secure APIs
PPTX
Utilize the Full Power of GlassFish Server and Java EE Security
PPT
Security architecture
PDF
Api days 2018 - API Security by Sqreen
CISSP Week 13
Platform Security IRL: Busting Buzzwords & Building Better
The hidden gems of Spring Security
Introduction To Building Enterprise Web Application With Spring Mvc
API Security Best Practices & Guidelines
Spring Security in Action 1st Edition Laurentiu Spilca Spilcă Laurenţiu
WebApp_to_Container_Security.pdf
Spring security jwt tutorial toptal
How to code securely: a crash course for non-coders
Spring Security in Action 1st Edition Laurentiu Spilca
Securing Microservices with Spring Cloud Security
Pyramid Security
Unit 3_detailed_automotiving_mobiles.pptx
API Security Best Practices & Guidelines
Secured REST Microservices with Spring Cloud
Spring Security Introduction
Designing Secure APIs
Utilize the Full Power of GlassFish Server and Java EE Security
Security architecture
Api days 2018 - API Security by Sqreen
Ad

More from ColdFusionConference (20)

PDF
Api manager preconference
PDF
PDF
Building better SQL Server Databases
PDF
API Economy, Realizing the Business Value of APIs
PDF
Don't just pdf, Smart PDF
PDF
Crafting ColdFusion Applications like an Architect
PDF
Security And Access Control For APIS using CF API Manager
PDF
Become a Security Rockstar with ColdFusion 2016
PDF
ColdFusion in Transit action
PDF
Developer Insights for Application Upgrade to ColdFusion 2016
PDF
Where is cold fusion headed
PDF
ColdFusion Keynote: Building the Agile Web Since 1995
PDF
Instant ColdFusion with Vagrant
PPT
Restful services with ColdFusion
PDF
Super Fast Application development with Mura CMS
PDF
Build your own secure and real-time dashboard for mobile and web
PDF
Why Everyone else writes bad code
PDF
Securing applications
PDF
Testing automaton
PDF
Rest ful tools for lazy experts
Api manager preconference
Building better SQL Server Databases
API Economy, Realizing the Business Value of APIs
Don't just pdf, Smart PDF
Crafting ColdFusion Applications like an Architect
Security And Access Control For APIS using CF API Manager
Become a Security Rockstar with ColdFusion 2016
ColdFusion in Transit action
Developer Insights for Application Upgrade to ColdFusion 2016
Where is cold fusion headed
ColdFusion Keynote: Building the Agile Web Since 1995
Instant ColdFusion with Vagrant
Restful services with ColdFusion
Super Fast Application development with Mura CMS
Build your own secure and real-time dashboard for mobile and web
Why Everyone else writes bad code
Securing applications
Testing automaton
Rest ful tools for lazy experts

Recently uploaded (20)

PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
MYSQL Presentation for SQL database connectivity
PPT
Teaching material agriculture food technology
PDF
Empathic Computing: Creating Shared Understanding
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
cuic standard and advanced reporting.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
MYSQL Presentation for SQL database connectivity
Teaching material agriculture food technology
Empathic Computing: Creating Shared Understanding
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Electronic commerce courselecture one. Pdf
Encapsulation_ Review paper, used for researhc scholars
Reach Out and Touch Someone: Haptics and Empathic Computing
“AI and Expert System Decision Support & Business Intelligence Systems”
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Mobile App Security Testing_ A Comprehensive Guide.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Network Security Unit 5.pdf for BCA BBA.
Advanced methodologies resolving dimensionality complications for autism neur...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx

Dev objecttives-2015 auth-auth-fine-grained-slides