Skip to end of metadata
Go to start of metadata
You are viewing an old version of this page. View the current version. Compare with Current  |   View Page History

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

Zend Framework: Zend_Auth_Adapter_Twitter Component Proposal

Proposed Component Name Zend_Auth_Adapter_Twitter
Developer Notes http://framework.zend.com/wiki/display/ZFDEV/Zend_Auth_Adapter_Twitter
Proposers Jason Austin
Zend Liaison TBD
Revision 1.0 - 17 November 2010: Initial Draft. (wiki revision: 14)

Table of Contents

1. Overview

Zend_Auth_Adapter_Twitter is an authentication adapter designed to use twitter's OAuth service to authenticate a user.

2. References

3. Component Requirements, Constraints, and Acceptance Criteria

  • This component will conform to the requirements of the Zend_Auth_Adapter component (class Zend_Auth_Adapter_Twitter implements Zend_Auth_Adapter_Interface).
  • The Zend_Auth_Adapter::authenticate() method will not return Zend_Auth_Result::SUCCESS unless a valid OAuth access token is obtained from twitter
  • This adapter will not throw exceptions for conditions that may occur during normal operation with a properly configured adapter (i.e. authentication failure). All such exceptions will be caught in the adapter's authenticate method and translated into an appropriate Zend_Auth_Result::FAILURE response.
  • This adapter will throw exceptions for configuration errors, environmental issues and invalid usage such as invalid configuration options for OAuth settings (i.e. consumer key/secret).
  • This adapter will return Zend_Auth_Result::FAILURE if access was not granted by the user from twitter's access challenge (i.e. they deny access to the application)
  • This adapter will take advantage of the existing Zend_Oauth component to obtain and exchange tokens from twitter.
  • This adapter will take advantage of Zend_Session_Namespace to save state while the user is taken away to twitter's site, then back to the application

4. Dependencies on Other Framework Components

  • Zend_Oauth
  • Zend_Session

5. Theory of Operation

The component will be used as an instance of Zend_Auth_Adapter_Interface, implementing the authenticate() method. What makes this component unique is it's need to leave the user's application to authenticate with twitter's OAuth service, then return back to a state within the application.

The workflow would be something like:

  • Create an options array containing 'consumerKey', 'consumerSecret', and 'callbackUrl'
  • Instantiate Zend_Auth_Adapter_Twitter, passing the options array to the constructor
  • Call the authenticate method
  • Authenticate method would acquire a request token
  • Store the request token in a Zend_Session object
  • Redirect the user to twitter to authenticate
  • User will allow or deny access from twitter's website
  • Twitter will redirect the user back to the application through the callbackUrl passed in the options
  • Obtain an access token based on the request token stored in the Zend_Session object
  • Unset the Zend_Session object
  • Return twitter's uid in a Zend_Auth_Result object

Sample code can be found here: http://github.com/jfaustin/Zend_Auth_Adapter_Twitter/

6. Milestones / Tasks

  • Milestone 1: [DONE] Prototype
  • Milestone 2: Create documentation necessary to use the component
  • Milestone 3: Working prototype checked into the incubator
  • Milestone 4: Create Unit Tests

7. Class Index

  • Zend_Auth_Adapter_Twitter

8. Use Cases

9. Class Skeletons

]]></ac:plain-text-body></ac:macro>

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.