at thinktecture • Focus on – security in distributed applica9ons – iden9ty management – access control – Windows/.NET security – mobile app security • MicrosoG MVP for Developer Security • ASP.NET Web API Advisor • [email protected] • h;p://leastprivilege.com think mobile!
do I want to use today? -‐ Do I trust this app? -‐ Who is the user? -‐ How can I securely communicate with the back-‐end -‐ Who is the user? -‐ Who is the client? -‐ What are they allowed to do?
2007 • 2008 -‐ IETF normaliza0on started in 2008 • 2010 -‐ RFC 5849 defines OAuth 1.0 • 2010 -‐ WRAP (Web Resource Authoriza0on Profiles) proposed by MicrosoG, Yahoo! and Google • 2010 -‐ OAuth 2.0 work begins in IETF • Working deployments of various draGs & versions at Google, MicrosoG, Facebook, Github, Twi;er, Flickr, Dropbox… • Mid 2012 – Lead author and editor resigned & withdraws his name from all specs • October 2012 – RFC 6749, RFC 6750 • January 2014 – OpenID Connect (built on top of OAuth2)
communica0on between client and authoriza0on server – server-‐rendered web applica9ons – user-‐agent based web applica9ons – na9ve applica9ons – machine-‐to-‐machine communica9on – federa9on • Ability to treat the client as par0ally trusted – as well as client authen9ca9on
Authoriza0on Server Client issues access token Confiden9al/Public Trusted/Untrusted OAuth2: The Players "owns" a resource uses trusts is registered with accesses
Owner Client Authoriza9on Server POST /token Authorization: Basic (client_id:secret) grant_type=password& scope=read& user_name=owner& password=password& Resource Server
password with a token – short lived or long lived • Be;er than dealing with passwords directly – e.g. storing the password – client s9ll can "see" the password – maybe not what you want • Client creden0als flow – similar but no user creden9als – client acts on behalf of itself (not the user)
Server Resource Owner Client GET /authorize? client_id=nativeapp& scope=read& redirect_uri=http://localhost/cb& response_type=token& state=123 Authoriza9on Server
User enters creden0als at the authoriza0on server – not at the client • authoriza0on server returns (short lived) access token – to reduce exposure of token • OGen combined with OS helper mechanisms – cookie container – na9ve APIs
Designed for "confiden0al" clients – client can store secret securely – client authen9ca9on and authoriza9on based on client iden9ty possible – typically server-‐based applica9ons • Accountability is provided – access token never leaked to the browser • Long-‐lived access can be implemented
far authoriza0on server and resource server are always in the same trusted subsystem – your client accessing your back-‐end – facebook client accessing facebook back-‐end • What if you want to cross the line? – Asser9on Flow
Authoriza0on Server Resource "partner" Authoriza0on Server 1) request token using "core" flow 2) request token using "asser0on" flow 3) use token trust trust
Client [ResourceAc9onAuthorize("add", "customer"] public HgpResponseMessage Post(Customer c) { } [ScopeAuthorize("add")] public HgpResponseMessage Post(Customer c) { } h;ps://github.com/thinktecture/Thinktecture.Iden0tyModel
/ APIs is the mindset • OAuth2 is a framework – and a set of design pagerns • The authoriza0on server acts a a traffic cop between the par0es • Access control is based on access tokens • Authoriza0on is based on the user – and op9onally the client (type)