OAuth 2.0: Theory and Practice. Daniel Correia Pedro Félix



Similar documents
ACR Connect Authentication Service Developers Guide

OAuth 2.0 Developers Guide. Ping Identity, Inc th Street, Suite 100, Denver, CO

OAuth 2.0 Workshop. On how native (mobile) devices can use OAuth protected resources

EHR OAuth 2.0 Security

How To Use Kiteworks On A Microsoft Webmail Account On A Pc Or Macbook Or Ipad (For A Webmail Password) On A Webcomposer (For An Ipad) On An Ipa Or Ipa (For

OAuth: Where are we going?

Web Based Single Sign-On and Access Control

Web 2.0 Lecture 9: OAuth and OpenID

Lecture Notes for Advanced Web Security 2015

Device Token Protocol for Persistent Authentication Shared Across Applications

Enterprise Access Control Patterns For REST and Web APIs

Axway API Gateway. Version 7.4.1

A Standards-based Mobile Application IdM Architecture

Fairsail REST API: Guide for Developers

OAuth 2.0. Weina Ma

AIRTEL INDIA OPEN API. Application Developer Guide for OAuth2 Authentication and Authorization. Document Version 1.1

Oracle Fusion Middleware Oracle API Gateway OAuth User Guide 11g Release 2 ( )

SAML and OAUTH comparison

Globus Auth. Steve Tuecke. The University of Chicago

Login with Amazon. Developer Guide for Websites

Using ArcGIS with OAuth 2.0. Aaron CTO, Esri R&D Center Portland

IBM WebSphere Application Server

Identity Management with Spring Security. Dave Syer, VMware, SpringOne 2011

OAuth2 Ready or not? Dominick Baier

Traitware Authentication Service Integration Document

The Essential OAuth Primer: Understanding OAuth for Securing Cloud APIs

Security and ArcGIS Web Development. Heather Gonzago and Jeremy Bartley

Force.com REST API Developer's Guide

Mashery OAuth 2.0 Implementation Guide

Contents. 2 Alfresco API Version 1.0

Dell One Identity Cloud Access Manager How to Develop OpenID Connect Apps

Onegini Token server / Web API Platform

Research on the Security of OAuth-Based Single Sign-On Service

Computer Systems Security 2013/2014. Single Sign-On. Bruno Maia Pedro Borges

OpenID Single Sign On and OAuth Data Access for Google Apps. Ryan Dave Primmer May 2010

Online Multimedia Authorization Protocol An Industry Standard for Authorized Access to Internet Multimedia Resources

OpenID Connect 1.0 for Enterprise

Authenticate and authorize API with Apigility. by Enrico Zimuel Software Engineer Apigility and ZF2 Team

Authorization and Authentication

Securing ASP.NET Web APIs Dominick Baier

OAuth Hacks A Gentle Introduction to OAuth 2.0 and Apache Oltu

An Oracle White Paper Dec Oracle Access Management OAuth Service

Table of Contents. Open-Xchange Authentication & Session Handling. 1.Introduction...3

MIT Tech Talk, May 2013 Justin Richer, The MITRE Corporation

Securing JAX-RS RESTful services. Miroslav Fuksa (software developer) Michal Gajdoš (software developer)

OAuth2 and UMA for ACE draft-maler-ace-oauth-uma-00.txt. Eve Maler, Erik Wahlström, Samuel Erdtman, Hannes Tschofenig

Building Secure Applications. James Tedrick

Title page. Alcatel-Lucent 5620 SERVICE AWARE MANAGER 13.0 R7

Federation architectures for mobile applications OAuth 2.0 Drivers OAuth 2.0 Overview Mobile walkthrough

Cryptonite. SSO: Single Sign-On Security Overview. Áron SZABÓ. H.A.C.K. Hackerspace Budapest (hsbp.org)

SERIES Y: GLOBAL INFORMATION INFRASTRUCTURE, INTERNET PROTOCOL ASPECTS AND NEXT-GENERATION NETWORKS Next Generation Networks Security

OpenID Deutsche telekom. Dr. Torsten Lodderstedt, Deutsche Telekom AG

Yandex.Money API API for Apps

OAuth Guide Release 6.0

SETTING UP YOUR JAVA DEVELOPER ENVIRONMENT

#07 Web Security CLIENT/SERVER COMPUTING AND WEB TECHNOLOGIES

Office365Mon Developer API

Comparative analysis - Web-based Identity Management Systems

INTEGRATION GUIDE. DIGIPASS Authentication for Google Apps using IDENTIKEY Federation Server

OAuth. Network Security. Online Services and Private Data. A real-life example. Material and Credits. OAuth. OAuth

Copyright: WhosOnLocation Limited

Mobile Security. Policies, Standards, Frameworks, Guidelines

Login with Amazon. Getting Started Guide for Websites. Version 1.0

OAuth2lib. implementation

Using SAML for Single Sign-On in the SOA Software Platform

Federated Identity and Single Sign-On using CA API Gateway

OpenLogin: PTA, SAML, and OAuth/OpenID

Copyright Pivotal Software Inc, of 10

Final Project Report December 9, Cloud-based Authentication with Native Client Server Applications. Nils Dussart

I) Add support for OAuth in CAS server

SAP HANA Cloud Platform Security Tutorial Securing your Web API with OAuth 2.0

Using XACML Policies as OAuth Scope

INTEGRATION GUIDE. DIGIPASS Authentication for Salesforce using IDENTIKEY Federation Server

OPENID AUTHENTICATION SECURITY

Applying Cryptography as a Service to Mobile Applications

Keeping access control while moving to the cloud. Presented by Zdenek Nejedly Computing & Communications Services University of Guelph

API documentation - 1 -

Enabling SSO for native applications

OAuth Web Authorization Protocol Barry Leiba

The Top 5 Federated Single Sign-On Scenarios

Key & Data Storage on Mobile Devices

Automatic Recognition, Processing and Attacking of Single Sign-On Protocols with Burp Suite

Adeptia Suite 6.2. Application Services Guide. Release Date October 16, 2014

OAuth 2.0 andinternet Standard. Torsten Lodderstedt Deutsche Telekom AG

Authentication and Authorization for Mobile Devices

Secure Single Sign-On

WHITE PAPER Usher Mobile Identity Platform

IVOA Single-Sign-On Profile: Authentication Mechanisms Version 2.0

Salesforce1 Mobile Security Guide

The full setup includes the server itself, the server control panel, Firebird Database Server, and three sample applications with source code.

Securing RESTful Web Services Using Spring and OAuth 2.0

Administering Jive Mobile Apps

ShareFile Enterprise: security white paper

AAI for Mobile Apps How mobile Apps can use SAML Authentication and Attributes. Lukas Hämmerle

Transcription:

OAuth 2.0: Theory and Practice Daniel Correia Pedro Félix 1

whoami Daniel Correia Fast learner Junior Software Engineer Passionate about everything Web-related Currently working with the SAPO SDB team Pedro Félix Teacher at ISEL the engineering school of the Lisbon Polytechnic Institute Independent consultant working with the SAPO SDB team 2

OAuth History OAuth started circa 2007 2008 - IETF normalization started in 2008 2010 - RFC 5849 defines OAuth 1.0 2010 - WRAP (Web Resource Authorization Profiles) proposed by Microsoft, Yahoo! And Google 2010 - OAuth 2.0 work begins in IETF 2012 RFC 6749 - The OAuth 2.0 Authorization Framework RFC 6750 - The OAuth 2.0 Authorization Framework: Bearer Token Usage 3

An use case The cast of characters www.storecode.example code repository service (e.g. github.com) www.checkcode.example code analysis service (e.g. travis-ci.org) Alice a fictional developer The problem How can Alice allow checkcode to access her private code stored at storecode? build and analyze code Alice stores private code www.checkcode.example fetch Alice s code www.storecode.example 4

The password anti-pattern A solution: Alice shares her password with checkcode Problems: Unrestricted access checkcode has all of Alice s permissions read and write on all code repositories, issues, wiki,... No easy revocation Changing password implies revoking all other client applications Password management Changing password implies updating all the delegated applications 5

The protocol www.checkcode.example www.storecode.example authorization request Alice s authentication and authorization delegation to checkcode authorization response code token request client creds code token response access_token service request access_token service response Alice s resource representation 6

A demo would be nice Accessing GitHub 7

Developer experience Manage Clients (Applications) client_id client_secret redirect_uri 8

User experience Grant authorizations Manage authorization 9

The OAuth 2.0 roles www.checkcode.example www.storecode.example Resource Owner (aka User) authorization request Client Alice s authentication and authorization delegation to checkcode authorization response code token request client creds code Authorization Server token response access_token service request access_token service response Alice s resource representation Resource Server (aka Service) 10

A matter of trust Browser Web Server HomeBank MobileApp HomeBank Service checkcode storecode 11

Client Types Confidential Clients capable of maintaining the confidentiality of their credentials (e.g. client implemented on a secure server) Public Clients incapable of maintaining the confidentiality of their credentials (e.g. clients executing on the device used by the resource owner)

Client Types 3 implementation scenarios Single client all the users (web app) One client per user (native mobile app) One client per multiple users (family shared tablet, IPTV Box) Dynamic Client Registration Client Registration Endpoint still in draft Turning public clients into private client instances Not a closed problem

Authorization and Token Endpoints www.checkcode.example Front Channel authorization request Alice s authentication and authorization delegation to checkcode www.storecode.example Authorization Endpoint authorization response code Authorization Server token request client creds code token response access_token Back Channel Token Endpoint 14

Front and back channels Front channel Authorization Endpoint (AE) Authorization request redirect from Client to AE via the User-agent Human interface User authentication and authorization delegation Authorization response redirect from AE to Client via the User-agent Back channel Token Endpoint (TE) Direct request-response between Client and TE No User interaction No human interface 15

Scopes scope scope of the access request Parameter on the authorization request or token request Set of space-delimited strings E.g https://www.googleapis.com/auth/calendar.readonly Usages Client Must find the required scopes for each service interaction docs User AS translates the scopes into friendly User messages Service Maps a scope into (URIs, methods) or (service, operation) Granted scope may differ from requested scopes No provision for mandatory and optional scopes 16

The grant concept Represents the logical outcome of the User s authorization User identity Client identity Scope Core domain concept Bound to all the tokens Code Access token Refresh token 17

Not (Keep It Simple) 18

OAuth 2.0: a framework not a protocol The previous protocol is just a one of many options Three parts 1. Obtaining user authorization 2. Issuing access tokens 3. Using access tokens to authorize service requests Multiple protocol flows Different User authorization Critique Complexity Compromises interoperability WS-* again? 19

Obtaining authorization Authorization Code Grant The previous protocol Implicit Grant Authorization Endpoint returns the access token directly Javascript Clients running on the browser Resource Owner Password Credentials Grant User gives password to Client, Client uses it to obtain access token Client Credentials Grant No User, Client access on its own behalve Extensions Identity federation, SAML assertions 20

Implicit Grant Javascript Client on browser www.storecode.example authorization request Alice s authentication and authorization delegation to checkcode authorization response access_token service request access_token service response Alice s resource representation 21

Resource Owner Password Credentials Grant www.checkcode.example www.storecode.example Grant access User password token request client creds User password token response access_token service request access_token service response Alice s resource representation 22

Client Credentials Grant www.checkcode.example www.storecode.example token request client creds token response access_token service request access_token service response Alice s resource representation 23

Accessing the Token Endpoint POST /token_endpoint HTTP/1.1 Host: as.storecode.example Content-Type: application/x-www-form-urlencoded Authorization: Basic <client_id:client_secret> grant_type=authorization_code code=abcdef... redirect_uri=https://redirect.checkcode.example client_id=...& client_secret=.. 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", "example_parameter":"example_value" 24

Accessing the service (Resource Server) How to associate the access token to the request message? Bearer just append the token to the request message RFC 6750 Just like bearer checks or HTTP cookies MAC (holder-of-key) prove the possession of a key still draft Similar to OAuth 1.0 or to AWS (used in S3) GET /resource HTTP/1.1 Host: api.storecode.example Authorization: Bearer <access_token> GET /resource HTTP/1.1 Host: api.storecode.example Authorization: MAC id=..., nonce=..., mac=... 25

Bearer vs. MAC Bearer Simpler no signatures Require HTTPS Incorrect use RFC 6750 Similar to cookie usage Behare of the fallacy Same origin policies Discoverability MAC Safer More complex signature Client library integration 26

Token structure Not covered by the RFCs Token content options Artifact (reference/handle) reference to stored data Store Hash(artifact) and not artifact directly At least 128 bits of entropy Revocation just clear the stored data Assertions contains the (cryptographically protected) data JWT JSON Web Token Revocation harder (e.g. maintain revocation list) Token data Validity period Grant (User, Client, Scopes) Type ({code, access_token, refresh_token}) Usage (e.g. code should be used only once) 27

Refresh tokens Two lifetimes Access tokens short lifetime Bearer usage Refresh tokens long lifetime Usage requires client credentials Useful for revocation Token Endpoint - obtain new access token given a refresh token Critique: state management on the client 28

Security: authorization request www.checkcode.example www.storecode.example authorization request: response_type=code, client_id, redirect_uri, scope, state Alice s authentication and authorization delegation to checkcode authorization response: code, state Request-response correlation state parameter - unpredictable Session-fixation attack Code search At least 128 bit of entropy Small usage period (e.g. 5 minutes) Code bound to a client_id Code usage throttled by client_id 29

Security: code exchange www.checkcode.example www.storecode.example authorization request: response_type=code, client_id, redirect_uri, scope, state Alice s authentication and authorization delegation to checkcode authorization response: code,... token request: client_secret, redirect_uri, code,... token response access_token 30

Mobile: authorization request www.checkcode.example www.storecode.example authorization request: response_type=code, client_id, redirect_uri, scope, state Alice s authentication and authorization delegation to checkcode authorization response: code, state Use a web view e.g. Windows 8 WebAuthenticationBroker Use an external browser - how to obtain the response parameters? Redirect Use localhost Special redirect URI urn:ietf:wg:oauth:2.0:oob (Google uses it but not on RFC) Custom redirect URI scheme 31

OAuth 2.0: for authorization not authentication Not safe for authentication in the general case OpenID Connect OAuth 2.0 + authentication code access_token Facebook AS access_token Facebook Client access_token alice@wonderla.nd Facebook API impersonation access_token Another Facebook Client access_token alice@wonderla.nd Facebook API 32

SDB - Service Delivery Broker Brokering between service clients and service enablers (implementations) Access Control (OAuth 1.0, API keys,...) Caching, protocol and format translation,... Public market place - https://store.services.sapo.pt Multi-tenant Service Clients Service Clients Service Clients https://services.sapo.pt OAuth 2.0 SDB Connect Service Delivery Broker (SDB) Service Enablers Service Enablers Service Enablers 33

References IETF Web Authorization Working Group - http://datatracker.ietf.org/wg/oauth/ RFCs Drafts Eran Hammer OAuth 2.0 and the Road to Hell - http://hueniverse.com/2012/07/oauth-2-0-and-the-road-to-hell/ OAuth 2.0 - Looking Back and Moving On - http://vimeo.com/52882780 John Bradley - http://www.thread-safe.com/2012/07/the-oauth-2-sky-is-not-falling.html 34