0
OAuth?<br />Oaths is an authorization standard for API’s that does away with logins and passwords to grant authorization t...
Why OAuth?<br />Every day a new websites are launched which tie services from different sites and offer you<br />
OAuth Definitions<br />Service provider<br />	The website or web-service where the restricted resources are located<br />U...
OAuth : Protocol Workflow<br />
Jane wants to share some of her vacation photos with her friends. Jane uses Faji, a photo sharing site, for sharing journe...
	Jane wants to share them with her grandmother. But grandma doesn’t have an internet connection so Jane plans to order pri...
When Beppa added support for Faji photo import, a Beppa developer known in OAuth as a Consumer Developer obtained a Consum...
Beppa requests from Faji a Request Token. At this point, the Request Token is not User-specific, and can be used by Beppa ...
When Beppa receives the Request Token, it redirects Jane to the Faji OAuth User Authorization URL with the Request Token a...
After successfully logging into Faji, Jane is asked to grant access to Beppa, the Consumer. Faji informs Jane of who is re...
Jane waits for Beppa to present her with her photos fetched from her Faji account.<br />
While Jane waits, Beppa uses the authorized Request Token and exchanges it for an Access Token. Request Tokens are only go...
Jane is very impressed how Beppa grabbed her photos without asking for her username and password. She likes what she sees ...
	Tokens<br />OAuth uses three types of credentials<br />Client credentials (consumer key and secret)<br />Temporary creden...
		Client Credentials<br />Allows server to authenticate server<br />Allows server to get information about the client<br /...
Token Credentials<br />Token credentials are in place of username and password<br />The client uses token credentials to a...
Temporary credentials<br />Used to identify the authorization request<br />To accommodate different clients like desktop, ...
OAuthSecurity Architecture<br />
 Signature and Hash<br />OAuth uses digital signatures instead of sending the full credentials (specifically, passwords) w...
Hash Algorithm<br />A common way to sign digital content is using a hash algorithm. <br />Hashing is the process of taking...
Shared Secret<br />By itself, hashing does not verify the identity of the sender, only data integrity.<br />In order to al...
		Nonce(‘Number used Once’)<br />What is missing is something to prevent requests intercepted by an unauthorized party, us...
TimeStamp<br />Using nonces can be very costly for Service Providers as they demand persistent storage of all nonce values...
Signature Methods<br />OAuth defines 3 signature methods used to sign and verify requests<br />PLAINTEXT<br />HMAC-SHA1<br...
Signature Base String<br />Not only must they both use the same algorithm and share secret, but they must sign the same co...
Building a reqestToken request requires the following:HTTPMethod,Request URI,oauth_callback,oauth_consumer_key,oauth_nonce...
Getting the Request Token<br /><ul><li>First build your string to sign</li></li></ul><li>First build your string to sign<b...
Create your Authorization HTTP Header & and Issue the  request<br />Now we sign this string using our consumer secret and ...
Now we issue this request to the requestTokenendpoint,and if all is sucessful,you will get something like the following UR...
Now that we have a request token,we can build the url to authoriza the user.we  will then redirect the user to this url so...
The user will then be sent to our authorization paeg.when completed the user wil either be sent back to your oauth_callbac...
Regardless of whether you used out-of-band authentication or not,you will now be euipped with a request token an oauth_tok...
Getting the Access Token<br /><ul><li>First build your string to sign</li></li></ul><li>First build your string to sign<br...
Create your Authorization HTTP Header & and Issue the  request<br />Now we sign this string using our consumer secret and ...
Now we issue this request to the aceessTokenendpoint,and if all is sucessful,you will get something like the following URL...
Reuesting your own profile<br /><ul><li>First build your string to sign</li></li></ul><li>First build your string to sign<...
Create your Authorization HTTP Header & and Issue the  request<br />Now we sign this string using our consumer secret and ...
Now we issue this reuest to thew people resource,and if all is sucessful,you will get something like the following XML res...
Oauth is complicated, and there are a number of things that go wrong.<br />Here are some tips.<br />Every error response w...
Links<br />
Maintest3
Maintest3
Maintest3
Maintest3
Upcoming SlideShare
Loading in...5
×

Maintest3

2,485

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
2,485
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
14
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Maintest3"

  1. 1. OAuth?<br />Oaths is an authorization standard for API’s that does away with logins and passwords to grant authorization to a third-party <br />
  2. 2. Why OAuth?<br />Every day a new websites are launched which tie services from different sites and offer you<br />
  3. 3. OAuth Definitions<br />Service provider<br /> The website or web-service where the restricted resources are located<br />User<br /> User have ‘stuff’ they don’t want to make pubic on the service provider but they do want to share it with another site<br />Consumer<br /> The name for the application trying access the users resources<br />Protected Resources<br /> The ‘stuff’ oauth protects and allow access.<br />Tokens<br /> Tokens are used instead of user credentials to access resources<br />
  4. 4. OAuth : Protocol Workflow<br />
  5. 5. Jane wants to share some of her vacation photos with her friends. Jane uses Faji, a photo sharing site, for sharing journey photos. She signs into her faji.com account, and uploads two photos which she marks private.<br /> Using OAuth terminology<br /> Jane is the User <br />Faji is the Service Provider. <br /> The 2 photos Jane uploaded are the Protected Resources.<br /> OAuth Example<br />
  6. 6. Jane wants to share them with her grandmother. But grandma doesn’t have an internet connection so Jane plans to order prints and have them mailed to grandma. Being a responsible person, Jane uses Beppa, an environmentally friendly photo printing service.<br />Using OAuth terminology, <br />Beppa is the Consumer. <br />Beppa must use OAuth to gain access to the photos in order to print them.<br />
  7. 7. When Beppa added support for Faji photo import, a Beppa developer known in OAuth as a Consumer Developer obtained a Consumer Key and Consumer Secret from Faji to be used with Faji’s OAuth-enabled API.<br />Using OAuth terminology, <br />Consumer Key <br />Consumer secret<br />
  8. 8. Beppa requests from Faji a Request Token. At this point, the Request Token is not User-specific, and can be used by Beppa to gain User approval from Jane to access her private photos.<br />Using OAuth terminology, <br />Request Token<br />
  9. 9. When Beppa receives the Request Token, it redirects Jane to the Faji OAuth User Authorization URL with the Request Token and asks Faji to redirect Jane back once approval has been granted to http://beppa.com/order.<br />Using OAuth terminology, <br />Oauth User Authorization URL<br />Call Back URL<br />
  10. 10. After successfully logging into Faji, Jane is asked to grant access to Beppa, the Consumer. Faji informs Jane of who is requesting access (in this case Beppa) and the type of access being granted. Jane can approve or deny access.<br />
  11. 11. Jane waits for Beppa to present her with her photos fetched from her Faji account.<br />
  12. 12. While Jane waits, Beppa uses the authorized Request Token and exchanges it for an Access Token. Request Tokens are only good for obtaining User approval, while Access Tokens are used to access Protected Resources, in this case Jane’s photos.<br /> In the first request, Beppa exchanges the Request Token for an Access Token and in the second (can be multiple requests, one for a list of photos, and a few more to get each photo) request gets the photos.<br />Using OAuth terminology, <br />Access Token<br />
  13. 13. Jane is very impressed how Beppa grabbed her photos without asking for her username and password. She likes what she sees and place the print order.<br />
  14. 14.
  15. 15. Tokens<br />OAuth uses three types of credentials<br />Client credentials (consumer key and secret)<br />Temporary credentials (request token and secret)<br />Token credentials (access token and secret)<br />
  16. 16. Client Credentials<br />Allows server to authenticate server<br />Allows server to get information about the client<br />Oauth_consumer_key<br /> Oauth_consumer_secret<br />
  17. 17. Token Credentials<br />Token credentials are in place of username and password<br />The client uses token credentials to access resource owner protected resource<br />Token credentials are limited in scope and duration<br />Oauth_access_token<br />Oauth_access_secret<br />
  18. 18. Temporary credentials<br />Used to identify the authorization request<br />To accommodate different clients like desktop, mobile etc.<br />Add extra flexibility and security<br />Oauth_token<br />Oauth_token_secret<br />
  19. 19. OAuthSecurity Architecture<br />
  20. 20. Signature and Hash<br />OAuth uses digital signatures instead of sending the full credentials (specifically, passwords) with each request. <br />The sender uses a mathematical algorithm to calculate the signature of the request and includes it with the request.<br />
  21. 21. Hash Algorithm<br />A common way to sign digital content is using a hash algorithm. <br />Hashing is the process of taking data (of any size) and condensing it to a much smaller value (digest) in a fully reproducible (one-way) manner<br />This means that using the same hash algorithm on the same data will always produce the same smaller value<br />Hashing usually does not allow going from the smaller value back to the original.<br />
  22. 22. Shared Secret<br />By itself, hashing does not verify the identity of the sender, only data integrity.<br />In order to allow the recipient to verify that the request came from the claimed sender, the hash algorithm is combined with a shared secret<br />If both sides agree on some shared secret known only to them, they can add it to the content being hashed.<br />
  23. 23. Nonce(‘Number used Once’)<br />What is missing is something to prevent requests intercepted by an unauthorized party, usually by sniffing the network, from being reused. This is known as a replay attack.<br />Able to make the same sign request over and over again.<br />To prevent compromised requests from being used again (replayed), OAuth uses a nonce and timestamp.<br />By having a unique identifier for each request, the Service Provider is able to prevent requests from being used more than once<br />
  24. 24. TimeStamp<br />Using nonces can be very costly for Service Providers as they demand persistent storage of all nonce values received, ever.<br />OAuth adds a timestamp value to each request which allows the Service Provider to only keep nonce values for a limited time.<br />When a request comes in with a timestamp that is older than the retained time frame, it is rejected as the Service Provider no longer has nonces from that time period.<br />
  25. 25. Signature Methods<br />OAuth defines 3 signature methods used to sign and verify requests<br />PLAINTEXT<br />HMAC-SHA1<br />RSA-SHA1<br /> When signing requests, it is necessary to specify which signature method has been used to allow the recipient to reproduce the signature for verification<br />The decision of which signature method to use depends on the security requirements of each application<br />
  26. 26. Signature Base String<br />Not only must they both use the same algorithm and share secret, but they must sign the same content. <br />This requires a consistent method for converting HTTP requests into a single string which is used as the signed content — the Signature Base String.. <br />
  27. 27. Building a reqestToken request requires the following:HTTPMethod,Request URI,oauth_callback,oauth_consumer_key,oauth_nonce,oauth_signature_method,oauth_timestamp and oauth_version<br />Getting the Request Token<br />
  28. 28. Getting the Request Token<br /><ul><li>First build your string to sign</li></li></ul><li>First build your string to sign<br />These parameters get sortdedalphabetically,each value is URL escaped, and than concatenated into a single string.<br />Getting the reuest Token<br />
  29. 29. Create your Authorization HTTP Header & and Issue the request<br />Now we sign this string using our consumer secret and create an HTTP Authorization header.The signature should be placed in the oauth_signature value<br />Getting the request token<br />
  30. 30. Now we issue this request to the requestTokenendpoint,and if all is sucessful,you will get something like the following URL encoded response:<br />The oauth_token field is now your request token,and the oauth_token_secret will be used for signing your request for an access toen.oaut_callback_confirmed just gives you confirmation the we recogized your oauth_callback parameter <br />You will want to “hold on” to oauth_token and oauth_token_secretuntill you have completed the access token step<br />Evaluate the Request Token<br />
  31. 31. Now that we have a request token,we can build the url to authoriza the user.we will then redirect the user to this url so they can grant your application access.<br />An authorization ur is simply this end point:http://api.linkedIn.com/usas/oauth/authorize with a query parameter tacked on called oauth_token.the value for this parameter is eual to the request token you received in the previous step.<br />The user needs to land on this page within 5 minutes of your request toke cycle.you should not pass an oauth_callbac parameter to this page(you already did that in the reuest token step) <br />Authorizing the member<br />Build your authrization URL<br />
  32. 32. The user will then be sent to our authorization paeg.when completed the user wil either be sent back to your oauth_callback URL or presented with a series of digits they will be instructed to hand-enter into your application(if you are performing out-of-band authentication)<br />Authorizing the member<br />Send the user to LinkedIn’s Authorization PAge<br />
  33. 33.
  34. 34.
  35. 35. Regardless of whether you used out-of-band authentication or not,you will now be euipped with a request token an oauth_token_secret and an oauth_verfier.you are now going to excahge that request token for an access token,imbued with permission of the linkedIn member to act on their behalf<br />Getting an Access token<br />Prepare your singing secret<br />
  36. 36. Getting the Access Token<br /><ul><li>First build your string to sign</li></li></ul><li>First build your string to sign<br />These parameters get sortdedalphabetically,each value is URL escaped, and than concatenated into a single string.<br />Getting the Access Token<br />
  37. 37. Create your Authorization HTTP Header & and Issue the request<br />Now we sign this string using our consumer secret and create an HTTP Authorization header.The signature should be placed in the oauth_signature value<br />Getting the Access token<br />
  38. 38. Now we issue this request to the aceessTokenendpoint,and if all is sucessful,you will get something like the following URL encoded response:<br />The oauth_token field is now your access token,and the auth_toke_secert will be used for signing all reuest on behalf of the member.<br />You will want to “hold on” to oauth_token and oauth_token_secretuntill you have completed the access token step<br />Evaluate the Access Token<br />
  39. 39.
  40. 40. Reuesting your own profile<br /><ul><li>First build your string to sign</li></li></ul><li>First build your string to sign<br />These parameters get sortdedalphabetically,each value is URL escaped, and than concatenated into a single string.<br />Requesting yourown profile<br />
  41. 41. Create your Authorization HTTP Header & and Issue the request<br />Now we sign this string using our consumer secret and create an HTTP Authorization header.The signature should be placed in the oauth_signature value<br />Requesting your own profile<br />
  42. 42. Now we issue this reuest to thew people resource,and if all is sucessful,you will get something like the following XML response,with your own profile values in place of my own<br />If the access token is invalid,or your signature was not properly calculated,youwil receive a 401 Unauthorized error.There is always interesting debugging information in the xml body of failed request and the http headers we return to you.Maybe your timestamp was off by a few minutes?Maybe your signature was invaid?maybe the access token is no longer vaid?<br />Requesting your own profile<br />
  43. 43. Oauth is complicated, and there are a number of things that go wrong.<br />Here are some tips.<br />Every error response we send you will contain an xml body describing the error, including a timestamp representing server time. Some oauth-based requests will LSO RETURN AN OAUTH_PROBLEM HHTP HEADER<br />Make sure that your server’s system clock is in sync with ours<br />Oauth_callback should only be provided on the request token step.<br />Oauth_verifier is required in the access Token.<br />PUT & POST operations typically have xml content-types. your oauth library should exclude the request body in signature calculations as a result.<br />For the access token step, remember that the request tokens oauth_token_secret must be used as part of your signing key<br />Likewise, for ai resource requests, your access tokens oauth_token_secret must be used as part of your signing key.<br />Troubleshootong<br />
  44. 44. Links<br />
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×