sorcery 0.6.0 → 0.7.0
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/Gemfile +2 -2
- data/Gemfile.lock +97 -82
- data/README.rdoc +14 -4
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/lib/generators/sorcery_migration/templates/core.rb +1 -1
- data/lib/generators/sorcery_migration/templates/reset_password.rb +4 -0
- data/lib/sorcery/controller/adapters/sinatra.rb +12 -1
- data/lib/sorcery/controller/submodules/activity_logging.rb +18 -1
- data/lib/sorcery/controller/submodules/brute_force_protection.rb +2 -1
- data/lib/sorcery/controller/submodules/external/protocols/certs/ca-bundle.crt +5182 -0
- data/lib/sorcery/controller/submodules/external/protocols/oauth2.rb +10 -6
- data/lib/sorcery/controller/submodules/external/providers/github.rb +80 -0
- data/lib/sorcery/controller/submodules/external/providers/twitter.rb +5 -0
- data/lib/sorcery/controller/submodules/external.rb +10 -3
- data/lib/sorcery/controller/submodules/http_basic_auth.rb +1 -1
- data/lib/sorcery/controller/submodules/remember_me.rb +13 -4
- data/lib/sorcery/controller/submodules/session_timeout.rb +1 -1
- data/lib/sorcery/controller.rb +26 -6
- data/lib/sorcery/crypto_providers/aes256.rb +7 -3
- data/lib/sorcery/engine.rb +1 -0
- data/lib/sorcery/initializers/initializer.rb +81 -60
- data/lib/sorcery/model/adapters/active_record.rb +2 -1
- data/lib/sorcery/model/adapters/mongoid.rb +7 -2
- data/lib/sorcery/model/submodules/brute_force_protection.rb +5 -3
- data/lib/sorcery/model/submodules/remember_me.rb +1 -1
- data/lib/sorcery/model/submodules/reset_password.rb +1 -2
- data/lib/sorcery/model/submodules/user_activation.rb +1 -2
- data/lib/sorcery/model/temporary_token.rb +5 -0
- data/lib/sorcery/model.rb +13 -11
- data/lib/sorcery/test_helpers/internal/rails.rb +1 -1
- data/lib/sorcery/test_helpers/rails.rb +2 -2
- data/lib/sorcery/test_helpers/sinatra.rb +1 -1
- data/lib/sorcery.rb +1 -0
- data/sorcery.gemspec +31 -24
- data/spec/Gemfile +2 -2
- data/spec/Gemfile.lock +36 -37
- data/spec/README.md +26 -0
- data/spec/rails3/Gemfile +2 -0
- data/spec/rails3/Gemfile.lock +38 -16
- data/spec/rails3/app/controllers/application_controller.rb +40 -22
- data/spec/rails3/app/views/application/index.html.erb +17 -0
- data/spec/rails3/spec/controller_activity_logging_spec.rb +23 -0
- data/spec/rails3/spec/controller_oauth2_spec.rb +62 -21
- data/spec/rails3/spec/controller_remember_me_spec.rb +37 -6
- data/spec/rails3/spec/controller_spec.rb +30 -0
- data/spec/rails3/spec/integration_spec.rb +23 -0
- data/spec/rails3/spec/spec_helper.rb +6 -3
- data/spec/rails3_mongoid/Gemfile.lock +14 -16
- data/spec/rails3_mongoid/spec/controller_spec.rb +130 -0
- data/spec/shared_examples/user_remember_me_shared_examples.rb +1 -0
- data/spec/shared_examples/user_shared_examples.rb +7 -7
- data/spec/sinatra/Gemfile.lock +14 -16
- data/spec/sinatra/spec/controller_oauth2_spec.rb +3 -6
- data/spec/sinatra/spec/controller_spec.rb +7 -0
- data/spec/sinatra_modular/Gemfile.lock +14 -16
- data/spec/sinatra_modular/spec_modular/controller_oauth2_spec.rb +3 -6
- metadata +18 -13
- data/spec/rails3/public/index.html +0 -239
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
|
+
|
|
3
|
+
describe ApplicationController do
|
|
4
|
+
|
|
5
|
+
# ----------------- PLUGIN CONFIGURATION -----------------------
|
|
6
|
+
describe ApplicationController, "plugin configuration" do
|
|
7
|
+
before(:all) do
|
|
8
|
+
sorcery_reload!
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
after(:each) do
|
|
12
|
+
Sorcery::Controller::Config.reset!
|
|
13
|
+
sorcery_reload!
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "should enable configuration option 'user_class'" do
|
|
17
|
+
sorcery_controller_property_set(:user_class, "TestUser")
|
|
18
|
+
Sorcery::Controller::Config.user_class.should == "TestUser"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "should enable configuration option 'not_authenticated_action'" do
|
|
22
|
+
sorcery_controller_property_set(:not_authenticated_action, :my_action)
|
|
23
|
+
Sorcery::Controller::Config.not_authenticated_action.should equal(:my_action)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# ----------------- PLUGIN ACTIVATED -----------------------
|
|
29
|
+
describe ApplicationController, "when activated with sorcery" do
|
|
30
|
+
before(:all) do
|
|
31
|
+
sorcery_reload!
|
|
32
|
+
User.delete_all
|
|
33
|
+
create_new_user
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
after(:each) do
|
|
37
|
+
Sorcery::Controller::Config.reset!
|
|
38
|
+
sorcery_controller_property_set(:user_class, User)
|
|
39
|
+
sorcery_model_property_set(:username_attribute_names, [:username, :email])
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
specify { should respond_to(:login) }
|
|
43
|
+
|
|
44
|
+
specify { should respond_to(:logout) }
|
|
45
|
+
|
|
46
|
+
specify { should respond_to(:logged_in?) }
|
|
47
|
+
|
|
48
|
+
specify { should respond_to(:current_user) }
|
|
49
|
+
|
|
50
|
+
it "login(username,password) should return the user when success and set the session with user.id" do
|
|
51
|
+
get :test_login, :username => 'gizmo', :password => 'secret'
|
|
52
|
+
assigns[:user].should == @user
|
|
53
|
+
session[:user_id].should == @user.id
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it "login(email,password) should return the user when success and set the session with user.id" do
|
|
57
|
+
get :test_login, :username => 'bla@bla.com', :password => 'secret'
|
|
58
|
+
assigns[:user].should == @user
|
|
59
|
+
session[:user_id].should == @user.id
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
it "login(username,password) should return nil and not set the session when failure" do
|
|
63
|
+
get :test_login, :username => 'gizmo', :password => 'opensesame!'
|
|
64
|
+
assigns[:user].should be_nil
|
|
65
|
+
session[:user_id].should be_nil
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
it "logout should clear the session" do
|
|
69
|
+
cookies[:remember_me_token] = nil
|
|
70
|
+
session[:user_id] = @user.id
|
|
71
|
+
get :test_logout
|
|
72
|
+
session[:user_id].should be_nil
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
it "logged_in? should return true if logged in" do
|
|
76
|
+
session[:user_id] = @user.id
|
|
77
|
+
subject.logged_in?.should be_true
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
it "logged_in? should return false if not logged in" do
|
|
81
|
+
session[:user_id] = nil
|
|
82
|
+
subject.logged_in?.should be_false
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
it "current_user should return the user instance if logged in" do
|
|
86
|
+
create_new_user
|
|
87
|
+
session[:user_id] = @user.id
|
|
88
|
+
subject.current_user.should == @user
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
it "current_user should return false if not logged in" do
|
|
92
|
+
session[:user_id] = nil
|
|
93
|
+
subject.current_user.should == false
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
specify { should respond_to(:require_login) }
|
|
97
|
+
|
|
98
|
+
it "should call the configured 'not_authenticated_action' when authenticate before_filter fails" do
|
|
99
|
+
session[:user_id] = nil
|
|
100
|
+
sorcery_controller_property_set(:not_authenticated_action, :test_not_authenticated_action)
|
|
101
|
+
get :test_logout
|
|
102
|
+
response.body.should == "test_not_authenticated_action"
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
it "require_login before_filter should save the url that the user originally wanted" do
|
|
106
|
+
get :some_action
|
|
107
|
+
session[:return_to_url].should == "http://test.host/application/some_action"
|
|
108
|
+
response.should redirect_to("http://test.host/")
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
it "on successful login the user should be redirected to the url he originally wanted" do
|
|
112
|
+
session[:return_to_url] = "http://test.host/some_action"
|
|
113
|
+
post :test_return_to, :username => 'gizmo', :password => 'secret'
|
|
114
|
+
response.should redirect_to("http://test.host/some_action")
|
|
115
|
+
flash[:notice].should == "haha!"
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
# --- login_user(user) ---
|
|
120
|
+
specify { should respond_to(:auto_login) }
|
|
121
|
+
|
|
122
|
+
it "auto_login(user) should login a user instance" do
|
|
123
|
+
create_new_user
|
|
124
|
+
session[:user_id] = nil
|
|
125
|
+
subject.auto_login(@user)
|
|
126
|
+
subject.logged_in?.should be_true
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
end
|
|
@@ -30,6 +30,7 @@ shared_examples_for "rails_3_remember_me_model" do
|
|
|
30
30
|
@user.remember_me_token.should_not be_nil
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
+
# FIXME: assert on line 37 sometimes fails by a second
|
|
33
34
|
it "should set an expiration based on 'remember_me_for' attribute" do
|
|
34
35
|
sorcery_model_property_set(:remember_me_for, 2 * 60 * 60 * 24)
|
|
35
36
|
@user.remember_me!
|
|
@@ -4,9 +4,9 @@ shared_examples_for "rails_3_core_model" do
|
|
|
4
4
|
User.sorcery_config.reset!
|
|
5
5
|
end
|
|
6
6
|
|
|
7
|
-
it "should enable configuration option '
|
|
8
|
-
sorcery_model_property_set(:
|
|
9
|
-
User.sorcery_config.
|
|
7
|
+
it "should enable configuration option 'username_attribute_names'" do
|
|
8
|
+
sorcery_model_property_set(:username_attribute_names, :email)
|
|
9
|
+
User.sorcery_config.username_attribute_names.should == [:email]
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
it "should enable configuration option 'password_attribute_name'" do
|
|
@@ -76,12 +76,12 @@ shared_examples_for "rails_3_core_model" do
|
|
|
76
76
|
|
|
77
77
|
it "authenticate should return true if credentials are good" do
|
|
78
78
|
create_new_user
|
|
79
|
-
User.authenticate(@user.send(User.sorcery_config.
|
|
79
|
+
User.authenticate(@user.send(User.sorcery_config.username_attribute_names.first), 'secret').should be_true
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
it "authenticate should return false if credentials are bad" do
|
|
83
83
|
create_new_user
|
|
84
|
-
User.authenticate(@user.send(User.sorcery_config.
|
|
84
|
+
User.authenticate(@user.send(User.sorcery_config.username_attribute_names.first), 'wrong!').should be_false
|
|
85
85
|
end
|
|
86
86
|
|
|
87
87
|
specify { User.should respond_to(:encrypt) }
|
|
@@ -186,7 +186,7 @@ shared_examples_for "rails_3_core_model" do
|
|
|
186
186
|
it "should work with no password encryption" do
|
|
187
187
|
sorcery_model_property_set(:encryption_algorithm, :none)
|
|
188
188
|
create_new_user
|
|
189
|
-
User.authenticate(@user.send(User.sorcery_config.
|
|
189
|
+
User.authenticate(@user.send(User.sorcery_config.username_attribute_names.first), 'secret').should be_true
|
|
190
190
|
end
|
|
191
191
|
|
|
192
192
|
it "should work with custom password encryption" do
|
|
@@ -202,7 +202,7 @@ shared_examples_for "rails_3_core_model" do
|
|
|
202
202
|
sorcery_model_property_set(:encryption_algorithm, :custom)
|
|
203
203
|
sorcery_model_property_set(:custom_encryption_provider, MyCrypto)
|
|
204
204
|
create_new_user
|
|
205
|
-
User.authenticate(@user.send(User.sorcery_config.
|
|
205
|
+
User.authenticate(@user.send(User.sorcery_config.username_attribute_names.first), 'secret').should be_true
|
|
206
206
|
end
|
|
207
207
|
|
|
208
208
|
it "if encryption algo is aes256, it should set key to crypto provider" do
|
data/spec/sinatra/Gemfile.lock
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ../../
|
|
3
3
|
specs:
|
|
4
|
-
sorcery (0.
|
|
5
|
-
bcrypt-ruby (~>
|
|
6
|
-
oauth (
|
|
7
|
-
|
|
8
|
-
oauth2 (>= 0.1.1)
|
|
9
|
-
oauth2 (>= 0.1.1)
|
|
4
|
+
sorcery (0.6.1)
|
|
5
|
+
bcrypt-ruby (~> 3.0.0)
|
|
6
|
+
oauth (~> 0.4.4)
|
|
7
|
+
oauth2 (~> 0.5.0)
|
|
10
8
|
|
|
11
9
|
GEM
|
|
12
10
|
remote: http://rubygems.org/
|
|
@@ -35,17 +33,17 @@ GEM
|
|
|
35
33
|
arel (~> 2.0.2)
|
|
36
34
|
tzinfo (~> 0.3.23)
|
|
37
35
|
activesupport (3.0.5)
|
|
38
|
-
addressable (2.2.
|
|
36
|
+
addressable (2.2.6)
|
|
39
37
|
archive-tar-minitar (0.5.2)
|
|
40
38
|
arel (2.0.7)
|
|
41
|
-
bcrypt-ruby (
|
|
39
|
+
bcrypt-ruby (3.0.1)
|
|
42
40
|
builder (2.1.2)
|
|
43
41
|
columnize (0.3.2)
|
|
44
42
|
diff-lcs (1.1.2)
|
|
45
43
|
erubis (2.6.6)
|
|
46
44
|
abstract (>= 1.0.0)
|
|
47
|
-
faraday (0.
|
|
48
|
-
addressable (~> 2.2.
|
|
45
|
+
faraday (0.7.4)
|
|
46
|
+
addressable (~> 2.2.6)
|
|
49
47
|
multipart-post (~> 1.1.0)
|
|
50
48
|
rack (< 2, >= 1.1.0)
|
|
51
49
|
i18n (0.5.0)
|
|
@@ -57,12 +55,12 @@ GEM
|
|
|
57
55
|
mime-types (~> 1.16)
|
|
58
56
|
treetop (~> 1.4.8)
|
|
59
57
|
mime-types (1.16)
|
|
60
|
-
multi_json (1.0.
|
|
61
|
-
multipart-post (1.1.
|
|
62
|
-
oauth (0.4.
|
|
63
|
-
oauth2 (0.
|
|
64
|
-
faraday (~> 0.
|
|
65
|
-
multi_json (
|
|
58
|
+
multi_json (1.0.3)
|
|
59
|
+
multipart-post (1.1.3)
|
|
60
|
+
oauth (0.4.5)
|
|
61
|
+
oauth2 (0.5.1)
|
|
62
|
+
faraday (~> 0.7.4)
|
|
63
|
+
multi_json (~> 1.0.3)
|
|
66
64
|
polyglot (0.3.1)
|
|
67
65
|
rack (1.2.1)
|
|
68
66
|
rack-mount (0.6.14)
|
|
@@ -4,10 +4,8 @@ require File.expand_path(File.dirname(__FILE__) + '/../../shared_examples/contro
|
|
|
4
4
|
def stub_all_oauth2_requests!
|
|
5
5
|
@client = OAuth2::Client.new("key","secret", :site => "http://myapi.com")
|
|
6
6
|
OAuth2::Client.stub!(:new).and_return(@client)
|
|
7
|
-
@acc_token = OAuth2::AccessToken.new(@client, "
|
|
8
|
-
@
|
|
9
|
-
OAuth2::Strategy::WebServer.stub!(:new).and_return(@webby)
|
|
10
|
-
@webby.stub!(:get_access_token).and_return(@acc_token)
|
|
7
|
+
@acc_token = OAuth2::AccessToken.new(@client, "asd", {})
|
|
8
|
+
@client.stub!(:get_token).and_return(@acc_token)
|
|
11
9
|
@acc_token.stub!(:get).and_return({"id"=>"123", "name"=>"Noam Ben Ari", "first_name"=>"Noam", "last_name"=>"Ben Ari", "link"=>"http://www.facebook.com/nbenari1", "hometown"=>{"id"=>"110619208966868", "name"=>"Haifa, Israel"}, "location"=>{"id"=>"106906559341067", "name"=>"Pardes Hanah, Hefa, Israel"}, "bio"=>"I'm a new daddy, and enjoying it!", "gender"=>"male", "email"=>"nbenari@gmail.com", "timezone"=>2, "locale"=>"en_US", "languages"=>[{"id"=>"108405449189952", "name"=>"Hebrew"}, {"id"=>"106059522759137", "name"=>"English"}, {"id"=>"112624162082677", "name"=>"Russian"}], "verified"=>true, "updated_time"=>"2011-02-16T20:59:38+0000"}.to_json)
|
|
12
10
|
end
|
|
13
11
|
|
|
@@ -40,8 +38,7 @@ describe 'MyApp' do
|
|
|
40
38
|
create_new_user
|
|
41
39
|
get "/login_at_test2"
|
|
42
40
|
last_response.should be_a_redirect
|
|
43
|
-
|
|
44
|
-
last_response.should redirect_to("http://myapi.com/oauth/authorize?client_id=key&redirect_uri=http%3A%2F%2Fblabla.com&scope=email%2Coffline_access&response_type=code")
|
|
41
|
+
last_response.should redirect_to("http://myapi.com/oauth/authorize?redirect_uri=http%3A%2F%2Fblabla.com&scope=email%2Coffline_access")
|
|
45
42
|
end
|
|
46
43
|
|
|
47
44
|
it "'login_from' logins if user exists" do
|
|
@@ -36,6 +36,7 @@ describe Sinatra::Application do
|
|
|
36
36
|
after(:each) do
|
|
37
37
|
Sorcery::Controller::Config.reset!
|
|
38
38
|
sorcery_controller_property_set(:user_class, User)
|
|
39
|
+
sorcery_model_property_set(:username_attribute_names, [:username, :email])
|
|
39
40
|
end
|
|
40
41
|
|
|
41
42
|
it "should respond to the instance method login" do
|
|
@@ -59,6 +60,12 @@ describe Sinatra::Application do
|
|
|
59
60
|
assigns[:user].should == @user
|
|
60
61
|
session[:user_id].should == @user.id
|
|
61
62
|
end
|
|
63
|
+
|
|
64
|
+
it "login(email,password) should return the user when success and set the session with user.id" do
|
|
65
|
+
get "/test_login", :username => 'bla@bla.com', :password => 'secret'
|
|
66
|
+
assigns[:user].should == @user
|
|
67
|
+
session[:user_id].should == @user.id
|
|
68
|
+
end
|
|
62
69
|
|
|
63
70
|
it "login(username,password) should return nil and not set the session when failure" do
|
|
64
71
|
get "/test_login", :username => 'gizmo', :password => 'opensesame!'
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ../../
|
|
3
3
|
specs:
|
|
4
|
-
sorcery (0.
|
|
5
|
-
bcrypt-ruby (~>
|
|
6
|
-
oauth (
|
|
7
|
-
|
|
8
|
-
oauth2 (>= 0.1.1)
|
|
9
|
-
oauth2 (>= 0.1.1)
|
|
4
|
+
sorcery (0.6.1)
|
|
5
|
+
bcrypt-ruby (~> 3.0.0)
|
|
6
|
+
oauth (~> 0.4.4)
|
|
7
|
+
oauth2 (~> 0.5.0)
|
|
10
8
|
|
|
11
9
|
GEM
|
|
12
10
|
remote: http://rubygems.org/
|
|
@@ -35,17 +33,17 @@ GEM
|
|
|
35
33
|
arel (~> 2.0.2)
|
|
36
34
|
tzinfo (~> 0.3.23)
|
|
37
35
|
activesupport (3.0.5)
|
|
38
|
-
addressable (2.2.
|
|
36
|
+
addressable (2.2.6)
|
|
39
37
|
archive-tar-minitar (0.5.2)
|
|
40
38
|
arel (2.0.7)
|
|
41
|
-
bcrypt-ruby (
|
|
39
|
+
bcrypt-ruby (3.0.1)
|
|
42
40
|
builder (2.1.2)
|
|
43
41
|
columnize (0.3.2)
|
|
44
42
|
diff-lcs (1.1.2)
|
|
45
43
|
erubis (2.6.6)
|
|
46
44
|
abstract (>= 1.0.0)
|
|
47
|
-
faraday (0.
|
|
48
|
-
addressable (~> 2.2.
|
|
45
|
+
faraday (0.7.4)
|
|
46
|
+
addressable (~> 2.2.6)
|
|
49
47
|
multipart-post (~> 1.1.0)
|
|
50
48
|
rack (< 2, >= 1.1.0)
|
|
51
49
|
i18n (0.5.0)
|
|
@@ -57,12 +55,12 @@ GEM
|
|
|
57
55
|
mime-types (~> 1.16)
|
|
58
56
|
treetop (~> 1.4.8)
|
|
59
57
|
mime-types (1.16)
|
|
60
|
-
multi_json (1.0.
|
|
61
|
-
multipart-post (1.1.
|
|
62
|
-
oauth (0.4.
|
|
63
|
-
oauth2 (0.
|
|
64
|
-
faraday (~> 0.
|
|
65
|
-
multi_json (
|
|
58
|
+
multi_json (1.0.3)
|
|
59
|
+
multipart-post (1.1.3)
|
|
60
|
+
oauth (0.4.5)
|
|
61
|
+
oauth2 (0.5.1)
|
|
62
|
+
faraday (~> 0.7.4)
|
|
63
|
+
multi_json (~> 1.0.3)
|
|
66
64
|
polyglot (0.3.1)
|
|
67
65
|
rack (1.2.1)
|
|
68
66
|
rack-mount (0.6.14)
|
|
@@ -4,10 +4,8 @@ require File.expand_path(File.dirname(__FILE__) + '/../../shared_examples/contro
|
|
|
4
4
|
def stub_all_oauth2_requests!
|
|
5
5
|
@client = OAuth2::Client.new("key","secret", :site => "http://myapi.com")
|
|
6
6
|
OAuth2::Client.stub!(:new).and_return(@client)
|
|
7
|
-
@acc_token = OAuth2::AccessToken.new(@client, "
|
|
8
|
-
@
|
|
9
|
-
OAuth2::Strategy::WebServer.stub!(:new).and_return(@webby)
|
|
10
|
-
@webby.stub!(:get_access_token).and_return(@acc_token)
|
|
7
|
+
@acc_token = OAuth2::AccessToken.new(@client, "asd", {})
|
|
8
|
+
@client.stub!(:get_token).and_return(@acc_token)
|
|
11
9
|
@acc_token.stub!(:get).and_return({"id"=>"123", "name"=>"Noam Ben Ari", "first_name"=>"Noam", "last_name"=>"Ben Ari", "link"=>"http://www.facebook.com/nbenari1", "hometown"=>{"id"=>"110619208966868", "name"=>"Haifa, Israel"}, "location"=>{"id"=>"106906559341067", "name"=>"Pardes Hanah, Hefa, Israel"}, "bio"=>"I'm a new daddy, and enjoying it!", "gender"=>"male", "email"=>"nbenari@gmail.com", "timezone"=>2, "locale"=>"en_US", "languages"=>[{"id"=>"108405449189952", "name"=>"Hebrew"}, {"id"=>"106059522759137", "name"=>"English"}, {"id"=>"112624162082677", "name"=>"Russian"}], "verified"=>true, "updated_time"=>"2011-02-16T20:59:38+0000"}.to_json)
|
|
12
10
|
end
|
|
13
11
|
|
|
@@ -40,8 +38,7 @@ describe 'MyApp' do
|
|
|
40
38
|
create_new_user
|
|
41
39
|
get "/login_at_test2"
|
|
42
40
|
last_response.should be_a_redirect
|
|
43
|
-
|
|
44
|
-
last_response.should redirect_to("http://myapi.com/oauth/authorize?client_id=key&redirect_uri=http%3A%2F%2Fblabla.com&scope=email%2Coffline_access&response_type=code")
|
|
41
|
+
last_response.should redirect_to("http://myapi.com/oauth/authorize?redirect_uri=http%3A%2F%2Fblabla.com&scope=email%2Coffline_access")
|
|
45
42
|
end
|
|
46
43
|
|
|
47
44
|
it "'login_from' logins if user exists" do
|
metadata
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: sorcery
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease:
|
|
5
|
-
version: 0.
|
|
5
|
+
version: 0.7.0
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
8
8
|
- Noam Ben Ari
|
|
@@ -10,15 +10,14 @@ autorequire:
|
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
12
|
|
|
13
|
-
date: 2011-
|
|
14
|
-
default_executable:
|
|
13
|
+
date: 2011-09-30 00:00:00 Z
|
|
15
14
|
dependencies:
|
|
16
15
|
- !ruby/object:Gem::Dependency
|
|
17
16
|
name: oauth
|
|
18
17
|
requirement: &id001 !ruby/object:Gem::Requirement
|
|
19
18
|
none: false
|
|
20
19
|
requirements:
|
|
21
|
-
- -
|
|
20
|
+
- - ~>
|
|
22
21
|
- !ruby/object:Gem::Version
|
|
23
22
|
version: 0.4.4
|
|
24
23
|
type: :runtime
|
|
@@ -29,9 +28,9 @@ dependencies:
|
|
|
29
28
|
requirement: &id002 !ruby/object:Gem::Requirement
|
|
30
29
|
none: false
|
|
31
30
|
requirements:
|
|
32
|
-
- -
|
|
31
|
+
- - ~>
|
|
33
32
|
- !ruby/object:Gem::Version
|
|
34
|
-
version: 0.
|
|
33
|
+
version: 0.5.1
|
|
35
34
|
type: :runtime
|
|
36
35
|
prerelease: false
|
|
37
36
|
version_requirements: *id002
|
|
@@ -185,7 +184,7 @@ dependencies:
|
|
|
185
184
|
requirements:
|
|
186
185
|
- - ~>
|
|
187
186
|
- !ruby/object:Gem::Version
|
|
188
|
-
version:
|
|
187
|
+
version: 3.0.0
|
|
189
188
|
type: :runtime
|
|
190
189
|
prerelease: false
|
|
191
190
|
version_requirements: *id016
|
|
@@ -194,7 +193,7 @@ dependencies:
|
|
|
194
193
|
requirement: &id017 !ruby/object:Gem::Requirement
|
|
195
194
|
none: false
|
|
196
195
|
requirements:
|
|
197
|
-
- -
|
|
196
|
+
- - ~>
|
|
198
197
|
- !ruby/object:Gem::Version
|
|
199
198
|
version: 0.4.4
|
|
200
199
|
type: :runtime
|
|
@@ -205,9 +204,9 @@ dependencies:
|
|
|
205
204
|
requirement: &id018 !ruby/object:Gem::Requirement
|
|
206
205
|
none: false
|
|
207
206
|
requirements:
|
|
208
|
-
- -
|
|
207
|
+
- - ~>
|
|
209
208
|
- !ruby/object:Gem::Version
|
|
210
|
-
version: 0.
|
|
209
|
+
version: 0.5.1
|
|
211
210
|
type: :runtime
|
|
212
211
|
prerelease: false
|
|
213
212
|
version_requirements: *id018
|
|
@@ -243,9 +242,11 @@ files:
|
|
|
243
242
|
- lib/sorcery/controller/submodules/activity_logging.rb
|
|
244
243
|
- lib/sorcery/controller/submodules/brute_force_protection.rb
|
|
245
244
|
- lib/sorcery/controller/submodules/external.rb
|
|
245
|
+
- lib/sorcery/controller/submodules/external/protocols/certs/ca-bundle.crt
|
|
246
246
|
- lib/sorcery/controller/submodules/external/protocols/oauth1.rb
|
|
247
247
|
- lib/sorcery/controller/submodules/external/protocols/oauth2.rb
|
|
248
248
|
- lib/sorcery/controller/submodules/external/providers/facebook.rb
|
|
249
|
+
- lib/sorcery/controller/submodules/external/providers/github.rb
|
|
249
250
|
- lib/sorcery/controller/submodules/external/providers/twitter.rb
|
|
250
251
|
- lib/sorcery/controller/submodules/http_basic_auth.rb
|
|
251
252
|
- lib/sorcery/controller/submodules/remember_me.rb
|
|
@@ -281,6 +282,7 @@ files:
|
|
|
281
282
|
- sorcery.gemspec
|
|
282
283
|
- spec/Gemfile
|
|
283
284
|
- spec/Gemfile.lock
|
|
285
|
+
- spec/README.md
|
|
284
286
|
- spec/Rakefile
|
|
285
287
|
- spec/rails3/.gitignore
|
|
286
288
|
- spec/rails3/.rspec
|
|
@@ -294,6 +296,7 @@ files:
|
|
|
294
296
|
- spec/rails3/app/mailers/sorcery_mailer.rb
|
|
295
297
|
- spec/rails3/app/models/authentication.rb
|
|
296
298
|
- spec/rails3/app/models/user.rb
|
|
299
|
+
- spec/rails3/app/views/application/index.html.erb
|
|
297
300
|
- spec/rails3/app/views/layouts/application.html.erb
|
|
298
301
|
- spec/rails3/app/views/sorcery_mailer/activation_email.html.erb
|
|
299
302
|
- spec/rails3/app/views/sorcery_mailer/activation_email.text.erb
|
|
@@ -332,7 +335,6 @@ files:
|
|
|
332
335
|
- spec/rails3/public/500.html
|
|
333
336
|
- spec/rails3/public/favicon.ico
|
|
334
337
|
- spec/rails3/public/images/rails.png
|
|
335
|
-
- spec/rails3/public/index.html
|
|
336
338
|
- spec/rails3/public/javascripts/application.js
|
|
337
339
|
- spec/rails3/public/javascripts/controls.js
|
|
338
340
|
- spec/rails3/public/javascripts/dragdrop.js
|
|
@@ -350,6 +352,7 @@ files:
|
|
|
350
352
|
- spec/rails3/spec/controller_remember_me_spec.rb
|
|
351
353
|
- spec/rails3/spec/controller_session_timeout_spec.rb
|
|
352
354
|
- spec/rails3/spec/controller_spec.rb
|
|
355
|
+
- spec/rails3/spec/integration_spec.rb
|
|
353
356
|
- spec/rails3/spec/spec.opts
|
|
354
357
|
- spec/rails3/spec/spec_helper.orig.rb
|
|
355
358
|
- spec/rails3/spec/spec_helper.rb
|
|
@@ -411,6 +414,7 @@ files:
|
|
|
411
414
|
- spec/rails3_mongoid/public/robots.txt
|
|
412
415
|
- spec/rails3_mongoid/public/stylesheets/.gitkeep
|
|
413
416
|
- spec/rails3_mongoid/script/rails
|
|
417
|
+
- spec/rails3_mongoid/spec/controller_spec.rb
|
|
414
418
|
- spec/rails3_mongoid/spec/spec.opts
|
|
415
419
|
- spec/rails3_mongoid/spec/spec_helper.orig.rb
|
|
416
420
|
- spec/rails3_mongoid/spec/spec_helper.rb
|
|
@@ -488,7 +492,6 @@ files:
|
|
|
488
492
|
- spec/sorcery_crypto_providers_spec.rb
|
|
489
493
|
- spec/spec.opts
|
|
490
494
|
- spec/spec_helper.rb
|
|
491
|
-
has_rdoc: true
|
|
492
495
|
homepage: http://github.com/NoamB/sorcery
|
|
493
496
|
licenses:
|
|
494
497
|
- MIT
|
|
@@ -512,7 +515,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
512
515
|
requirements: []
|
|
513
516
|
|
|
514
517
|
rubyforge_project:
|
|
515
|
-
rubygems_version: 1.
|
|
518
|
+
rubygems_version: 1.8.10
|
|
516
519
|
signing_key:
|
|
517
520
|
specification_version: 3
|
|
518
521
|
summary: Magical authentication for Rails 3 applications
|
|
@@ -552,6 +555,7 @@ test_files:
|
|
|
552
555
|
- spec/rails3/spec/controller_remember_me_spec.rb
|
|
553
556
|
- spec/rails3/spec/controller_session_timeout_spec.rb
|
|
554
557
|
- spec/rails3/spec/controller_spec.rb
|
|
558
|
+
- spec/rails3/spec/integration_spec.rb
|
|
555
559
|
- spec/rails3/spec/spec_helper.orig.rb
|
|
556
560
|
- spec/rails3/spec/spec_helper.rb
|
|
557
561
|
- spec/rails3/spec/user_activation_spec.rb
|
|
@@ -581,6 +585,7 @@ test_files:
|
|
|
581
585
|
- spec/rails3_mongoid/config/routes.rb
|
|
582
586
|
- spec/rails3_mongoid/db/schema.rb
|
|
583
587
|
- spec/rails3_mongoid/db/seeds.rb
|
|
588
|
+
- spec/rails3_mongoid/spec/controller_spec.rb
|
|
584
589
|
- spec/rails3_mongoid/spec/spec_helper.orig.rb
|
|
585
590
|
- spec/rails3_mongoid/spec/spec_helper.rb
|
|
586
591
|
- spec/rails3_mongoid/spec/user_activation_spec.rb
|