sorcery 0.1.3 → 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 +53 -36
- 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 +13 -5
- 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 +1 -5
- 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 +40 -19
- data/lib/sorcery/model/temporary_token.rb +22 -0
- data/lib/sorcery/model.rb +10 -3
- data/lib/sorcery/test_helpers.rb +84 -0
- data/lib/sorcery.rb +16 -1
- data/sorcery.gemspec +84 -43
- 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 +44 -3
- 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 -10
- 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/{controller_http_basic_auth_spec.rb → app_root/spec/controller_http_basic_auth_spec.rb} +13 -3
- 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} +60 -20
- 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 +144 -63
- 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
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.2.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-
|
|
13
|
+
date: 2011-03-13 00:00:00 +02:00
|
|
14
14
|
default_executable:
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
@@ -18,69 +18,69 @@ dependencies:
|
|
|
18
18
|
requirement: &id001 !ruby/object:Gem::Requirement
|
|
19
19
|
none: false
|
|
20
20
|
requirements:
|
|
21
|
-
- - "
|
|
21
|
+
- - ">="
|
|
22
22
|
- !ruby/object:Gem::Version
|
|
23
|
-
version: 3.0.
|
|
24
|
-
type: :
|
|
23
|
+
version: 3.0.0
|
|
24
|
+
type: :runtime
|
|
25
25
|
prerelease: false
|
|
26
26
|
version_requirements: *id001
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
28
|
+
name: json
|
|
29
29
|
requirement: &id002 !ruby/object:Gem::Requirement
|
|
30
30
|
none: false
|
|
31
31
|
requirements:
|
|
32
|
-
- -
|
|
32
|
+
- - ">="
|
|
33
33
|
- !ruby/object:Gem::Version
|
|
34
|
-
version:
|
|
35
|
-
type: :
|
|
34
|
+
version: 1.5.1
|
|
35
|
+
type: :runtime
|
|
36
36
|
prerelease: false
|
|
37
37
|
version_requirements: *id002
|
|
38
38
|
- !ruby/object:Gem::Dependency
|
|
39
|
-
name:
|
|
39
|
+
name: oauth
|
|
40
40
|
requirement: &id003 !ruby/object:Gem::Requirement
|
|
41
41
|
none: false
|
|
42
42
|
requirements:
|
|
43
43
|
- - ">="
|
|
44
44
|
- !ruby/object:Gem::Version
|
|
45
|
-
version:
|
|
46
|
-
type: :
|
|
45
|
+
version: 0.4.4
|
|
46
|
+
type: :runtime
|
|
47
47
|
prerelease: false
|
|
48
48
|
version_requirements: *id003
|
|
49
49
|
- !ruby/object:Gem::Dependency
|
|
50
|
-
name:
|
|
50
|
+
name: oauth2
|
|
51
51
|
requirement: &id004 !ruby/object:Gem::Requirement
|
|
52
52
|
none: false
|
|
53
53
|
requirements:
|
|
54
54
|
- - ">="
|
|
55
55
|
- !ruby/object:Gem::Version
|
|
56
|
-
version:
|
|
57
|
-
type: :
|
|
56
|
+
version: 0.1.1
|
|
57
|
+
type: :runtime
|
|
58
58
|
prerelease: false
|
|
59
59
|
version_requirements: *id004
|
|
60
60
|
- !ruby/object:Gem::Dependency
|
|
61
|
-
name:
|
|
61
|
+
name: rspec
|
|
62
62
|
requirement: &id005 !ruby/object:Gem::Requirement
|
|
63
63
|
none: false
|
|
64
64
|
requirements:
|
|
65
|
-
- -
|
|
65
|
+
- - ~>
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
|
-
version:
|
|
67
|
+
version: 2.3.0
|
|
68
68
|
type: :development
|
|
69
69
|
prerelease: false
|
|
70
70
|
version_requirements: *id005
|
|
71
71
|
- !ruby/object:Gem::Dependency
|
|
72
|
-
name:
|
|
72
|
+
name: rspec-rails
|
|
73
73
|
requirement: &id006 !ruby/object:Gem::Requirement
|
|
74
74
|
none: false
|
|
75
75
|
requirements:
|
|
76
|
-
- -
|
|
76
|
+
- - ">="
|
|
77
77
|
- !ruby/object:Gem::Version
|
|
78
|
-
version: 0
|
|
78
|
+
version: "0"
|
|
79
79
|
type: :development
|
|
80
80
|
prerelease: false
|
|
81
81
|
version_requirements: *id006
|
|
82
82
|
- !ruby/object:Gem::Dependency
|
|
83
|
-
name:
|
|
83
|
+
name: ruby-debug19
|
|
84
84
|
requirement: &id007 !ruby/object:Gem::Requirement
|
|
85
85
|
none: false
|
|
86
86
|
requirements:
|
|
@@ -91,8 +91,30 @@ dependencies:
|
|
|
91
91
|
prerelease: false
|
|
92
92
|
version_requirements: *id007
|
|
93
93
|
- !ruby/object:Gem::Dependency
|
|
94
|
-
name:
|
|
94
|
+
name: sqlite3-ruby
|
|
95
95
|
requirement: &id008 !ruby/object:Gem::Requirement
|
|
96
|
+
none: false
|
|
97
|
+
requirements:
|
|
98
|
+
- - ">="
|
|
99
|
+
- !ruby/object:Gem::Version
|
|
100
|
+
version: "0"
|
|
101
|
+
type: :development
|
|
102
|
+
prerelease: false
|
|
103
|
+
version_requirements: *id008
|
|
104
|
+
- !ruby/object:Gem::Dependency
|
|
105
|
+
name: yard
|
|
106
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
|
107
|
+
none: false
|
|
108
|
+
requirements:
|
|
109
|
+
- - ~>
|
|
110
|
+
- !ruby/object:Gem::Version
|
|
111
|
+
version: 0.6.0
|
|
112
|
+
type: :development
|
|
113
|
+
prerelease: false
|
|
114
|
+
version_requirements: *id009
|
|
115
|
+
- !ruby/object:Gem::Dependency
|
|
116
|
+
name: bundler
|
|
117
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
|
96
118
|
none: false
|
|
97
119
|
requirements:
|
|
98
120
|
- - ~>
|
|
@@ -100,10 +122,10 @@ dependencies:
|
|
|
100
122
|
version: 1.0.0
|
|
101
123
|
type: :development
|
|
102
124
|
prerelease: false
|
|
103
|
-
version_requirements: *
|
|
125
|
+
version_requirements: *id010
|
|
104
126
|
- !ruby/object:Gem::Dependency
|
|
105
127
|
name: jeweler
|
|
106
|
-
requirement: &
|
|
128
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
|
107
129
|
none: false
|
|
108
130
|
requirements:
|
|
109
131
|
- - ~>
|
|
@@ -111,10 +133,10 @@ dependencies:
|
|
|
111
133
|
version: 1.5.2
|
|
112
134
|
type: :development
|
|
113
135
|
prerelease: false
|
|
114
|
-
version_requirements: *
|
|
136
|
+
version_requirements: *id011
|
|
115
137
|
- !ruby/object:Gem::Dependency
|
|
116
138
|
name: simplecov
|
|
117
|
-
requirement: &
|
|
139
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
|
118
140
|
none: false
|
|
119
141
|
requirements:
|
|
120
142
|
- - ">="
|
|
@@ -122,7 +144,40 @@ dependencies:
|
|
|
122
144
|
version: 0.3.8
|
|
123
145
|
type: :development
|
|
124
146
|
prerelease: false
|
|
125
|
-
version_requirements: *
|
|
147
|
+
version_requirements: *id012
|
|
148
|
+
- !ruby/object:Gem::Dependency
|
|
149
|
+
name: bcrypt-ruby
|
|
150
|
+
requirement: &id013 !ruby/object:Gem::Requirement
|
|
151
|
+
none: false
|
|
152
|
+
requirements:
|
|
153
|
+
- - ~>
|
|
154
|
+
- !ruby/object:Gem::Version
|
|
155
|
+
version: 2.1.4
|
|
156
|
+
type: :runtime
|
|
157
|
+
prerelease: false
|
|
158
|
+
version_requirements: *id013
|
|
159
|
+
- !ruby/object:Gem::Dependency
|
|
160
|
+
name: oauth
|
|
161
|
+
requirement: &id014 !ruby/object:Gem::Requirement
|
|
162
|
+
none: false
|
|
163
|
+
requirements:
|
|
164
|
+
- - ">="
|
|
165
|
+
- !ruby/object:Gem::Version
|
|
166
|
+
version: 0.4.4
|
|
167
|
+
type: :runtime
|
|
168
|
+
prerelease: false
|
|
169
|
+
version_requirements: *id014
|
|
170
|
+
- !ruby/object:Gem::Dependency
|
|
171
|
+
name: oauth2
|
|
172
|
+
requirement: &id015 !ruby/object:Gem::Requirement
|
|
173
|
+
none: false
|
|
174
|
+
requirements:
|
|
175
|
+
- - ">="
|
|
176
|
+
- !ruby/object:Gem::Version
|
|
177
|
+
version: 0.1.1
|
|
178
|
+
type: :runtime
|
|
179
|
+
prerelease: false
|
|
180
|
+
version_requirements: *id015
|
|
126
181
|
description: Provides common authentication needs such as signing in/out, activating by email and resetting password.
|
|
127
182
|
email: nbenari@gmail.com
|
|
128
183
|
executables: []
|
|
@@ -141,11 +196,16 @@ files:
|
|
|
141
196
|
- README.rdoc
|
|
142
197
|
- Rakefile
|
|
143
198
|
- VERSION
|
|
144
|
-
- features/support/env.rb
|
|
145
199
|
- lib/sorcery.rb
|
|
146
200
|
- lib/sorcery/controller.rb
|
|
201
|
+
- lib/sorcery/controller/submodules/activity_logging.rb
|
|
147
202
|
- lib/sorcery/controller/submodules/brute_force_protection.rb
|
|
148
203
|
- lib/sorcery/controller/submodules/http_basic_auth.rb
|
|
204
|
+
- lib/sorcery/controller/submodules/oauth.rb
|
|
205
|
+
- lib/sorcery/controller/submodules/oauth/oauth1.rb
|
|
206
|
+
- lib/sorcery/controller/submodules/oauth/oauth2.rb
|
|
207
|
+
- lib/sorcery/controller/submodules/oauth/providers/facebook.rb
|
|
208
|
+
- lib/sorcery/controller/submodules/oauth/providers/twitter.rb
|
|
149
209
|
- lib/sorcery/controller/submodules/remember_me.rb
|
|
150
210
|
- lib/sorcery/controller/submodules/session_timeout.rb
|
|
151
211
|
- lib/sorcery/crypto_providers/aes256.rb
|
|
@@ -156,23 +216,30 @@ files:
|
|
|
156
216
|
- lib/sorcery/crypto_providers/sha512.rb
|
|
157
217
|
- lib/sorcery/engine.rb
|
|
158
218
|
- lib/sorcery/model.rb
|
|
159
|
-
- lib/sorcery/model/submodules/
|
|
219
|
+
- lib/sorcery/model/submodules/activity_logging.rb
|
|
220
|
+
- lib/sorcery/model/submodules/brute_force_protection.rb
|
|
221
|
+
- lib/sorcery/model/submodules/oauth.rb
|
|
160
222
|
- lib/sorcery/model/submodules/remember_me.rb
|
|
223
|
+
- lib/sorcery/model/submodules/reset_password.rb
|
|
161
224
|
- lib/sorcery/model/submodules/user_activation.rb
|
|
225
|
+
- lib/sorcery/model/temporary_token.rb
|
|
226
|
+
- lib/sorcery/test_helpers.rb
|
|
162
227
|
- sorcery.gemspec
|
|
163
228
|
- spec/Gemfile
|
|
164
229
|
- spec/Gemfile.lock
|
|
165
230
|
- spec/Rakefile
|
|
166
231
|
- spec/rails3/.rspec
|
|
167
|
-
- spec/rails3/Gemfile
|
|
168
|
-
- spec/rails3/Gemfile.lock
|
|
169
|
-
- spec/rails3/Rakefile
|
|
170
232
|
- spec/rails3/app_root/.gitignore
|
|
233
|
+
- spec/rails3/app_root/.rspec
|
|
234
|
+
- spec/rails3/app_root/Gemfile
|
|
235
|
+
- spec/rails3/app_root/Gemfile.lock
|
|
171
236
|
- spec/rails3/app_root/README
|
|
237
|
+
- spec/rails3/app_root/Rakefile
|
|
172
238
|
- spec/rails3/app_root/Rakefile.unused
|
|
173
239
|
- spec/rails3/app_root/app/controllers/application_controller.rb
|
|
174
240
|
- spec/rails3/app_root/app/helpers/application_helper.rb
|
|
175
241
|
- spec/rails3/app_root/app/mailers/sorcery_mailer.rb
|
|
242
|
+
- spec/rails3/app_root/app/models/authentication.rb
|
|
176
243
|
- spec/rails3/app_root/app/models/user.rb
|
|
177
244
|
- spec/rails3/app_root/app/views/layouts/application.html.erb
|
|
178
245
|
- spec/rails3/app_root/app/views/sorcery_mailer/activation_email.html.erb
|
|
@@ -198,9 +265,12 @@ files:
|
|
|
198
265
|
- spec/rails3/app_root/config/locales/en.yml
|
|
199
266
|
- spec/rails3/app_root/config/routes.rb
|
|
200
267
|
- spec/rails3/app_root/db/migrate/activation/20101224223622_add_activation_to_users.rb
|
|
268
|
+
- spec/rails3/app_root/db/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb
|
|
269
|
+
- spec/rails3/app_root/db/migrate/brute_force_protection/20101224223626_add_brute_force_protection_to_users.rb
|
|
201
270
|
- spec/rails3/app_root/db/migrate/core/20101224223620_create_users.rb
|
|
202
|
-
- spec/rails3/app_root/db/migrate/
|
|
271
|
+
- spec/rails3/app_root/db/migrate/oauth/20101224223628_create_authentications.rb
|
|
203
272
|
- spec/rails3/app_root/db/migrate/remember_me/20101224223623_add_remember_me_token_to_users.rb
|
|
273
|
+
- spec/rails3/app_root/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb
|
|
204
274
|
- spec/rails3/app_root/db/schema.rb
|
|
205
275
|
- spec/rails3/app_root/db/seeds.rb
|
|
206
276
|
- spec/rails3/app_root/lib/tasks/.gitkeep
|
|
@@ -219,21 +289,24 @@ files:
|
|
|
219
289
|
- spec/rails3/app_root/public/robots.txt
|
|
220
290
|
- spec/rails3/app_root/public/stylesheets/.gitkeep
|
|
221
291
|
- spec/rails3/app_root/script/rails
|
|
222
|
-
- spec/rails3/app_root/
|
|
223
|
-
- spec/rails3/app_root/
|
|
224
|
-
- spec/rails3/app_root/
|
|
225
|
-
- spec/rails3/app_root/
|
|
292
|
+
- spec/rails3/app_root/spec/controller_activity_logging_spec.rb
|
|
293
|
+
- spec/rails3/app_root/spec/controller_brute_force_protection_spec.rb
|
|
294
|
+
- spec/rails3/app_root/spec/controller_http_basic_auth_spec.rb
|
|
295
|
+
- spec/rails3/app_root/spec/controller_oauth2_spec.rb
|
|
296
|
+
- spec/rails3/app_root/spec/controller_oauth_spec.rb
|
|
297
|
+
- spec/rails3/app_root/spec/controller_remember_me_spec.rb
|
|
298
|
+
- spec/rails3/app_root/spec/controller_session_timeout_spec.rb
|
|
299
|
+
- spec/rails3/app_root/spec/controller_spec.rb
|
|
300
|
+
- spec/rails3/app_root/spec/spec_helper.orig.rb
|
|
301
|
+
- spec/rails3/app_root/spec/spec_helper.rb
|
|
302
|
+
- spec/rails3/app_root/spec/user_activation_spec.rb
|
|
303
|
+
- spec/rails3/app_root/spec/user_activity_logging_spec.rb
|
|
304
|
+
- spec/rails3/app_root/spec/user_brute_force_protection_spec.rb
|
|
305
|
+
- spec/rails3/app_root/spec/user_oauth_spec.rb
|
|
306
|
+
- spec/rails3/app_root/spec/user_remember_me_spec.rb
|
|
307
|
+
- spec/rails3/app_root/spec/user_reset_password_spec.rb
|
|
308
|
+
- spec/rails3/app_root/spec/user_spec.rb
|
|
226
309
|
- spec/rails3/app_root/vendor/plugins/.gitkeep
|
|
227
|
-
- spec/rails3/controller_brute_force_protection_spec.rb
|
|
228
|
-
- spec/rails3/controller_http_basic_auth_spec.rb
|
|
229
|
-
- spec/rails3/controller_remember_me_spec.rb
|
|
230
|
-
- spec/rails3/controller_session_timeout_spec.rb
|
|
231
|
-
- spec/rails3/controller_spec.rb
|
|
232
|
-
- spec/rails3/spec_helper.rb
|
|
233
|
-
- spec/rails3/user_activation_spec.rb
|
|
234
|
-
- spec/rails3/user_password_reset_spec.rb
|
|
235
|
-
- spec/rails3/user_remember_me_spec.rb
|
|
236
|
-
- spec/rails3/user_spec.rb
|
|
237
310
|
- spec/sorcery_crypto_providers_spec.rb
|
|
238
311
|
- spec/spec_helper.rb
|
|
239
312
|
has_rdoc: true
|
|
@@ -260,7 +333,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
260
333
|
requirements: []
|
|
261
334
|
|
|
262
335
|
rubyforge_project:
|
|
263
|
-
rubygems_version: 1.
|
|
336
|
+
rubygems_version: 1.6.2
|
|
264
337
|
signing_key:
|
|
265
338
|
specification_version: 3
|
|
266
339
|
summary: Magical authentication for Rails 3 applications
|
|
@@ -268,6 +341,7 @@ test_files:
|
|
|
268
341
|
- spec/rails3/app_root/app/controllers/application_controller.rb
|
|
269
342
|
- spec/rails3/app_root/app/helpers/application_helper.rb
|
|
270
343
|
- spec/rails3/app_root/app/mailers/sorcery_mailer.rb
|
|
344
|
+
- spec/rails3/app_root/app/models/authentication.rb
|
|
271
345
|
- spec/rails3/app_root/app/models/user.rb
|
|
272
346
|
- spec/rails3/app_root/config/application.rb
|
|
273
347
|
- spec/rails3/app_root/config/boot.rb
|
|
@@ -283,23 +357,30 @@ test_files:
|
|
|
283
357
|
- spec/rails3/app_root/config/initializers/session_store.rb
|
|
284
358
|
- spec/rails3/app_root/config/routes.rb
|
|
285
359
|
- spec/rails3/app_root/db/migrate/activation/20101224223622_add_activation_to_users.rb
|
|
360
|
+
- spec/rails3/app_root/db/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb
|
|
361
|
+
- spec/rails3/app_root/db/migrate/brute_force_protection/20101224223626_add_brute_force_protection_to_users.rb
|
|
286
362
|
- spec/rails3/app_root/db/migrate/core/20101224223620_create_users.rb
|
|
287
|
-
- spec/rails3/app_root/db/migrate/
|
|
363
|
+
- spec/rails3/app_root/db/migrate/oauth/20101224223628_create_authentications.rb
|
|
288
364
|
- spec/rails3/app_root/db/migrate/remember_me/20101224223623_add_remember_me_token_to_users.rb
|
|
365
|
+
- spec/rails3/app_root/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb
|
|
289
366
|
- spec/rails3/app_root/db/schema.rb
|
|
290
367
|
- spec/rails3/app_root/db/seeds.rb
|
|
291
|
-
- spec/rails3/app_root/
|
|
292
|
-
- spec/rails3/app_root/
|
|
293
|
-
- spec/rails3/app_root/
|
|
294
|
-
- spec/rails3/
|
|
295
|
-
- spec/rails3/
|
|
296
|
-
- spec/rails3/controller_remember_me_spec.rb
|
|
297
|
-
- spec/rails3/controller_session_timeout_spec.rb
|
|
298
|
-
- spec/rails3/controller_spec.rb
|
|
299
|
-
- spec/rails3/spec_helper.rb
|
|
300
|
-
- spec/rails3/
|
|
301
|
-
- spec/rails3/
|
|
302
|
-
- spec/rails3/
|
|
303
|
-
- spec/rails3/
|
|
368
|
+
- spec/rails3/app_root/spec/controller_activity_logging_spec.rb
|
|
369
|
+
- spec/rails3/app_root/spec/controller_brute_force_protection_spec.rb
|
|
370
|
+
- spec/rails3/app_root/spec/controller_http_basic_auth_spec.rb
|
|
371
|
+
- spec/rails3/app_root/spec/controller_oauth2_spec.rb
|
|
372
|
+
- spec/rails3/app_root/spec/controller_oauth_spec.rb
|
|
373
|
+
- spec/rails3/app_root/spec/controller_remember_me_spec.rb
|
|
374
|
+
- spec/rails3/app_root/spec/controller_session_timeout_spec.rb
|
|
375
|
+
- spec/rails3/app_root/spec/controller_spec.rb
|
|
376
|
+
- spec/rails3/app_root/spec/spec_helper.orig.rb
|
|
377
|
+
- spec/rails3/app_root/spec/spec_helper.rb
|
|
378
|
+
- spec/rails3/app_root/spec/user_activation_spec.rb
|
|
379
|
+
- spec/rails3/app_root/spec/user_activity_logging_spec.rb
|
|
380
|
+
- spec/rails3/app_root/spec/user_brute_force_protection_spec.rb
|
|
381
|
+
- spec/rails3/app_root/spec/user_oauth_spec.rb
|
|
382
|
+
- spec/rails3/app_root/spec/user_remember_me_spec.rb
|
|
383
|
+
- spec/rails3/app_root/spec/user_reset_password_spec.rb
|
|
384
|
+
- spec/rails3/app_root/spec/user_spec.rb
|
|
304
385
|
- spec/sorcery_crypto_providers_spec.rb
|
|
305
386
|
- spec/spec_helper.rb
|
data/features/support/env.rb
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
require 'bundler'
|
|
2
|
-
begin
|
|
3
|
-
Bundler.setup(:default, :development)
|
|
4
|
-
rescue Bundler::BundlerError => e
|
|
5
|
-
$stderr.puts e.message
|
|
6
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
|
7
|
-
exit e.status_code
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
|
|
11
|
-
require 'sorcery'
|
|
12
|
-
|
|
13
|
-
require 'rspec/expectations'
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
module Sorcery
|
|
2
|
-
module Model
|
|
3
|
-
module Submodules
|
|
4
|
-
# This submodule adds the ability to reset password via email confirmation.
|
|
5
|
-
module PasswordReset
|
|
6
|
-
def self.included(base)
|
|
7
|
-
base.sorcery_config.class_eval do
|
|
8
|
-
attr_accessor :reset_password_code_attribute_name, # reset password code attribute name.
|
|
9
|
-
:reset_password_mailer, # mailer class. Needed.
|
|
10
|
-
:reset_password_email_method_name # reset password email method on your mailer class.
|
|
11
|
-
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
base.sorcery_config.instance_eval do
|
|
15
|
-
@defaults.merge!(:@reset_password_code_attribute_name => :reset_password_code,
|
|
16
|
-
:@reset_password_mailer => nil,
|
|
17
|
-
:@reset_password_email_method_name => :reset_password_email)
|
|
18
|
-
|
|
19
|
-
reset!
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
base.class_eval do
|
|
23
|
-
clear_reset_password_code_proc = Proc.new do |record|
|
|
24
|
-
record.valid? && record.send(sorcery_config.password_attribute_name)
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
before_save :clear_reset_password_code, :if =>clear_reset_password_code_proc
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
base.sorcery_config.after_config << :validate_mailer_defined
|
|
31
|
-
|
|
32
|
-
base.extend(ClassMethods)
|
|
33
|
-
base.send(:include, InstanceMethods)
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
module ClassMethods
|
|
37
|
-
def validate_mailer_defined
|
|
38
|
-
msg = "To use password_reset submodule, you must define a mailer (config.reset_password_mailer = YourMailerClass)."
|
|
39
|
-
raise ArgumentError, msg if @sorcery_config.reset_password_mailer == nil
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
module InstanceMethods
|
|
44
|
-
def reset_password!
|
|
45
|
-
config = sorcery_config
|
|
46
|
-
self.send(:"#{config.reset_password_code_attribute_name}=", generate_random_code)
|
|
47
|
-
self.class.transaction do
|
|
48
|
-
self.save!(:validate => false)
|
|
49
|
-
generic_send_email(:reset_password_email_method_name, :reset_password_mailer)
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
protected
|
|
54
|
-
|
|
55
|
-
def clear_reset_password_code
|
|
56
|
-
config = sorcery_config
|
|
57
|
-
self.send(:"#{config.reset_password_code_attribute_name}=", nil)
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
end
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
ENV["RAILS_ENV"] = "test"
|
|
2
|
-
require File.expand_path('../../config/environment', __FILE__)
|
|
3
|
-
require 'rails/test_help'
|
|
4
|
-
|
|
5
|
-
class ActiveSupport::TestCase
|
|
6
|
-
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
|
|
7
|
-
#
|
|
8
|
-
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
|
9
|
-
# -- they do not yet inherit this setting
|
|
10
|
-
fixtures :all
|
|
11
|
-
|
|
12
|
-
# Add more helper methods to be used by all tests here...
|
|
13
|
-
end
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
|
-
|
|
3
|
-
describe ApplicationController do
|
|
4
|
-
|
|
5
|
-
# ----------------- SESSION TIMEOUT -----------------------
|
|
6
|
-
describe ApplicationController, "with brute force protection features" do
|
|
7
|
-
before(:all) do
|
|
8
|
-
plugin_model_configure([:brute_force_protection])
|
|
9
|
-
create_new_user
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
after(:each) do
|
|
13
|
-
Sorcery::Controller::Config.reset!
|
|
14
|
-
plugin_set_controller_config_property(:user_class, User)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
it "should have configuration for 'login_retries_amount_allowed' per session" do
|
|
18
|
-
plugin_set_controller_config_property(:login_retries_amount_allowed, 32)
|
|
19
|
-
Sorcery::Controller::Config.login_retries_amount_allowed.should equal(32)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
it "should have configuration for 'login_retries_counter_reset_time'" do
|
|
23
|
-
plugin_set_controller_config_property(:login_retries_time_period, 32)
|
|
24
|
-
Sorcery::Controller::Config.login_retries_time_period.should equal(32)
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
it "should count login retries per session" do
|
|
28
|
-
3.times {get :test_login, :username => 'gizmo', :password => 'blabla'}
|
|
29
|
-
session[:failed_logins].should == 3
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
it "should reset the counter if enough time has passed" do
|
|
33
|
-
plugin_set_controller_config_property(:login_retries_amount_allowed, 5)
|
|
34
|
-
plugin_set_controller_config_property(:login_retries_time_period, 0.2)
|
|
35
|
-
get :test_login, :username => 'gizmo', :password => 'blabla'
|
|
36
|
-
sleep 0.4
|
|
37
|
-
get :test_login, :username => 'gizmo', :password => 'blabla'
|
|
38
|
-
session[:failed_logins].should == 1
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
it "should ban session when number of retries reached within an amount of time" do
|
|
42
|
-
plugin_set_controller_config_property(:login_retries_amount_allowed, 1)
|
|
43
|
-
plugin_set_controller_config_property(:login_retries_time_period, 50)
|
|
44
|
-
get :test_login, :username => 'gizmo', :password => 'blabla'
|
|
45
|
-
get :test_login, :username => 'gizmo', :password => 'blabla'
|
|
46
|
-
session[:banned].should == true
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
it "should clear ban after ban time limit passes" do
|
|
50
|
-
plugin_set_controller_config_property(:login_retries_amount_allowed, 1)
|
|
51
|
-
plugin_set_controller_config_property(:login_retries_time_period, 50)
|
|
52
|
-
plugin_set_controller_config_property(:login_ban_time_period, 0.2)
|
|
53
|
-
get :test_login, :username => 'gizmo', :password => 'blabla'
|
|
54
|
-
get :test_login, :username => 'gizmo', :password => 'blabla'
|
|
55
|
-
session[:banned].should == true
|
|
56
|
-
sleep 0.3
|
|
57
|
-
get :test_login, :username => 'gizmo', :password => 'blabla'
|
|
58
|
-
session[:banned].should == nil
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
it "banned session calls the configured banned action" do
|
|
62
|
-
plugin_set_controller_config_property(:login_retries_amount_allowed, 1)
|
|
63
|
-
plugin_set_controller_config_property(:login_retries_time_period, 50)
|
|
64
|
-
plugin_set_controller_config_property(:login_ban_time_period, 50)
|
|
65
|
-
get :test_login, :username => 'gizmo', :password => 'blabla'
|
|
66
|
-
get :test_login, :username => 'gizmo', :password => 'blabla'
|
|
67
|
-
get :test_login, :username => 'gizmo', :password => 'blabla'
|
|
68
|
-
session[:banned].should == true
|
|
69
|
-
response.body.should == " "
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
end
|