Skip to content
OAuth Strategy generator for Warden Authentication Framework
Ruby
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
spec
.document
.gitignore
CHANGELOG
LICENSE
README.rdoc
Rakefile
VERSION

README.rdoc

warden_oauth

warden_oauth enhances the warden gem offering a simple interface for creating oauth strategies on very simple steps.

Getting Started

To get started you just have to require the warden_oauth libraries, and setup the oauth services you would like to have on the Warden::Manager middleware declaration:

<pre> <code class=“ruby”> Warden::Manager do |manager|

manager.failure_app = FailureApp
manager.oauth(:twitter) do |twitter|
  twitter.consumer_secret = <YOUR CONSUMER SECRET>
  twitter.consumer_token  = <YOUR CONSUMER TOKEN>
  twitter.options :site => 'http://twitter.com'
end
manager.default_strategies(:twitter_oauth, :password, :other)

end </code> </pre>

Giving an Access Token fetcher

Users get identified on a system via an access_token and an access_secret, when a valid access_token is recevied, warden_oauth calls a fetcher declared on Warden::Manager.access_token_user_finder.

<pre> <code class=“ruby”> Warden::Manager.access_token_user_finder(:twitter) do |access_token|

User.find_by_access_token_and_access_secret(access_token.token, access_token.secret)

end </code> </pre>

If a user is returned, then this is the user that is going to be authenticated in the session, otherwise the FailureApp will be called, you may check the env[:oauth][:access_token] to check the original access_token and create a new user from there if desired.

Strategy Class info

When you declare an oauth strategy on the Warden::Manager initialization, (e.g. manager.oauth(:service_name)) a Warden::OAuth::Strategy::ServiceName will be declared, at the same time this class will be registered as :service_name_oauth on the Warden::Strategies.

So if we have a declaration like the one of the Getting Started section, we will have an Strategy class called Warden::OAuth::Strategy::Twitter, and this will be registered as :twitter_oauth.

Note on Patches/Pull Requests

For any error send an email to: romanandreg [at] gmail [dot] com

Copyright

Copyright © 2009 Roman Gonzalez. See LICENSE for details.

Something went wrong with that request. Please try again.