13
Digging Deeper into Desktop and Mobile App Security Pat Patterson, salesforce.com, Principal Developer Evangelist @metadaddy

Digging Deeper into Desktop and Mobile App Security

Embed Size (px)

Citation preview

Page 1: Digging Deeper into Desktop and Mobile App Security

Digging Deeper into Desktop and

Mobile App Security

Pat Patterson, salesforce.com, Principal Developer Evangelist

@metadaddy

Page 2: Digging Deeper into Desktop and Mobile App Security

Safe Harbor

Safe harbor statement under the Private Securities Litigation Reform Act of 1995:

This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties

materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results

expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be

deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other

financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any

statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services.

The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new

functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our

operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of

intellectual property and other litigation, risks associated with possible mergers and acquisitions, the immature market in which we

operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new

releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization

and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of

salesforce.com, inc. is included in our annual report on Form 10-Q for the most recent fiscal quarter ended July 31, 2012. This

documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of

our Web site.

Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently

available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based

upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-

looking statements.

Page 3: Digging Deeper into Desktop and Mobile App Security

Pat Patterson

Principal Developer Evangelist

@metadaddy

Page 4: Digging Deeper into Desktop and Mobile App Security

Objectives

By the end of this session, you should understand:

Best practices for authenticating from desktop and mobile apps

The OAuth 2.0 Protocol

How to create a Connected App in a Developer Edition org

Page 5: Digging Deeper into Desktop and Mobile App Security

How Not to Do It!

Collect user credentials in a form in your app

Use SOAP login() or OAuth 2.0 username/password flow

Store user credentials on the device

Like this…

Page 6: Digging Deeper into Desktop and Mobile App Security

Why Not? The Password Anti-Pattern!

Treat personal data such as username/password like toxic

waste – don’t handle them unless you absolutely must!

Requiring username/password rules out single sign-on

If a single client leaks the password, the user must change it

for all clients

Page 7: Digging Deeper into Desktop and Mobile App Security

The right stuff: OAuth 2.0 User-Agent Flow

Pop up a browser window and sent the user to

https://login.salesforce.com/services/oauth2/authorize

Let Salesforce handle the authentication process

Store the resulting refresh_token securely on the device

Like this…

Page 8: Digging Deeper into Desktop and Mobile App Security

Sidebar: The Salesforce Mobile SDK

The Mobile SDK provides OAuth 2.0 User-Agent Flow,

secure token storage, and token refresh for native and

hybrid apps

Job done!

But what’s actually happening under the covers???

Page 9: Digging Deeper into Desktop and Mobile App Security

OAuth 2.0

Authorization for RESTful APIs

Evolution of Google AuthSub, Yahoo BBAuth, AOL

OpenAuth etc

‘Valet key’ for the web

Emphasis on simplicity, ease of implementation

Page 10: Digging Deeper into Desktop and Mobile App Security

OAuth Roles

Authorization Server!!!

Page 11: Digging Deeper into Desktop and Mobile App Security

Authenticate

OAuth 2.0 Protocol

Browser App

Authorization Server

(login.salesforce.com)

https://login.salesforce.com/services/oauth2/authorize?

response_type=token&client_id=XYZ…&redirect_uri=m

yapp://oauth GET /services/oauth2/authorize?

response_type=token&client_id=XYZ

…&redirect_uri=myapp://oauth

302 Found

Location: myapp://oauth#

access_token=…&refresh_token=…&

instance_url=…&id=…&signature=…

&issued_at=…

GET /oauth#access_token=…&…

Resource Server

(na1.salesforce.com)

GET /services/data/v25.0/…

Authorization: Bearer 00D5…

200 OK

Data

Page 12: Digging Deeper into Desktop and Mobile App Security

Force.com Identity Service

OAuth response contains ‘id’ element:{

myapp://oauth#

access_token=00D5...&

refresh_token=ABC...&

instance_url=https://na1.salesforce.com&

id=https://login.salesforce.com/id/00D50000000IZ3ZEAW/00550000001fg5OAAQ&

signature=GhBp…&

issued_at=1308806720993

We can access this URL (with the OAuth token) to obtain

information on the user

Same pattern as OpenID Connect

Page 13: Digging Deeper into Desktop and Mobile App Security