sorcery 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sorcery might be problematic. Click here for more details.
- data/Gemfile +1 -1
- data/Gemfile.lock +7 -7
- data/README.rdoc +14 -4
- data/Rakefile +1 -1
- 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.rb +1 -0
- data/lib/sorcery/controller.rb +26 -6
- 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.rb +10 -3
- 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/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/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.rb +13 -11
- 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/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/sorcery.gemspec +16 -9
- data/spec/Gemfile +1 -1
- data/spec/Gemfile.lock +9 -11
- data/spec/README.md +26 -0
- data/spec/rails3/Gemfile +2 -0
- data/spec/rails3/Gemfile.lock +33 -11
- 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 +61 -20
- 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 +9 -11
- 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 +9 -11
- 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 +9 -11
- data/spec/sinatra_modular/spec_modular/controller_oauth2_spec.rb +3 -6
- metadata +12 -5
- data/spec/rails3/public/index.html +0 -239
@@ -0,0 +1,23 @@
|
|
1
|
+
# require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
#
|
3
|
+
# describe "the login process", :type => :request do
|
4
|
+
# before(:all) do
|
5
|
+
# sorcery_reload!
|
6
|
+
# create_new_user
|
7
|
+
# end
|
8
|
+
#
|
9
|
+
# after(:all) do
|
10
|
+
# end
|
11
|
+
#
|
12
|
+
# it "handles unverified request" do
|
13
|
+
# visit root_path
|
14
|
+
# # save_and_open_page
|
15
|
+
# fill_in 'Username', :with => 'gizmo'
|
16
|
+
# fill_in 'Password', :with => 'secret'
|
17
|
+
# # <input name="authenticity_token" type="hidden" value="+8M9lXnjnhAW/mAuzwI9Mmy6hM+00qZJa8VMQUg+NmM=">
|
18
|
+
# #page.execute_script("$$('hidden').value='mezuza'")
|
19
|
+
# #save_and_open_page
|
20
|
+
# click_button 'Login'
|
21
|
+
# save_and_open_page
|
22
|
+
# end
|
23
|
+
# end
|
@@ -1,9 +1,11 @@
|
|
1
1
|
$: << File.join(File.dirname(__FILE__), '..', '..', 'lib' )
|
2
2
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
3
|
+
|
3
4
|
# Set the default environment to sqlite3's in_memory database
|
4
|
-
ENV[
|
5
|
-
require File.expand_path("../../config/environment", __FILE__)
|
6
|
-
require 'rspec/rails'
|
5
|
+
ENV["RAILS_ENV"] ||= 'in_memory'
|
6
|
+
require File.expand_path("../../config/environment", __FILE__)
|
7
|
+
require 'rspec/rails'
|
8
|
+
require 'capybara/rspec'
|
7
9
|
require 'timecop'
|
8
10
|
# require 'simplecov'
|
9
11
|
# SimpleCov.root File.join(File.dirname(__FILE__), "..", "..", "rails3" )
|
@@ -43,6 +45,7 @@ RSpec.configure do |config|
|
|
43
45
|
# instead of true.
|
44
46
|
config.use_transactional_fixtures = true
|
45
47
|
|
48
|
+
#ActiveRecord::Base.logger = Logger.new(STDOUT)
|
46
49
|
config.before(:suite) do
|
47
50
|
ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate/core")
|
48
51
|
end
|
@@ -1,12 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../../../
|
3
3
|
specs:
|
4
|
-
sorcery (0.6.
|
4
|
+
sorcery (0.6.1)
|
5
5
|
bcrypt-ruby (~> 3.0.0)
|
6
|
-
oauth (
|
7
|
-
|
8
|
-
oauth2 (>= 0.1.1)
|
9
|
-
oauth2 (>= 0.1.1)
|
6
|
+
oauth (~> 0.4.4)
|
7
|
+
oauth2 (~> 0.5.0)
|
10
8
|
|
11
9
|
GEM
|
12
10
|
remote: http://rubygems.org/
|
@@ -41,7 +39,7 @@ GEM
|
|
41
39
|
addressable (2.2.6)
|
42
40
|
archive-tar-minitar (0.5.2)
|
43
41
|
arel (2.0.6)
|
44
|
-
bcrypt-ruby (3.0.
|
42
|
+
bcrypt-ruby (3.0.1)
|
45
43
|
bson (1.3.0)
|
46
44
|
bson_ext (1.3.0)
|
47
45
|
builder (2.1.2)
|
@@ -49,8 +47,8 @@ GEM
|
|
49
47
|
diff-lcs (1.1.2)
|
50
48
|
erubis (2.6.6)
|
51
49
|
abstract (>= 1.0.0)
|
52
|
-
faraday (0.
|
53
|
-
addressable (~> 2.2.
|
50
|
+
faraday (0.7.4)
|
51
|
+
addressable (~> 2.2.6)
|
54
52
|
multipart-post (~> 1.1.0)
|
55
53
|
rack (< 2, >= 1.1.0)
|
56
54
|
i18n (0.5.0)
|
@@ -72,9 +70,9 @@ GEM
|
|
72
70
|
multi_json (1.0.3)
|
73
71
|
multipart-post (1.1.3)
|
74
72
|
oauth (0.4.5)
|
75
|
-
oauth2 (0.
|
76
|
-
faraday (~> 0.
|
77
|
-
multi_json (
|
73
|
+
oauth2 (0.5.1)
|
74
|
+
faraday (~> 0.7.4)
|
75
|
+
multi_json (~> 1.0.3)
|
78
76
|
polyglot (0.3.1)
|
79
77
|
rack (1.2.1)
|
80
78
|
rack-mount (0.6.13)
|
@@ -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.6.
|
4
|
+
sorcery (0.6.1)
|
5
5
|
bcrypt-ruby (~> 3.0.0)
|
6
|
-
oauth (
|
7
|
-
|
8
|
-
oauth2 (>= 0.1.1)
|
9
|
-
oauth2 (>= 0.1.1)
|
6
|
+
oauth (~> 0.4.4)
|
7
|
+
oauth2 (~> 0.5.0)
|
10
8
|
|
11
9
|
GEM
|
12
10
|
remote: http://rubygems.org/
|
@@ -38,14 +36,14 @@ GEM
|
|
38
36
|
addressable (2.2.6)
|
39
37
|
archive-tar-minitar (0.5.2)
|
40
38
|
arel (2.0.7)
|
41
|
-
bcrypt-ruby (3.0.
|
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)
|
@@ -60,9 +58,9 @@ GEM
|
|
60
58
|
multi_json (1.0.3)
|
61
59
|
multipart-post (1.1.3)
|
62
60
|
oauth (0.4.5)
|
63
|
-
oauth2 (0.
|
64
|
-
faraday (~> 0.
|
65
|
-
multi_json (
|
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.6.
|
4
|
+
sorcery (0.6.1)
|
5
5
|
bcrypt-ruby (~> 3.0.0)
|
6
|
-
oauth (
|
7
|
-
|
8
|
-
oauth2 (>= 0.1.1)
|
9
|
-
oauth2 (>= 0.1.1)
|
6
|
+
oauth (~> 0.4.4)
|
7
|
+
oauth2 (~> 0.5.0)
|
10
8
|
|
11
9
|
GEM
|
12
10
|
remote: http://rubygems.org/
|
@@ -38,14 +36,14 @@ GEM
|
|
38
36
|
addressable (2.2.6)
|
39
37
|
archive-tar-minitar (0.5.2)
|
40
38
|
arel (2.0.7)
|
41
|
-
bcrypt-ruby (3.0.
|
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)
|
@@ -60,9 +58,9 @@ GEM
|
|
60
58
|
multi_json (1.0.3)
|
61
59
|
multipart-post (1.1.3)
|
62
60
|
oauth (0.4.5)
|
63
|
-
oauth2 (0.
|
64
|
-
faraday (~> 0.
|
65
|
-
multi_json (
|
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,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-09-
|
13
|
+
date: 2011-09-30 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: oauth
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.5.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: *id002
|
@@ -206,7 +206,7 @@ dependencies:
|
|
206
206
|
requirements:
|
207
207
|
- - ~>
|
208
208
|
- !ruby/object:Gem::Version
|
209
|
-
version: 0.
|
209
|
+
version: 0.5.1
|
210
210
|
type: :runtime
|
211
211
|
prerelease: false
|
212
212
|
version_requirements: *id018
|
@@ -242,9 +242,11 @@ files:
|
|
242
242
|
- lib/sorcery/controller/submodules/activity_logging.rb
|
243
243
|
- lib/sorcery/controller/submodules/brute_force_protection.rb
|
244
244
|
- lib/sorcery/controller/submodules/external.rb
|
245
|
+
- lib/sorcery/controller/submodules/external/protocols/certs/ca-bundle.crt
|
245
246
|
- lib/sorcery/controller/submodules/external/protocols/oauth1.rb
|
246
247
|
- lib/sorcery/controller/submodules/external/protocols/oauth2.rb
|
247
248
|
- lib/sorcery/controller/submodules/external/providers/facebook.rb
|
249
|
+
- lib/sorcery/controller/submodules/external/providers/github.rb
|
248
250
|
- lib/sorcery/controller/submodules/external/providers/twitter.rb
|
249
251
|
- lib/sorcery/controller/submodules/http_basic_auth.rb
|
250
252
|
- lib/sorcery/controller/submodules/remember_me.rb
|
@@ -280,6 +282,7 @@ files:
|
|
280
282
|
- sorcery.gemspec
|
281
283
|
- spec/Gemfile
|
282
284
|
- spec/Gemfile.lock
|
285
|
+
- spec/README.md
|
283
286
|
- spec/Rakefile
|
284
287
|
- spec/rails3/.gitignore
|
285
288
|
- spec/rails3/.rspec
|
@@ -293,6 +296,7 @@ files:
|
|
293
296
|
- spec/rails3/app/mailers/sorcery_mailer.rb
|
294
297
|
- spec/rails3/app/models/authentication.rb
|
295
298
|
- spec/rails3/app/models/user.rb
|
299
|
+
- spec/rails3/app/views/application/index.html.erb
|
296
300
|
- spec/rails3/app/views/layouts/application.html.erb
|
297
301
|
- spec/rails3/app/views/sorcery_mailer/activation_email.html.erb
|
298
302
|
- spec/rails3/app/views/sorcery_mailer/activation_email.text.erb
|
@@ -331,7 +335,6 @@ files:
|
|
331
335
|
- spec/rails3/public/500.html
|
332
336
|
- spec/rails3/public/favicon.ico
|
333
337
|
- spec/rails3/public/images/rails.png
|
334
|
-
- spec/rails3/public/index.html
|
335
338
|
- spec/rails3/public/javascripts/application.js
|
336
339
|
- spec/rails3/public/javascripts/controls.js
|
337
340
|
- spec/rails3/public/javascripts/dragdrop.js
|
@@ -349,6 +352,7 @@ files:
|
|
349
352
|
- spec/rails3/spec/controller_remember_me_spec.rb
|
350
353
|
- spec/rails3/spec/controller_session_timeout_spec.rb
|
351
354
|
- spec/rails3/spec/controller_spec.rb
|
355
|
+
- spec/rails3/spec/integration_spec.rb
|
352
356
|
- spec/rails3/spec/spec.opts
|
353
357
|
- spec/rails3/spec/spec_helper.orig.rb
|
354
358
|
- spec/rails3/spec/spec_helper.rb
|
@@ -410,6 +414,7 @@ files:
|
|
410
414
|
- spec/rails3_mongoid/public/robots.txt
|
411
415
|
- spec/rails3_mongoid/public/stylesheets/.gitkeep
|
412
416
|
- spec/rails3_mongoid/script/rails
|
417
|
+
- spec/rails3_mongoid/spec/controller_spec.rb
|
413
418
|
- spec/rails3_mongoid/spec/spec.opts
|
414
419
|
- spec/rails3_mongoid/spec/spec_helper.orig.rb
|
415
420
|
- spec/rails3_mongoid/spec/spec_helper.rb
|
@@ -550,6 +555,7 @@ test_files:
|
|
550
555
|
- spec/rails3/spec/controller_remember_me_spec.rb
|
551
556
|
- spec/rails3/spec/controller_session_timeout_spec.rb
|
552
557
|
- spec/rails3/spec/controller_spec.rb
|
558
|
+
- spec/rails3/spec/integration_spec.rb
|
553
559
|
- spec/rails3/spec/spec_helper.orig.rb
|
554
560
|
- spec/rails3/spec/spec_helper.rb
|
555
561
|
- spec/rails3/spec/user_activation_spec.rb
|
@@ -579,6 +585,7 @@ test_files:
|
|
579
585
|
- spec/rails3_mongoid/config/routes.rb
|
580
586
|
- spec/rails3_mongoid/db/schema.rb
|
581
587
|
- spec/rails3_mongoid/db/seeds.rb
|
588
|
+
- spec/rails3_mongoid/spec/controller_spec.rb
|
582
589
|
- spec/rails3_mongoid/spec/spec_helper.orig.rb
|
583
590
|
- spec/rails3_mongoid/spec/spec_helper.rb
|
584
591
|
- spec/rails3_mongoid/spec/user_activation_spec.rb
|