SlideShare une entreprise Scribd logo
1  sur  103
Télécharger pour lire hors ligne
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 1
Brent Shaffer
OAuth2: The Swiss Army Framework
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 2
Who Is This Guy?
Hint: Brent Shaffer
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 3
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 4
Maintainer of #1 Open Source PHP library for Server-Side OAuth
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 5
I’m in a Band!
The ladies love us!
More Hazards More Heroes
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 6
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 19
Don’t require your users to authenticate
with 3rd parties using passwords!
The moral of the story
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 20
Don’t require your users to authenticate
with your APIs using passwords!
…and to a lesser extent
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 21
What is OAuth?
▪ Something to do with Facebook
▪ Twitter’s in the mix
▪ Maybe Google too? Github?
▪ Authorization and Authentication
▪ Tokens everywhere
▪ Two-legs, three-legs… crablegs?
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 22
Overview
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 23
“OAuth is a big set of rules that explain how
two parties exchange tokens"
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 24
Currency for Tokens
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 25
Tokens Expire
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 26
Bearer Token
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 27
Applications (aka Clients)
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 28
▪ One user can have many apps
▪ Each app has its own set of credentials
▪ Each app represents a single program / application / script, etc
▪ A conceptual wrapper around your project
Applications (aka Clients)
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 29
User
“Resource Owner”
Client
“3rd Party”
Server
“Resource and Authorization Provider”
Three Roles
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 30
USER
3RD PARTY
SERVICE
Three Legs
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 31
Authorize Token Resource
The user authorizes
the client
The server returns a
token to the client
Three Endpoints
The server provides
the resource
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 32
Grant Types
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 33
“A Grant Type is just a specific way to obtain
(or be granted) an Access Token"
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 34
“The multiple ways to get an access token,
i.e. the Grant Types, are what make OAuth a
Swiss Army Framework™”
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 35
Brent Shaffer
OAuth2: The Swiss Army Framework
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 36
Difficulty: Easy
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 37
Client
Authorize
Token
Resource
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 38
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 39
Personal Access Token
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 40
Personal Access Token
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 41
▪ Easier than dirt
▪ Good for calling your APIs on your behalf
▪ No encryption other than HTTPS
▪ No expiration
▪ Treat these like a password
▪ Extension of OAuth2.0 Spec
Personal Access Tokens
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 42
Personal Access Token
$ curl https://api.github.com/users/bshaffer 	
	 -u fd8e84b60c4bfd8e9277cb3b16f112859d60c45c:
$ curl https://api.github.com/users/bshaffer?access_token=xyz
GET /users/bshaffer HTTP/1.1!
Host: api.github.com!
Authorization: Basic czZCaGRSa3F0Mzp
GET /users/bshaffer?access_token=xyz HTTP/1.1!
Host: api.github.com
$ curl https://api.github.com/users/bshaffer 	
-H ‘Authorization: Bearer xyz
GET /users/bshaffer HTTP/1.1!
Authorization: Bearer xyz!
Host: api.github.com
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 43
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 44
▪ Slightly harder than dirt, but still very easy
▪ Good for calling YOUR apis
▪ Good for Server-to-Server calls
▪ Tokens expire
▪ Hardcoded credentials
▪ I couldn’t find this in the wild
Client Credentials
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 45
Client Credentials
$ curl https://api.example.com/token	
	 -d ‘grant_type=client_credentials’	
	 -d ‘client_id=avatarfanclub’	
	 -d ‘client_secret=df40b2’
POST /token HTTP/1.1!
Host: api.example.com!
Content-Type: application/x-www-form-urlencoded!
!
grant_type=client_credentials!
&client_id=avatarfanclub!
&client_secret=df40b2
$ curl https://api.example.com/token	
	 -u ‘avatarfanclub:df40b2’
POST /token HTTP/1.1!
Host: server.example.com!
Authorization: Basic czZCaGRSa3F0Mzp!
Content-Type: application/x-www-form-urlencoded!
!
grant_type=client_credentials
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 46
Client
Token
Client Credentials
Authorize
Resource
POST /token HTTP/1.1!
Host: api.example.com!
Content-Type: application/x-www-form-urlencoded!
!
grant_type=client_credentials!
&client_id=avatarfanclub!
&client_secret=df40b2
Client Credentials
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 47
Client
Token
Client Credentials
Authorize
Resource
HTTP/1.1 200 OK!
Content-Type: application/json;charset=UTF-8!
Cache-Control: no-store!
Pragma: no-cache!
{!
"access_token":"2YotnFZFEjr1zCsicMWpAA",!
"token_type":"bearer",!
"expires_in":3600!
}
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 48
Client
Resource
Client Credentials
Authorize
Token
GET /resource/1 HTTP/1.1!
Host: example.com!
Authorization: Bearer 2YotnFZFEjr1zCsicMWpAA
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 49
Client
Resource
Client Credentials
Authorize
Token
HTTP/1.1 200 OK!
Content-Type: application/json;charset=UTF-8!
!
{!
"resource":"foo",!
"value":"bar",!
"success":true!
}
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 50
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 51
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 52
▪ Equally difficult to dirt
▪ Good for trusted applications with login forms
▪ Good for testing
▪ Tokens expire
▪ Not good for server-to-server calls, as this would require hardcoded credentials
Resource Owner Password Credentials
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 53
Resource Owner Password Credentials
$ curl https://api.github.com/login/oauth/token	
	 -d ‘grant_type=password’	
	 -d ‘username=bshaffer’	
	 -d ‘password=iheartavatar’	
	 -d ‘client_id=avatarfanclub’ POST /login/oauth/token HTTP/1.1!
Host: api.github.com!
Content-Type: application/x-www-form-urlencoded!
!
grant_type=password!
&username=bshaffer!
&password=iheartavatar!
&client_id=avatarfanclub
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 54
Client
Resource Owner Username / Password
Token
Authorization Code
Authorize
Resource
POST /login/oauth/token HTTP/1.1!
Host: api.github.com!
Content-Type: application/x-www-form-urlencoded!
!
grant_type=password!
&username=bshaffer!
&password=iheartavatar!
&client_id=avatarfanclub
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 55
Client
Token
Resource Owner Password Credentials
Authorize
Resource
HTTP/1.1 200 OK!
Content-Type: application/json;charset=UTF-8!
Cache-Control: no-store!
Pragma: no-cache!
{!
"access_token":"2YotnFZFEjr1zCsicMWpAA",!
"token_type":"bearer",!
"expires_in":3600!
}
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 56
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 57
Difficulty: Intermediate
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 58
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 59
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 60
▪ Why OAuth Exists
▪ For obtaining authorization to access a user’s information
▪ For when client credentials are secure (Web Applications)
Authorization Code
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 61
Authorization Code
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 62
Client
Authorization Request
Authorization Code
Authorization Code
Access Token
Access Token
Protected Resource
Authorize
Token
Resource
Authorization Code
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 63
Client
Authorize
Authorization Code
GET /authorize!
?response_type=code!
&client_id=s6BhdRkqt3!
HTTP/1.1!
Host: server.example.com!
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 64
Client
Authorize
Authorization Code
TokenHTTP/1.1 302 Found!
Location: http://example.com/cb!
?code=SplxlOBeZQQYbYS6WxSbIA
Resource
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 65
Client
Token
Authorization Code
Resource
POST /token HTTP/1.1!
Host: server.example.com!
Authorization: Basic czZCaGRSa3F0Mzp!
Content-Type: application/x-www-form-urlencoded!
!
grant_type=authorization_code!
&code=SplxlOBeZQQYbYS6WxSbIA
Authorize
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 66
Client
Token
Resource Owner Password Credentials
Authorize
HTTP/1.1 200 OK!
Content-Type: application/json;charset=UTF-8!
Cache-Control: no-store!
Pragma: no-cache!
{!
"access_token":"2YotnFZFEjr1zCsicMWpAA",!
"token_type":"bearer",!
"expires_in":3600!
}
Resource
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 67
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 68
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 69
▪ For native apps (Desktop, Mobile, Javascript in a browser)
▪ Your client’s credentials cannot be sent due to the public nature of the application
▪ We still want users to authorize our applications (3-legged)
▪ We want to prevent attackers from intercepting the request
Implicit / Device Grant
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 70
Implicit / Device Grant
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 71
PublicClient
Authorize
Token
Resource
Implicit / Device Grant
Access Token!
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 72
▪ A native call is made containing the access token directly from the authorization request
▪ Javascript
▪ Uses a registered Redirect URI
!
▪ Validated against Origins URL
!
▪ iOS Applications
▪ Issues a call to your app using a registered Bundle ID
▪ Android Applications
▪ Issues a call to your app using a registered Package Name
Implicit / Device Grant
https://mysite.com/myapp#access_token=xyz
function onAuthorizeCallback(authResult) {..}
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 73
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 74
Login With OAuth
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 75
▪ It’s a Trick!!
▪ This is just Authorization Code in disguise!
▪ The application uses your profile data from the other service to create a local account
▪ The two accounts, your local account and the OAuth-provided account, are matched up every time
you log in
Login With OAuth
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 76
Client
Token
Login with OAuth
Authorize
Resource
HTTP/1.1 200 OK!
Content-Type: application/json;charset=UTF-8!
Cache-Control: no-store!
Pragma: no-cache!
{!
"access_token":"2YotnFZFEjr1zCsicMWpAA",!
"token_type":"bearer",!
“expires_in":3600!
}
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 77
Client
Resource
Client Credentials
Authorize
Token
GET /profile HTTP/1.1!
Host: api.example.com!
Authorization: Bearer 2YotnFZFEjr1zCsicMWpAA
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 78
Client
Resource
Login With OAuth
Authorize
Token
HTTP/1.1 200 OK!
Content-Type: application/json;charset=UTF-8!
!
{!
“user_id":"f560f23b24feff2g",!
“first_name”:"Ash",!
“nickname”:”Poke-Master”,!
“favorite_pokemon”: “magikarp”!
}
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 79
▪ This is not SSO
▪ Very nice way to trick your users into creating an account on your website (clients)
▪ Very nice way to maintain a single canonical user base (server)
▪ While being nefarious, it’s also convenient for your users
▪ Stay tuned for OpenID Connect (advanced)
Login With OAuth
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 80
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 81
▪ Usually comes back with an access token
▪ When your access token expires, you get another one
▪ Allows the user to not have to reauthorize
▪ Refresh Tokens can expire, or not
Refresh Tokens
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 82
Client
Token
Refresh Token
Authorize
Resource
HTTP/1.1 200 OK!
Content-Type: application/json;charset=UTF-8!
Cache-Control: no-store!
Pragma: no-cache!
{!
"access_token":"2YotnFZFEjr1zCsicMWpAA",!
"token_type":"bearer",!
"expires_in":3600,!
“refresh_token”: “tGzv3JOkF0XG5Qx2TlKWIA“!
}
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 83
Client
Token
Refresh Token
Authorize
Resource
POST /token HTTP/1.1!
Host: server.example.com!
Authorization: Basic czZCaGRSa3F0Mzp!
Content-Type: application/x-www-form-urlencoded!
!
grant_type=refresh_token!
&refresh_token=tGzv3JOkF0XG5Qx2TlKWIA
Refresh Token
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 84
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 85
Difficulty: Expert
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 86
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 87
▪ Json Web Token
▪ For Service Accounts (2-legged)
▪ Enterprise-style
▪ Uses Public/Private Keys rather than Client Credentials
▪ Signs a request and receives an access token upon validation
JWT Bearer
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 88
JWT Bearer
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
// Create the payload	
$payload = json_encode(array(	
	 ‘iss’ => ‘myclient’,	
	 ‘sub’ => ‘myuser’,	
	 ‘aud’ => ‘api.example.com’	
	 // ...	
));
89
JWT Bearer
// Create the header	
$header = base64_encode(json_encode(array(	
	 ‘algo’ => ‘RS256’,	
	 ‘typ’ => ‘jwt’	
)));
eyJpc3MiOiJteWNsaWVudCIsInN1YiI6Im15d
XNlciIsImF1ZCI6ImFwaS5leGFtcGxlLmNvbS
J9
eyJhbGdvIjoiUlNBMjU2IiwidHlwIjoiand0I
n0=
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 90
JWT Bearer
$ curl https://api.example.com/token 	
	 -d ‘grant_type=jwt_bearer’	
	 -d ‘assertion=$JWT’
// sign that with a public key	
openssl_sign($input, $signature, $key, ‘RS256’);	
return sprintf(‘%s.%s’, $input, $signature);
eyJhbGdvIjoiUlNBMjU2IiwidHlwIjoiand0I
n0.eyJpc3MiOiJteWNsaWVudCIsInN1YiI6Im
15dXNlciIsImF1ZCI6ImFwaS5leGFtcGxlLmN
vbSJ9.ZW50IiwicJKV3
// Patch em together	
$input = sprintf(‘%s.%s’, $header, $payload); eyJhbGdvIjoiUlNBMjU2IiwidHlwIjoiand0I
n0.eyJpc3MiOiJteWNsaWVudCIsInN1YiI6Im
15dXNlciIsImF1ZCI6ImFwaS5leGFtcGxlLmN
vbSJ9
YOU GET A TOKEN
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 91
▪ Layered Security
▪ No credentials are ever sent over the wire
▪ Similar to OAuth 1.0
JWT Bearer
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 92
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 93
▪ Allows for Decentralized API Validation
▪ Authorization Server issues tokens signed using "key db” and a certificate authority
▪ Resource Server validates access tokens according to "Trust Model"
▪ Metadata for token exists in the token itself
▪ Very scalable
JWT as Access Tokens
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 94
Client
Token
JWT Access Token
Authorize
Resource
HTTP/1.1 200 OK!
Content-Type: application/json;charset=UTF-8!
Cache-Control: no-store!
Pragma: no-cache!
{!
“access_token”:”eyJhbGdvIjoiUlNBMjU2IiwidH
lwIjoiand0In0.eyJpc3MiOiJteWNsaWVudCIsInN1Yi
I6Im15dXNlciIsImF1ZCI6ImFwaS5leGFtcGxlLmNvbS
J9.ZW50IiwicJKV3",!
"token_type":"bearer",!
"expires_in":3600!
}
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 95
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 96
▪ An effort to standardize the “Login with OAuth” flow
▪ Answers the question “What is the identity of the person using this browser/device?”
▪ Standardizes the exchanging of user profile data
▪ Uses JWT to send profile data with the access token to save additional round trip request
OpenID Connect
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 97
Client
Authorize
OpenID Connect
GET /authorize!
?response_type=token!
&client_id=s6BhdRkqt3&state=xyz!
&redirect_uri=https://example.com/cb!
&scope=openid,email,profile!
HTTP/1.1!
Host: server.example.com!
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 98
Client
Token
OpenID Connect
Authorize
Resource
HTTP/1.1 200 OK!
Content-Type: application/json;charset=UTF-8!
Cache-Control: no-store!
Pragma: no-cache!
{!
“access_token”:”xyz”,!
“id_token”:”eyJhbGdvIjoiUlNBMjU2IiwidH
lwIjoiand0In0.eyJpc3MiOiJteWNsaWVudCIsInN1Yi
I6Im15dXNlciIsImF1ZCI6ImFwaS5leGFtcGxlLmNvbS
J9.ZW50IiwicJKV3",!
"token_type":"bearer",!
"expires_in":3600!
}
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 99
OpenID Connect
// Decode the ID Token Payload	
$id_token = $response[‘id_token’];	
list($header, $payload, $signature) = explode($id_token);	
$userData = base64_decode($payload);
{!
"iss":"accounts.google.com",!
“email_verified":"true",!
"email":"jsmith@example.com",!
"sub":"10769150350006150715113082367",!
"azp":"xyz.apps.googleusercontent.com",!
// ...!
}
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 100
!
Scope Type Description
sub string Subject - Identifier for the End-User at the Issuer.
name string End-User's full name in displayable form including all name parts, possibly including titles and suffixes
given_name string Given name(s) or first name(s) of the End-User.
family_name string Surname(s) or last name(s) of the End-User.
middle_name string Middle name(s) of the End-User.
nickname string Casual name of the End-User
preferred_username string Shorthand name by which the End-User wishes to be referred to at the RP
profile string URL of the End-User's profile page. The contents of this Web page SHOULD be about the End-User.
picture string URL of the End-User's profile picture. This URL MUST refer to an image file
website string URL of the End-User's Web page or blog.
email string End-User's preferred e-mail address.
email_verified boolean True if the End-User's e-mail address has been verified; otherwise false.
gender string End-User's gender. Values defined by this specification are female and male.
birthdate string End-User's birthday, represented as an ISO 8601:2004 [ISO8601-2004] YYYY-MM-DD format.
zoneinfo string String from zoneinfo [zoneinfo] time zone database representing the End-User's time zone.
locale string End-User's locale
phone_number string End-User's preferred telephone number.
phone_number_verified boolean True if the End-User's phone number has been verified; otherwise false.
address JSON object End-User's preferred postal address.
updated_at number Time the End-User's information was last updated.
OpenID Connect
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 101
Review
Difficulty # of Legs Description
Personal Access Token Easy Two Dead simple way to receive an access token
Client Credentials Easy Two Uses client credentials (which are implicitly associated with a user or
organization) to retrieve an access token
Resource Owner
Password Credentials
Easy Two/Three Uses a user’s credentials to retrieve an access token
Authorization Code Intermediate Three Allows authentication of third parties without requiring their passwords
Implicit / Device Grant Intermediate Three Authorization Code, but for native apps, where credentials are public
Login with OAuth Intermediate Three Uses Authorization Code to tie the authorized account to a local one
Refresh Tokens Intermediate Three Used to get a new access tokens upon expiration without prompting the user
JWT Bearer Expert Two Uses an Encrypted Payload to establish trust between server and client
JWT Access Tokens Expert Two/Three Uses Encrypted Payload to establish trust amongst servers
OpenID Connect Expert Three A standardization for retrieving user data who have Logged in with OAuth
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 102
Resources
▪ OAuth Screencast: https://knpuniversity.com/screencast/oauth
▪ PHP Server-Side Library: https://github.com/bshaffer/oauth2-server-php
▪ OAuth 2.0 Spec - http://tools.ietf.org/html/rfc6749
▪ JWT Spec - http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-20
▪ More Great Slides - http://www.slideshare.net/rnewton/oauth-in-the-real-world-featuring-webshell
© 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Contenu connexe

Tendances

Neat tricks to bypass CSRF-protection
Neat tricks to bypass CSRF-protectionNeat tricks to bypass CSRF-protection
Neat tricks to bypass CSRF-protectionMikhail Egorov
 
Rails security: above and beyond the defaults
Rails security: above and beyond the defaultsRails security: above and beyond the defaults
Rails security: above and beyond the defaultsMatias Korhonen
 
Web Application Security: Winning When The Odds Are Against You
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
Web Application Security: Winning When The Odds Are Against Youbendechrai
 
OAuth Hacks A gentle introduction to OAuth 2 and Apache Oltu
OAuth Hacks A gentle introduction to OAuth 2 and Apache OltuOAuth Hacks A gentle introduction to OAuth 2 and Apache Oltu
OAuth Hacks A gentle introduction to OAuth 2 and Apache OltuAntonio Sanso
 
Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...
Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...
Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...Jeremiah Grossman
 
Client-side JavaScript Vulnerabilities
Client-side JavaScript VulnerabilitiesClient-side JavaScript Vulnerabilities
Client-side JavaScript VulnerabilitiesOry Segal
 
Web Application Security: The Land that Information Security Forgot
Web Application Security: The Land that Information Security ForgotWeb Application Security: The Land that Information Security Forgot
Web Application Security: The Land that Information Security ForgotJeremiah Grossman
 
Hacker's Practice Ground - Wall of Sheep workshops - Defcon 2015
Hacker's Practice Ground - Wall of Sheep workshops - Defcon 2015 Hacker's Practice Ground - Wall of Sheep workshops - Defcon 2015
Hacker's Practice Ground - Wall of Sheep workshops - Defcon 2015 lokeshpidawekar
 
AEM hacker - approaching Adobe Experience Manager webapps in bug bounty programs
AEM hacker - approaching Adobe Experience Manager webapps in bug bounty programsAEM hacker - approaching Adobe Experience Manager webapps in bug bounty programs
AEM hacker - approaching Adobe Experience Manager webapps in bug bounty programsMikhail Egorov
 
[CB16] Electron - Build cross platform desktop XSS, it’s easier than you thin...
[CB16] Electron - Build cross platform desktop XSS, it’s easier than you thin...[CB16] Electron - Build cross platform desktop XSS, it’s easier than you thin...
[CB16] Electron - Build cross platform desktop XSS, it’s easier than you thin...CODE BLUE
 
XSS Magic tricks
XSS Magic tricksXSS Magic tricks
XSS Magic tricksGarethHeyes
 
04. xss and encoding
04.  xss and encoding04.  xss and encoding
04. xss and encodingEoin Keary
 
Rich Web App Security - Keeping your application safe
Rich Web App Security - Keeping your application safeRich Web App Security - Keeping your application safe
Rich Web App Security - Keeping your application safeJeremiah Grossman
 
DVWA BruCON Workshop
DVWA BruCON WorkshopDVWA BruCON Workshop
DVWA BruCON Workshoptestuser1223
 
DVWA(Damn Vulnerabilities Web Application)
DVWA(Damn Vulnerabilities Web Application)DVWA(Damn Vulnerabilities Web Application)
DVWA(Damn Vulnerabilities Web Application)Soham Kansodaria
 
Attacking Drupal
Attacking DrupalAttacking Drupal
Attacking DrupalGreg Foss
 
Phpnw security-20111009
Phpnw security-20111009Phpnw security-20111009
Phpnw security-20111009Paul Lemon
 
Understanding Identity in the World of Web APIs – Ronnie Mitra, API Architec...
Understanding Identity in the World of Web APIs – Ronnie Mitra,  API Architec...Understanding Identity in the World of Web APIs – Ronnie Mitra,  API Architec...
Understanding Identity in the World of Web APIs – Ronnie Mitra, API Architec...CA API Management
 

Tendances (20)

Neat tricks to bypass CSRF-protection
Neat tricks to bypass CSRF-protectionNeat tricks to bypass CSRF-protection
Neat tricks to bypass CSRF-protection
 
Web Hacking
Web HackingWeb Hacking
Web Hacking
 
Rails security: above and beyond the defaults
Rails security: above and beyond the defaultsRails security: above and beyond the defaults
Rails security: above and beyond the defaults
 
Web Application Security: Winning When The Odds Are Against You
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
Web Application Security: Winning When The Odds Are Against You
 
OAuth Hacks A gentle introduction to OAuth 2 and Apache Oltu
OAuth Hacks A gentle introduction to OAuth 2 and Apache OltuOAuth Hacks A gentle introduction to OAuth 2 and Apache Oltu
OAuth Hacks A gentle introduction to OAuth 2 and Apache Oltu
 
Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...
Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...
Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...
 
Client-side JavaScript Vulnerabilities
Client-side JavaScript VulnerabilitiesClient-side JavaScript Vulnerabilities
Client-side JavaScript Vulnerabilities
 
Web Application Security: The Land that Information Security Forgot
Web Application Security: The Land that Information Security ForgotWeb Application Security: The Land that Information Security Forgot
Web Application Security: The Land that Information Security Forgot
 
Hacker's Practice Ground - Wall of Sheep workshops - Defcon 2015
Hacker's Practice Ground - Wall of Sheep workshops - Defcon 2015 Hacker's Practice Ground - Wall of Sheep workshops - Defcon 2015
Hacker's Practice Ground - Wall of Sheep workshops - Defcon 2015
 
AEM hacker - approaching Adobe Experience Manager webapps in bug bounty programs
AEM hacker - approaching Adobe Experience Manager webapps in bug bounty programsAEM hacker - approaching Adobe Experience Manager webapps in bug bounty programs
AEM hacker - approaching Adobe Experience Manager webapps in bug bounty programs
 
[CB16] Electron - Build cross platform desktop XSS, it’s easier than you thin...
[CB16] Electron - Build cross platform desktop XSS, it’s easier than you thin...[CB16] Electron - Build cross platform desktop XSS, it’s easier than you thin...
[CB16] Electron - Build cross platform desktop XSS, it’s easier than you thin...
 
XSS Magic tricks
XSS Magic tricksXSS Magic tricks
XSS Magic tricks
 
WordPress Security Best Practices
WordPress Security Best PracticesWordPress Security Best Practices
WordPress Security Best Practices
 
04. xss and encoding
04.  xss and encoding04.  xss and encoding
04. xss and encoding
 
Rich Web App Security - Keeping your application safe
Rich Web App Security - Keeping your application safeRich Web App Security - Keeping your application safe
Rich Web App Security - Keeping your application safe
 
DVWA BruCON Workshop
DVWA BruCON WorkshopDVWA BruCON Workshop
DVWA BruCON Workshop
 
DVWA(Damn Vulnerabilities Web Application)
DVWA(Damn Vulnerabilities Web Application)DVWA(Damn Vulnerabilities Web Application)
DVWA(Damn Vulnerabilities Web Application)
 
Attacking Drupal
Attacking DrupalAttacking Drupal
Attacking Drupal
 
Phpnw security-20111009
Phpnw security-20111009Phpnw security-20111009
Phpnw security-20111009
 
Understanding Identity in the World of Web APIs – Ronnie Mitra, API Architec...
Understanding Identity in the World of Web APIs – Ronnie Mitra,  API Architec...Understanding Identity in the World of Web APIs – Ronnie Mitra,  API Architec...
Understanding Identity in the World of Web APIs – Ronnie Mitra, API Architec...
 

En vedette

OAuth 2.0 (as a comic strip)
OAuth 2.0 (as a comic strip)OAuth 2.0 (as a comic strip)
OAuth 2.0 (as a comic strip)Brent Shaffer
 
In The Future We All Use Symfony2
In The Future We All Use Symfony2In The Future We All Use Symfony2
In The Future We All Use Symfony2Brent Shaffer
 
HTTP - The Protocol of Our Lives
HTTP - The Protocol of Our LivesHTTP - The Protocol of Our Lives
HTTP - The Protocol of Our LivesBrent Shaffer
 
Pocket guidebook elections in ukraine ukr crisimediacentre-052014
Pocket guidebook elections in ukraine ukr crisimediacentre-052014Pocket guidebook elections in ukraine ukr crisimediacentre-052014
Pocket guidebook elections in ukraine ukr crisimediacentre-052014Dmytro Lysiuk
 
Stateless authentication with OAuth 2 and JWT - JavaZone 2015
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
 
The Role of Enterprise Integration in Digital Transformation
The Role of Enterprise Integration in Digital TransformationThe Role of Enterprise Integration in Digital Transformation
The Role of Enterprise Integration in Digital TransformationKasun Indrasiri
 

En vedette (8)

OAuth 2.0 (as a comic strip)
OAuth 2.0 (as a comic strip)OAuth 2.0 (as a comic strip)
OAuth 2.0 (as a comic strip)
 
In The Future We All Use Symfony2
In The Future We All Use Symfony2In The Future We All Use Symfony2
In The Future We All Use Symfony2
 
Symfony Events
Symfony EventsSymfony Events
Symfony Events
 
HTTP - The Protocol of Our Lives
HTTP - The Protocol of Our LivesHTTP - The Protocol of Our Lives
HTTP - The Protocol of Our Lives
 
Pocket guidebook elections in ukraine ukr crisimediacentre-052014
Pocket guidebook elections in ukraine ukr crisimediacentre-052014Pocket guidebook elections in ukraine ukr crisimediacentre-052014
Pocket guidebook elections in ukraine ukr crisimediacentre-052014
 
OAuth2 simplified
OAuth2   simplifiedOAuth2   simplified
OAuth2 simplified
 
Stateless authentication with OAuth 2 and JWT - JavaZone 2015
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 2015
 
The Role of Enterprise Integration in Digital Transformation
The Role of Enterprise Integration in Digital TransformationThe Role of Enterprise Integration in Digital Transformation
The Role of Enterprise Integration in Digital Transformation
 

Similaire à OAuth2 - The Swiss Army Framework

Cloud Foundry Day in Tokyo Lightning Talk - Cloud Foundry over the Proxy
Cloud Foundry Day in Tokyo Lightning Talk - Cloud Foundry over the ProxyCloud Foundry Day in Tokyo Lightning Talk - Cloud Foundry over the Proxy
Cloud Foundry Day in Tokyo Lightning Talk - Cloud Foundry over the ProxyMaki Toshio
 
Application Security in ASP.NET Core
Application Security in ASP.NET CoreApplication Security in ASP.NET Core
Application Security in ASP.NET CoreNETUserGroupBern
 
Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...
Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...
Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...CA API Management
 
API Services: Building State-of-the-Art APIs
API Services: Building State-of-the-Art APIsAPI Services: Building State-of-the-Art APIs
API Services: Building State-of-the-Art APIsApigee | Google Cloud
 
Securing .NET Core, ASP.NET Core applications
Securing .NET Core, ASP.NET Core applicationsSecuring .NET Core, ASP.NET Core applications
Securing .NET Core, ASP.NET Core applicationsNETUserGroupBern
 
OAuth and OEmbed
OAuth and OEmbedOAuth and OEmbed
OAuth and OEmbedleahculver
 
Securing your Rails application
Securing your Rails applicationSecuring your Rails application
Securing your Rails applicationclucasKrof
 
DataHero / Eventbrite - API Best Practices
DataHero / Eventbrite - API Best PracticesDataHero / Eventbrite - API Best Practices
DataHero / Eventbrite - API Best PracticesJeff Zabel
 
Serverless OAuth: Authorizing Third-Party Applications to Your Serverless API...
Serverless OAuth: Authorizing Third-Party Applications to Your Serverless API...Serverless OAuth: Authorizing Third-Party Applications to Your Serverless API...
Serverless OAuth: Authorizing Third-Party Applications to Your Serverless API...Amazon Web Services
 
CredHub and Secure Credential Management
CredHub and Secure Credential ManagementCredHub and Secure Credential Management
CredHub and Secure Credential ManagementVMware Tanzu
 
drupal 7 amfserver presentation: integrating flash and drupal
drupal 7 amfserver presentation: integrating flash and drupaldrupal 7 amfserver presentation: integrating flash and drupal
drupal 7 amfserver presentation: integrating flash and drupalrolf vreijdenberger
 
Introduction to Marketing Cloud UI, Adobe Summit 2014
Introduction to Marketing Cloud UI, Adobe Summit 2014Introduction to Marketing Cloud UI, Adobe Summit 2014
Introduction to Marketing Cloud UI, Adobe Summit 2014Damien Antipa
 
OAuth2 & OpenID Connect with Spring Security
OAuth2 & OpenID Connect with Spring SecurityOAuth2 & OpenID Connect with Spring Security
OAuth2 & OpenID Connect with Spring SecurityShuto Uwai
 
Building the Eventbrite API Ecosystem
Building the Eventbrite API EcosystemBuilding the Eventbrite API Ecosystem
Building the Eventbrite API EcosystemMitch Colleran
 
The WAF book intro protection elements v1.0 lior rotkovitch
The WAF book intro protection elements v1.0 lior rotkovitchThe WAF book intro protection elements v1.0 lior rotkovitch
The WAF book intro protection elements v1.0 lior rotkovitchLior Rotkovitch
 
Cloud Foundry UAA as an Identity Gateway
Cloud Foundry UAA as an Identity GatewayCloud Foundry UAA as an Identity Gateway
Cloud Foundry UAA as an Identity GatewayVMware Tanzu
 
Accessing APIs using OAuth on the federated (WordPress) web
Accessing APIs using OAuth on the federated (WordPress) webAccessing APIs using OAuth on the federated (WordPress) web
Accessing APIs using OAuth on the federated (WordPress) webFelix Arntz
 

Similaire à OAuth2 - The Swiss Army Framework (20)

Cloud Foundry Day in Tokyo Lightning Talk - Cloud Foundry over the Proxy
Cloud Foundry Day in Tokyo Lightning Talk - Cloud Foundry over the ProxyCloud Foundry Day in Tokyo Lightning Talk - Cloud Foundry over the Proxy
Cloud Foundry Day in Tokyo Lightning Talk - Cloud Foundry over the Proxy
 
Application Security in ASP.NET Core
Application Security in ASP.NET CoreApplication Security in ASP.NET Core
Application Security in ASP.NET Core
 
Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...
Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...
Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...
 
API Services: Building State-of-the-Art APIs
API Services: Building State-of-the-Art APIsAPI Services: Building State-of-the-Art APIs
API Services: Building State-of-the-Art APIs
 
Api manager preconference
Api manager preconferenceApi manager preconference
Api manager preconference
 
Securing .NET Core, ASP.NET Core applications
Securing .NET Core, ASP.NET Core applicationsSecuring .NET Core, ASP.NET Core applications
Securing .NET Core, ASP.NET Core applications
 
OAuth and OEmbed
OAuth and OEmbedOAuth and OEmbed
OAuth and OEmbed
 
Securing your Rails application
Securing your Rails applicationSecuring your Rails application
Securing your Rails application
 
DataHero / Eventbrite - API Best Practices
DataHero / Eventbrite - API Best PracticesDataHero / Eventbrite - API Best Practices
DataHero / Eventbrite - API Best Practices
 
Serverless OAuth: Authorizing Third-Party Applications to Your Serverless API...
Serverless OAuth: Authorizing Third-Party Applications to Your Serverless API...Serverless OAuth: Authorizing Third-Party Applications to Your Serverless API...
Serverless OAuth: Authorizing Third-Party Applications to Your Serverless API...
 
CredHub and Secure Credential Management
CredHub and Secure Credential ManagementCredHub and Secure Credential Management
CredHub and Secure Credential Management
 
drupal 7 amfserver presentation: integrating flash and drupal
drupal 7 amfserver presentation: integrating flash and drupaldrupal 7 amfserver presentation: integrating flash and drupal
drupal 7 amfserver presentation: integrating flash and drupal
 
Introduction to Marketing Cloud UI, Adobe Summit 2014
Introduction to Marketing Cloud UI, Adobe Summit 2014Introduction to Marketing Cloud UI, Adobe Summit 2014
Introduction to Marketing Cloud UI, Adobe Summit 2014
 
OAuth2 & OpenID Connect with Spring Security
OAuth2 & OpenID Connect with Spring SecurityOAuth2 & OpenID Connect with Spring Security
OAuth2 & OpenID Connect with Spring Security
 
Building the Eventbrite API Ecosystem
Building the Eventbrite API EcosystemBuilding the Eventbrite API Ecosystem
Building the Eventbrite API Ecosystem
 
The WAF book intro protection elements v1.0 lior rotkovitch
The WAF book intro protection elements v1.0 lior rotkovitchThe WAF book intro protection elements v1.0 lior rotkovitch
The WAF book intro protection elements v1.0 lior rotkovitch
 
Cloud Foundry UAA as an Identity Gateway
Cloud Foundry UAA as an Identity GatewayCloud Foundry UAA as an Identity Gateway
Cloud Foundry UAA as an Identity Gateway
 
API SECURITY
API SECURITYAPI SECURITY
API SECURITY
 
Facebook & Twitter API
Facebook & Twitter APIFacebook & Twitter API
Facebook & Twitter API
 
Accessing APIs using OAuth on the federated (WordPress) web
Accessing APIs using OAuth on the federated (WordPress) webAccessing APIs using OAuth on the federated (WordPress) web
Accessing APIs using OAuth on the federated (WordPress) web
 

Dernier

Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 

Dernier (20)

Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 

OAuth2 - The Swiss Army Framework

  • 1. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 1 Brent Shaffer OAuth2: The Swiss Army Framework
  • 2. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 2 Who Is This Guy? Hint: Brent Shaffer
  • 3. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 3
  • 4. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 4 Maintainer of #1 Open Source PHP library for Server-Side OAuth
  • 5. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 5 I’m in a Band! The ladies love us! More Hazards More Heroes
  • 6. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 6
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 19 Don’t require your users to authenticate with 3rd parties using passwords! The moral of the story
  • 20. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 20 Don’t require your users to authenticate with your APIs using passwords! …and to a lesser extent
  • 21. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 21 What is OAuth? ▪ Something to do with Facebook ▪ Twitter’s in the mix ▪ Maybe Google too? Github? ▪ Authorization and Authentication ▪ Tokens everywhere ▪ Two-legs, three-legs… crablegs?
  • 22. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 22 Overview
  • 23. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 23 “OAuth is a big set of rules that explain how two parties exchange tokens"
  • 24. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 24 Currency for Tokens
  • 25. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 25 Tokens Expire
  • 26. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 26 Bearer Token
  • 27. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 27 Applications (aka Clients)
  • 28. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 28 ▪ One user can have many apps ▪ Each app has its own set of credentials ▪ Each app represents a single program / application / script, etc ▪ A conceptual wrapper around your project Applications (aka Clients)
  • 29. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 29 User “Resource Owner” Client “3rd Party” Server “Resource and Authorization Provider” Three Roles
  • 30. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 30 USER 3RD PARTY SERVICE Three Legs
  • 31. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 31 Authorize Token Resource The user authorizes the client The server returns a token to the client Three Endpoints The server provides the resource
  • 32. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 32 Grant Types
  • 33. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 33 “A Grant Type is just a specific way to obtain (or be granted) an Access Token"
  • 34. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 34 “The multiple ways to get an access token, i.e. the Grant Types, are what make OAuth a Swiss Army Framework™”
  • 35. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 35 Brent Shaffer OAuth2: The Swiss Army Framework
  • 36. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 36 Difficulty: Easy
  • 37. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 37 Client Authorize Token Resource
  • 38. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 38
  • 39. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 39 Personal Access Token
  • 40. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 40 Personal Access Token
  • 41. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 41 ▪ Easier than dirt ▪ Good for calling your APIs on your behalf ▪ No encryption other than HTTPS ▪ No expiration ▪ Treat these like a password ▪ Extension of OAuth2.0 Spec Personal Access Tokens
  • 42. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 42 Personal Access Token $ curl https://api.github.com/users/bshaffer -u fd8e84b60c4bfd8e9277cb3b16f112859d60c45c: $ curl https://api.github.com/users/bshaffer?access_token=xyz GET /users/bshaffer HTTP/1.1! Host: api.github.com! Authorization: Basic czZCaGRSa3F0Mzp GET /users/bshaffer?access_token=xyz HTTP/1.1! Host: api.github.com $ curl https://api.github.com/users/bshaffer -H ‘Authorization: Bearer xyz GET /users/bshaffer HTTP/1.1! Authorization: Bearer xyz! Host: api.github.com
  • 43. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 43
  • 44. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 44 ▪ Slightly harder than dirt, but still very easy ▪ Good for calling YOUR apis ▪ Good for Server-to-Server calls ▪ Tokens expire ▪ Hardcoded credentials ▪ I couldn’t find this in the wild Client Credentials
  • 45. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 45 Client Credentials $ curl https://api.example.com/token -d ‘grant_type=client_credentials’ -d ‘client_id=avatarfanclub’ -d ‘client_secret=df40b2’ POST /token HTTP/1.1! Host: api.example.com! Content-Type: application/x-www-form-urlencoded! ! grant_type=client_credentials! &client_id=avatarfanclub! &client_secret=df40b2 $ curl https://api.example.com/token -u ‘avatarfanclub:df40b2’ POST /token HTTP/1.1! Host: server.example.com! Authorization: Basic czZCaGRSa3F0Mzp! Content-Type: application/x-www-form-urlencoded! ! grant_type=client_credentials
  • 46. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 46 Client Token Client Credentials Authorize Resource POST /token HTTP/1.1! Host: api.example.com! Content-Type: application/x-www-form-urlencoded! ! grant_type=client_credentials! &client_id=avatarfanclub! &client_secret=df40b2 Client Credentials
  • 47. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 47 Client Token Client Credentials Authorize Resource HTTP/1.1 200 OK! Content-Type: application/json;charset=UTF-8! Cache-Control: no-store! Pragma: no-cache! {! "access_token":"2YotnFZFEjr1zCsicMWpAA",! "token_type":"bearer",! "expires_in":3600! }
  • 48. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 48 Client Resource Client Credentials Authorize Token GET /resource/1 HTTP/1.1! Host: example.com! Authorization: Bearer 2YotnFZFEjr1zCsicMWpAA
  • 49. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 49 Client Resource Client Credentials Authorize Token HTTP/1.1 200 OK! Content-Type: application/json;charset=UTF-8! ! {! "resource":"foo",! "value":"bar",! "success":true! }
  • 50. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 50
  • 51. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 51
  • 52. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 52 ▪ Equally difficult to dirt ▪ Good for trusted applications with login forms ▪ Good for testing ▪ Tokens expire ▪ Not good for server-to-server calls, as this would require hardcoded credentials Resource Owner Password Credentials
  • 53. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 53 Resource Owner Password Credentials $ curl https://api.github.com/login/oauth/token -d ‘grant_type=password’ -d ‘username=bshaffer’ -d ‘password=iheartavatar’ -d ‘client_id=avatarfanclub’ POST /login/oauth/token HTTP/1.1! Host: api.github.com! Content-Type: application/x-www-form-urlencoded! ! grant_type=password! &username=bshaffer! &password=iheartavatar! &client_id=avatarfanclub
  • 54. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 54 Client Resource Owner Username / Password Token Authorization Code Authorize Resource POST /login/oauth/token HTTP/1.1! Host: api.github.com! Content-Type: application/x-www-form-urlencoded! ! grant_type=password! &username=bshaffer! &password=iheartavatar! &client_id=avatarfanclub
  • 55. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 55 Client Token Resource Owner Password Credentials Authorize Resource HTTP/1.1 200 OK! Content-Type: application/json;charset=UTF-8! Cache-Control: no-store! Pragma: no-cache! {! "access_token":"2YotnFZFEjr1zCsicMWpAA",! "token_type":"bearer",! "expires_in":3600! }
  • 56. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 56
  • 57. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 57 Difficulty: Intermediate
  • 58. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 58
  • 59. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 59
  • 60. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 60 ▪ Why OAuth Exists ▪ For obtaining authorization to access a user’s information ▪ For when client credentials are secure (Web Applications) Authorization Code
  • 61. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 61 Authorization Code
  • 62. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 62 Client Authorization Request Authorization Code Authorization Code Access Token Access Token Protected Resource Authorize Token Resource Authorization Code
  • 63. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 63 Client Authorize Authorization Code GET /authorize! ?response_type=code! &client_id=s6BhdRkqt3! HTTP/1.1! Host: server.example.com!
  • 64. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 64 Client Authorize Authorization Code TokenHTTP/1.1 302 Found! Location: http://example.com/cb! ?code=SplxlOBeZQQYbYS6WxSbIA Resource
  • 65. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 65 Client Token Authorization Code Resource POST /token HTTP/1.1! Host: server.example.com! Authorization: Basic czZCaGRSa3F0Mzp! Content-Type: application/x-www-form-urlencoded! ! grant_type=authorization_code! &code=SplxlOBeZQQYbYS6WxSbIA Authorize
  • 66. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 66 Client Token Resource Owner Password Credentials Authorize HTTP/1.1 200 OK! Content-Type: application/json;charset=UTF-8! Cache-Control: no-store! Pragma: no-cache! {! "access_token":"2YotnFZFEjr1zCsicMWpAA",! "token_type":"bearer",! "expires_in":3600! } Resource
  • 67. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 67
  • 68. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 68
  • 69. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 69 ▪ For native apps (Desktop, Mobile, Javascript in a browser) ▪ Your client’s credentials cannot be sent due to the public nature of the application ▪ We still want users to authorize our applications (3-legged) ▪ We want to prevent attackers from intercepting the request Implicit / Device Grant
  • 70. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 70 Implicit / Device Grant
  • 71. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 71 PublicClient Authorize Token Resource Implicit / Device Grant Access Token!
  • 72. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 72 ▪ A native call is made containing the access token directly from the authorization request ▪ Javascript ▪ Uses a registered Redirect URI ! ▪ Validated against Origins URL ! ▪ iOS Applications ▪ Issues a call to your app using a registered Bundle ID ▪ Android Applications ▪ Issues a call to your app using a registered Package Name Implicit / Device Grant https://mysite.com/myapp#access_token=xyz function onAuthorizeCallback(authResult) {..}
  • 73. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 73
  • 74. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 74 Login With OAuth
  • 75. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 75 ▪ It’s a Trick!! ▪ This is just Authorization Code in disguise! ▪ The application uses your profile data from the other service to create a local account ▪ The two accounts, your local account and the OAuth-provided account, are matched up every time you log in Login With OAuth
  • 76. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 76 Client Token Login with OAuth Authorize Resource HTTP/1.1 200 OK! Content-Type: application/json;charset=UTF-8! Cache-Control: no-store! Pragma: no-cache! {! "access_token":"2YotnFZFEjr1zCsicMWpAA",! "token_type":"bearer",! “expires_in":3600! }
  • 77. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 77 Client Resource Client Credentials Authorize Token GET /profile HTTP/1.1! Host: api.example.com! Authorization: Bearer 2YotnFZFEjr1zCsicMWpAA
  • 78. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 78 Client Resource Login With OAuth Authorize Token HTTP/1.1 200 OK! Content-Type: application/json;charset=UTF-8! ! {! “user_id":"f560f23b24feff2g",! “first_name”:"Ash",! “nickname”:”Poke-Master”,! “favorite_pokemon”: “magikarp”! }
  • 79. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 79 ▪ This is not SSO ▪ Very nice way to trick your users into creating an account on your website (clients) ▪ Very nice way to maintain a single canonical user base (server) ▪ While being nefarious, it’s also convenient for your users ▪ Stay tuned for OpenID Connect (advanced) Login With OAuth
  • 80. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 80
  • 81. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 81 ▪ Usually comes back with an access token ▪ When your access token expires, you get another one ▪ Allows the user to not have to reauthorize ▪ Refresh Tokens can expire, or not Refresh Tokens
  • 82. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 82 Client Token Refresh Token Authorize Resource HTTP/1.1 200 OK! Content-Type: application/json;charset=UTF-8! Cache-Control: no-store! Pragma: no-cache! {! "access_token":"2YotnFZFEjr1zCsicMWpAA",! "token_type":"bearer",! "expires_in":3600,! “refresh_token”: “tGzv3JOkF0XG5Qx2TlKWIA“! }
  • 83. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 83 Client Token Refresh Token Authorize Resource POST /token HTTP/1.1! Host: server.example.com! Authorization: Basic czZCaGRSa3F0Mzp! Content-Type: application/x-www-form-urlencoded! ! grant_type=refresh_token! &refresh_token=tGzv3JOkF0XG5Qx2TlKWIA Refresh Token
  • 84. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 84
  • 85. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 85 Difficulty: Expert
  • 86. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 86
  • 87. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 87 ▪ Json Web Token ▪ For Service Accounts (2-legged) ▪ Enterprise-style ▪ Uses Public/Private Keys rather than Client Credentials ▪ Signs a request and receives an access token upon validation JWT Bearer
  • 88. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 88 JWT Bearer
  • 89. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. // Create the payload $payload = json_encode(array( ‘iss’ => ‘myclient’, ‘sub’ => ‘myuser’, ‘aud’ => ‘api.example.com’ // ... )); 89 JWT Bearer // Create the header $header = base64_encode(json_encode(array( ‘algo’ => ‘RS256’, ‘typ’ => ‘jwt’ ))); eyJpc3MiOiJteWNsaWVudCIsInN1YiI6Im15d XNlciIsImF1ZCI6ImFwaS5leGFtcGxlLmNvbS J9 eyJhbGdvIjoiUlNBMjU2IiwidHlwIjoiand0I n0=
  • 90. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 90 JWT Bearer $ curl https://api.example.com/token -d ‘grant_type=jwt_bearer’ -d ‘assertion=$JWT’ // sign that with a public key openssl_sign($input, $signature, $key, ‘RS256’); return sprintf(‘%s.%s’, $input, $signature); eyJhbGdvIjoiUlNBMjU2IiwidHlwIjoiand0I n0.eyJpc3MiOiJteWNsaWVudCIsInN1YiI6Im 15dXNlciIsImF1ZCI6ImFwaS5leGFtcGxlLmN vbSJ9.ZW50IiwicJKV3 // Patch em together $input = sprintf(‘%s.%s’, $header, $payload); eyJhbGdvIjoiUlNBMjU2IiwidHlwIjoiand0I n0.eyJpc3MiOiJteWNsaWVudCIsInN1YiI6Im 15dXNlciIsImF1ZCI6ImFwaS5leGFtcGxlLmN vbSJ9 YOU GET A TOKEN
  • 91. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 91 ▪ Layered Security ▪ No credentials are ever sent over the wire ▪ Similar to OAuth 1.0 JWT Bearer
  • 92. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 92
  • 93. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 93 ▪ Allows for Decentralized API Validation ▪ Authorization Server issues tokens signed using "key db” and a certificate authority ▪ Resource Server validates access tokens according to "Trust Model" ▪ Metadata for token exists in the token itself ▪ Very scalable JWT as Access Tokens
  • 94. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 94 Client Token JWT Access Token Authorize Resource HTTP/1.1 200 OK! Content-Type: application/json;charset=UTF-8! Cache-Control: no-store! Pragma: no-cache! {! “access_token”:”eyJhbGdvIjoiUlNBMjU2IiwidH lwIjoiand0In0.eyJpc3MiOiJteWNsaWVudCIsInN1Yi I6Im15dXNlciIsImF1ZCI6ImFwaS5leGFtcGxlLmNvbS J9.ZW50IiwicJKV3",! "token_type":"bearer",! "expires_in":3600! }
  • 95. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 95
  • 96. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 96 ▪ An effort to standardize the “Login with OAuth” flow ▪ Answers the question “What is the identity of the person using this browser/device?” ▪ Standardizes the exchanging of user profile data ▪ Uses JWT to send profile data with the access token to save additional round trip request OpenID Connect
  • 97. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 97 Client Authorize OpenID Connect GET /authorize! ?response_type=token! &client_id=s6BhdRkqt3&state=xyz! &redirect_uri=https://example.com/cb! &scope=openid,email,profile! HTTP/1.1! Host: server.example.com!
  • 98. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 98 Client Token OpenID Connect Authorize Resource HTTP/1.1 200 OK! Content-Type: application/json;charset=UTF-8! Cache-Control: no-store! Pragma: no-cache! {! “access_token”:”xyz”,! “id_token”:”eyJhbGdvIjoiUlNBMjU2IiwidH lwIjoiand0In0.eyJpc3MiOiJteWNsaWVudCIsInN1Yi I6Im15dXNlciIsImF1ZCI6ImFwaS5leGFtcGxlLmNvbS J9.ZW50IiwicJKV3",! "token_type":"bearer",! "expires_in":3600! }
  • 99. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 99 OpenID Connect // Decode the ID Token Payload $id_token = $response[‘id_token’]; list($header, $payload, $signature) = explode($id_token); $userData = base64_decode($payload); {! "iss":"accounts.google.com",! “email_verified":"true",! "email":"jsmith@example.com",! "sub":"10769150350006150715113082367",! "azp":"xyz.apps.googleusercontent.com",! // ...! }
  • 100. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 100 ! Scope Type Description sub string Subject - Identifier for the End-User at the Issuer. name string End-User's full name in displayable form including all name parts, possibly including titles and suffixes given_name string Given name(s) or first name(s) of the End-User. family_name string Surname(s) or last name(s) of the End-User. middle_name string Middle name(s) of the End-User. nickname string Casual name of the End-User preferred_username string Shorthand name by which the End-User wishes to be referred to at the RP profile string URL of the End-User's profile page. The contents of this Web page SHOULD be about the End-User. picture string URL of the End-User's profile picture. This URL MUST refer to an image file website string URL of the End-User's Web page or blog. email string End-User's preferred e-mail address. email_verified boolean True if the End-User's e-mail address has been verified; otherwise false. gender string End-User's gender. Values defined by this specification are female and male. birthdate string End-User's birthday, represented as an ISO 8601:2004 [ISO8601-2004] YYYY-MM-DD format. zoneinfo string String from zoneinfo [zoneinfo] time zone database representing the End-User's time zone. locale string End-User's locale phone_number string End-User's preferred telephone number. phone_number_verified boolean True if the End-User's phone number has been verified; otherwise false. address JSON object End-User's preferred postal address. updated_at number Time the End-User's information was last updated. OpenID Connect
  • 101. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 101 Review Difficulty # of Legs Description Personal Access Token Easy Two Dead simple way to receive an access token Client Credentials Easy Two Uses client credentials (which are implicitly associated with a user or organization) to retrieve an access token Resource Owner Password Credentials Easy Two/Three Uses a user’s credentials to retrieve an access token Authorization Code Intermediate Three Allows authentication of third parties without requiring their passwords Implicit / Device Grant Intermediate Three Authorization Code, but for native apps, where credentials are public Login with OAuth Intermediate Three Uses Authorization Code to tie the authorized account to a local one Refresh Tokens Intermediate Three Used to get a new access tokens upon expiration without prompting the user JWT Bearer Expert Two Uses an Encrypted Payload to establish trust between server and client JWT Access Tokens Expert Two/Three Uses Encrypted Payload to establish trust amongst servers OpenID Connect Expert Three A standardization for retrieving user data who have Logged in with OAuth
  • 102. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 102 Resources ▪ OAuth Screencast: https://knpuniversity.com/screencast/oauth ▪ PHP Server-Side Library: https://github.com/bshaffer/oauth2-server-php ▪ OAuth 2.0 Spec - http://tools.ietf.org/html/rfc6749 ▪ JWT Spec - http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-20 ▪ More Great Slides - http://www.slideshare.net/rnewton/oauth-in-the-real-world-featuring-webshell
  • 103. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.