sorcery 0.5.21 → 0.6.1
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 +96 -81
- data/README.rdoc +9 -1
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/lib/sorcery/controller/submodules/activity_logging.rb +11 -7
- data/lib/sorcery/controller/submodules/brute_force_protection.rb +8 -5
- data/lib/sorcery/controller/submodules/external.rb +11 -6
- data/lib/sorcery/controller/submodules/http_basic_auth.rb +11 -6
- data/lib/sorcery/controller/submodules/remember_me.rb +14 -5
- data/lib/sorcery/controller/submodules/session_timeout.rb +3 -1
- data/lib/sorcery/controller.rb +12 -9
- data/lib/sorcery/crypto_providers/aes256.rb +8 -5
- data/lib/sorcery/crypto_providers/bcrypt.rb +12 -6
- data/lib/sorcery/crypto_providers/sha256.rb +2 -1
- data/lib/sorcery/crypto_providers/sha512.rb +2 -1
- data/lib/sorcery/initializers/initializer.rb +125 -36
- data/lib/sorcery/model/adapters/active_record.rb +2 -2
- data/lib/sorcery/model/adapters/mongoid.rb +4 -4
- data/lib/sorcery/model/submodules/activity_logging.rb +7 -6
- data/lib/sorcery/model/submodules/brute_force_protection.rb +10 -6
- data/lib/sorcery/model/submodules/external.rb +4 -2
- data/lib/sorcery/model/submodules/remember_me.rb +4 -3
- data/lib/sorcery/model/submodules/reset_password.rb +16 -8
- data/lib/sorcery/model/submodules/user_activation.rb +23 -10
- data/lib/sorcery/model/temporary_token.rb +3 -2
- data/lib/sorcery/model.rb +58 -26
- data/lib/sorcery/test_helpers/internal/rails.rb +6 -2
- data/lib/sorcery/test_helpers/internal/sinatra.rb +1 -1
- data/lib/sorcery/test_helpers/internal/sinatra_modular.rb +1 -1
- data/lib/sorcery/test_helpers/internal.rb +2 -1
- data/sorcery.gemspec +41 -23
- data/spec/Gemfile +2 -2
- data/spec/Gemfile.lock +33 -32
- data/spec/rails3/Gemfile.lock +7 -7
- data/spec/rails3/spec/controller_oauth2_spec.rb +4 -25
- data/spec/rails3/spec/controller_oauth_spec.rb +3 -24
- data/spec/rails3/spec/controller_spec.rb +2 -2
- data/spec/rails3/spec/user_activation_spec.rb +2 -168
- data/spec/rails3/spec/user_activity_logging_spec.rb +2 -30
- data/spec/rails3/spec/user_brute_force_protection_spec.rb +2 -35
- data/spec/rails3/spec/user_oauth_spec.rb +2 -26
- data/spec/rails3/spec/user_remember_me_spec.rb +2 -45
- data/spec/rails3/spec/user_reset_password_spec.rb +3 -168
- data/spec/rails3/spec/user_spec.rb +3 -283
- data/spec/rails3_mongoid/Gemfile.lock +7 -7
- data/spec/rails3_mongoid/app/models/authentication.rb +3 -3
- data/spec/rails3_mongoid/spec/user_activation_spec.rb +2 -171
- data/spec/rails3_mongoid/spec/user_activity_logging_spec.rb +2 -25
- data/spec/rails3_mongoid/spec/user_brute_force_protection_spec.rb +2 -35
- data/spec/rails3_mongoid/spec/user_oauth_spec.rb +2 -28
- data/spec/rails3_mongoid/spec/user_remember_me_spec.rb +2 -45
- data/spec/rails3_mongoid/spec/user_reset_password_spec.rb +2 -176
- data/spec/rails3_mongoid/spec/user_spec.rb +3 -285
- data/spec/shared_examples/controller_oauth2_shared_examples.rb +37 -0
- data/spec/shared_examples/controller_oauth_shared_examples.rb +37 -0
- data/spec/shared_examples/user_activation_shared_examples.rb +173 -0
- data/spec/shared_examples/user_activity_logging_shared_examples.rb +27 -0
- data/spec/shared_examples/user_brute_force_protection_shared_examples.rb +37 -0
- data/spec/shared_examples/user_oauth_shared_examples.rb +31 -0
- data/spec/shared_examples/user_remember_me_shared_examples.rb +47 -0
- data/spec/shared_examples/user_reset_password_shared_examples.rb +177 -0
- data/spec/shared_examples/user_shared_examples.rb +292 -0
- data/spec/sinatra/Gemfile.lock +7 -7
- data/spec/sinatra/spec/controller_oauth2_spec.rb +3 -24
- data/spec/sinatra/spec/controller_oauth_spec.rb +3 -24
- data/spec/sinatra/spec/controller_spec.rb +2 -2
- data/spec/sinatra_modular/Gemfile.lock +7 -7
- data/spec/sinatra_modular/spec_modular/controller_oauth2_spec.rb +3 -24
- data/spec/sinatra_modular/spec_modular/controller_oauth_spec.rb +3 -24
- data/spec/sinatra_modular/spec_modular/controller_spec.rb +2 -2
- metadata +28 -12
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../shared_examples/controller_oauth2_shared_examples')
|
|
2
3
|
|
|
3
4
|
def stub_all_oauth2_requests!
|
|
4
5
|
@client = OAuth2::Client.new("key","secret", :site => "http://myapi.com")
|
|
@@ -58,30 +59,8 @@ describe 'MyApp' do
|
|
|
58
59
|
end
|
|
59
60
|
end
|
|
60
61
|
|
|
61
|
-
describe Modular
|
|
62
|
-
|
|
63
|
-
stub_all_oauth2_requests!
|
|
64
|
-
User.delete_all
|
|
65
|
-
Authentication.delete_all
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
it "should create a new user" do
|
|
69
|
-
sorcery_model_property_set(:authentications_class, Authentication)
|
|
70
|
-
sorcery_controller_external_property_set(:facebook, :user_info_mapping, {:username => "name"})
|
|
71
|
-
lambda do
|
|
72
|
-
get "/test_create_from_provider", :provider => "facebook"
|
|
73
|
-
end.should change(User, :count).by(1)
|
|
74
|
-
User.first.username.should == "Noam Ben Ari"
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
it "should support nested attributes" do
|
|
78
|
-
sorcery_model_property_set(:authentications_class, Authentication)
|
|
79
|
-
sorcery_controller_external_property_set(:facebook, :user_info_mapping, {:username => "hometown/name"})
|
|
80
|
-
lambda do
|
|
81
|
-
get "/test_create_from_provider", :provider => "facebook"
|
|
82
|
-
end.should change(User, :count).by(1)
|
|
83
|
-
User.first.username.should == "Haifa, Israel"
|
|
84
|
-
end
|
|
62
|
+
describe Modular do
|
|
63
|
+
it_behaves_like "oauth2_controller"
|
|
85
64
|
end
|
|
86
65
|
|
|
87
66
|
describe Modular, "OAuth with User Activation features" do
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../shared_examples/controller_oauth_shared_examples')
|
|
2
3
|
require 'ostruct'
|
|
3
4
|
|
|
4
5
|
def stub_all_oauth_requests!
|
|
@@ -63,30 +64,8 @@ describe Modular do
|
|
|
63
64
|
end
|
|
64
65
|
end
|
|
65
66
|
|
|
66
|
-
describe Modular
|
|
67
|
-
|
|
68
|
-
stub_all_oauth_requests!
|
|
69
|
-
User.delete_all
|
|
70
|
-
Authentication.delete_all
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
it "should create a new user" do
|
|
74
|
-
sorcery_model_property_set(:authentications_class, Authentication)
|
|
75
|
-
sorcery_controller_external_property_set(:twitter, :user_info_mapping, {:username => "screen_name"})
|
|
76
|
-
lambda do
|
|
77
|
-
get :test_create_from_provider, :provider => "twitter"
|
|
78
|
-
end.should change(User, :count).by(1)
|
|
79
|
-
User.first.username.should == "nbenari"
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
it "should support nested attributes" do
|
|
83
|
-
sorcery_model_property_set(:authentications_class, Authentication)
|
|
84
|
-
sorcery_controller_external_property_set(:twitter, :user_info_mapping, {:username => "status/text"})
|
|
85
|
-
lambda do
|
|
86
|
-
get :test_create_from_provider, :provider => "twitter"
|
|
87
|
-
end.should change(User, :count).by(1)
|
|
88
|
-
User.first.username.should == "coming soon to sorcery gem: twitter and facebook authentication support."
|
|
89
|
-
end
|
|
67
|
+
describe Modular do
|
|
68
|
+
it_behaves_like "oauth_controller"
|
|
90
69
|
end
|
|
91
70
|
|
|
92
71
|
describe Modular, "OAuth with User Activation features" do
|
|
@@ -14,8 +14,8 @@ describe Modular do
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
it "should enable configuration option 'user_class'" do
|
|
17
|
-
sorcery_controller_property_set(:user_class, TestUser)
|
|
18
|
-
Sorcery::Controller::Config.user_class.should
|
|
17
|
+
sorcery_controller_property_set(:user_class, "TestUser")
|
|
18
|
+
Sorcery::Controller::Config.user_class.should == "TestUser"
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
it "should enable configuration option 'not_authenticated_action'" 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.6.1
|
|
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-02 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.4.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.4.1
|
|
211
210
|
type: :runtime
|
|
212
211
|
prerelease: false
|
|
213
212
|
version_requirements: *id018
|
|
@@ -422,6 +421,15 @@ files:
|
|
|
422
421
|
- spec/rails3_mongoid/spec/user_reset_password_spec.rb
|
|
423
422
|
- spec/rails3_mongoid/spec/user_spec.rb
|
|
424
423
|
- spec/rails3_mongoid/vendor/plugins/.gitkeep
|
|
424
|
+
- spec/shared_examples/controller_oauth2_shared_examples.rb
|
|
425
|
+
- spec/shared_examples/controller_oauth_shared_examples.rb
|
|
426
|
+
- spec/shared_examples/user_activation_shared_examples.rb
|
|
427
|
+
- spec/shared_examples/user_activity_logging_shared_examples.rb
|
|
428
|
+
- spec/shared_examples/user_brute_force_protection_shared_examples.rb
|
|
429
|
+
- spec/shared_examples/user_oauth_shared_examples.rb
|
|
430
|
+
- spec/shared_examples/user_remember_me_shared_examples.rb
|
|
431
|
+
- spec/shared_examples/user_reset_password_shared_examples.rb
|
|
432
|
+
- spec/shared_examples/user_shared_examples.rb
|
|
425
433
|
- spec/sinatra/Gemfile
|
|
426
434
|
- spec/sinatra/Gemfile.lock
|
|
427
435
|
- spec/sinatra/Rakefile
|
|
@@ -479,7 +487,6 @@ files:
|
|
|
479
487
|
- spec/sorcery_crypto_providers_spec.rb
|
|
480
488
|
- spec/spec.opts
|
|
481
489
|
- spec/spec_helper.rb
|
|
482
|
-
has_rdoc: true
|
|
483
490
|
homepage: http://github.com/NoamB/sorcery
|
|
484
491
|
licenses:
|
|
485
492
|
- MIT
|
|
@@ -503,7 +510,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
503
510
|
requirements: []
|
|
504
511
|
|
|
505
512
|
rubyforge_project:
|
|
506
|
-
rubygems_version: 1.
|
|
513
|
+
rubygems_version: 1.8.10
|
|
507
514
|
signing_key:
|
|
508
515
|
specification_version: 3
|
|
509
516
|
summary: Magical authentication for Rails 3 applications
|
|
@@ -581,6 +588,15 @@ test_files:
|
|
|
581
588
|
- spec/rails3_mongoid/spec/user_remember_me_spec.rb
|
|
582
589
|
- spec/rails3_mongoid/spec/user_reset_password_spec.rb
|
|
583
590
|
- spec/rails3_mongoid/spec/user_spec.rb
|
|
591
|
+
- spec/shared_examples/controller_oauth2_shared_examples.rb
|
|
592
|
+
- spec/shared_examples/controller_oauth_shared_examples.rb
|
|
593
|
+
- spec/shared_examples/user_activation_shared_examples.rb
|
|
594
|
+
- spec/shared_examples/user_activity_logging_shared_examples.rb
|
|
595
|
+
- spec/shared_examples/user_brute_force_protection_shared_examples.rb
|
|
596
|
+
- spec/shared_examples/user_oauth_shared_examples.rb
|
|
597
|
+
- spec/shared_examples/user_remember_me_shared_examples.rb
|
|
598
|
+
- spec/shared_examples/user_reset_password_shared_examples.rb
|
|
599
|
+
- spec/shared_examples/user_shared_examples.rb
|
|
584
600
|
- spec/sinatra/authentication.rb
|
|
585
601
|
- spec/sinatra/db/migrate/activation/20101224223622_add_activation_to_users.rb
|
|
586
602
|
- spec/sinatra/db/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb
|