Adding initial version of the OAuth token authentication method. This adds basic OAuth support for registering apps, getting and revoking keys, etc... The tokens come with 6 separate permissions bits; read/write user preferences, write diaries, write API and read/write GPS traces. Needs more tests.

This commit is contained in:
Matt Amos 2009-06-22 16:54:37 +00:00
parent 2ad330d642
commit b8f6dbd403
85 changed files with 3277 additions and 9 deletions

View file

@ -0,0 +1,24 @@
./script/generate oauth_provider
This creates an OAuth Provider controller as well as the requisite models.
It requires an authentication framework such as acts_as_authenticated, restful_authentication or restful_open_id_authentication.
If you generated the migration file (true by default), make sure you run
rake db:migrate
You need to add the following routes to your config/routes.rb file:
map.resources :oauth_clients
map.oauth '/oauth',:controller=>'oauth',:action=>'index'
map.authorize '/oauth/authorize',:controller=>'oauth',:action=>'authorize'
map.request_token '/oauth/request_token',:controller=>'oauth',:action=>'request_token'
map.access_token '/oauth/access_token',:controller=>'oauth',:action=>'access_token'
map.test_request '/oauth/test_request',:controller=>'oauth',:action=>'test_request'
include the following in your user.rb
has_many :client_applications
has_many :tokens, :class_name=>"OauthToken",:order=>"authorized_at desc",:include=>[:client_application]