rack-oauth 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +49 -0
- data/Rakefile +68 -0
- data/VERSION +1 -0
- data/examples/rails-example/README +243 -0
- data/examples/rails-example/Rakefile +10 -0
- data/examples/rails-example/app/controllers/application_controller.rb +12 -0
- data/examples/rails-example/app/controllers/welcome_controller.rb +26 -0
- data/examples/rails-example/app/helpers/application_helper.rb +3 -0
- data/examples/rails-example/app/helpers/welcome_helper.rb +2 -0
- data/examples/rails-example/app/views/welcome/index.html.erb +2 -0
- data/examples/rails-example/config/boot.rb +110 -0
- data/examples/rails-example/config/database.yml +22 -0
- data/examples/rails-example/config/environment.rb +14 -0
- data/examples/rails-example/config/environments/development.rb +17 -0
- data/examples/rails-example/config/environments/production.rb +28 -0
- data/examples/rails-example/config/environments/test.rb +32 -0
- data/examples/rails-example/config/initializers/backtrace_silencers.rb +7 -0
- data/examples/rails-example/config/initializers/inflections.rb +10 -0
- data/examples/rails-example/config/initializers/mime_types.rb +5 -0
- data/examples/rails-example/config/initializers/new_rails_defaults.rb +21 -0
- data/examples/rails-example/config/initializers/session_store.rb +15 -0
- data/examples/rails-example/config/locales/en.yml +5 -0
- data/examples/rails-example/config/routes.rb +6 -0
- data/examples/rails-example/db/development.sqlite3 +1 -0
- data/examples/rails-example/db/seeds.rb +7 -0
- data/examples/rails-example/db/test.sqlite3 +1 -0
- data/examples/rails-example/doc/README_FOR_APP +2 -0
- data/examples/rails-example/lib/tasks/rspec.rake +182 -0
- data/examples/rails-example/log/development.log +165 -0
- data/examples/rails-example/log/production.log +0 -0
- data/examples/rails-example/log/server.log +0 -0
- data/examples/rails-example/log/test.log +1591 -0
- data/examples/rails-example/public/404.html +30 -0
- data/examples/rails-example/public/422.html +30 -0
- data/examples/rails-example/public/500.html +30 -0
- data/examples/rails-example/public/favicon.ico +0 -0
- data/examples/rails-example/public/images/rails.png +0 -0
- data/examples/rails-example/public/javascripts/application.js +2 -0
- data/examples/rails-example/public/javascripts/controls.js +963 -0
- data/examples/rails-example/public/javascripts/dragdrop.js +973 -0
- data/examples/rails-example/public/javascripts/effects.js +1128 -0
- data/examples/rails-example/public/javascripts/prototype.js +4320 -0
- data/examples/rails-example/public/robots.txt +5 -0
- data/examples/rails-example/script/about +4 -0
- data/examples/rails-example/script/autospec +6 -0
- data/examples/rails-example/script/console +3 -0
- data/examples/rails-example/script/dbconsole +3 -0
- data/examples/rails-example/script/destroy +3 -0
- data/examples/rails-example/script/generate +3 -0
- data/examples/rails-example/script/performance/benchmarker +3 -0
- data/examples/rails-example/script/performance/profiler +3 -0
- data/examples/rails-example/script/plugin +3 -0
- data/examples/rails-example/script/runner +3 -0
- data/examples/rails-example/script/server +3 -0
- data/examples/rails-example/script/spec +10 -0
- data/examples/rails-example/script/spec_server +9 -0
- data/examples/rails-example/spec/integration/login_spec.rb +27 -0
- data/examples/rails-example/spec/rcov.opts +2 -0
- data/examples/rails-example/spec/spec.opts +4 -0
- data/examples/rails-example/spec/spec_helper.rb +12 -0
- data/examples/rails-example/tmp/webrat-1257205170.html +202 -0
- data/examples/rails-example/tmp/webrat-1257205276.html +31 -0
- data/examples/rails-example/tmp/webrat-1257205315.html +211 -0
- data/examples/rails-example/tmp/webrat-1257205333.html +31 -0
- data/examples/rails-example/tmp/webrat-1257205380.html +211 -0
- data/examples/rails-example/tmp/webrat-1257205757.html +211 -0
- data/examples/rails-example/tmp/webrat-1257210107.html +32 -0
- data/examples/rails-example/tmp/webrat-1257210160.html +32 -0
- data/examples/rails-example/tmp/webrat-1257210488.html +32 -0
- data/examples/rails-example/tmp/webrat-1257210501.html +32 -0
- data/examples/rails-example/tmp/webrat-1257210545.html +32 -0
- data/examples/rails-example/tmp/webrat-1257210564.html +32 -0
- data/examples/rails-example/tmp/webrat-1257210581.html +32 -0
- data/examples/rails-example/tmp/webrat-1257210600.html +32 -0
- data/examples/rails-example/tmp/webrat-1257210608.html +32 -0
- data/examples/sinatra-twitter.rb +47 -0
- data/examples/sinatra-twitter.ru +2 -0
- data/lib/rack/oauth.rb +1 -0
- data/lib/rack-oauth.rb +378 -0
- data/spec/data/authorized_access_token.yml +58 -0
- data/spec/data/authorized_oauth_verifier.yml +1 -0
- data/spec/data/authorized_request_secret.yml +1 -0
- data/spec/data/authorized_request_token.yml +1 -0
- data/spec/data/unauthorized_request_token.yml +56 -0
- data/spec/rack_oauth_middleware_spec.rb +156 -0
- data/spec/sample_sinatra_app_spec.rb +105 -0
- data/spec/spec_helper.rb +24 -0
- metadata +162 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
|
2
|
+
|
|
3
|
+
# This is just testing to make sure that the basics of the middleware
|
|
4
|
+
# all work. This does NOT actually test any of the OAuth functionality.
|
|
5
|
+
describe Rack::OAuth, 'basic middlware usage' do
|
|
6
|
+
|
|
7
|
+
before do
|
|
8
|
+
@app = lambda {|env| [200, {}, ["Hello World"]] }
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it 'should have a name' do
|
|
12
|
+
oauth = Rack::OAuth.new @app, :foo, :site => 'a', :key => 'b', :secret => 'c'
|
|
13
|
+
oauth.name.should == 'foo'
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it 'name should default to "default"' do
|
|
17
|
+
oauth = Rack::OAuth.new @app, :site => 'a', :key => 'b', :secret => 'c'
|
|
18
|
+
oauth.name.should == 'default'
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it 'should be able to access an instance of Rack::OAuth by name from within Rack application' do
|
|
22
|
+
app = lambda {|env| [200, {}, [ env['rack.oauth'].keys.inspect ]] }
|
|
23
|
+
|
|
24
|
+
oauth = Rack::OAuth.new app, :foo, :site => 'a', :key => 'b', :secret => 'c'
|
|
25
|
+
RackBox.request(Rack::Session::Cookie.new(oauth), '/').body.should include('foo')
|
|
26
|
+
RackBox.request(Rack::Session::Cookie.new(oauth), '/').body.should_not include('bar')
|
|
27
|
+
|
|
28
|
+
oauth = Rack::OAuth.new oauth, :bar, :site => 'a', :key => 'b', :secret => 'c'
|
|
29
|
+
RackBox.request(Rack::Session::Cookie.new(oauth), '/').body.should include('foo')
|
|
30
|
+
RackBox.request(Rack::Session::Cookie.new(oauth), '/').body.should include('bar')
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it 'should be *really* easy to access the default instance of Rack::OAuth by name from within Rack application' do
|
|
34
|
+
app = lambda {|env| [200, {}, [ Rack::OAuth.get(env).inspect ]] }
|
|
35
|
+
|
|
36
|
+
oauth = Rack::OAuth.new app, :foo, :site => 'a', :key => 'b', :secret => 'c'
|
|
37
|
+
RackBox.request(Rack::Session::Cookie.new(oauth), '/').body.should == 'nil'
|
|
38
|
+
|
|
39
|
+
oauth = Rack::OAuth.new app, :site => 'a', :key => 'b', :secret => 'c'
|
|
40
|
+
RackBox.request(Rack::Session::Cookie.new(oauth), '/').body.should_not == 'nil'
|
|
41
|
+
RackBox.request(Rack::Session::Cookie.new(oauth), '/').body.should include('#<Rack::OAuth')
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it 'should be easy to access an instance of Rack::OAuth by name from within Rack application' do
|
|
45
|
+
app = lambda {|env| [200, {}, [ Rack::OAuth.get(env, :bar).inspect ]] }
|
|
46
|
+
|
|
47
|
+
oauth = Rack::OAuth.new app, :foo, :site => 'a', :key => 'b', :secret => 'c'
|
|
48
|
+
RackBox.request(Rack::Session::Cookie.new(oauth), '/').body.should == 'nil'
|
|
49
|
+
|
|
50
|
+
oauth = Rack::OAuth.new oauth, :bar, :site => 'a', :key => 'b', :secret => 'c'
|
|
51
|
+
RackBox.request(Rack::Session::Cookie.new(oauth), '/').body.should_not == 'nil'
|
|
52
|
+
RackBox.request(Rack::Session::Cookie.new(oauth), '/').body.should include('#<Rack::OAuth')
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it 'should be easy to access to all instances of Rack::OAuth for a Rack application' do
|
|
56
|
+
app = lambda {|env| [200, {}, [ Rack::OAuth.all(env).length ]] }
|
|
57
|
+
|
|
58
|
+
oauth = Rack::OAuth.new app, :foo, :site => 'a', :key => 'b', :secret => 'c'
|
|
59
|
+
RackBox.request(Rack::Session::Cookie.new(oauth), '/').body.should == '1'
|
|
60
|
+
|
|
61
|
+
oauth = Rack::OAuth.new oauth, :bar, :site => 'a', :key => 'b', :secret => 'c'
|
|
62
|
+
RackBox.request(Rack::Session::Cookie.new(oauth), '/').body.should == '2'
|
|
63
|
+
|
|
64
|
+
## double check it's working as expected ...
|
|
65
|
+
|
|
66
|
+
app = lambda {|env| [200, {}, [ Rack::OAuth.all(env).keys ]] }
|
|
67
|
+
|
|
68
|
+
oauth = Rack::OAuth.new app, :foo, :site => 'a', :key => 'b', :secret => 'c'
|
|
69
|
+
RackBox.request(Rack::Session::Cookie.new(oauth), '/').body.should include('foo')
|
|
70
|
+
RackBox.request(Rack::Session::Cookie.new(oauth), '/').body.should_not include('bar')
|
|
71
|
+
|
|
72
|
+
oauth = Rack::OAuth.new oauth, :bar, :site => 'a', :key => 'b', :secret => 'c'
|
|
73
|
+
RackBox.request(Rack::Session::Cookie.new(oauth), '/').body.should include('foo')
|
|
74
|
+
RackBox.request(Rack::Session::Cookie.new(oauth), '/').body.should include('bar')
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
it 'should be able to get the login path for an instance (so we can easily redirect from the app)' do
|
|
78
|
+
pending
|
|
79
|
+
oauth = Rack::OAuth.new app, :foo, :site => 'a', :key => 'b', :secret => 'c'
|
|
80
|
+
oauth.login_path
|
|
81
|
+
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# path getters should join the name of the Rack::OAuth. setters shouldn't include the name.
|
|
85
|
+
it 'login path should be namespaced to the name of the Rack::OAuth instance' do
|
|
86
|
+
app = lambda {|env| [200, {}, ["Hello World"]] }
|
|
87
|
+
|
|
88
|
+
# the default name doesn't have its name appended. we assume 'default' for this.
|
|
89
|
+
Rack::OAuth.new(app, :site => 'a', :key => 'b', :secret => 'c').login_path.should == '/oauth_login'
|
|
90
|
+
|
|
91
|
+
Rack::OAuth.new(app, :foo, :site => 'a', :key => 'b', :secret => 'c').login_path.should == '/oauth_login/foo'
|
|
92
|
+
|
|
93
|
+
oauth = Rack::OAuth.new(app, :bar, :site => 'a', :key => 'b', :secret => 'c', :login_path => '/twitter_login')
|
|
94
|
+
oauth.login_path.should == '/twitter_login/bar'
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
it 'callback path should be namespaced to the name of the Rack::OAuth instance' do
|
|
98
|
+
app = lambda {|env| [200, {}, ["Hello World"]] }
|
|
99
|
+
|
|
100
|
+
# the default name doesn't have its name appended. we assume 'default' for this.
|
|
101
|
+
Rack::OAuth.new(app, :site => 'a', :key => 'b', :secret => 'c').callback_path.should == '/oauth_callback'
|
|
102
|
+
|
|
103
|
+
Rack::OAuth.new(app, :foo, :site => 'a', :key => 'b', :secret => 'c').callback_path.should == '/oauth_callback/foo'
|
|
104
|
+
|
|
105
|
+
oauth = Rack::OAuth.new(app, :bar, :site => 'a', :key => 'b', :secret => 'c', :callback_path => '/twitter_callback')
|
|
106
|
+
oauth.callback_path.should == '/twitter_callback/bar'
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
it 'redirect_to should NOT be namespaced to the name of the Rack::OAuth instance' do
|
|
110
|
+
app = lambda {|env| [200, {}, ["Hello World"]] }
|
|
111
|
+
|
|
112
|
+
# the default name doesn't have its name appended. we assume 'default' for this.
|
|
113
|
+
Rack::OAuth.new(app, :site => 'a', :key => 'b', :secret => 'c').redirect_to.should == '/oauth_complete'
|
|
114
|
+
|
|
115
|
+
Rack::OAuth.new(app, :foo, :site => 'a', :key => 'b', :secret => 'c').redirect_to.should == '/oauth_complete'
|
|
116
|
+
|
|
117
|
+
oauth = Rack::OAuth.new(app, :bar, :site => 'a', :key => 'b', :secret => 'c', :redirect_to => '/twitter_login_complete')
|
|
118
|
+
oauth.redirect_to.should == '/twitter_login_complete'
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
it 'session variables should all be namespaced to the name of the Rack::OAuth instance'
|
|
122
|
+
|
|
123
|
+
it 'should explodify with a helpful message if 2 Rack::OAuths are instantiated with the same name (?)'
|
|
124
|
+
|
|
125
|
+
describe 'Mocked requests / responses and whatnot' do
|
|
126
|
+
|
|
127
|
+
it 'the Rack::OAuth#consumer should persist through requests (confirm this is true because we need it to be true for mocking purposes)' do
|
|
128
|
+
app = lambda {|env| [200, {}, [ Rack::OAuth.get(env).consumer.object_id.to_s ]] }
|
|
129
|
+
oauth = Rack::OAuth.new app, :site => 'a', :key => 'b', :secret => 'c'
|
|
130
|
+
|
|
131
|
+
consumer_id = oauth.consumer.object_id
|
|
132
|
+
|
|
133
|
+
RackBox.request(Rack::Session::Cookie.new(oauth), '/').body.should include(consumer_id.to_s)
|
|
134
|
+
oauth.consumer.object_id.should == consumer_id
|
|
135
|
+
|
|
136
|
+
# do another request to make sure it stays the same
|
|
137
|
+
RackBox.request(Rack::Session::Cookie.new(oauth), '/').body.should include(consumer_id.to_s)
|
|
138
|
+
oauth.consumer.object_id.should == consumer_id
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
it 'should redirect to the authorize_url of the OAuth::RequestToken returned by consumer.get_request_token' do
|
|
142
|
+
app = lambda {|env| [200, {}, ["Hello World"]] }
|
|
143
|
+
oauth = Rack::OAuth.new app, :site => 'a', :key => 'b', :secret => 'c'
|
|
144
|
+
|
|
145
|
+
oauth.consumer.should_receive(:get_request_token).with(:oauth_callback => 'http://foo.com/oauth_callback').
|
|
146
|
+
and_return(mock_request_token(:authorize_path => '/silly_path'))
|
|
147
|
+
|
|
148
|
+
RackBox.request(Rack::Session::Cookie.new(oauth), '/oauth_login', 'HTTP_HOST' => 'foo.com').
|
|
149
|
+
headers['Location'].should =~ /^http:\/\/twitter\.com\/silly_path\?oauth_token=/
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
it 'should get an access token that can be used to make arbitrary requests if the callback_path is hit with the right variables given'
|
|
153
|
+
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
end
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
|
2
|
+
|
|
3
|
+
require 'json'
|
|
4
|
+
require 'sinatra/base'
|
|
5
|
+
class SampleSinatraApp < Sinatra::Base
|
|
6
|
+
|
|
7
|
+
# this is hardcore optional ... if you want to override where ALL tokens are persisted, you can do this ...
|
|
8
|
+
|
|
9
|
+
def self.get_token key, oauth
|
|
10
|
+
@tokens[key] if @tokens
|
|
11
|
+
end
|
|
12
|
+
def self.set_token key, token, oauth
|
|
13
|
+
@tokens ||= {}
|
|
14
|
+
@tokens[key] = token
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
use Rack::Session::Cookie
|
|
18
|
+
use Rack::OAuth, :site => 'http://twitter.com',
|
|
19
|
+
:key => '4JjFmhjfZyQ6rdbiql5A',
|
|
20
|
+
:secret => 'rv4ZaCgvxVPVjxHIDbMxTGFbIMxUa4KkIdPqL7HmaQo',
|
|
21
|
+
:get => method(:get_token),
|
|
22
|
+
:set => method(:set_token)
|
|
23
|
+
|
|
24
|
+
enable :raise_errors
|
|
25
|
+
|
|
26
|
+
helpers do
|
|
27
|
+
include Rack::OAuth::Methods
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
get '/' do
|
|
31
|
+
if logged_in?
|
|
32
|
+
"Hello World"
|
|
33
|
+
else
|
|
34
|
+
redirect oauth_login_path
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
get '/oauth_complete' do
|
|
39
|
+
info = JSON.parse oauth_request('/account/verify_credentials.json')
|
|
40
|
+
name = info['screen_name']
|
|
41
|
+
$access_tokens[name] = oauth_access_token
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
get '/get_user_info' do
|
|
45
|
+
info = JSON.parse oauth_request('/account/verify_credentials.json')
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
describe SampleSinatraApp do
|
|
50
|
+
|
|
51
|
+
def example_json
|
|
52
|
+
%[{"time_zone":"Pacific Time (US & Canada)","profile_image_url":"http://a3.twimg.com/profile_images/54765389/remi-rock-on_bak_normal.png","description":"Beer goes in, Code comes out","following":false,"profile_text_color":"3E4415","status":{"source":"web","in_reply_to_user_id":64218381,"in_reply_to_status_id":5352275994,"truncated":false,"created_at":"Mon Nov 02 02:00:26 +0000 2009","favorited":false,"in_reply_to_screen_name":"benatkin","id":5352407184,"text":"@benatkin For GoldBar, they would want to tell you when you buy something because lots of people are coming in and not buying anything :/"},"profile_background_image_url":"http://s.twimg.com/a/1256928834/images/themes/theme5/bg.gif","followers_count":257,"screen_name":"remitaylor","profile_link_color":"D02B55","profile_background_tile":false,"friends_count":190,"url":"http://remi.org","created_at":"Tue Dec 11 09:13:43 +0000 2007","profile_background_color":"352726","notifications":false,"favourites_count":0,"statuses_count":1700,"profile_sidebar_fill_color":"99CC33","protected":false,"geo_enabled":false,"location":"Phoenix, AZ","name":"remitaylor","profile_sidebar_border_color":"829D5E","id":11043342,"verified":false,"utc_offset":-28800}]
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
before :all do
|
|
56
|
+
@rackbox_app = RackBox.app
|
|
57
|
+
RackBox.app = SampleSinatraApp
|
|
58
|
+
Rack::OAuth.enable_test_mode
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
after :all do
|
|
62
|
+
RackBox.app = @rackbox_app
|
|
63
|
+
Rack::OAuth.disable_test_mode
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it 'should be able to "authorize" a user' do
|
|
67
|
+
# we're not authorized, so logged_in? is false and we should redirect to /oauth_login
|
|
68
|
+
request('/').status.should == 302
|
|
69
|
+
request('/').headers['Location'].should include('/oauth_login')
|
|
70
|
+
|
|
71
|
+
# because we're in test mode, redirecting to /oauth_login should pretend to log
|
|
72
|
+
# us in and it should redirect to /oauth_complete
|
|
73
|
+
request('/oauth_login').status.should == 302
|
|
74
|
+
request('/oauth_login').headers['Location'].should include('/oauth_complete')
|
|
75
|
+
|
|
76
|
+
# now the user should be authorized
|
|
77
|
+
request('/').status.should == 200
|
|
78
|
+
request('/').body.should include('Hello World')
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
it 'should be able to specify a mock response for an arbitrary authorized response' do
|
|
82
|
+
request('/oauth_login') # login
|
|
83
|
+
|
|
84
|
+
# if we don't mock the request, it should blow up
|
|
85
|
+
lambda { request('/get_user_info') }.should raise_error
|
|
86
|
+
|
|
87
|
+
Rack::OAuth.mock_request '/account/verify_credentials.json', example_json
|
|
88
|
+
|
|
89
|
+
request('/get_user_info').body.should include('remitaylor')
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
it 'should be able to persist access token by some arbitrary value like twitter screen_name' do
|
|
93
|
+
$access_tokens ||= {}
|
|
94
|
+
request('/oauth_login').status.should == 302
|
|
95
|
+
|
|
96
|
+
# token should be nil
|
|
97
|
+
$access_tokens['remitaylor'].should be_nil
|
|
98
|
+
|
|
99
|
+
request('/oauth_complete')
|
|
100
|
+
|
|
101
|
+
# token should not be nil because the oauth_complete goes and gets and persists it
|
|
102
|
+
$access_tokens['remitaylor'].should_not be_nil
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'spec'
|
|
3
|
+
require 'rackbox'
|
|
4
|
+
require File.dirname(__FILE__) + '/../lib/rack-oauth'
|
|
5
|
+
|
|
6
|
+
# returns the path to a data file, eg. data_path(:foo) => 'spec/data/foo.yml'
|
|
7
|
+
def data_path name
|
|
8
|
+
File.join File.dirname(__FILE__), 'data', "#{ name }.yml"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# returns the string body of a file using data_path to get the path to the file
|
|
12
|
+
def data name
|
|
13
|
+
File.read data_path(name)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def mock_request_token options = {}
|
|
17
|
+
YAML.load data(:unauthorized_request_token).sub('AUTH_PATH', options[:authorize_path] || '/oauth/authorize')
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
RackBox.app = lambda {}
|
|
21
|
+
|
|
22
|
+
Spec::Runner.configure do |config|
|
|
23
|
+
config.use_blackbox = true
|
|
24
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: rack-oauth
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.2
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- remi
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
|
|
12
|
+
date: 2009-11-02 00:00:00 -07:00
|
|
13
|
+
default_executable:
|
|
14
|
+
dependencies: []
|
|
15
|
+
|
|
16
|
+
description: Rack Middleware for OAuth Authorization
|
|
17
|
+
email: remi@remitaylor.com
|
|
18
|
+
executables: []
|
|
19
|
+
|
|
20
|
+
extensions: []
|
|
21
|
+
|
|
22
|
+
extra_rdoc_files:
|
|
23
|
+
- README.rdoc
|
|
24
|
+
files:
|
|
25
|
+
- README.rdoc
|
|
26
|
+
- Rakefile
|
|
27
|
+
- VERSION
|
|
28
|
+
- examples/rails-example/README
|
|
29
|
+
- examples/rails-example/Rakefile
|
|
30
|
+
- examples/rails-example/app/controllers/application_controller.rb
|
|
31
|
+
- examples/rails-example/app/controllers/welcome_controller.rb
|
|
32
|
+
- examples/rails-example/app/helpers/application_helper.rb
|
|
33
|
+
- examples/rails-example/app/helpers/welcome_helper.rb
|
|
34
|
+
- examples/rails-example/app/views/welcome/index.html.erb
|
|
35
|
+
- examples/rails-example/config/boot.rb
|
|
36
|
+
- examples/rails-example/config/database.yml
|
|
37
|
+
- examples/rails-example/config/environment.rb
|
|
38
|
+
- examples/rails-example/config/environments/development.rb
|
|
39
|
+
- examples/rails-example/config/environments/production.rb
|
|
40
|
+
- examples/rails-example/config/environments/test.rb
|
|
41
|
+
- examples/rails-example/config/initializers/backtrace_silencers.rb
|
|
42
|
+
- examples/rails-example/config/initializers/inflections.rb
|
|
43
|
+
- examples/rails-example/config/initializers/mime_types.rb
|
|
44
|
+
- examples/rails-example/config/initializers/new_rails_defaults.rb
|
|
45
|
+
- examples/rails-example/config/initializers/session_store.rb
|
|
46
|
+
- examples/rails-example/config/locales/en.yml
|
|
47
|
+
- examples/rails-example/config/routes.rb
|
|
48
|
+
- examples/rails-example/db/development.sqlite3
|
|
49
|
+
- examples/rails-example/db/seeds.rb
|
|
50
|
+
- examples/rails-example/db/test.sqlite3
|
|
51
|
+
- examples/rails-example/doc/README_FOR_APP
|
|
52
|
+
- examples/rails-example/lib/tasks/rspec.rake
|
|
53
|
+
- examples/rails-example/log/development.log
|
|
54
|
+
- examples/rails-example/log/production.log
|
|
55
|
+
- examples/rails-example/log/server.log
|
|
56
|
+
- examples/rails-example/log/test.log
|
|
57
|
+
- examples/rails-example/public/404.html
|
|
58
|
+
- examples/rails-example/public/422.html
|
|
59
|
+
- examples/rails-example/public/500.html
|
|
60
|
+
- examples/rails-example/public/favicon.ico
|
|
61
|
+
- examples/rails-example/public/images/rails.png
|
|
62
|
+
- examples/rails-example/public/javascripts/application.js
|
|
63
|
+
- examples/rails-example/public/javascripts/controls.js
|
|
64
|
+
- examples/rails-example/public/javascripts/dragdrop.js
|
|
65
|
+
- examples/rails-example/public/javascripts/effects.js
|
|
66
|
+
- examples/rails-example/public/javascripts/prototype.js
|
|
67
|
+
- examples/rails-example/public/robots.txt
|
|
68
|
+
- examples/rails-example/script/about
|
|
69
|
+
- examples/rails-example/script/autospec
|
|
70
|
+
- examples/rails-example/script/console
|
|
71
|
+
- examples/rails-example/script/dbconsole
|
|
72
|
+
- examples/rails-example/script/destroy
|
|
73
|
+
- examples/rails-example/script/generate
|
|
74
|
+
- examples/rails-example/script/performance/benchmarker
|
|
75
|
+
- examples/rails-example/script/performance/profiler
|
|
76
|
+
- examples/rails-example/script/plugin
|
|
77
|
+
- examples/rails-example/script/runner
|
|
78
|
+
- examples/rails-example/script/server
|
|
79
|
+
- examples/rails-example/script/spec
|
|
80
|
+
- examples/rails-example/script/spec_server
|
|
81
|
+
- examples/rails-example/spec/integration/login_spec.rb
|
|
82
|
+
- examples/rails-example/spec/rcov.opts
|
|
83
|
+
- examples/rails-example/spec/spec.opts
|
|
84
|
+
- examples/rails-example/spec/spec_helper.rb
|
|
85
|
+
- examples/rails-example/tmp/webrat-1257205170.html
|
|
86
|
+
- examples/rails-example/tmp/webrat-1257205276.html
|
|
87
|
+
- examples/rails-example/tmp/webrat-1257205315.html
|
|
88
|
+
- examples/rails-example/tmp/webrat-1257205333.html
|
|
89
|
+
- examples/rails-example/tmp/webrat-1257205380.html
|
|
90
|
+
- examples/rails-example/tmp/webrat-1257205757.html
|
|
91
|
+
- examples/rails-example/tmp/webrat-1257210107.html
|
|
92
|
+
- examples/rails-example/tmp/webrat-1257210160.html
|
|
93
|
+
- examples/rails-example/tmp/webrat-1257210488.html
|
|
94
|
+
- examples/rails-example/tmp/webrat-1257210501.html
|
|
95
|
+
- examples/rails-example/tmp/webrat-1257210545.html
|
|
96
|
+
- examples/rails-example/tmp/webrat-1257210564.html
|
|
97
|
+
- examples/rails-example/tmp/webrat-1257210581.html
|
|
98
|
+
- examples/rails-example/tmp/webrat-1257210600.html
|
|
99
|
+
- examples/rails-example/tmp/webrat-1257210608.html
|
|
100
|
+
- examples/sinatra-twitter.rb
|
|
101
|
+
- examples/sinatra-twitter.ru
|
|
102
|
+
- lib/rack-oauth.rb
|
|
103
|
+
- lib/rack/oauth.rb
|
|
104
|
+
- spec/data/authorized_access_token.yml
|
|
105
|
+
- spec/data/authorized_oauth_verifier.yml
|
|
106
|
+
- spec/data/authorized_request_secret.yml
|
|
107
|
+
- spec/data/authorized_request_token.yml
|
|
108
|
+
- spec/data/unauthorized_request_token.yml
|
|
109
|
+
- spec/rack_oauth_middleware_spec.rb
|
|
110
|
+
- spec/sample_sinatra_app_spec.rb
|
|
111
|
+
- spec/spec_helper.rb
|
|
112
|
+
has_rdoc: true
|
|
113
|
+
homepage: http://github.com/remi/rack-oauth
|
|
114
|
+
licenses: []
|
|
115
|
+
|
|
116
|
+
post_install_message:
|
|
117
|
+
rdoc_options:
|
|
118
|
+
- --charset=UTF-8
|
|
119
|
+
require_paths:
|
|
120
|
+
- lib
|
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
122
|
+
requirements:
|
|
123
|
+
- - ">="
|
|
124
|
+
- !ruby/object:Gem::Version
|
|
125
|
+
version: "0"
|
|
126
|
+
version:
|
|
127
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
|
+
requirements:
|
|
129
|
+
- - ">="
|
|
130
|
+
- !ruby/object:Gem::Version
|
|
131
|
+
version: "0"
|
|
132
|
+
version:
|
|
133
|
+
requirements: []
|
|
134
|
+
|
|
135
|
+
rubyforge_project:
|
|
136
|
+
rubygems_version: 1.3.5
|
|
137
|
+
signing_key:
|
|
138
|
+
specification_version: 3
|
|
139
|
+
summary: Rack Middleware for OAuth Authorization
|
|
140
|
+
test_files:
|
|
141
|
+
- spec/rack_oauth_middleware_spec.rb
|
|
142
|
+
- spec/spec_helper.rb
|
|
143
|
+
- spec/sample_sinatra_app_spec.rb
|
|
144
|
+
- examples/sinatra-twitter.rb
|
|
145
|
+
- examples/rails-example/spec/integration/login_spec.rb
|
|
146
|
+
- examples/rails-example/spec/spec_helper.rb
|
|
147
|
+
- examples/rails-example/config/boot.rb
|
|
148
|
+
- examples/rails-example/config/routes.rb
|
|
149
|
+
- examples/rails-example/config/environments/development.rb
|
|
150
|
+
- examples/rails-example/config/environments/test.rb
|
|
151
|
+
- examples/rails-example/config/environments/production.rb
|
|
152
|
+
- examples/rails-example/config/environment.rb
|
|
153
|
+
- examples/rails-example/config/initializers/backtrace_silencers.rb
|
|
154
|
+
- examples/rails-example/config/initializers/inflections.rb
|
|
155
|
+
- examples/rails-example/config/initializers/new_rails_defaults.rb
|
|
156
|
+
- examples/rails-example/config/initializers/session_store.rb
|
|
157
|
+
- examples/rails-example/config/initializers/mime_types.rb
|
|
158
|
+
- examples/rails-example/db/seeds.rb
|
|
159
|
+
- examples/rails-example/app/helpers/application_helper.rb
|
|
160
|
+
- examples/rails-example/app/helpers/welcome_helper.rb
|
|
161
|
+
- examples/rails-example/app/controllers/application_controller.rb
|
|
162
|
+
- examples/rails-example/app/controllers/welcome_controller.rb
|