Slide 1

Slide 1 text

Aaron Parecki • March 2021 aaronpk.com Intro to OAuth IETF 110

Slide 2

Slide 2 text

Specs are not good tutorials!

Slide 3

Slide 3 text

RFC6749 RFC6750 CLIENT TYPE AUTH METHOD GRANT TYPE RFC6819 RFC7009 RFC7592 RFC7662 RFC7636 RFC7591 RFC7519 RFC8252 OIDC RFC8414 STATE PARAM TLS CSRF UMA 2 FAPI RFC7515 RFC7516 RFC7517 RFC7518 TOKEN BINDING POP SECURITY BCP CIBA HTTP SIGNING MUTUAL TLS SPA BCP JARM JAR TOKEN EXCHANGE DPOP

Slide 4

Slide 4 text

The Password Anti-Pattern

Slide 5

Slide 5 text

The Password Anti-Pattern facebook.com ~2010

Slide 6

Slide 6 text

The Password Anti-Pattern • How do you revoke this app’s access? • Do you trust the app to not store your password? • Do you trust the app to access only the things it says it needs? • Do you trust the app to not do things like change your password or delete your account?

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

how can I let an app access my data without giving it my password?

Slide 9

Slide 9 text

password password password

Slide 10

Slide 10 text

Authorization Server Access Token Resource (API)

Slide 11

Slide 11 text

OAuth doesn't tell the app who logged in

Slide 12

Slide 12 text

Identification authentication Accessing APIs authorization

Slide 13

Slide 13 text

How OAuth Works

Slide 14

Slide 14 text

Goal of the Client: Get an access token Use the access token to make API requests

Slide 15

Slide 15 text

Authorization Code OAuth Flows Device Flow Client Credentials Implicit Password web mobile SPA browserless devices server-to-server CLI CLI >_ >_

Slide 16

Slide 16 text

POST /resource/1/update HTTP/1.1 Authorization: Bearer RsT5OjbzRn430zqMLgV3Ia Host: api.authorization-server.com description=Hello+World USING AN ACCESS TOKEN

Slide 17

Slide 17 text

ROLES IN OAUTH OAuth Server (Authorization Server) aka the token factory API (Resource Server) The Application (Client) The User (Resource Owner) Device (User Agent)

Slide 18

Slide 18 text

ROLES IN OAUTH OAuth Server (Authorization Server) aka the token factory API (Resource Server) The Application (Client) The User (Resource Owner) Device (User Agent) Travis-CI.org GitHub

Slide 19

Slide 19 text

ROLES IN OAUTH OAuth Server (Authorization Server) aka the token factory API (Resource Server) The Application (Client) The User (Resource Owner) Device (User Agent) iPhone App Okta Your API

Slide 20

Slide 20 text

Authorization Code + PKCE

Slide 21

Slide 21 text

Front Channel Back Channel https://accounts.google.com/?... Passing data via the browser's address bar The user, or malicious software, can modify the requests and responses Sent from client to server HTTPS request from client to server, so requests cannot be tampered with

Slide 22

Slide 22 text

Passing Data via the Back Channel

Slide 23

Slide 23 text

Passing Data via the Front Channel

Slide 24

Slide 24 text

User: I’d like to use this great app App: Please go to the authorization server to grant me access, take this hash with you User: I’d like to log in to this app, here's the hash it gave me AS: Here is a temporary code the app can use App: Here's the code, and the temporary secret, please give me a token User: Here is the temporary code, please use this to get a token AS: Let me verify the hash of that secret... ok here is an access token! App: Please let me access this user’s data with this access token! App: Hang on while I generate a temporary secret and hash it User 
 Agent App OAuth Server API ?

Slide 25

Slide 25 text

PKCE Ensures the app that receives the access token is the same one that started the exchange

Slide 26

Slide 26 text

Refresh tokens 


Slide 27

Slide 27 text

Refresh tokens 
 keep the user logged in

Slide 28

Slide 28 text

Application Refresh Token API (Resource Server) Access Token Authorization Server A ccess Token

Slide 29

Slide 29 text

Exchange the Refresh Token for an Access Token POST https://authorization-server.com/token grant_type=refresh_token& refresh_token=REFRESH_TOKEN& client_id=CLIENT_ID& client_secret=CLIENT_SECRET

Slide 30

Slide 30 text

New Access Token in the Response { "access_token": "RsT5OjbzRn430zqMLgV3Ia", "expires_in": 3600, "refresh_token": "64d049f8b21191e12522d5d96d5641af5e8" }

Slide 31

Slide 31 text

SIGN IN user authenticates access token & refresh token authorization request store refresh token in secure storage

Slide 32

Slide 32 text

SIGN IN biometrics unlock refresh token new access token & refresh token already has refresh token use refresh token to get new access token

Slide 33

Slide 33 text

Scope

Slide 34

Slide 34 text

Scope lets an application request limited access to data

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

The app requests certain scopes, and is confirmed by the user 
 and the authorization server

Slide 38

Slide 38 text

Access tokens

Slide 39

Slide 39 text

Access tokens are what the application uses to request data from the API

Slide 40

Slide 40 text

Types of Access Tokens MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3 eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEwMDAsI mlzcyI6Imh0dHBzOi8vYXV0aG9yaXphdGlvbi1zZXJ2ZXIuY29tIiw iY2lkIjoiaHR0cHM6Ly9leGFtcGxlLWFwcC5jb20iLCJpYXQiOjE0N zAwMDI3MDMsImV4cCI6MTUyOTE3NDg1MSwic2NvcGUiOiJyZWFkIHd yaXRlIn0.QiIrnmaC4VrbAYAsu0YPeuJ992p20fSxrXWPLw-gkFA Reference Self-Encoded (e.g. JWT)

Slide 41

Slide 41 text

Reference Tokens MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3 * user_id * expiration * permissions * ...

Slide 42

Slide 42 text

Self-Encoded Tokens eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEwMDAsI mlzcyI6Imh0dHBzOi8vYXV0aG9yaXphdGlvbi1zZXJ2ZXIuY29tIiw iY2lkIjoiaHR0cHM6Ly9leGFtcGxlLWFwcC5jb20iLCJpYXQiOjE0N zAwMDI3MDMsImV4cCI6MTUyOTE3NDg1MSwic2NvcGUiOiJyZWFkIHd yaXRlIn0.QiIrnmaC4VrbAYAsu0YPeuJ992p20fSxrXWPLw-gkFA { "sub": "{USER_ID}", "aud": "{CLIENT_ID}", "exp": 1524240821, "scope": "create" }

Slide 43

Slide 43 text

Access Token Validation The Fast Way The Strong Way Local Validation Remote Introspection eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZS I6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImp0aSI6ImI5ZDRhNzViLTA2MDMtNDgxYy1hM jgyLTY3YTk0NDJiNGRkNiIsImlhdCI6MTUzMjQwMDkyMiwiZXhwIjoxNTMyNDA0NTIyfQ.S jYROEt8lZpEOq1eKh3OxRmRk3xttOXZeD5yW8aW2k8 { "sub": "1234567890", "name": "John Doe", "admin": true, "jti": "b9d4a75b-0603-481c-a282-67a9442b4dd6", "iat": 1532400922, "exp": 1532404522 } POST https://authorization-server.com/introspect token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0NTY3OD &client_id={CLIENT_ID} &client_secret={CLIENT_SECRET}

Slide 44

Slide 44 text

Rejecting Revoked Tokens 1:00 2:00 3:00 4:00 5:00 6:00 7:00 expired 0:00 Local Validation Remote Introspection User revokes application

Slide 45

Slide 45 text

Current Work

Slide 46

Slide 46 text

OAuth 2.1 Consolidate the OAuth 2.0 specs,
 adding best practices, 
 removing deprecated features Capture current best practices in OAuth 2.0 under a single name

Slide 47

Slide 47 text

OAuth 2.0 RFC6749 OAuth Core Authorization Code Implicit Password Client Credentials RFC6750 Bearer Tokens Tokens in HTTP Header Tokens in POST Form Body Tokens in GET Query String RFC7636 +PKCE RFC8252 PKCE for mobile Browser App BCP PKCE for SPAs PKCE for con fi dential clients Security BCP

Slide 48

Slide 48 text

OAuth 2.1 Authorization Code Client Credentials +PKCE Tokens in HTTP Header Tokens in POST Form Body

Slide 49

Slide 49 text

OAuth 2.1 oauth.net/2.1 tools.ietf.org/html/draft-ietf-oauth-v2-1

Slide 50

Slide 50 text

JWT Pro fi le for Access Tokens Describes a standard set of JWT claims to use in a JWT access token. This enables resource servers to be built with standard libraries to validate tokens.

Slide 51

Slide 51 text

Rich Authorization Requests (RAR) oauth.net/2/rich-authorization-requests

Slide 52

Slide 52 text

Pushed Authorization Requests (PAR) • Currently, the authorization request is sent in the front-channel • Front-channel is susceptible to inspection and modi fi cation • PAR initiates the OAuth fl ow from the back-channel oauth.net/2/pushed-authorization-requests

Slide 53

Slide 53 text

Specs Built on OAuth • OpenID Connect (openid.net) • FAPI (Financial-Grade API) • UMA (User-Managed Access) • IndieAuth (indieauth.net)

Slide 54

Slide 54 text

aaronpk.com oauth2simpli fi ed.com