Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0...

37
OAuth 2.0 Muhammad Rizwan Asghar The University of Auckland September 17, 2015 For template of slides, thanks to kingsoftstore.com

Transcript of Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0...

Page 1: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

OAuth 2.0

Muhammad Rizwan AsgharThe University of Auckland

September 17, 2015

For template of slides, thanks to kingsoftstore.com

Page 2: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

Overview of OAuth 2.0

• An open standard for authorisation

• Evolved from OAuth

• Not backward compatible

• Created in late 2006

• OAuth 2.0 was published as RFC 6749 in October 2012

Page 3: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

Why OAuth 2.0

• OAuth 2.0 is better than OAuth 1.0 due to

• Clear separation of roles

• Simplicity

• Support of a variety of use cases

• Addressing native applications

Page 4: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

Basic Purpose

• Enabling third-party applications • To obtain limited access

• To protected resources

• On behalf of a Resource Owner

• Or on its own behalf

Page 5: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

Roles in OAuth 2.0

• Resource Owner• Grants access to protected resources

• Resource Server• Hosts protected resources

• Client• Requests access to protected resources

• Authorisation Server• Issues Access Tokens to the Client

Page 6: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

Roles in Detail

• The Authorisation Server may be the same server as the Resource Server

• A single Authorisation Server may issue Access Tokens accepted by multiple Resource Servers

Page 7: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

OAuth 2.0 Flow

Client Authorisation

Server

Resource

Owner

Resource

Server

1 – Authorisation Request

2 – Authorisation Grant

3 – Authorisation Grant

4 – Access Token

5 – Access Token

6 – Protected Resource

Page 8: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

Authorisation Grant

• A credential representing authorisation by the Resource Owner

• To access protected resources

• Used by the Client to obtain an Access Token

Page 9: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

Access Token

• Credentials used to access protected resources

• Tokens represent specific scopes and durations of access

• Granted by the Resource Owner

• Enforced by the Resource Server and

Authorisation Server

Page 10: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

Refresh Token

• Credentials used to obtain Access Tokens

• Used when the current Access Token expires

• It is optional

Page 11: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

OAuth 2.0 Flow: Refresh Token

ClientAuthorisation

Server

Resource

Server

1 – Authorisation Grant

2 – Access Token & Refresh Token

7 – Refresh Token

8 – Access Token &

Optional Refresh Token

3 – Access Token

4 – Protected Resource

5 – Access Token

6 – Invalid Token Error

Page 12: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

Security Requirements

• It requires the Transport Layer Security (TLS) mechanism for ensuring

• Confidentiality

• Integrity

• Prevention of replay attack

Page 13: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

Client Registration

• First, the Client registers with the Authorisation Server

• When registering a Client, a Client Developer specifies

• Client Type

• …

Page 14: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

Client Credentials

• Client Identifier• It is unique but not secret

• Client Secret• Password, private/public key pair

• Only for Confidential Clients (see next

slide)

Page 15: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

Client Types

• Confidential• Clients maintaining the confidentiality of

their credentials

• Capable of secure client authentication

• Public• Clients incapable of maintaining the

confidentiality of their credentials

• Incapable of secure client authentication

Page 16: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

Client Profiles

• Web application• Confidential Client

• User-agent-based application• Public Client

• Native application• Public Client

Page 17: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

Grant Types

• Authorisation code

• Implicit

• Resource Owner password credentials

• Client credentials

• Extensibility mechanism for defining additional types

Page 18: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

Authorisation Code

• Used to obtain both Access Tokens and Refresh Tokens

• Optimised for Confidential Clients

• Client interacts with User Agent of the Resource Owner

Page 19: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

OAuth 2.0 Flow: Authorisation Code

1b – Client Identifier & Redirection URI

Authorisation

Server

Client

User-

Agent

Resource

Owner

1a 3b

2a

2b – Authentication

3a – Authorisation Code

4 – Authorisation Code & Redirection URI

5 – Access Token (with Optional Refresh Token)

Page 20: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

Implicit

• Used to obtain Access Tokens

• It does not support the issuance of Refresh Tokens

• Optimised for Public Clients

• Client interacts with User Agent of the Resource Owner

•A Client receives the Access Token as the result of the Authorisation Request

Page 21: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

OAuth 2.0 Flow: Implicit

1b – Client Identifier & Redirection URI

Authorisation

Server

Client

User-

Agent

Resource

Owner

1a

2a

2b – Authentication

3 – Access Code

4 – Access Code

Page 22: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

Resource Owner Password Credential

• Suitable when the Resource Owner has a trust relationship with the Client

• Examples• Operating system

• Highly privileged application

Page 23: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

OAuth 2.0 Flow: Resource Owner Password Credential

Authorisation

Server

Resource

Owner

2 – Resource Owner Password Credential

Client

3 – Access Token (with Optional Refresh Token)

1 – Resource Owner Password Credential

Page 24: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

Client Credentials

• A Client can request an Access Token using only Client Credentials

• Only used by Confidential Clients

Page 25: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

OAuth 2.0 Flow: Client Credentials

1 – Client Authentication

Authorisation

Server

Client

2 – Access Token

Page 26: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

Access Token Response

• Access Token

• Expiry

• Refresh Token

• Scope

Page 27: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

Refreshing Access Tokens

• Client makes a refresh request• Grant type

• Must be ‘Refresh Token’

• Refresh Token

• Scope

Page 28: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

Accessing Resources

• Client interacts with the Resource Server

• Client accesses protected Resources by presenting Access Tokens

• The Resource Server validates• Validity of the Access Token

• Scope

Page 29: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

• Obtaining Client Secrets• Revoke Client Secrets

• Obtaining Refresh Tokens• Revoke Refresh Tokens

• Obtaining Access Tokens• Keep lifetime short

Attacks and Countermeasures

Page 30: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

• No backward compatibility

• It relies on SSL/TLS for ensuring• Confidentiality

• Integrity

• Prevention of replay attack

• Phishing attack

Limitations

Page 31: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

Limitations (2)

• Privacy issues• Servers will know more about Resource

Owners and Clients

• Denial-of-Service (DoS) attack• Effect on Clients and Servers

Page 32: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

OAuth Service Providers

• Flickr

• Google App Engine

• Netflix

• Yahoo

• …

Page 33: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

OAuth 2.0 Service Providers

• Amazon

• AOL

• Facebook

• GitHub

• Google

• Microsoft

• Paypal

Page 34: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

Service Providers Supporting Both

• Dropbox

• LinkedIn

• Twitter

• …

Page 35: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

Summary

• OAuth 2.0 is evolved from OAuth

• Provides clear separation of roles

• A variety of use cases• Native applications

• Enterprises offer OAuth, OAuth 2.0 or both

Page 36: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use
Page 37: Muhammad Rizwan Asghar - Computer Science · Why OAuth 2.0 • OAuth 2.0 is better than OAuth 1.0 due to •Clear separation of roles •Simplicity •Support of a variety of use

References

• OAuth 2.0, http://oauth.net/2/

• The OAuth 2.0 Authorization Framework, http://tools.ietf.org/html/rfc6749

• OAuth 2.0 Threat Model and Security Considerations, http://tools.ietf.org/html/rfc6819