sorcery 0.1.0 → 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 -12
- 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 +2 -6
- 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 +22 -9
- data/lib/sorcery/test_helpers.rb +84 -0
- data/lib/sorcery.rb +17 -1
- data/sorcery.gemspec +250 -0
- 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} +6 -3
- data/spec/rails3/{Gemfile.lock → app_root/Gemfile.lock} +27 -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} +75 -41
- metadata +147 -102
- 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
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sorcery
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
prerelease:
|
|
5
|
-
|
|
6
|
-
- 0
|
|
7
|
-
- 1
|
|
8
|
-
- 0
|
|
9
|
-
version: 0.1.0
|
|
4
|
+
prerelease:
|
|
5
|
+
version: 0.2.0
|
|
10
6
|
platform: ruby
|
|
11
7
|
authors:
|
|
12
8
|
- Noam Ben Ari
|
|
@@ -14,7 +10,7 @@ autorequire:
|
|
|
14
10
|
bindir: bin
|
|
15
11
|
cert_chain: []
|
|
16
12
|
|
|
17
|
-
date: 2011-
|
|
13
|
+
date: 2011-03-13 00:00:00 +02:00
|
|
18
14
|
default_executable:
|
|
19
15
|
dependencies:
|
|
20
16
|
- !ruby/object:Gem::Dependency
|
|
@@ -22,143 +18,166 @@ dependencies:
|
|
|
22
18
|
requirement: &id001 !ruby/object:Gem::Requirement
|
|
23
19
|
none: false
|
|
24
20
|
requirements:
|
|
25
|
-
- - "
|
|
21
|
+
- - ">="
|
|
26
22
|
- !ruby/object:Gem::Version
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
- 0
|
|
30
|
-
- 3
|
|
31
|
-
version: 3.0.3
|
|
32
|
-
type: :development
|
|
23
|
+
version: 3.0.0
|
|
24
|
+
type: :runtime
|
|
33
25
|
prerelease: false
|
|
34
26
|
version_requirements: *id001
|
|
35
27
|
- !ruby/object:Gem::Dependency
|
|
36
|
-
name:
|
|
28
|
+
name: json
|
|
37
29
|
requirement: &id002 !ruby/object:Gem::Requirement
|
|
38
30
|
none: false
|
|
39
31
|
requirements:
|
|
40
|
-
- -
|
|
32
|
+
- - ">="
|
|
41
33
|
- !ruby/object:Gem::Version
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
- 3
|
|
45
|
-
- 0
|
|
46
|
-
version: 2.3.0
|
|
47
|
-
type: :development
|
|
34
|
+
version: 1.5.1
|
|
35
|
+
type: :runtime
|
|
48
36
|
prerelease: false
|
|
49
37
|
version_requirements: *id002
|
|
50
38
|
- !ruby/object:Gem::Dependency
|
|
51
|
-
name:
|
|
39
|
+
name: oauth
|
|
52
40
|
requirement: &id003 !ruby/object:Gem::Requirement
|
|
53
41
|
none: false
|
|
54
42
|
requirements:
|
|
55
43
|
- - ">="
|
|
56
44
|
- !ruby/object:Gem::Version
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
version: "0"
|
|
60
|
-
type: :development
|
|
45
|
+
version: 0.4.4
|
|
46
|
+
type: :runtime
|
|
61
47
|
prerelease: false
|
|
62
48
|
version_requirements: *id003
|
|
63
49
|
- !ruby/object:Gem::Dependency
|
|
64
|
-
name:
|
|
50
|
+
name: oauth2
|
|
65
51
|
requirement: &id004 !ruby/object:Gem::Requirement
|
|
66
52
|
none: false
|
|
67
53
|
requirements:
|
|
68
54
|
- - ">="
|
|
69
55
|
- !ruby/object:Gem::Version
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
version: "0"
|
|
73
|
-
type: :development
|
|
56
|
+
version: 0.1.1
|
|
57
|
+
type: :runtime
|
|
74
58
|
prerelease: false
|
|
75
59
|
version_requirements: *id004
|
|
76
60
|
- !ruby/object:Gem::Dependency
|
|
77
|
-
name:
|
|
61
|
+
name: rspec
|
|
78
62
|
requirement: &id005 !ruby/object:Gem::Requirement
|
|
79
63
|
none: false
|
|
80
64
|
requirements:
|
|
81
|
-
- -
|
|
65
|
+
- - ~>
|
|
82
66
|
- !ruby/object:Gem::Version
|
|
83
|
-
|
|
84
|
-
- 0
|
|
85
|
-
version: "0"
|
|
67
|
+
version: 2.3.0
|
|
86
68
|
type: :development
|
|
87
69
|
prerelease: false
|
|
88
70
|
version_requirements: *id005
|
|
89
71
|
- !ruby/object:Gem::Dependency
|
|
90
|
-
name:
|
|
72
|
+
name: rspec-rails
|
|
91
73
|
requirement: &id006 !ruby/object:Gem::Requirement
|
|
92
74
|
none: false
|
|
93
75
|
requirements:
|
|
94
|
-
- -
|
|
76
|
+
- - ">="
|
|
95
77
|
- !ruby/object:Gem::Version
|
|
96
|
-
|
|
97
|
-
- 0
|
|
98
|
-
- 6
|
|
99
|
-
- 0
|
|
100
|
-
version: 0.6.0
|
|
78
|
+
version: "0"
|
|
101
79
|
type: :development
|
|
102
80
|
prerelease: false
|
|
103
81
|
version_requirements: *id006
|
|
104
82
|
- !ruby/object:Gem::Dependency
|
|
105
|
-
name:
|
|
83
|
+
name: ruby-debug19
|
|
106
84
|
requirement: &id007 !ruby/object:Gem::Requirement
|
|
107
85
|
none: false
|
|
108
86
|
requirements:
|
|
109
87
|
- - ">="
|
|
110
88
|
- !ruby/object:Gem::Version
|
|
111
|
-
segments:
|
|
112
|
-
- 0
|
|
113
89
|
version: "0"
|
|
114
90
|
type: :development
|
|
115
91
|
prerelease: false
|
|
116
92
|
version_requirements: *id007
|
|
117
93
|
- !ruby/object:Gem::Dependency
|
|
118
|
-
name:
|
|
94
|
+
name: sqlite3-ruby
|
|
119
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
|
|
120
118
|
none: false
|
|
121
119
|
requirements:
|
|
122
120
|
- - ~>
|
|
123
121
|
- !ruby/object:Gem::Version
|
|
124
|
-
segments:
|
|
125
|
-
- 1
|
|
126
|
-
- 0
|
|
127
|
-
- 0
|
|
128
122
|
version: 1.0.0
|
|
129
123
|
type: :development
|
|
130
124
|
prerelease: false
|
|
131
|
-
version_requirements: *
|
|
125
|
+
version_requirements: *id010
|
|
132
126
|
- !ruby/object:Gem::Dependency
|
|
133
127
|
name: jeweler
|
|
134
|
-
requirement: &
|
|
128
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
|
135
129
|
none: false
|
|
136
130
|
requirements:
|
|
137
131
|
- - ~>
|
|
138
132
|
- !ruby/object:Gem::Version
|
|
139
|
-
segments:
|
|
140
|
-
- 1
|
|
141
|
-
- 5
|
|
142
|
-
- 2
|
|
143
133
|
version: 1.5.2
|
|
144
134
|
type: :development
|
|
145
135
|
prerelease: false
|
|
146
|
-
version_requirements: *
|
|
136
|
+
version_requirements: *id011
|
|
147
137
|
- !ruby/object:Gem::Dependency
|
|
148
138
|
name: simplecov
|
|
149
|
-
requirement: &
|
|
139
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
|
150
140
|
none: false
|
|
151
141
|
requirements:
|
|
152
142
|
- - ">="
|
|
153
143
|
- !ruby/object:Gem::Version
|
|
154
|
-
segments:
|
|
155
|
-
- 0
|
|
156
|
-
- 3
|
|
157
|
-
- 8
|
|
158
144
|
version: 0.3.8
|
|
159
145
|
type: :development
|
|
160
146
|
prerelease: false
|
|
161
|
-
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
|
|
162
181
|
description: Provides common authentication needs such as signing in/out, activating by email and resetting password.
|
|
163
182
|
email: nbenari@gmail.com
|
|
164
183
|
executables: []
|
|
@@ -177,10 +196,16 @@ files:
|
|
|
177
196
|
- README.rdoc
|
|
178
197
|
- Rakefile
|
|
179
198
|
- VERSION
|
|
180
|
-
- features/support/env.rb
|
|
181
199
|
- lib/sorcery.rb
|
|
182
200
|
- lib/sorcery/controller.rb
|
|
201
|
+
- lib/sorcery/controller/submodules/activity_logging.rb
|
|
183
202
|
- lib/sorcery/controller/submodules/brute_force_protection.rb
|
|
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
|
|
184
209
|
- lib/sorcery/controller/submodules/remember_me.rb
|
|
185
210
|
- lib/sorcery/controller/submodules/session_timeout.rb
|
|
186
211
|
- lib/sorcery/crypto_providers/aes256.rb
|
|
@@ -191,22 +216,30 @@ files:
|
|
|
191
216
|
- lib/sorcery/crypto_providers/sha512.rb
|
|
192
217
|
- lib/sorcery/engine.rb
|
|
193
218
|
- lib/sorcery/model.rb
|
|
194
|
-
- 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
|
|
195
222
|
- lib/sorcery/model/submodules/remember_me.rb
|
|
223
|
+
- lib/sorcery/model/submodules/reset_password.rb
|
|
196
224
|
- lib/sorcery/model/submodules/user_activation.rb
|
|
225
|
+
- lib/sorcery/model/temporary_token.rb
|
|
226
|
+
- lib/sorcery/test_helpers.rb
|
|
227
|
+
- sorcery.gemspec
|
|
197
228
|
- spec/Gemfile
|
|
198
229
|
- spec/Gemfile.lock
|
|
199
230
|
- spec/Rakefile
|
|
200
231
|
- spec/rails3/.rspec
|
|
201
|
-
- spec/rails3/Gemfile
|
|
202
|
-
- spec/rails3/Gemfile.lock
|
|
203
|
-
- spec/rails3/Rakefile
|
|
204
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
|
|
205
236
|
- spec/rails3/app_root/README
|
|
237
|
+
- spec/rails3/app_root/Rakefile
|
|
206
238
|
- spec/rails3/app_root/Rakefile.unused
|
|
207
239
|
- spec/rails3/app_root/app/controllers/application_controller.rb
|
|
208
240
|
- spec/rails3/app_root/app/helpers/application_helper.rb
|
|
209
241
|
- spec/rails3/app_root/app/mailers/sorcery_mailer.rb
|
|
242
|
+
- spec/rails3/app_root/app/models/authentication.rb
|
|
210
243
|
- spec/rails3/app_root/app/models/user.rb
|
|
211
244
|
- spec/rails3/app_root/app/views/layouts/application.html.erb
|
|
212
245
|
- spec/rails3/app_root/app/views/sorcery_mailer/activation_email.html.erb
|
|
@@ -232,9 +265,12 @@ files:
|
|
|
232
265
|
- spec/rails3/app_root/config/locales/en.yml
|
|
233
266
|
- spec/rails3/app_root/config/routes.rb
|
|
234
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
|
|
235
270
|
- spec/rails3/app_root/db/migrate/core/20101224223620_create_users.rb
|
|
236
|
-
- spec/rails3/app_root/db/migrate/
|
|
271
|
+
- spec/rails3/app_root/db/migrate/oauth/20101224223628_create_authentications.rb
|
|
237
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
|
|
238
274
|
- spec/rails3/app_root/db/schema.rb
|
|
239
275
|
- spec/rails3/app_root/db/seeds.rb
|
|
240
276
|
- spec/rails3/app_root/lib/tasks/.gitkeep
|
|
@@ -253,20 +289,24 @@ files:
|
|
|
253
289
|
- spec/rails3/app_root/public/robots.txt
|
|
254
290
|
- spec/rails3/app_root/public/stylesheets/.gitkeep
|
|
255
291
|
- spec/rails3/app_root/script/rails
|
|
256
|
-
- spec/rails3/app_root/
|
|
257
|
-
- spec/rails3/app_root/
|
|
258
|
-
- spec/rails3/app_root/
|
|
259
|
-
- 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
|
|
260
309
|
- spec/rails3/app_root/vendor/plugins/.gitkeep
|
|
261
|
-
- spec/rails3/controller_brute_force_protection_spec.rb
|
|
262
|
-
- spec/rails3/controller_remember_me_spec.rb
|
|
263
|
-
- spec/rails3/controller_session_timeout_spec.rb
|
|
264
|
-
- spec/rails3/controller_spec.rb
|
|
265
|
-
- spec/rails3/spec_helper.rb
|
|
266
|
-
- spec/rails3/user_activation_spec.rb
|
|
267
|
-
- spec/rails3/user_password_reset_spec.rb
|
|
268
|
-
- spec/rails3/user_remember_me_spec.rb
|
|
269
|
-
- spec/rails3/user_spec.rb
|
|
270
310
|
- spec/sorcery_crypto_providers_spec.rb
|
|
271
311
|
- spec/spec_helper.rb
|
|
272
312
|
has_rdoc: true
|
|
@@ -283,21 +323,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
283
323
|
requirements:
|
|
284
324
|
- - ">="
|
|
285
325
|
- !ruby/object:Gem::Version
|
|
286
|
-
segments:
|
|
287
|
-
- 0
|
|
288
326
|
version: "0"
|
|
289
327
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
290
328
|
none: false
|
|
291
329
|
requirements:
|
|
292
330
|
- - ">="
|
|
293
331
|
- !ruby/object:Gem::Version
|
|
294
|
-
segments:
|
|
295
|
-
- 0
|
|
296
332
|
version: "0"
|
|
297
333
|
requirements: []
|
|
298
334
|
|
|
299
335
|
rubyforge_project:
|
|
300
|
-
rubygems_version: 1.
|
|
336
|
+
rubygems_version: 1.6.2
|
|
301
337
|
signing_key:
|
|
302
338
|
specification_version: 3
|
|
303
339
|
summary: Magical authentication for Rails 3 applications
|
|
@@ -305,6 +341,7 @@ test_files:
|
|
|
305
341
|
- spec/rails3/app_root/app/controllers/application_controller.rb
|
|
306
342
|
- spec/rails3/app_root/app/helpers/application_helper.rb
|
|
307
343
|
- spec/rails3/app_root/app/mailers/sorcery_mailer.rb
|
|
344
|
+
- spec/rails3/app_root/app/models/authentication.rb
|
|
308
345
|
- spec/rails3/app_root/app/models/user.rb
|
|
309
346
|
- spec/rails3/app_root/config/application.rb
|
|
310
347
|
- spec/rails3/app_root/config/boot.rb
|
|
@@ -320,22 +357,30 @@ test_files:
|
|
|
320
357
|
- spec/rails3/app_root/config/initializers/session_store.rb
|
|
321
358
|
- spec/rails3/app_root/config/routes.rb
|
|
322
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
|
|
323
362
|
- spec/rails3/app_root/db/migrate/core/20101224223620_create_users.rb
|
|
324
|
-
- spec/rails3/app_root/db/migrate/
|
|
363
|
+
- spec/rails3/app_root/db/migrate/oauth/20101224223628_create_authentications.rb
|
|
325
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
|
|
326
366
|
- spec/rails3/app_root/db/schema.rb
|
|
327
367
|
- spec/rails3/app_root/db/seeds.rb
|
|
328
|
-
- spec/rails3/app_root/
|
|
329
|
-
- spec/rails3/app_root/
|
|
330
|
-
- spec/rails3/app_root/
|
|
331
|
-
- spec/rails3/
|
|
332
|
-
- spec/rails3/
|
|
333
|
-
- spec/rails3/
|
|
334
|
-
- spec/rails3/
|
|
335
|
-
- spec/rails3/
|
|
336
|
-
- spec/rails3/
|
|
337
|
-
- spec/rails3/
|
|
338
|
-
- spec/rails3/
|
|
339
|
-
- 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
|
|
340
385
|
- spec/sorcery_crypto_providers_spec.rb
|
|
341
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
|
-
:sorcery_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
|
-
:@sorcery_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.sorcery_mailer = YourMailerClass)."
|
|
39
|
-
raise ArgumentError, msg if @sorcery_config.sorcery_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)
|
|
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
|