authenticate 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -4
- data/CHANGELOG.md +12 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +21 -6
- data/app/controllers/authenticate/passwords_controller.rb +1 -1
- data/authenticate.gemspec +7 -3
- data/config/locales/authenticate.en.yml +1 -1
- data/gemfiles/rails42.gemfile +6 -1
- data/lib/authenticate/callbacks/brute_force.rb +3 -4
- data/lib/authenticate/configuration.rb +2 -2
- data/lib/authenticate/controller.rb +1 -2
- data/lib/authenticate/model/brute_force.rb +2 -2
- data/lib/authenticate/model/db_password.rb +2 -3
- data/lib/authenticate/model/email.rb +3 -6
- data/lib/authenticate/model/lifetimed.rb +1 -1
- data/lib/authenticate/model/password_reset.rb +1 -1
- data/lib/authenticate/model/timeoutable.rb +2 -2
- data/lib/authenticate/model/trackable.rb +1 -1
- data/lib/authenticate/model/username.rb +1 -1
- data/lib/authenticate/session.rb +0 -4
- data/lib/authenticate/user.rb +12 -0
- data/lib/authenticate/version.rb +1 -1
- data/spec/controllers/passwords_controller_spec.rb +119 -0
- data/spec/controllers/secured_controller_spec.rb +70 -0
- data/spec/controllers/sessions_controller_spec.rb +86 -0
- data/spec/controllers/users_controller_spec.rb +82 -0
- data/spec/dummy/app/controllers/application_controller.rb +2 -0
- data/spec/dummy/app/controllers/welcome_controller.rb +4 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/welcome/index.html.erb +4 -0
- data/spec/dummy/config/application.rb +2 -0
- data/spec/dummy/config/environments/production.rb +12 -0
- data/spec/dummy/config/initializers/authenticate.rb +4 -11
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/factories/users.rb +2 -4
- data/spec/features/brute_force_spec.rb +49 -0
- data/spec/features/max_session_lifetime_spec.rb +30 -0
- data/spec/features/password_reset_spec.rb +69 -0
- data/spec/features/password_update_spec.rb +41 -0
- data/spec/features/sign_in_spec.rb +29 -0
- data/spec/features/sign_out_spec.rb +22 -0
- data/spec/features/sign_up_spec.rb +42 -0
- data/spec/features/timeoutable_spec.rb +30 -0
- data/spec/model/brute_force_spec.rb +26 -29
- data/spec/model/configuration_spec.rb +61 -0
- data/spec/model/db_password_spec.rb +8 -9
- data/spec/model/email_spec.rb +0 -1
- data/spec/model/lifetimed_spec.rb +6 -18
- data/spec/model/password_reset_spec.rb +2 -9
- data/spec/model/session_spec.rb +16 -23
- data/spec/model/timeoutable_spec.rb +8 -7
- data/spec/model/trackable_spec.rb +0 -1
- data/spec/model/user_spec.rb +1 -2
- data/spec/spec_helper.rb +33 -131
- data/spec/support/controllers/controller_helpers.rb +24 -0
- data/spec/support/features/feature_helpers.rb +36 -0
- metadata +80 -8
- data/spec/configuration_spec.rb +0 -60
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authenticate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Tomich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bcrypt
|
@@ -59,7 +59,7 @@ dependencies:
|
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '5.1'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
62
|
+
name: factory_girl
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - ">="
|
@@ -76,16 +76,16 @@ dependencies:
|
|
76
76
|
name: rspec-rails
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
|
-
- - "
|
79
|
+
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version:
|
81
|
+
version: 3.1.0
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
|
-
- - "
|
86
|
+
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version:
|
88
|
+
version: 3.1.0
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: pry
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,6 +114,62 @@ dependencies:
|
|
114
114
|
- - ">="
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '0'
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: shoulda-matchers
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - "~>"
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '2.8'
|
124
|
+
type: :development
|
125
|
+
prerelease: false
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - "~>"
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '2.8'
|
131
|
+
- !ruby/object:Gem::Dependency
|
132
|
+
name: capybara
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - "~>"
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: 2.6.2
|
138
|
+
type: :development
|
139
|
+
prerelease: false
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - "~>"
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: 2.6.2
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: database_cleaner
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - "~>"
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: 1.5.1
|
152
|
+
type: :development
|
153
|
+
prerelease: false
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - "~>"
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: 1.5.1
|
159
|
+
- !ruby/object:Gem::Dependency
|
160
|
+
name: timecop
|
161
|
+
requirement: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - "~>"
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: 0.8.0
|
166
|
+
type: :development
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - "~>"
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: 0.8.0
|
117
173
|
description: Authentication for Rails applications
|
118
174
|
email:
|
119
175
|
- justin@tomich.org
|
@@ -201,7 +257,10 @@ files:
|
|
201
257
|
- lib/generators/authenticate/views/USAGE
|
202
258
|
- lib/generators/authenticate/views/views_generator.rb
|
203
259
|
- lib/tasks/authenticate_tasks.rake
|
204
|
-
- spec/
|
260
|
+
- spec/controllers/passwords_controller_spec.rb
|
261
|
+
- spec/controllers/secured_controller_spec.rb
|
262
|
+
- spec/controllers/sessions_controller_spec.rb
|
263
|
+
- spec/controllers/users_controller_spec.rb
|
205
264
|
- spec/dummy/README.rdoc
|
206
265
|
- spec/dummy/Rakefile
|
207
266
|
- spec/dummy/app/assets/images/.keep
|
@@ -209,12 +268,14 @@ files:
|
|
209
268
|
- spec/dummy/app/assets/stylesheets/application.css
|
210
269
|
- spec/dummy/app/controllers/application_controller.rb
|
211
270
|
- spec/dummy/app/controllers/concerns/.keep
|
271
|
+
- spec/dummy/app/controllers/welcome_controller.rb
|
212
272
|
- spec/dummy/app/helpers/application_helper.rb
|
213
273
|
- spec/dummy/app/mailers/.keep
|
214
274
|
- spec/dummy/app/models/.keep
|
215
275
|
- spec/dummy/app/models/concerns/.keep
|
216
276
|
- spec/dummy/app/models/user.rb
|
217
277
|
- spec/dummy/app/views/layouts/application.html.erb
|
278
|
+
- spec/dummy/app/views/welcome/index.html.erb
|
218
279
|
- spec/dummy/bin/bundle
|
219
280
|
- spec/dummy/bin/rails
|
220
281
|
- spec/dummy/bin/rake
|
@@ -253,7 +314,16 @@ files:
|
|
253
314
|
- spec/dummy/public/500.html
|
254
315
|
- spec/dummy/public/favicon.ico
|
255
316
|
- spec/factories/users.rb
|
317
|
+
- spec/features/brute_force_spec.rb
|
318
|
+
- spec/features/max_session_lifetime_spec.rb
|
319
|
+
- spec/features/password_reset_spec.rb
|
320
|
+
- spec/features/password_update_spec.rb
|
321
|
+
- spec/features/sign_in_spec.rb
|
322
|
+
- spec/features/sign_out_spec.rb
|
323
|
+
- spec/features/sign_up_spec.rb
|
324
|
+
- spec/features/timeoutable_spec.rb
|
256
325
|
- spec/model/brute_force_spec.rb
|
326
|
+
- spec/model/configuration_spec.rb
|
257
327
|
- spec/model/db_password_spec.rb
|
258
328
|
- spec/model/email_spec.rb
|
259
329
|
- spec/model/lifetimed_spec.rb
|
@@ -265,6 +335,8 @@ files:
|
|
265
335
|
- spec/model/user_spec.rb
|
266
336
|
- spec/orm/active_record.rb
|
267
337
|
- spec/spec_helper.rb
|
338
|
+
- spec/support/controllers/controller_helpers.rb
|
339
|
+
- spec/support/features/feature_helpers.rb
|
268
340
|
homepage: http://github.com/tomichj/authenticate
|
269
341
|
licenses:
|
270
342
|
- MIT
|
data/spec/configuration_spec.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Authenticate::Configuration do
|
4
|
-
after {restore_default_configuration}
|
5
|
-
|
6
|
-
context 'when no user_model_name is specified' do
|
7
|
-
before do
|
8
|
-
Authenticate.configure do |config|
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'defaults to User' do
|
13
|
-
expect(Authenticate.configuration.user_model).to eq '::User'
|
14
|
-
expect(Authenticate.configuration.user_model_class).to eq ::User
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
context 'with a customer user_model' do
|
19
|
-
before do
|
20
|
-
MyUser = Class.new
|
21
|
-
Authenticate.configure do |config|
|
22
|
-
config.user_model = 'MyUser'
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'is used instead of User' do
|
27
|
-
expect(Authenticate.configuration.user_model_class).to eq MyUser
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe '#authentication_strategy' do
|
32
|
-
context 'with no strategy set' do
|
33
|
-
it 'defaults to email' do
|
34
|
-
expect(Authenticate.configuration.authentication_strategy).to eq :email
|
35
|
-
end
|
36
|
-
it 'includes email in modules' do
|
37
|
-
expect(Authenticate.configuration.modules).to include :email
|
38
|
-
end
|
39
|
-
it 'does not include username in modules' do
|
40
|
-
expect(Authenticate.configuration.modules).to_not include :username
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
context 'with strategy set to username' do
|
45
|
-
before do
|
46
|
-
Authenticate.configure do |config|
|
47
|
-
config.authentication_strategy = :username
|
48
|
-
end
|
49
|
-
end
|
50
|
-
it 'includes username in modules' do
|
51
|
-
expect(Authenticate.configuration.modules).to include :username
|
52
|
-
end
|
53
|
-
it 'does not include email in modules' do
|
54
|
-
expect(Authenticate.configuration.modules).to_not include :email
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|
59
|
-
|
60
|
-
end
|