sorcery 0.1.1 → 0.2.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 +4 -3
- data/Gemfile.lock +16 -13
- data/LICENSE.txt +1 -1
- data/README.rdoc +77 -63
- data/Rakefile +7 -13
- data/VERSION +1 -1
- data/lib/sorcery/controller/submodules/activity_logging.rb +58 -0
- data/lib/sorcery/controller/submodules/brute_force_protection.rb +15 -69
- data/lib/sorcery/controller/submodules/http_basic_auth.rb +65 -0
- data/lib/sorcery/controller/submodules/oauth/oauth1.rb +25 -0
- data/lib/sorcery/controller/submodules/oauth/oauth2.rb +23 -0
- data/lib/sorcery/controller/submodules/oauth/providers/facebook.rb +64 -0
- data/lib/sorcery/controller/submodules/oauth/providers/twitter.rb +61 -0
- data/lib/sorcery/controller/submodules/oauth.rb +95 -0
- data/lib/sorcery/controller/submodules/remember_me.rb +14 -5
- data/lib/sorcery/controller/submodules/session_timeout.rb +10 -2
- data/lib/sorcery/controller.rb +40 -22
- data/lib/sorcery/crypto_providers/bcrypt.rb +3 -7
- data/lib/sorcery/engine.rb +9 -2
- data/lib/sorcery/model/submodules/activity_logging.rb +40 -0
- data/lib/sorcery/model/submodules/brute_force_protection.rb +79 -0
- data/lib/sorcery/model/submodules/oauth.rb +53 -0
- data/lib/sorcery/model/submodules/remember_me.rb +6 -2
- data/lib/sorcery/model/submodules/reset_password.rb +96 -0
- data/lib/sorcery/model/submodules/user_activation.rb +44 -23
- data/lib/sorcery/model/temporary_token.rb +22 -0
- data/lib/sorcery/model.rb +13 -6
- data/lib/sorcery/test_helpers.rb +84 -0
- data/lib/sorcery.rb +17 -1
- data/sorcery.gemspec +85 -41
- data/spec/Gemfile +3 -2
- data/spec/Gemfile.lock +15 -2
- data/spec/rails3/app_root/.rspec +1 -0
- data/spec/rails3/{Gemfile → app_root/Gemfile} +5 -3
- data/spec/rails3/{Gemfile.lock → app_root/Gemfile.lock} +25 -2
- data/spec/rails3/app_root/app/controllers/application_controller.rb +48 -2
- data/spec/rails3/app_root/app/models/authentication.rb +3 -0
- data/spec/rails3/app_root/app/models/user.rb +4 -1
- data/spec/rails3/app_root/config/application.rb +1 -3
- data/spec/rails3/app_root/config/routes.rb +1 -9
- data/spec/rails3/app_root/db/migrate/activation/20101224223622_add_activation_to_users.rb +6 -4
- data/spec/rails3/app_root/db/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb +17 -0
- data/spec/rails3/app_root/db/migrate/brute_force_protection/20101224223626_add_brute_force_protection_to_users.rb +11 -0
- data/spec/rails3/app_root/db/migrate/core/20101224223620_create_users.rb +4 -4
- data/spec/rails3/app_root/db/migrate/oauth/20101224223628_create_authentications.rb +14 -0
- data/spec/rails3/app_root/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb +13 -0
- data/spec/rails3/app_root/spec/controller_activity_logging_spec.rb +84 -0
- data/spec/rails3/app_root/spec/controller_brute_force_protection_spec.rb +65 -0
- data/spec/rails3/app_root/spec/controller_http_basic_auth_spec.rb +50 -0
- data/spec/rails3/app_root/spec/controller_oauth2_spec.rb +117 -0
- data/spec/rails3/app_root/spec/controller_oauth_spec.rb +117 -0
- data/spec/rails3/{controller_remember_me_spec.rb → app_root/spec/controller_remember_me_spec.rb} +4 -4
- data/spec/rails3/{controller_session_timeout_spec.rb → app_root/spec/controller_session_timeout_spec.rb} +5 -4
- data/spec/rails3/{controller_spec.rb → app_root/spec/controller_spec.rb} +23 -16
- data/spec/rails3/app_root/spec/spec_helper.orig.rb +27 -0
- data/spec/rails3/app_root/spec/spec_helper.rb +61 -0
- data/spec/rails3/{user_activation_spec.rb → app_root/spec/user_activation_spec.rb} +62 -22
- data/spec/rails3/app_root/spec/user_activity_logging_spec.rb +36 -0
- data/spec/rails3/app_root/spec/user_brute_force_protection_spec.rb +76 -0
- data/spec/rails3/app_root/spec/user_oauth_spec.rb +39 -0
- data/spec/rails3/{user_remember_me_spec.rb → app_root/spec/user_remember_me_spec.rb} +4 -4
- data/spec/rails3/app_root/spec/user_reset_password_spec.rb +178 -0
- data/spec/rails3/{user_spec.rb → app_root/spec/user_spec.rb} +68 -38
- metadata +145 -61
- data/features/support/env.rb +0 -13
- data/lib/sorcery/model/submodules/password_reset.rb +0 -64
- data/spec/rails3/app_root/db/migrate/password_reset/20101224223622_add_password_reset_to_users.rb +0 -9
- data/spec/rails3/app_root/test/fixtures/users.yml +0 -9
- data/spec/rails3/app_root/test/performance/browsing_test.rb +0 -9
- data/spec/rails3/app_root/test/test_helper.rb +0 -13
- data/spec/rails3/app_root/test/unit/user_test.rb +0 -8
- data/spec/rails3/controller_brute_force_protection_spec.rb +0 -72
- data/spec/rails3/spec_helper.rb +0 -115
- data/spec/rails3/user_password_reset_spec.rb +0 -76
- /data/spec/rails3/{Rakefile → app_root/Rakefile} +0 -0
data/sorcery.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{sorcery}
|
|
8
|
-
s.version = "0.
|
|
8
|
+
s.version = "0.2.0"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Noam Ben Ari"]
|
|
12
|
-
s.date = %q{2011-
|
|
12
|
+
s.date = %q{2011-03-13}
|
|
13
13
|
s.description = %q{Provides common authentication needs such as signing in/out, activating by email and resetting password.}
|
|
14
14
|
s.email = %q{nbenari@gmail.com}
|
|
15
15
|
s.extra_rdoc_files = [
|
|
@@ -25,10 +25,16 @@ Gem::Specification.new do |s|
|
|
|
25
25
|
"README.rdoc",
|
|
26
26
|
"Rakefile",
|
|
27
27
|
"VERSION",
|
|
28
|
-
"features/support/env.rb",
|
|
29
28
|
"lib/sorcery.rb",
|
|
30
29
|
"lib/sorcery/controller.rb",
|
|
30
|
+
"lib/sorcery/controller/submodules/activity_logging.rb",
|
|
31
31
|
"lib/sorcery/controller/submodules/brute_force_protection.rb",
|
|
32
|
+
"lib/sorcery/controller/submodules/http_basic_auth.rb",
|
|
33
|
+
"lib/sorcery/controller/submodules/oauth.rb",
|
|
34
|
+
"lib/sorcery/controller/submodules/oauth/oauth1.rb",
|
|
35
|
+
"lib/sorcery/controller/submodules/oauth/oauth2.rb",
|
|
36
|
+
"lib/sorcery/controller/submodules/oauth/providers/facebook.rb",
|
|
37
|
+
"lib/sorcery/controller/submodules/oauth/providers/twitter.rb",
|
|
32
38
|
"lib/sorcery/controller/submodules/remember_me.rb",
|
|
33
39
|
"lib/sorcery/controller/submodules/session_timeout.rb",
|
|
34
40
|
"lib/sorcery/crypto_providers/aes256.rb",
|
|
@@ -39,23 +45,30 @@ Gem::Specification.new do |s|
|
|
|
39
45
|
"lib/sorcery/crypto_providers/sha512.rb",
|
|
40
46
|
"lib/sorcery/engine.rb",
|
|
41
47
|
"lib/sorcery/model.rb",
|
|
42
|
-
"lib/sorcery/model/submodules/
|
|
48
|
+
"lib/sorcery/model/submodules/activity_logging.rb",
|
|
49
|
+
"lib/sorcery/model/submodules/brute_force_protection.rb",
|
|
50
|
+
"lib/sorcery/model/submodules/oauth.rb",
|
|
43
51
|
"lib/sorcery/model/submodules/remember_me.rb",
|
|
52
|
+
"lib/sorcery/model/submodules/reset_password.rb",
|
|
44
53
|
"lib/sorcery/model/submodules/user_activation.rb",
|
|
54
|
+
"lib/sorcery/model/temporary_token.rb",
|
|
55
|
+
"lib/sorcery/test_helpers.rb",
|
|
45
56
|
"sorcery.gemspec",
|
|
46
57
|
"spec/Gemfile",
|
|
47
58
|
"spec/Gemfile.lock",
|
|
48
59
|
"spec/Rakefile",
|
|
49
60
|
"spec/rails3/.rspec",
|
|
50
|
-
"spec/rails3/Gemfile",
|
|
51
|
-
"spec/rails3/Gemfile.lock",
|
|
52
|
-
"spec/rails3/Rakefile",
|
|
53
61
|
"spec/rails3/app_root/.gitignore",
|
|
62
|
+
"spec/rails3/app_root/.rspec",
|
|
63
|
+
"spec/rails3/app_root/Gemfile",
|
|
64
|
+
"spec/rails3/app_root/Gemfile.lock",
|
|
54
65
|
"spec/rails3/app_root/README",
|
|
66
|
+
"spec/rails3/app_root/Rakefile",
|
|
55
67
|
"spec/rails3/app_root/Rakefile.unused",
|
|
56
68
|
"spec/rails3/app_root/app/controllers/application_controller.rb",
|
|
57
69
|
"spec/rails3/app_root/app/helpers/application_helper.rb",
|
|
58
70
|
"spec/rails3/app_root/app/mailers/sorcery_mailer.rb",
|
|
71
|
+
"spec/rails3/app_root/app/models/authentication.rb",
|
|
59
72
|
"spec/rails3/app_root/app/models/user.rb",
|
|
60
73
|
"spec/rails3/app_root/app/views/layouts/application.html.erb",
|
|
61
74
|
"spec/rails3/app_root/app/views/sorcery_mailer/activation_email.html.erb",
|
|
@@ -81,9 +94,12 @@ Gem::Specification.new do |s|
|
|
|
81
94
|
"spec/rails3/app_root/config/locales/en.yml",
|
|
82
95
|
"spec/rails3/app_root/config/routes.rb",
|
|
83
96
|
"spec/rails3/app_root/db/migrate/activation/20101224223622_add_activation_to_users.rb",
|
|
97
|
+
"spec/rails3/app_root/db/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb",
|
|
98
|
+
"spec/rails3/app_root/db/migrate/brute_force_protection/20101224223626_add_brute_force_protection_to_users.rb",
|
|
84
99
|
"spec/rails3/app_root/db/migrate/core/20101224223620_create_users.rb",
|
|
85
|
-
"spec/rails3/app_root/db/migrate/
|
|
100
|
+
"spec/rails3/app_root/db/migrate/oauth/20101224223628_create_authentications.rb",
|
|
86
101
|
"spec/rails3/app_root/db/migrate/remember_me/20101224223623_add_remember_me_token_to_users.rb",
|
|
102
|
+
"spec/rails3/app_root/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb",
|
|
87
103
|
"spec/rails3/app_root/db/schema.rb",
|
|
88
104
|
"spec/rails3/app_root/db/seeds.rb",
|
|
89
105
|
"spec/rails3/app_root/lib/tasks/.gitkeep",
|
|
@@ -102,32 +118,37 @@ Gem::Specification.new do |s|
|
|
|
102
118
|
"spec/rails3/app_root/public/robots.txt",
|
|
103
119
|
"spec/rails3/app_root/public/stylesheets/.gitkeep",
|
|
104
120
|
"spec/rails3/app_root/script/rails",
|
|
105
|
-
"spec/rails3/app_root/
|
|
106
|
-
"spec/rails3/app_root/
|
|
107
|
-
"spec/rails3/app_root/
|
|
108
|
-
"spec/rails3/app_root/
|
|
121
|
+
"spec/rails3/app_root/spec/controller_activity_logging_spec.rb",
|
|
122
|
+
"spec/rails3/app_root/spec/controller_brute_force_protection_spec.rb",
|
|
123
|
+
"spec/rails3/app_root/spec/controller_http_basic_auth_spec.rb",
|
|
124
|
+
"spec/rails3/app_root/spec/controller_oauth2_spec.rb",
|
|
125
|
+
"spec/rails3/app_root/spec/controller_oauth_spec.rb",
|
|
126
|
+
"spec/rails3/app_root/spec/controller_remember_me_spec.rb",
|
|
127
|
+
"spec/rails3/app_root/spec/controller_session_timeout_spec.rb",
|
|
128
|
+
"spec/rails3/app_root/spec/controller_spec.rb",
|
|
129
|
+
"spec/rails3/app_root/spec/spec_helper.orig.rb",
|
|
130
|
+
"spec/rails3/app_root/spec/spec_helper.rb",
|
|
131
|
+
"spec/rails3/app_root/spec/user_activation_spec.rb",
|
|
132
|
+
"spec/rails3/app_root/spec/user_activity_logging_spec.rb",
|
|
133
|
+
"spec/rails3/app_root/spec/user_brute_force_protection_spec.rb",
|
|
134
|
+
"spec/rails3/app_root/spec/user_oauth_spec.rb",
|
|
135
|
+
"spec/rails3/app_root/spec/user_remember_me_spec.rb",
|
|
136
|
+
"spec/rails3/app_root/spec/user_reset_password_spec.rb",
|
|
137
|
+
"spec/rails3/app_root/spec/user_spec.rb",
|
|
109
138
|
"spec/rails3/app_root/vendor/plugins/.gitkeep",
|
|
110
|
-
"spec/rails3/controller_brute_force_protection_spec.rb",
|
|
111
|
-
"spec/rails3/controller_remember_me_spec.rb",
|
|
112
|
-
"spec/rails3/controller_session_timeout_spec.rb",
|
|
113
|
-
"spec/rails3/controller_spec.rb",
|
|
114
|
-
"spec/rails3/spec_helper.rb",
|
|
115
|
-
"spec/rails3/user_activation_spec.rb",
|
|
116
|
-
"spec/rails3/user_password_reset_spec.rb",
|
|
117
|
-
"spec/rails3/user_remember_me_spec.rb",
|
|
118
|
-
"spec/rails3/user_spec.rb",
|
|
119
139
|
"spec/sorcery_crypto_providers_spec.rb",
|
|
120
140
|
"spec/spec_helper.rb"
|
|
121
141
|
]
|
|
122
142
|
s.homepage = %q{http://github.com/NoamB/sorcery}
|
|
123
143
|
s.licenses = ["MIT"]
|
|
124
144
|
s.require_paths = ["lib"]
|
|
125
|
-
s.rubygems_version = %q{1.
|
|
145
|
+
s.rubygems_version = %q{1.6.2}
|
|
126
146
|
s.summary = %q{Magical authentication for Rails 3 applications}
|
|
127
147
|
s.test_files = [
|
|
128
148
|
"spec/rails3/app_root/app/controllers/application_controller.rb",
|
|
129
149
|
"spec/rails3/app_root/app/helpers/application_helper.rb",
|
|
130
150
|
"spec/rails3/app_root/app/mailers/sorcery_mailer.rb",
|
|
151
|
+
"spec/rails3/app_root/app/models/authentication.rb",
|
|
131
152
|
"spec/rails3/app_root/app/models/user.rb",
|
|
132
153
|
"spec/rails3/app_root/config/application.rb",
|
|
133
154
|
"spec/rails3/app_root/config/boot.rb",
|
|
@@ -143,23 +164,31 @@ Gem::Specification.new do |s|
|
|
|
143
164
|
"spec/rails3/app_root/config/initializers/session_store.rb",
|
|
144
165
|
"spec/rails3/app_root/config/routes.rb",
|
|
145
166
|
"spec/rails3/app_root/db/migrate/activation/20101224223622_add_activation_to_users.rb",
|
|
167
|
+
"spec/rails3/app_root/db/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb",
|
|
168
|
+
"spec/rails3/app_root/db/migrate/brute_force_protection/20101224223626_add_brute_force_protection_to_users.rb",
|
|
146
169
|
"spec/rails3/app_root/db/migrate/core/20101224223620_create_users.rb",
|
|
147
|
-
"spec/rails3/app_root/db/migrate/
|
|
170
|
+
"spec/rails3/app_root/db/migrate/oauth/20101224223628_create_authentications.rb",
|
|
148
171
|
"spec/rails3/app_root/db/migrate/remember_me/20101224223623_add_remember_me_token_to_users.rb",
|
|
172
|
+
"spec/rails3/app_root/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb",
|
|
149
173
|
"spec/rails3/app_root/db/schema.rb",
|
|
150
174
|
"spec/rails3/app_root/db/seeds.rb",
|
|
151
|
-
"spec/rails3/app_root/
|
|
152
|
-
"spec/rails3/app_root/
|
|
153
|
-
"spec/rails3/app_root/
|
|
154
|
-
"spec/rails3/
|
|
155
|
-
"spec/rails3/
|
|
156
|
-
"spec/rails3/
|
|
157
|
-
"spec/rails3/
|
|
158
|
-
"spec/rails3/
|
|
159
|
-
"spec/rails3/
|
|
160
|
-
"spec/rails3/
|
|
161
|
-
"spec/rails3/
|
|
162
|
-
"spec/rails3/
|
|
175
|
+
"spec/rails3/app_root/spec/controller_activity_logging_spec.rb",
|
|
176
|
+
"spec/rails3/app_root/spec/controller_brute_force_protection_spec.rb",
|
|
177
|
+
"spec/rails3/app_root/spec/controller_http_basic_auth_spec.rb",
|
|
178
|
+
"spec/rails3/app_root/spec/controller_oauth2_spec.rb",
|
|
179
|
+
"spec/rails3/app_root/spec/controller_oauth_spec.rb",
|
|
180
|
+
"spec/rails3/app_root/spec/controller_remember_me_spec.rb",
|
|
181
|
+
"spec/rails3/app_root/spec/controller_session_timeout_spec.rb",
|
|
182
|
+
"spec/rails3/app_root/spec/controller_spec.rb",
|
|
183
|
+
"spec/rails3/app_root/spec/spec_helper.orig.rb",
|
|
184
|
+
"spec/rails3/app_root/spec/spec_helper.rb",
|
|
185
|
+
"spec/rails3/app_root/spec/user_activation_spec.rb",
|
|
186
|
+
"spec/rails3/app_root/spec/user_activity_logging_spec.rb",
|
|
187
|
+
"spec/rails3/app_root/spec/user_brute_force_protection_spec.rb",
|
|
188
|
+
"spec/rails3/app_root/spec/user_oauth_spec.rb",
|
|
189
|
+
"spec/rails3/app_root/spec/user_remember_me_spec.rb",
|
|
190
|
+
"spec/rails3/app_root/spec/user_reset_password_spec.rb",
|
|
191
|
+
"spec/rails3/app_root/spec/user_spec.rb",
|
|
163
192
|
"spec/sorcery_crypto_providers_spec.rb",
|
|
164
193
|
"spec/spec_helper.rb"
|
|
165
194
|
]
|
|
@@ -168,39 +197,54 @@ Gem::Specification.new do |s|
|
|
|
168
197
|
s.specification_version = 3
|
|
169
198
|
|
|
170
199
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
171
|
-
s.
|
|
200
|
+
s.add_runtime_dependency(%q<rails>, [">= 3.0.0"])
|
|
201
|
+
s.add_runtime_dependency(%q<json>, [">= 1.5.1"])
|
|
202
|
+
s.add_runtime_dependency(%q<oauth>, [">= 0.4.4"])
|
|
203
|
+
s.add_runtime_dependency(%q<oauth2>, [">= 0.1.1"])
|
|
172
204
|
s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
|
|
173
205
|
s.add_development_dependency(%q<rspec-rails>, [">= 0"])
|
|
174
206
|
s.add_development_dependency(%q<ruby-debug19>, [">= 0"])
|
|
175
207
|
s.add_development_dependency(%q<sqlite3-ruby>, [">= 0"])
|
|
176
208
|
s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
|
|
177
|
-
s.add_development_dependency(%q<cucumber>, [">= 0"])
|
|
178
209
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
|
179
210
|
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
|
180
211
|
s.add_development_dependency(%q<simplecov>, [">= 0.3.8"])
|
|
212
|
+
s.add_runtime_dependency(%q<bcrypt-ruby>, ["~> 2.1.4"])
|
|
213
|
+
s.add_runtime_dependency(%q<oauth>, [">= 0.4.4"])
|
|
214
|
+
s.add_runtime_dependency(%q<oauth2>, [">= 0.1.1"])
|
|
181
215
|
else
|
|
182
|
-
s.add_dependency(%q<rails>, ["
|
|
216
|
+
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
|
217
|
+
s.add_dependency(%q<json>, [">= 1.5.1"])
|
|
218
|
+
s.add_dependency(%q<oauth>, [">= 0.4.4"])
|
|
219
|
+
s.add_dependency(%q<oauth2>, [">= 0.1.1"])
|
|
183
220
|
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
|
184
221
|
s.add_dependency(%q<rspec-rails>, [">= 0"])
|
|
185
222
|
s.add_dependency(%q<ruby-debug19>, [">= 0"])
|
|
186
223
|
s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
|
|
187
224
|
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
|
188
|
-
s.add_dependency(%q<cucumber>, [">= 0"])
|
|
189
225
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
|
190
226
|
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
|
191
227
|
s.add_dependency(%q<simplecov>, [">= 0.3.8"])
|
|
228
|
+
s.add_dependency(%q<bcrypt-ruby>, ["~> 2.1.4"])
|
|
229
|
+
s.add_dependency(%q<oauth>, [">= 0.4.4"])
|
|
230
|
+
s.add_dependency(%q<oauth2>, [">= 0.1.1"])
|
|
192
231
|
end
|
|
193
232
|
else
|
|
194
|
-
s.add_dependency(%q<rails>, ["
|
|
233
|
+
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
|
234
|
+
s.add_dependency(%q<json>, [">= 1.5.1"])
|
|
235
|
+
s.add_dependency(%q<oauth>, [">= 0.4.4"])
|
|
236
|
+
s.add_dependency(%q<oauth2>, [">= 0.1.1"])
|
|
195
237
|
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
|
196
238
|
s.add_dependency(%q<rspec-rails>, [">= 0"])
|
|
197
239
|
s.add_dependency(%q<ruby-debug19>, [">= 0"])
|
|
198
240
|
s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
|
|
199
241
|
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
|
200
|
-
s.add_dependency(%q<cucumber>, [">= 0"])
|
|
201
242
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
|
202
243
|
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
|
203
244
|
s.add_dependency(%q<simplecov>, [">= 0.3.8"])
|
|
245
|
+
s.add_dependency(%q<bcrypt-ruby>, ["~> 2.1.4"])
|
|
246
|
+
s.add_dependency(%q<oauth>, [">= 0.4.4"])
|
|
247
|
+
s.add_dependency(%q<oauth2>, [">= 0.1.1"])
|
|
204
248
|
end
|
|
205
249
|
end
|
|
206
250
|
|
data/spec/Gemfile
CHANGED
|
@@ -2,8 +2,9 @@ source 'http://rubygems.org'
|
|
|
2
2
|
|
|
3
3
|
gem "rails", '3.0.3'
|
|
4
4
|
gem 'bcrypt-ruby', :require => 'bcrypt'
|
|
5
|
-
gem "sorcery", '0.1.
|
|
6
|
-
|
|
5
|
+
gem "sorcery", '0.1.4', :path => '../../../'
|
|
6
|
+
gem 'oauth', ">= 0.4.4"
|
|
7
|
+
gem 'oauth2', ">= 0.1.1"
|
|
7
8
|
group :development do
|
|
8
9
|
gem 'rspec'
|
|
9
10
|
gem 'ruby-debug19'
|
data/spec/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ../../../
|
|
3
3
|
specs:
|
|
4
|
-
sorcery (0.1.
|
|
4
|
+
sorcery (0.1.4)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: http://rubygems.org/
|
|
@@ -33,6 +33,7 @@ GEM
|
|
|
33
33
|
activemodel (= 3.0.3)
|
|
34
34
|
activesupport (= 3.0.3)
|
|
35
35
|
activesupport (3.0.3)
|
|
36
|
+
addressable (2.2.4)
|
|
36
37
|
archive-tar-minitar (0.5.2)
|
|
37
38
|
arel (2.0.6)
|
|
38
39
|
bcrypt-ruby (2.1.3)
|
|
@@ -41,6 +42,10 @@ GEM
|
|
|
41
42
|
diff-lcs (1.1.2)
|
|
42
43
|
erubis (2.6.6)
|
|
43
44
|
abstract (>= 1.0.0)
|
|
45
|
+
faraday (0.5.5)
|
|
46
|
+
addressable (~> 2.2.4)
|
|
47
|
+
multipart-post (~> 1.1.0)
|
|
48
|
+
rack (< 2, >= 1.1.0)
|
|
44
49
|
i18n (0.5.0)
|
|
45
50
|
linecache19 (0.5.11)
|
|
46
51
|
ruby_core_source (>= 0.1.4)
|
|
@@ -50,6 +55,12 @@ GEM
|
|
|
50
55
|
mime-types (~> 1.16)
|
|
51
56
|
treetop (~> 1.4.8)
|
|
52
57
|
mime-types (1.16)
|
|
58
|
+
multi_json (0.0.5)
|
|
59
|
+
multipart-post (1.1.0)
|
|
60
|
+
oauth (0.4.4)
|
|
61
|
+
oauth2 (0.1.1)
|
|
62
|
+
faraday (~> 0.5.0)
|
|
63
|
+
multi_json (~> 0.0.4)
|
|
53
64
|
polyglot (0.3.1)
|
|
54
65
|
rack (1.2.1)
|
|
55
66
|
rack-mount (0.6.13)
|
|
@@ -101,8 +112,10 @@ PLATFORMS
|
|
|
101
112
|
|
|
102
113
|
DEPENDENCIES
|
|
103
114
|
bcrypt-ruby
|
|
115
|
+
oauth (>= 0.4.4)
|
|
116
|
+
oauth2 (>= 0.1.1)
|
|
104
117
|
rails (= 3.0.3)
|
|
105
118
|
rspec
|
|
106
119
|
ruby-debug19
|
|
107
120
|
simplecov (>= 0.3.8)
|
|
108
|
-
sorcery (= 0.1.
|
|
121
|
+
sorcery (= 0.1.4)!
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--colour
|
|
@@ -2,12 +2,14 @@ source 'http://rubygems.org'
|
|
|
2
2
|
|
|
3
3
|
gem 'rails', '3.0.3'
|
|
4
4
|
gem 'sqlite3-ruby', :require => 'sqlite3'
|
|
5
|
-
gem "sorcery", '0.1.
|
|
5
|
+
gem "sorcery", '0.1.4', :path => '../../../'
|
|
6
6
|
gem 'bcrypt-ruby', '~> 2.1.4', :require => 'bcrypt'
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
gem 'oauth', ">= 0.4.4"
|
|
8
|
+
gem 'oauth2', ">= 0.1.1"
|
|
9
|
+
group :development, :test do
|
|
9
10
|
gem 'rspec'
|
|
10
11
|
gem 'rspec-rails'
|
|
11
12
|
gem 'ruby-debug19'
|
|
12
13
|
gem 'simplecov', '>= 0.3.8', :require => false # Will install simplecov-html as a dependency
|
|
14
|
+
gem 'spork', '~> 0.9.0.rc'
|
|
13
15
|
end
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ../../../
|
|
3
3
|
specs:
|
|
4
|
-
sorcery (0.1.
|
|
4
|
+
sorcery (0.1.4)
|
|
5
|
+
bcrypt-ruby (~> 2.1.4)
|
|
6
|
+
json (>= 1.5.1)
|
|
7
|
+
oauth (>= 0.4.4)
|
|
8
|
+
oauth (>= 0.4.4)
|
|
9
|
+
oauth2 (>= 0.1.1)
|
|
10
|
+
oauth2 (>= 0.1.1)
|
|
11
|
+
rails (>= 3.0.0)
|
|
5
12
|
|
|
6
13
|
GEM
|
|
7
14
|
remote: http://rubygems.org/
|
|
@@ -33,6 +40,7 @@ GEM
|
|
|
33
40
|
activemodel (= 3.0.3)
|
|
34
41
|
activesupport (= 3.0.3)
|
|
35
42
|
activesupport (3.0.3)
|
|
43
|
+
addressable (2.2.4)
|
|
36
44
|
archive-tar-minitar (0.5.2)
|
|
37
45
|
arel (2.0.6)
|
|
38
46
|
bcrypt-ruby (2.1.4)
|
|
@@ -41,7 +49,12 @@ GEM
|
|
|
41
49
|
diff-lcs (1.1.2)
|
|
42
50
|
erubis (2.6.6)
|
|
43
51
|
abstract (>= 1.0.0)
|
|
52
|
+
faraday (0.5.5)
|
|
53
|
+
addressable (~> 2.2.4)
|
|
54
|
+
multipart-post (~> 1.1.0)
|
|
55
|
+
rack (< 2, >= 1.1.0)
|
|
44
56
|
i18n (0.5.0)
|
|
57
|
+
json (1.5.1)
|
|
45
58
|
linecache19 (0.5.11)
|
|
46
59
|
ruby_core_source (>= 0.1.4)
|
|
47
60
|
mail (2.2.13)
|
|
@@ -50,6 +63,12 @@ GEM
|
|
|
50
63
|
mime-types (~> 1.16)
|
|
51
64
|
treetop (~> 1.4.8)
|
|
52
65
|
mime-types (1.16)
|
|
66
|
+
multi_json (0.0.5)
|
|
67
|
+
multipart-post (1.1.0)
|
|
68
|
+
oauth (0.4.4)
|
|
69
|
+
oauth2 (0.1.1)
|
|
70
|
+
faraday (~> 0.5.0)
|
|
71
|
+
multi_json (~> 0.0.4)
|
|
53
72
|
polyglot (0.3.1)
|
|
54
73
|
rack (1.2.1)
|
|
55
74
|
rack-mount (0.6.13)
|
|
@@ -96,6 +115,7 @@ GEM
|
|
|
96
115
|
simplecov (0.3.9)
|
|
97
116
|
simplecov-html (>= 0.3.7)
|
|
98
117
|
simplecov-html (0.3.9)
|
|
118
|
+
spork (0.9.0.rc3)
|
|
99
119
|
sqlite3-ruby (1.3.2)
|
|
100
120
|
thor (0.14.6)
|
|
101
121
|
treetop (1.4.9)
|
|
@@ -107,10 +127,13 @@ PLATFORMS
|
|
|
107
127
|
|
|
108
128
|
DEPENDENCIES
|
|
109
129
|
bcrypt-ruby (~> 2.1.4)
|
|
130
|
+
oauth (>= 0.4.4)
|
|
131
|
+
oauth2 (>= 0.1.1)
|
|
110
132
|
rails (= 3.0.3)
|
|
111
133
|
rspec
|
|
112
134
|
rspec-rails
|
|
113
135
|
ruby-debug19
|
|
114
136
|
simplecov (>= 0.3.8)
|
|
115
|
-
sorcery (= 0.1.
|
|
137
|
+
sorcery (= 0.1.4)!
|
|
138
|
+
spork (~> 0.9.0.rc)
|
|
116
139
|
sqlite3-ruby
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
require 'oauth'
|
|
2
|
+
|
|
1
3
|
class ApplicationController < ActionController::Base
|
|
2
4
|
protect_from_forgery
|
|
3
5
|
|
|
4
6
|
#before_filter :validate_session, :only => [:test_should_be_logged_in] if defined?(:validate_session)
|
|
5
|
-
before_filter :
|
|
7
|
+
before_filter :require_login_from_http_basic, :only => [:test_http_basic_auth]
|
|
8
|
+
before_filter :require_login, :only => [:test_logout, :test_should_be_logged_in, :some_action]
|
|
6
9
|
|
|
7
10
|
def index
|
|
8
11
|
render :text => ""
|
|
@@ -17,6 +20,11 @@ class ApplicationController < ActionController::Base
|
|
|
17
20
|
render :text => ""
|
|
18
21
|
end
|
|
19
22
|
|
|
23
|
+
def test_return_to
|
|
24
|
+
@user = login(params[:username], params[:password])
|
|
25
|
+
return_or_redirect_to(:index, :notice => 'haha!')
|
|
26
|
+
end
|
|
27
|
+
|
|
20
28
|
def test_logout
|
|
21
29
|
logout
|
|
22
30
|
render :text => ""
|
|
@@ -42,7 +50,7 @@ class ApplicationController < ActionController::Base
|
|
|
42
50
|
end
|
|
43
51
|
|
|
44
52
|
def test_login_from_cookie
|
|
45
|
-
@user =
|
|
53
|
+
@user = current_user
|
|
46
54
|
render :text => ""
|
|
47
55
|
end
|
|
48
56
|
|
|
@@ -54,6 +62,44 @@ class ApplicationController < ActionController::Base
|
|
|
54
62
|
render :text => ""
|
|
55
63
|
end
|
|
56
64
|
|
|
65
|
+
def test_http_basic_auth
|
|
66
|
+
render :text => "HTTP Basic Auth"
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def auth_at_provider_test
|
|
70
|
+
auth_at_provider(:twitter)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def auth_at_provider_test2
|
|
74
|
+
auth_at_provider(:facebook)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def test_login_from_access_token
|
|
78
|
+
if @user = login_from_access_token(:twitter)
|
|
79
|
+
redirect_to "bla", :notice => "Success!"
|
|
80
|
+
else
|
|
81
|
+
redirect_to "blu", :alert => "Failed!"
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def test_login_from_access_token2
|
|
86
|
+
if @user = login_from_access_token(:facebook)
|
|
87
|
+
redirect_to "bla", :notice => "Success!"
|
|
88
|
+
else
|
|
89
|
+
redirect_to "blu", :alert => "Failed!"
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def test_create_from_provider
|
|
94
|
+
provider = params[:provider]
|
|
95
|
+
login_from_access_token(provider)
|
|
96
|
+
if @user = create_from_provider!(provider)
|
|
97
|
+
redirect_to "bla", :notice => "Success!"
|
|
98
|
+
else
|
|
99
|
+
redirect_to "blu", :alert => "Failed!"
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
57
103
|
protected
|
|
58
104
|
|
|
59
105
|
|
|
@@ -38,9 +38,7 @@ module AppRoot
|
|
|
38
38
|
|
|
39
39
|
# Configure sensitive parameters which will be filtered from the log file.
|
|
40
40
|
config.filter_parameters += [:password]
|
|
41
|
-
|
|
42
|
-
config.root = File.expand_path('../..', __FILE__)
|
|
43
|
-
|
|
41
|
+
|
|
44
42
|
config.action_mailer.delivery_method = :test
|
|
45
43
|
|
|
46
44
|
config.active_support.deprecation = :stderr
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
AppRoot::Application.routes.draw do
|
|
2
2
|
root :to => "application#index"
|
|
3
|
-
match '/test_login', :to => "application#test_login"
|
|
4
|
-
match '/test_logout', :to => "application#test_logout"
|
|
5
|
-
match '/some_action', :to => "application#some_action"
|
|
6
|
-
match '/test_logout_with_remember', :to => "application#test_logout_with_remember"
|
|
7
|
-
match '/test_login_with_remember', :to => 'application#test_login_with_remember'
|
|
8
|
-
match '/test_login_with_remember_in_login', :to => 'application#test_login_with_remember_in_login'
|
|
9
|
-
match '/test_login_from_cookie', :to => 'application#test_login_from_cookie'
|
|
10
|
-
match '/test_should_be_logged_in', :to => 'application#test_should_be_logged_in'
|
|
11
3
|
# The priority is based upon order of creation:
|
|
12
4
|
# first created -> highest priority.
|
|
13
5
|
|
|
@@ -63,5 +55,5 @@ AppRoot::Application.routes.draw do
|
|
|
63
55
|
|
|
64
56
|
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
|
65
57
|
# Note: This route will make all actions in every controller accessible via GET requests.
|
|
66
|
-
|
|
58
|
+
match ':controller(/:action(/:id(.:format)))'
|
|
67
59
|
end
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
class AddActivationToUsers < ActiveRecord::Migration
|
|
2
2
|
def self.up
|
|
3
3
|
add_column :users, :activation_state, :string, :default => nil
|
|
4
|
-
add_column :users, :
|
|
4
|
+
add_column :users, :activation_token, :string, :default => nil
|
|
5
|
+
add_column :users, :activation_token_expires_at, :datetime, :default => nil
|
|
5
6
|
|
|
6
|
-
add_index :users, :
|
|
7
|
+
add_index :users, :activation_token
|
|
7
8
|
end
|
|
8
9
|
|
|
9
10
|
def self.down
|
|
10
|
-
remove_index :users, :
|
|
11
|
+
remove_index :users, :activation_token
|
|
11
12
|
|
|
12
|
-
remove_column :users, :
|
|
13
|
+
remove_column :users, :activation_token_expires_at
|
|
14
|
+
remove_column :users, :activation_token
|
|
13
15
|
remove_column :users, :activation_state
|
|
14
16
|
end
|
|
15
17
|
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class AddActivityLoggingToUsers < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
add_column :users, :last_login_at, :datetime, :default => nil
|
|
4
|
+
add_column :users, :last_logout_at, :datetime, :default => nil
|
|
5
|
+
add_column :users, :last_activity_at, :datetime, :default => nil
|
|
6
|
+
|
|
7
|
+
add_index :users, [:last_logout_at, :last_activity_at]
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def self.down
|
|
11
|
+
remove_index :users, [:last_logout_at, :last_activity_at]
|
|
12
|
+
|
|
13
|
+
remove_column :users, :last_activity_at
|
|
14
|
+
remove_column :users, :last_logout_at
|
|
15
|
+
remove_column :users, :last_login_at
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
class AddBruteForceProtectionToUsers < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
add_column :users, :failed_logins_count, :integer, :default => 0
|
|
4
|
+
add_column :users, :lock_expires_at, :datetime, :default => nil
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def self.down
|
|
8
|
+
remove_column :users, :lock_expires_at
|
|
9
|
+
remove_column :users, :failed_logins_count
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
class CreateUsers < ActiveRecord::Migration
|
|
2
2
|
def self.up
|
|
3
3
|
create_table :users do |t|
|
|
4
|
-
t.string :username
|
|
5
|
-
t.string :email,
|
|
6
|
-
t.string :crypted_password
|
|
7
|
-
t.string :salt
|
|
4
|
+
t.string :username, :null => false
|
|
5
|
+
t.string :email, :default => nil
|
|
6
|
+
t.string :crypted_password, :default => nil
|
|
7
|
+
t.string :salt, :default => nil
|
|
8
8
|
|
|
9
9
|
t.timestamps
|
|
10
10
|
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
class CreateAuthentications < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :authentications do |t|
|
|
4
|
+
t.integer :user_id, :null => false
|
|
5
|
+
t.string :provider, :uid, :null => false
|
|
6
|
+
|
|
7
|
+
t.timestamps
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.down
|
|
12
|
+
drop_table :authentications
|
|
13
|
+
end
|
|
14
|
+
end
|
data/spec/rails3/app_root/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class AddResetPasswordToUsers < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
add_column :users, :reset_password_token, :string, :default => nil
|
|
4
|
+
add_column :users, :reset_password_token_expires_at, :datetime, :default => nil
|
|
5
|
+
add_column :users, :reset_password_email_sent_at, :datetime, :default => nil
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def self.down
|
|
9
|
+
remove_column :users, :reset_password_email_sent_at
|
|
10
|
+
remove_column :users, :reset_password_token_expires_at
|
|
11
|
+
remove_column :users, :reset_password_token
|
|
12
|
+
end
|
|
13
|
+
end
|