Zend_Oauth-ProtocolWorkflow.xml 4.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- EN-Revision: 20232 -->
  3. <!-- Reviewed: no -->
  4. <sect2 id="zend.oauth.introduction.protocol-workflow">
  5. <title>Workflow des Protokolls</title>
  6. <para>
  7. Bevor OAuth implementiert wird macht es Sinn zu verstehen wie das Protokoll arbeitet.
  8. Hierfür nehmen wir ein Beispiel von Twitter welches aktuell bereits OAuth basierend auf der
  9. OAuth Core 1.0 Revision A Spezifikation imeplementiert. Dieses Beispiel sieht das Protokoll
  10. aus der Perspektive des Benutzers (der den Zugriff gestattet), dem Konsumenten (der den
  11. Zugriff anfragt) und dem Provider (der die privaten Daten des Benutzers hat). Ein Zugriff
  12. kann nur-lesend, oder lesend und schreibend sein.
  13. </para>
  14. <para>
  15. Durch Zufall hat unser Benutzer entschieden das er einen neuen Service verwenden will der
  16. TweetExpress genannt wird und behauptet in der Lage zu sein Blog Posts bei Twitter in
  17. wenigen Sekunden nochmals zu posten. TweetExpress ist bei Twitter eine registrierte
  18. Anwendung was bedeutet das es Zugriff auf einen Konsumentenschlüssel und ein Geheimnis des
  19. Konsumenten hat (alle OAuth Anwendungen müssen diese vom Provider haben auf welchen Sie
  20. zugreifen wollen) welche seine Anfragen bei Twitter identifizieren und sicherstellen das
  21. alle Anfragen signiert werden können indem das Geheimnis des Konsumenten verwendet wird um
  22. deren Herkunft zu prüfen.
  23. </para>
  24. <para>
  25. Um TweetExpress zu verwenden wird man danach gefragt sich für einen neuen Account zu
  26. registrieren, und das der Registrierung wird sichergestellt das man dafüber informiert ist
  27. das TweetExpress den eigenen Twitter Account mit dem Service assoziiert.
  28. </para>
  29. <para>
  30. In the meantime TweetExpress has been busy. Before gaining your approval from Twitter, it
  31. has sent a HTTP request to Twitter's service asking for a new unauthorized Request Token.
  32. This token is not User specific from Twitter's perspective, but TweetExpress may use it
  33. specifically for the current User and should associate it with their account and store it
  34. for future use. TweetExpress now redirects the User to Twitter so they can approve
  35. TweetExpress' access. The URL for this redirect will be signed using TweetExpress' Consumer
  36. Secret and it will contain the unauthorized Request Token as a parameter.
  37. </para>
  38. <para>
  39. At this point the User may be asked to log into Twitter and will now be faced with a Twitter
  40. screen asking if they approve this request by TweetExpress to access Twitter's API on the
  41. User's behalf. Twitter will record the response which we'll assume was positive. Based on
  42. the User's approval, Twitter will record the current unauthorized Request Token as having
  43. been approved by the User (thus making it User specific) and will generate a new value in
  44. the form of a verification code. The User is now redirected back to a specific callback URL
  45. used by TweetExpress (this callback URL may be registered with Twitter or dynamically set
  46. using an oauth_callback parameter in requests). The redirect URL will contain the newly
  47. generated verification code.
  48. </para>
  49. <para>
  50. TweetExpress' callback URL will trigger an examination of the response to determine whether
  51. the User has granted their approval to Twitter. Assuming so, it may now exchange it's
  52. unauthorized Request Token for a fully authorized Access Token by sending a request back to
  53. Twitter including the Request Token and the received verification code. Twitter should now
  54. send back a response containing this Access Token which must be used in all requests used to
  55. access Twitter's API on behalf of the User. Twitter will only do this once they have
  56. confirmed the attached Request Token has not already been used to retrieve another Access
  57. Token. At this point, TweetExpress may confirm the receipt of the approval to the User and
  58. delete the original Request Token which is no longer needed.
  59. </para>
  60. <para>
  61. From this point forward, TweetExpress may use Twitter's API to post new tweets on the User's
  62. behalf simply by accessing the API endpoints with a request that has been digitally signed
  63. (via HMAC-SHA1) with a combination of TweetExpress' Consumer Secret and the Access Key being
  64. used.
  65. </para>
  66. <para>
  67. Although Twitter do not currently expire Access Tokens, the User is free to deauthorize
  68. TweetExpress from their Twitter account settings. Once deauthorized, TweetExpress' access
  69. will be cut off and their Access Token rendered invalid.
  70. </para>
  71. </sect2>