sorcery 0.3.1 → 0.4.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 +3 -2
- data/Gemfile.lock +13 -11
- data/README.rdoc +89 -61
- data/Rakefile +4 -4
- data/VERSION +1 -1
- data/lib/generators/sorcery_migration/templates/core.rb +2 -2
- data/lib/sorcery.rb +1 -0
- data/lib/sorcery/controller.rb +16 -18
- data/lib/sorcery/controller/submodules/http_basic_auth.rb +1 -1
- data/lib/sorcery/crypto_providers/bcrypt.rb +1 -1
- data/lib/sorcery/crypto_providers/common.rb +35 -0
- data/lib/sorcery/crypto_providers/md5.rb +3 -23
- data/lib/sorcery/crypto_providers/sha1.rb +4 -16
- data/lib/sorcery/crypto_providers/sha256.rb +3 -23
- data/lib/sorcery/crypto_providers/sha512.rb +3 -23
- data/lib/sorcery/engine.rb +4 -0
- data/lib/sorcery/initializers/initializer.rb +86 -0
- data/lib/sorcery/model.rb +4 -2
- data/lib/sorcery/railties/tasks.rake +10 -0
- data/lib/sorcery/sinatra.rb +0 -9
- data/lib/sorcery/test_helpers.rb +12 -0
- data/lib/sorcery/test_helpers/rails.rb +6 -9
- data/lib/sorcery/test_helpers/sinatra.rb +6 -9
- data/sorcery.gemspec +137 -146
- data/spec/Gemfile +2 -2
- data/spec/Gemfile.lock +10 -10
- data/spec/Rakefile +1 -0
- data/spec/rails3/{app_root/.gitignore → .gitignore} +0 -0
- data/spec/rails3/.rspec +1 -1
- data/spec/rails3/{app_root/Gemfile → Gemfile} +4 -4
- data/spec/rails3/{app_root/Gemfile.lock → Gemfile.lock} +20 -20
- data/spec/rails3/{app_root/README → README} +0 -0
- data/spec/rails3/{app_root/Rakefile → Rakefile} +1 -0
- data/spec/rails3/{app_root/Rakefile.unused → Rakefile.unused} +0 -0
- data/spec/rails3/{app_root/app → app}/controllers/application_controller.rb +0 -0
- data/spec/rails3/{app_root/app → app}/helpers/application_helper.rb +0 -0
- data/spec/rails3/{app_root/app → app}/mailers/sorcery_mailer.rb +0 -0
- data/spec/rails3/{app_root/app → app}/models/authentication.rb +0 -0
- data/spec/rails3/{app_root/app → app}/models/user.rb +0 -0
- data/spec/rails3/{app_root/app → app}/views/layouts/application.html.erb +0 -0
- data/spec/rails3/{app_root/app → app}/views/sorcery_mailer/activation_email.html.erb +0 -0
- data/spec/rails3/{app_root/app → app}/views/sorcery_mailer/activation_email.text.erb +0 -0
- data/spec/rails3/{app_root/app → app}/views/sorcery_mailer/activation_success_email.html.erb +0 -0
- data/spec/rails3/{app_root/app → app}/views/sorcery_mailer/activation_success_email.text.erb +0 -0
- data/spec/rails3/{app_root/app → app}/views/sorcery_mailer/reset_password_email.html.erb +0 -0
- data/spec/rails3/{app_root/app → app}/views/sorcery_mailer/reset_password_email.text.erb +0 -0
- data/spec/rails3/{app_root/config.ru → config.ru} +0 -0
- data/spec/rails3/{app_root/config → config}/application.rb +0 -0
- data/spec/rails3/{app_root/config → config}/boot.rb +0 -0
- data/spec/rails3/config/database.yml +27 -0
- data/spec/rails3/{app_root/config → config}/environment.rb +0 -0
- data/spec/rails3/{app_root/config → config}/environments/development.rb +0 -0
- data/spec/rails3/{app_root/config → config}/environments/in_memory.rb +0 -0
- data/spec/rails3/{app_root/config → config}/environments/production.rb +0 -0
- data/spec/rails3/{app_root/config → config}/environments/test.rb +0 -0
- data/spec/rails3/{app_root/config → config}/initializers/backtrace_silencers.rb +0 -0
- data/spec/rails3/{app_root/config → config}/initializers/inflections.rb +0 -0
- data/spec/rails3/{app_root/config → config}/initializers/mime_types.rb +0 -0
- data/spec/rails3/{app_root/config → config}/initializers/secret_token.rb +0 -0
- data/spec/rails3/{app_root/config → config}/initializers/session_store.rb +0 -0
- data/spec/rails3/{app_root/config → config}/locales/en.yml +0 -0
- data/spec/rails3/{app_root/config → config}/routes.rb +0 -0
- data/spec/rails3/{app_root/db → db}/migrate/activation/20101224223622_add_activation_to_users.rb +0 -0
- data/spec/rails3/{app_root/db → db}/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb +0 -0
- data/spec/rails3/{app_root/db → db}/migrate/brute_force_protection/20101224223626_add_brute_force_protection_to_users.rb +0 -0
- data/spec/rails3/{app_root/db → db}/migrate/core/20101224223620_create_users.rb +0 -0
- data/spec/rails3/{app_root/db → db}/migrate/external/20101224223628_create_authentications.rb +0 -0
- data/spec/rails3/{app_root/db → db}/migrate/remember_me/20101224223623_add_remember_me_token_to_users.rb +0 -0
- data/spec/rails3/{app_root/db → db}/migrate/reset_password/20101224223622_add_reset_password_to_users.rb +0 -0
- data/spec/rails3/{app_root/db → db}/schema.rb +0 -0
- data/spec/rails3/{app_root/db → db}/seeds.rb +0 -0
- data/spec/rails3/{app_root/lib → lib}/tasks/.gitkeep +0 -0
- data/spec/rails3/{app_root/public → public}/404.html +0 -0
- data/spec/rails3/{app_root/public → public}/422.html +0 -0
- data/spec/rails3/{app_root/public → public}/500.html +0 -0
- data/spec/rails3/{app_root/public → public}/favicon.ico +0 -0
- data/spec/rails3/{app_root/public → public}/images/rails.png +0 -0
- data/spec/rails3/{app_root/public → public}/index.html +0 -0
- data/spec/rails3/{app_root/public → public}/javascripts/application.js +0 -0
- data/spec/rails3/{app_root/public → public}/javascripts/controls.js +0 -0
- data/spec/rails3/{app_root/public → public}/javascripts/dragdrop.js +0 -0
- data/spec/rails3/{app_root/public → public}/javascripts/effects.js +0 -0
- data/spec/rails3/{app_root/public → public}/javascripts/prototype.js +0 -0
- data/spec/rails3/{app_root/public → public}/javascripts/rails.js +0 -0
- data/spec/rails3/{app_root/public → public}/robots.txt +0 -0
- data/spec/rails3/{app_root/public → public}/stylesheets/.gitkeep +0 -0
- data/spec/rails3/{app_root/script → script}/rails +0 -0
- data/spec/rails3/{app_root/spec → spec}/controller_activity_logging_spec.rb +0 -0
- data/spec/rails3/{app_root/spec → spec}/controller_brute_force_protection_spec.rb +3 -2
- data/spec/rails3/{app_root/spec → spec}/controller_http_basic_auth_spec.rb +0 -0
- data/spec/rails3/{app_root/spec → spec}/controller_oauth2_spec.rb +10 -9
- data/spec/rails3/{app_root/spec → spec}/controller_oauth_spec.rb +5 -5
- data/spec/rails3/{app_root/spec → spec}/controller_remember_me_spec.rb +0 -0
- data/spec/rails3/{app_root/spec → spec}/controller_session_timeout_spec.rb +8 -4
- data/spec/rails3/{app_root/spec → spec}/controller_spec.rb +0 -0
- data/spec/rails3/spec/spec.opts +2 -0
- data/spec/rails3/{app_root/spec → spec}/spec_helper.orig.rb +0 -0
- data/spec/rails3/spec/spec_helper.rb +70 -0
- data/spec/rails3/{app_root/spec → spec}/user_activation_spec.rb +5 -1
- data/spec/rails3/{app_root/spec → spec}/user_activity_logging_spec.rb +0 -0
- data/spec/rails3/{app_root/spec → spec}/user_brute_force_protection_spec.rb +0 -0
- data/spec/rails3/{app_root/spec → spec}/user_oauth_spec.rb +3 -3
- data/spec/rails3/{app_root/spec → spec}/user_remember_me_spec.rb +0 -0
- data/spec/rails3/{app_root/spec → spec}/user_reset_password_spec.rb +7 -3
- data/spec/rails3/{app_root/spec → spec}/user_spec.rb +3 -9
- data/spec/rails3/{app_root/vendor → vendor}/plugins/.gitkeep +0 -0
- data/spec/sinatra/Gemfile +3 -3
- data/spec/sinatra/Gemfile.lock +17 -17
- data/spec/sinatra/Rakefile +1 -0
- data/spec/sinatra/spec/controller_brute_force_protection_spec.rb +3 -2
- data/spec/sinatra/spec/controller_oauth2_spec.rb +10 -9
- data/spec/sinatra/spec/controller_oauth_spec.rb +5 -5
- data/spec/sinatra/spec/controller_session_timeout_spec.rb +8 -4
- data/spec/sinatra/spec/spec.opts +2 -4
- data/spec/sinatra/spec/spec_helper.rb +2 -1
- data/spec/sorcery_crypto_providers_spec.rb +5 -4
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +3 -4
- metadata +148 -149
- data/lib/sorcery/controller/submodules/email.rb +0 -44
- data/lib/sorcery/controller/submodules/oauth.rb +0 -95
- data/spec/rails3/app_root/.rspec +0 -1
- data/spec/rails3/app_root/config/database.yml +0 -27
- data/spec/rails3/app_root/spec/spec_helper.rb +0 -62
- data/spec/sinatra/spec/user_activation_spec.rb +0 -188
- data/spec/sinatra/spec/user_activity_logging_spec.rb +0 -36
- data/spec/sinatra/spec/user_brute_force_protection_spec.rb +0 -76
- data/spec/sinatra/spec/user_oauth_spec.rb +0 -39
- data/spec/sinatra/spec/user_remember_me_spec.rb +0 -66
- data/spec/sinatra/spec/user_reset_password_spec.rb +0 -178
- data/spec/sinatra/spec/user_spec.rb +0 -317
data/spec/Gemfile
CHANGED
@@ -2,11 +2,11 @@ source 'http://rubygems.org'
|
|
2
2
|
|
3
3
|
gem "rails", '3.0.3'
|
4
4
|
gem 'bcrypt-ruby', :require => 'bcrypt'
|
5
|
-
gem "sorcery", '0.
|
5
|
+
gem "sorcery", '0.4.0', :path => '../../../'
|
6
6
|
gem 'oauth', ">= 0.4.4"
|
7
7
|
gem 'oauth2', ">= 0.1.1"
|
8
8
|
group :development do
|
9
|
-
gem
|
9
|
+
gem "rspec", "~> 2.5.0"
|
10
10
|
gem 'ruby-debug19'
|
11
11
|
gem 'simplecov', '>= 0.3.8', :require => false # Will install simplecov-html as a dependency
|
12
12
|
end
|
data/spec/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../../../
|
3
3
|
specs:
|
4
|
-
sorcery (0.
|
4
|
+
sorcery (0.4.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: http://rubygems.org/
|
@@ -81,14 +81,14 @@ GEM
|
|
81
81
|
rake (>= 0.8.7)
|
82
82
|
thor (~> 0.14.4)
|
83
83
|
rake (0.8.7)
|
84
|
-
rspec (2.
|
85
|
-
rspec-core (~> 2.
|
86
|
-
rspec-expectations (~> 2.
|
87
|
-
rspec-mocks (~> 2.
|
88
|
-
rspec-core (2.
|
89
|
-
rspec-expectations (2.
|
84
|
+
rspec (2.5.0)
|
85
|
+
rspec-core (~> 2.5.0)
|
86
|
+
rspec-expectations (~> 2.5.0)
|
87
|
+
rspec-mocks (~> 2.5.0)
|
88
|
+
rspec-core (2.5.1)
|
89
|
+
rspec-expectations (2.5.0)
|
90
90
|
diff-lcs (~> 1.1.2)
|
91
|
-
rspec-mocks (2.
|
91
|
+
rspec-mocks (2.5.0)
|
92
92
|
ruby-debug-base19 (0.11.24)
|
93
93
|
columnize (>= 0.3.1)
|
94
94
|
linecache19 (>= 0.5.11)
|
@@ -115,7 +115,7 @@ DEPENDENCIES
|
|
115
115
|
oauth (>= 0.4.4)
|
116
116
|
oauth2 (>= 0.1.1)
|
117
117
|
rails (= 3.0.3)
|
118
|
-
rspec
|
118
|
+
rspec (~> 2.5.0)
|
119
119
|
ruby-debug19
|
120
120
|
simplecov (>= 0.3.8)
|
121
|
-
sorcery (= 0.
|
121
|
+
sorcery (= 0.4.0)!
|
data/spec/Rakefile
CHANGED
File without changes
|
data/spec/rails3/.rspec
CHANGED
@@ -1 +1 @@
|
|
1
|
-
--
|
1
|
+
--colour
|
@@ -2,12 +2,12 @@ source 'http://rubygems.org'
|
|
2
2
|
|
3
3
|
gem 'rails', '3.0.3'
|
4
4
|
gem 'sqlite3-ruby', :require => 'sqlite3'
|
5
|
-
gem "sorcery", '0.
|
5
|
+
gem "sorcery", '0.4.0', :path => '../../../'
|
6
6
|
|
7
7
|
group :development, :test do
|
8
|
-
gem
|
9
|
-
gem 'rspec-rails'
|
8
|
+
gem "rspec", "~> 2.5.0"
|
9
|
+
gem 'rspec-rails', "~> 2.5.0"
|
10
10
|
gem 'ruby-debug19'
|
11
11
|
gem 'simplecov', '>= 0.3.8', :require => false # Will install simplecov-html as a dependency
|
12
|
-
gem '
|
12
|
+
gem 'timecop'
|
13
13
|
end
|
@@ -1,7 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../../../
|
3
3
|
specs:
|
4
|
-
|
4
|
+
oauth (0.4.4)
|
5
|
+
sorcery (0.4.0)
|
5
6
|
bcrypt-ruby (~> 2.1.4)
|
6
7
|
json (>= 1.5.1)
|
7
8
|
oauth (>= 0.4.4)
|
@@ -40,7 +41,7 @@ GEM
|
|
40
41
|
activemodel (= 3.0.3)
|
41
42
|
activesupport (= 3.0.3)
|
42
43
|
activesupport (3.0.3)
|
43
|
-
addressable (2.2.
|
44
|
+
addressable (2.2.5)
|
44
45
|
archive-tar-minitar (0.5.2)
|
45
46
|
arel (2.0.6)
|
46
47
|
bcrypt-ruby (2.1.4)
|
@@ -49,7 +50,7 @@ GEM
|
|
49
50
|
diff-lcs (1.1.2)
|
50
51
|
erubis (2.6.6)
|
51
52
|
abstract (>= 1.0.0)
|
52
|
-
faraday (0.
|
53
|
+
faraday (0.6.1)
|
53
54
|
addressable (~> 2.2.4)
|
54
55
|
multipart-post (~> 1.1.0)
|
55
56
|
rack (< 2, >= 1.1.0)
|
@@ -65,9 +66,8 @@ GEM
|
|
65
66
|
mime-types (1.16)
|
66
67
|
multi_json (0.0.5)
|
67
68
|
multipart-post (1.1.0)
|
68
|
-
|
69
|
-
|
70
|
-
faraday (~> 0.5.0)
|
69
|
+
oauth2 (0.4.0)
|
70
|
+
faraday (~> 0.6.0)
|
71
71
|
multi_json (~> 0.0.4)
|
72
72
|
polyglot (0.3.1)
|
73
73
|
rack (1.2.1)
|
@@ -89,19 +89,19 @@ GEM
|
|
89
89
|
rake (>= 0.8.7)
|
90
90
|
thor (~> 0.14.4)
|
91
91
|
rake (0.8.7)
|
92
|
-
rspec (2.
|
93
|
-
rspec-core (~> 2.
|
94
|
-
rspec-expectations (~> 2.
|
95
|
-
rspec-mocks (~> 2.
|
96
|
-
rspec-core (2.
|
97
|
-
rspec-expectations (2.
|
92
|
+
rspec (2.5.0)
|
93
|
+
rspec-core (~> 2.5.0)
|
94
|
+
rspec-expectations (~> 2.5.0)
|
95
|
+
rspec-mocks (~> 2.5.0)
|
96
|
+
rspec-core (2.5.1)
|
97
|
+
rspec-expectations (2.5.0)
|
98
98
|
diff-lcs (~> 1.1.2)
|
99
|
-
rspec-mocks (2.
|
100
|
-
rspec-rails (2.
|
99
|
+
rspec-mocks (2.5.0)
|
100
|
+
rspec-rails (2.5.0)
|
101
101
|
actionpack (~> 3.0)
|
102
102
|
activesupport (~> 3.0)
|
103
103
|
railties (~> 3.0)
|
104
|
-
rspec (~> 2.
|
104
|
+
rspec (~> 2.5.0)
|
105
105
|
ruby-debug-base19 (0.11.24)
|
106
106
|
columnize (>= 0.3.1)
|
107
107
|
linecache19 (>= 0.5.11)
|
@@ -115,9 +115,9 @@ GEM
|
|
115
115
|
simplecov (0.3.9)
|
116
116
|
simplecov-html (>= 0.3.7)
|
117
117
|
simplecov-html (0.3.9)
|
118
|
-
spork (0.9.0.rc3)
|
119
118
|
sqlite3-ruby (1.3.2)
|
120
119
|
thor (0.14.6)
|
120
|
+
timecop (0.3.5)
|
121
121
|
treetop (1.4.9)
|
122
122
|
polyglot (>= 0.3.1)
|
123
123
|
tzinfo (0.3.23)
|
@@ -127,10 +127,10 @@ PLATFORMS
|
|
127
127
|
|
128
128
|
DEPENDENCIES
|
129
129
|
rails (= 3.0.3)
|
130
|
-
rspec
|
131
|
-
rspec-rails
|
130
|
+
rspec (~> 2.5.0)
|
131
|
+
rspec-rails (~> 2.5.0)
|
132
132
|
ruby-debug19
|
133
133
|
simplecov (>= 0.3.8)
|
134
|
-
sorcery (= 0.
|
135
|
-
spork (~> 0.9.0.rc)
|
134
|
+
sorcery (= 0.4.0)!
|
136
135
|
sqlite3-ruby
|
136
|
+
timecop
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/rails3/{app_root/app → app}/views/sorcery_mailer/activation_success_email.html.erb
RENAMED
File without changes
|
data/spec/rails3/{app_root/app → app}/views/sorcery_mailer/activation_success_email.text.erb
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3-ruby (not necessary on OS X Leopard)
|
3
|
+
# development:
|
4
|
+
# adapter: sqlite3
|
5
|
+
# database: db/development.sqlite3
|
6
|
+
# pool: 5
|
7
|
+
# timeout: 5000
|
8
|
+
#
|
9
|
+
# # Warning: The database defined as "test" will be erased and
|
10
|
+
# # re-generated from your development database when you run "rake".
|
11
|
+
# # Do not set this db to the same as development or production.
|
12
|
+
# test:
|
13
|
+
# adapter: sqlite3
|
14
|
+
# database: db/test.sqlite3
|
15
|
+
# pool: 5
|
16
|
+
# timeout: 5000
|
17
|
+
#
|
18
|
+
# production:
|
19
|
+
# adapter: sqlite3
|
20
|
+
# database: db/production.sqlite3
|
21
|
+
# pool: 5
|
22
|
+
# timeout: 5000
|
23
|
+
|
24
|
+
in_memory:
|
25
|
+
adapter: sqlite3
|
26
|
+
database: ":memory:"
|
27
|
+
verbosity: quiet
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/rails3/{app_root/db → db}/migrate/activation/20101224223622_add_activation_to_users.rb
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/rails3/{app_root/db → db}/migrate/external/20101224223628_create_authentications.rb
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -19,6 +19,7 @@ describe ApplicationController do
|
|
19
19
|
after(:each) do
|
20
20
|
Sorcery::Controller::Config.reset!
|
21
21
|
sorcery_controller_property_set(:user_class, User)
|
22
|
+
Timecop.return
|
22
23
|
end
|
23
24
|
|
24
25
|
it "should count login retries" do
|
@@ -46,7 +47,7 @@ describe ApplicationController do
|
|
46
47
|
get :test_login, :username => 'gizmo', :password => 'blabla'
|
47
48
|
get :test_login, :username => 'gizmo', :password => 'blabla'
|
48
49
|
User.find_by_username('gizmo').lock_expires_at.should_not be_nil
|
49
|
-
|
50
|
+
Timecop.travel(Time.now + 0.3)
|
50
51
|
get :test_login, :username => 'gizmo', :password => 'blabla'
|
51
52
|
User.find_by_username('gizmo').lock_expires_at.should be_nil
|
52
53
|
end
|
@@ -57,7 +58,7 @@ describe ApplicationController do
|
|
57
58
|
get :test_login, :username => 'gizmo', :password => 'blabla'
|
58
59
|
get :test_login, :username => 'gizmo', :password => 'blabla'
|
59
60
|
unlock_date = User.find_by_username('gizmo').lock_expires_at
|
60
|
-
|
61
|
+
Timecop.travel(Time.now + 1)
|
61
62
|
get :test_login, :username => 'gizmo', :password => 'blabla'
|
62
63
|
User.find_by_username('gizmo').lock_expires_at.to_s.should == unlock_date.to_s
|
63
64
|
end
|
File without changes
|
@@ -15,9 +15,9 @@ describe ApplicationController do
|
|
15
15
|
ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate/external")
|
16
16
|
sorcery_reload!([:external])
|
17
17
|
sorcery_controller_property_set(:external_providers, [:facebook])
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
sorcery_controller_external_property_set(:facebook, :key, "eYVNBjBDi33aa9GkA3w")
|
19
|
+
sorcery_controller_external_property_set(:facebook, :secret, "XpbeSdCoaKSmQGSeokz5qcUATClRW5u08QWNfv71N8")
|
20
|
+
sorcery_controller_external_property_set(:facebook, :callback_url, "http://blabla.com")
|
21
21
|
end
|
22
22
|
|
23
23
|
after(:all) do
|
@@ -39,7 +39,8 @@ describe ApplicationController do
|
|
39
39
|
create_new_user
|
40
40
|
get :login_at_test2
|
41
41
|
response.should be_a_redirect
|
42
|
-
response.should redirect_to("http://myapi.com/oauth/authorize?client_id=key&redirect_uri=http%3A%2F%2Fblabla.com&scope=email%2Coffline_access&type=web_server")
|
42
|
+
#response.should redirect_to("http://myapi.com/oauth/authorize?client_id=key&redirect_uri=http%3A%2F%2Fblabla.com&scope=email%2Coffline_access&type=web_server")
|
43
|
+
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")
|
43
44
|
end
|
44
45
|
|
45
46
|
it "'login_from' logins if user exists" do
|
@@ -66,7 +67,7 @@ describe ApplicationController do
|
|
66
67
|
|
67
68
|
it "should create a new user" do
|
68
69
|
sorcery_model_property_set(:authentications_class, Authentication)
|
69
|
-
|
70
|
+
sorcery_controller_external_property_set(:facebook, :user_info_mapping, {:username => "name"})
|
70
71
|
lambda do
|
71
72
|
get :test_create_from_provider, :provider => "facebook"
|
72
73
|
end.should change(User, :count).by(1)
|
@@ -75,7 +76,7 @@ describe ApplicationController do
|
|
75
76
|
|
76
77
|
it "should support nested attributes" do
|
77
78
|
sorcery_model_property_set(:authentications_class, Authentication)
|
78
|
-
|
79
|
+
sorcery_controller_external_property_set(:facebook, :user_info_mapping, {:username => "hometown/name"})
|
79
80
|
lambda do
|
80
81
|
get :test_create_from_provider, :provider => "facebook"
|
81
82
|
end.should change(User, :count).by(1)
|
@@ -88,9 +89,9 @@ describe ApplicationController do
|
|
88
89
|
ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate/activation")
|
89
90
|
sorcery_reload!([:user_activation,:external], :user_activation_mailer => ::SorceryMailer)
|
90
91
|
sorcery_controller_property_set(:external_providers, [:facebook])
|
91
|
-
|
92
|
-
|
93
|
-
|
92
|
+
sorcery_controller_external_property_set(:facebook, :key, "eYVNBjBDi33aa9GkA3w")
|
93
|
+
sorcery_controller_external_property_set(:facebook, :secret, "XpbeSdCoaKSmQGSeokz5qcUATClRW5u08QWNfv71N8")
|
94
|
+
sorcery_controller_external_property_set(:facebook, :callback_url, "http://blabla.com")
|
94
95
|
end
|
95
96
|
|
96
97
|
after(:all) do
|
@@ -22,9 +22,9 @@ describe ApplicationController do
|
|
22
22
|
ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate/external")
|
23
23
|
sorcery_reload!([:external])
|
24
24
|
sorcery_controller_property_set(:external_providers, [:twitter])
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
sorcery_controller_external_property_set(:twitter, :key, "eYVNBjBDi33aa9GkA3w")
|
26
|
+
sorcery_controller_external_property_set(:twitter, :secret, "XpbeSdCoaKSmQGSeokz5qcUATClRW5u08QWNfv71N8")
|
27
|
+
sorcery_controller_external_property_set(:twitter, :callback_url, "http://blabla.com")
|
28
28
|
end
|
29
29
|
|
30
30
|
after(:all) do
|
@@ -73,7 +73,7 @@ describe ApplicationController do
|
|
73
73
|
|
74
74
|
it "should create a new user" do
|
75
75
|
sorcery_model_property_set(:authentications_class, Authentication)
|
76
|
-
|
76
|
+
sorcery_controller_external_property_set(:twitter, :user_info_mapping, {:username => "screen_name"})
|
77
77
|
lambda do
|
78
78
|
get :test_create_from_provider, :provider => "twitter"
|
79
79
|
end.should change(User, :count).by(1)
|
@@ -82,7 +82,7 @@ describe ApplicationController do
|
|
82
82
|
|
83
83
|
it "should support nested attributes" do
|
84
84
|
sorcery_model_property_set(:authentications_class, Authentication)
|
85
|
-
|
85
|
+
sorcery_controller_external_property_set(:twitter, :user_info_mapping, {:username => "status/text"})
|
86
86
|
lambda do
|
87
87
|
get :test_create_from_provider, :provider => "twitter"
|
88
88
|
end.should change(User, :count).by(1)
|