devise_token_auth 1.0.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of devise_token_auth might be problematic. Click here for more details.
- checksums.yaml +5 -5
- data/README.md +4 -2
- data/app/controllers/devise_token_auth/application_controller.rb +0 -1
- data/app/controllers/devise_token_auth/concerns/resource_finder.rb +11 -12
- data/app/controllers/devise_token_auth/concerns/set_user_by_token.rb +39 -55
- data/app/controllers/devise_token_auth/confirmations_controller.rb +62 -20
- data/app/controllers/devise_token_auth/omniauth_callbacks_controller.rb +51 -26
- data/app/controllers/devise_token_auth/passwords_controller.rb +19 -23
- data/app/controllers/devise_token_auth/registrations_controller.rb +32 -40
- data/app/controllers/devise_token_auth/sessions_controller.rb +5 -5
- data/app/controllers/devise_token_auth/unlocks_controller.rb +4 -4
- data/app/models/devise_token_auth/concerns/active_record_support.rb +16 -0
- data/app/models/devise_token_auth/concerns/mongoid_support.rb +19 -0
- data/app/models/devise_token_auth/concerns/tokens_serialization.rb +19 -0
- data/app/models/devise_token_auth/concerns/user.rb +44 -67
- data/app/models/devise_token_auth/concerns/user_omniauth_callbacks.rb +2 -2
- data/app/validators/{email_validator.rb → devise_token_auth_email_validator.rb} +1 -1
- data/config/locales/en.yml +5 -0
- data/config/locales/he.yml +50 -0
- data/config/locales/ja.yml +1 -1
- data/lib/devise_token_auth/blacklist.rb +2 -0
- data/lib/devise_token_auth/engine.rb +2 -0
- data/lib/devise_token_auth/rails/routes.rb +1 -1
- data/lib/devise_token_auth/token_factory.rb +126 -0
- data/lib/devise_token_auth/version.rb +1 -1
- data/lib/devise_token_auth.rb +6 -3
- data/lib/generators/devise_token_auth/install_generator.rb +3 -87
- data/lib/generators/devise_token_auth/install_generator_helpers.rb +98 -0
- data/lib/generators/devise_token_auth/install_mongoid_generator.rb +46 -0
- data/lib/generators/devise_token_auth/templates/devise_token_auth.rb +5 -0
- data/lib/generators/devise_token_auth/templates/devise_token_auth_create_users.rb.erb +0 -7
- data/lib/generators/devise_token_auth/templates/user_mongoid.rb.erb +56 -0
- data/test/controllers/custom/custom_confirmations_controller_test.rb +1 -1
- data/test/controllers/demo_user_controller_test.rb +2 -2
- data/test/controllers/devise_token_auth/confirmations_controller_test.rb +79 -19
- data/test/controllers/devise_token_auth/omniauth_callbacks_controller_test.rb +2 -0
- data/test/controllers/devise_token_auth/passwords_controller_test.rb +115 -94
- data/test/controllers/devise_token_auth/registrations_controller_test.rb +31 -4
- data/test/controllers/devise_token_auth/sessions_controller_test.rb +0 -38
- data/test/controllers/devise_token_auth/token_validations_controller_test.rb +2 -1
- data/test/dummy/app/{models → active_record}/scoped_user.rb +2 -2
- data/test/dummy/app/{models → active_record}/unconfirmable_user.rb +1 -2
- data/test/dummy/app/{models → active_record}/unregisterable_user.rb +3 -3
- data/test/dummy/app/active_record/user.rb +6 -0
- data/test/dummy/app/controllers/overrides/confirmations_controller.rb +3 -3
- data/test/dummy/app/controllers/overrides/passwords_controller.rb +3 -3
- data/test/dummy/app/controllers/overrides/registrations_controller.rb +1 -1
- data/test/dummy/app/controllers/overrides/sessions_controller.rb +2 -2
- data/test/dummy/app/models/{user.rb → concerns/favorite_color.rb} +7 -8
- data/test/dummy/app/mongoid/lockable_user.rb +38 -0
- data/test/dummy/app/mongoid/mang.rb +46 -0
- data/test/dummy/app/mongoid/only_email_user.rb +33 -0
- data/test/dummy/app/mongoid/scoped_user.rb +50 -0
- data/test/dummy/app/mongoid/unconfirmable_user.rb +44 -0
- data/test/dummy/app/mongoid/unregisterable_user.rb +47 -0
- data/test/dummy/app/mongoid/user.rb +49 -0
- data/test/dummy/config/application.rb +23 -1
- data/test/dummy/config/boot.rb +4 -0
- data/test/dummy/config/initializers/devise.rb +285 -0
- data/test/dummy/config/initializers/devise_token_auth.rb +35 -4
- data/test/dummy/db/migrate/20140715061447_devise_token_auth_create_users.rb +0 -7
- data/test/dummy/db/migrate/20140715061805_devise_token_auth_create_mangs.rb +0 -7
- data/test/dummy/db/migrate/20141222035835_devise_token_auth_create_only_email_users.rb +0 -7
- data/test/dummy/db/migrate/20141222053502_devise_token_auth_create_unregisterable_users.rb +0 -7
- data/test/dummy/db/migrate/20150708104536_devise_token_auth_create_unconfirmable_users.rb +0 -7
- data/test/dummy/db/migrate/20160103235141_devise_token_auth_create_scoped_users.rb +0 -7
- data/test/dummy/db/migrate/20160629184441_devise_token_auth_create_lockable_users.rb +0 -7
- data/test/dummy/db/schema.rb +1 -28
- data/test/factories/users.rb +1 -1
- data/test/lib/devise_token_auth/blacklist_test.rb +11 -0
- data/test/lib/devise_token_auth/token_factory_test.rb +191 -0
- data/test/lib/generators/devise_token_auth/install_generator_test.rb +51 -31
- data/test/lib/generators/devise_token_auth/install_generator_with_namespace_test.rb +51 -31
- data/test/models/concerns/mongoid_support_test.rb +31 -0
- data/test/models/concerns/tokens_serialization_test.rb +70 -0
- data/test/models/only_email_user_test.rb +0 -8
- data/test/models/user_test.rb +1 -33
- data/test/test_helper.rb +12 -2
- metadata +105 -25
- data/config/initializers/devise.rb +0 -198
- /data/test/dummy/app/{models → active_record}/lockable_user.rb +0 -0
- /data/test/dummy/app/{models → active_record}/mang.rb +0 -0
- /data/test/dummy/app/{models → active_record}/only_email_user.rb +0 -0
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
if DEVISE_TOKEN_AUTH_ORM == :active_record
|
4
|
+
describe 'DeviseTokenAuth::TokensSerialization' do
|
5
|
+
let(:ts) { DeviseTokenAuth::TokensSerialization }
|
6
|
+
let(:user) { FactoryBot.create(:user) }
|
7
|
+
let(:tokens) do
|
8
|
+
# Сreate all possible token's attributes combinations
|
9
|
+
user.create_token
|
10
|
+
2.times { user.create_new_auth_token(user.tokens.first[0]) }
|
11
|
+
user.create_new_auth_token
|
12
|
+
user.create_token
|
13
|
+
|
14
|
+
user.tokens
|
15
|
+
end
|
16
|
+
let(:json) { JSON.generate(tokens) }
|
17
|
+
|
18
|
+
it 'is defined' do
|
19
|
+
assert_equal(ts.present?, true)
|
20
|
+
assert_kind_of(Module, ts)
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '.load(json)' do
|
24
|
+
let(:default) { {} }
|
25
|
+
|
26
|
+
it 'is defined' do
|
27
|
+
assert_respond_to(ts, :load)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'handles nil' do
|
31
|
+
assert_equal(ts.load(nil), default)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'handles string' do
|
35
|
+
assert_equal(ts.load(json), JSON.parse(json))
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'returns object of undesirable class' do
|
39
|
+
assert_equal(ts.load([]), [])
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe '.dump(object)' do
|
44
|
+
let(:default) { 'null' }
|
45
|
+
|
46
|
+
it 'is defined' do
|
47
|
+
assert_respond_to(ts, :dump)
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'handles nil' do
|
51
|
+
assert_equal(ts.dump(nil), default)
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'handles empty hash' do
|
55
|
+
assert_equal(ts.dump({}), '{}')
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'deserialize tokens' do
|
59
|
+
assert_equal(ts.dump(tokens), json)
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'removes nil values' do
|
63
|
+
new_tokens = tokens.dup
|
64
|
+
new_tokens[new_tokens.first[0]][:kos] = nil
|
65
|
+
|
66
|
+
assert_equal(ts.dump(tokens), ts.dump(new_tokens))
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -4,14 +4,6 @@ require 'test_helper'
|
|
4
4
|
|
5
5
|
class OnlyEmailUserTest < ActiveSupport::TestCase
|
6
6
|
describe OnlyEmailUser do
|
7
|
-
test 'trackable is disabled' do
|
8
|
-
refute OnlyEmailUser.method_defined?(:sign_in_count)
|
9
|
-
refute OnlyEmailUser.method_defined?(:current_sign_in_at)
|
10
|
-
refute OnlyEmailUser.method_defined?(:last_sign_in_at)
|
11
|
-
refute OnlyEmailUser.method_defined?(:current_sign_in_ip)
|
12
|
-
refute OnlyEmailUser.method_defined?(:last_sign_in_ip)
|
13
|
-
end
|
14
|
-
|
15
7
|
test 'confirmable is disabled' do
|
16
8
|
refute OnlyEmailUser.method_defined?(:confirmation_token)
|
17
9
|
refute OnlyEmailUser.method_defined?(:confirmed_at)
|
data/test/models/user_test.rb
CHANGED
@@ -44,7 +44,7 @@ class UserTest < ActiveSupport::TestCase
|
|
44
44
|
@resource = build(:user, user_attributes)
|
45
45
|
|
46
46
|
refute @resource.save
|
47
|
-
assert @resource.errors.messages[:email]
|
47
|
+
assert @resource.errors.messages[:email].first.include? 'taken'
|
48
48
|
assert @resource.errors.messages[:email].none? { |e| e =~ /translation missing/ }
|
49
49
|
end
|
50
50
|
end
|
@@ -76,38 +76,6 @@ class UserTest < ActiveSupport::TestCase
|
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
describe 'user specific token lifespan' do
|
80
|
-
before do
|
81
|
-
@resource = create(:user, :confirmed)
|
82
|
-
|
83
|
-
auth_headers = @resource.create_new_auth_token
|
84
|
-
@token_global = auth_headers['access-token']
|
85
|
-
@client_id_global = auth_headers['client']
|
86
|
-
|
87
|
-
def @resource.token_lifespan
|
88
|
-
1.minute
|
89
|
-
end
|
90
|
-
|
91
|
-
auth_headers = @resource.create_new_auth_token
|
92
|
-
@token_specific = auth_headers['access-token']
|
93
|
-
@client_id_specific = auth_headers['client']
|
94
|
-
end
|
95
|
-
|
96
|
-
test 'works per user' do
|
97
|
-
assert @resource.token_is_current?(@token_global, @client_id_global)
|
98
|
-
|
99
|
-
time = Time.zone.now.to_i
|
100
|
-
expiry_global = @resource.tokens[@client_id_global]['expiry'] || @resource.tokens[@client_id_global][:expiry]
|
101
|
-
|
102
|
-
assert expiry_global > time + DeviseTokenAuth.token_lifespan - 5.seconds
|
103
|
-
assert expiry_global < time + DeviseTokenAuth.token_lifespan + 5.seconds
|
104
|
-
|
105
|
-
expiry_specific = @resource.tokens[@client_id_specific]['expiry'] || @resource.tokens[@client_id_specific][:expiry]
|
106
|
-
assert expiry_specific > time + 55.seconds
|
107
|
-
assert expiry_specific < time + 65.seconds
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
79
|
describe 'expired tokens are destroyed on save' do
|
112
80
|
before do
|
113
81
|
@resource = create(:user, :confirmed)
|
data/test/test_helper.rb
CHANGED
@@ -7,11 +7,15 @@ SimpleCov.start 'rails' do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
ENV['RAILS_ENV'] = 'test'
|
10
|
+
DEVISE_TOKEN_AUTH_ORM = (ENV['DEVISE_TOKEN_AUTH_ORM'] || :active_record).to_sym
|
11
|
+
|
12
|
+
puts "\n==> DeviseTokenAuth.orm = #{DEVISE_TOKEN_AUTH_ORM.inspect}"
|
10
13
|
|
11
14
|
require File.expand_path('dummy/config/environment', __dir__)
|
12
|
-
require '
|
15
|
+
require 'active_support/testing/autorun'
|
13
16
|
require 'minitest/rails'
|
14
17
|
require 'mocha/minitest'
|
18
|
+
require 'database_cleaner'
|
15
19
|
|
16
20
|
FactoryBot.definition_file_paths = [File.expand_path('factories', __dir__)]
|
17
21
|
FactoryBot.find_definitions
|
@@ -30,7 +34,13 @@ end
|
|
30
34
|
class ActiveSupport::TestCase
|
31
35
|
include FactoryBot::Syntax::Methods
|
32
36
|
|
33
|
-
ActiveRecord::Migration.check_pending!
|
37
|
+
ActiveRecord::Migration.check_pending! if DEVISE_TOKEN_AUTH_ORM == :active_record
|
38
|
+
|
39
|
+
strategies = { active_record: :transaction,
|
40
|
+
mongoid: :truncation }
|
41
|
+
DatabaseCleaner.strategy = strategies[DEVISE_TOKEN_AUTH_ORM]
|
42
|
+
setup { DatabaseCleaner.start }
|
43
|
+
teardown { DatabaseCleaner.clean }
|
34
44
|
|
35
45
|
# Add more helper methods to be used by all tests here...
|
36
46
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise_token_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lynn Hurley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: 4.2.0
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '6'
|
22
|
+
version: '6.1'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: 4.2.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '6'
|
32
|
+
version: '6.1'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: devise
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
version: 3.5.2
|
40
40
|
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '4.
|
42
|
+
version: '4.7'
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -49,7 +49,21 @@ dependencies:
|
|
49
49
|
version: 3.5.2
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: '4.
|
52
|
+
version: '4.7'
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: bcrypt
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '3.0'
|
60
|
+
type: :runtime
|
61
|
+
prerelease: false
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - "~>"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '3.0'
|
53
67
|
- !ruby/object:Gem::Dependency
|
54
68
|
name: appraisal
|
55
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,14 +84,14 @@ dependencies:
|
|
70
84
|
requirements:
|
71
85
|
- - "~>"
|
72
86
|
- !ruby/object:Gem::Version
|
73
|
-
version:
|
87
|
+
version: 1.3.6
|
74
88
|
type: :development
|
75
89
|
prerelease: false
|
76
90
|
version_requirements: !ruby/object:Gem::Requirement
|
77
91
|
requirements:
|
78
92
|
- - "~>"
|
79
93
|
- !ruby/object:Gem::Version
|
80
|
-
version:
|
94
|
+
version: 1.3.6
|
81
95
|
- !ruby/object:Gem::Dependency
|
82
96
|
name: pg
|
83
97
|
requirement: !ruby/object:Gem::Requirement
|
@@ -106,6 +120,40 @@ dependencies:
|
|
106
120
|
- - ">="
|
107
121
|
- !ruby/object:Gem::Version
|
108
122
|
version: '0'
|
123
|
+
- !ruby/object:Gem::Dependency
|
124
|
+
name: mongoid
|
125
|
+
requirement: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '4'
|
130
|
+
- - "<"
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '8'
|
133
|
+
type: :development
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '4'
|
140
|
+
- - "<"
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '8'
|
143
|
+
- !ruby/object:Gem::Dependency
|
144
|
+
name: mongoid-locker
|
145
|
+
requirement: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - "~>"
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '1.0'
|
150
|
+
type: :development
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - "~>"
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '1.0'
|
109
157
|
description: For use with client side single page apps such as the venerable https://github.com/lynndylanhurley/ng-token-auth.
|
110
158
|
email:
|
111
159
|
- lynn.dylan.hurley@gmail.com
|
@@ -126,19 +174,22 @@ files:
|
|
126
174
|
- app/controllers/devise_token_auth/sessions_controller.rb
|
127
175
|
- app/controllers/devise_token_auth/token_validations_controller.rb
|
128
176
|
- app/controllers/devise_token_auth/unlocks_controller.rb
|
177
|
+
- app/models/devise_token_auth/concerns/active_record_support.rb
|
178
|
+
- app/models/devise_token_auth/concerns/mongoid_support.rb
|
179
|
+
- app/models/devise_token_auth/concerns/tokens_serialization.rb
|
129
180
|
- app/models/devise_token_auth/concerns/user.rb
|
130
181
|
- app/models/devise_token_auth/concerns/user_omniauth_callbacks.rb
|
131
|
-
- app/validators/
|
182
|
+
- app/validators/devise_token_auth_email_validator.rb
|
132
183
|
- app/views/devise/mailer/confirmation_instructions.html.erb
|
133
184
|
- app/views/devise/mailer/reset_password_instructions.html.erb
|
134
185
|
- app/views/devise/mailer/unlock_instructions.html.erb
|
135
186
|
- app/views/devise_token_auth/omniauth_external_window.html.erb
|
136
|
-
- config/initializers/devise.rb
|
137
187
|
- config/locales/da-DK.yml
|
138
188
|
- config/locales/de.yml
|
139
189
|
- config/locales/en.yml
|
140
190
|
- config/locales/es.yml
|
141
191
|
- config/locales/fr.yml
|
192
|
+
- config/locales/he.yml
|
142
193
|
- config/locales/it.yml
|
143
194
|
- config/locales/ja.yml
|
144
195
|
- config/locales/nl.yml
|
@@ -155,19 +206,24 @@ files:
|
|
155
206
|
- config/locales/zh-HK.yml
|
156
207
|
- config/locales/zh-TW.yml
|
157
208
|
- lib/devise_token_auth.rb
|
209
|
+
- lib/devise_token_auth/blacklist.rb
|
158
210
|
- lib/devise_token_auth/controllers/helpers.rb
|
159
211
|
- lib/devise_token_auth/controllers/url_helpers.rb
|
160
212
|
- lib/devise_token_auth/engine.rb
|
161
213
|
- lib/devise_token_auth/errors.rb
|
162
214
|
- lib/devise_token_auth/rails/routes.rb
|
215
|
+
- lib/devise_token_auth/token_factory.rb
|
163
216
|
- lib/devise_token_auth/url.rb
|
164
217
|
- lib/devise_token_auth/version.rb
|
165
218
|
- lib/generators/devise_token_auth/USAGE
|
166
219
|
- lib/generators/devise_token_auth/install_generator.rb
|
220
|
+
- lib/generators/devise_token_auth/install_generator_helpers.rb
|
221
|
+
- lib/generators/devise_token_auth/install_mongoid_generator.rb
|
167
222
|
- lib/generators/devise_token_auth/install_views_generator.rb
|
168
223
|
- lib/generators/devise_token_auth/templates/devise_token_auth.rb
|
169
224
|
- lib/generators/devise_token_auth/templates/devise_token_auth_create_users.rb.erb
|
170
225
|
- lib/generators/devise_token_auth/templates/user.rb.erb
|
226
|
+
- lib/generators/devise_token_auth/templates/user_mongoid.rb.erb
|
171
227
|
- lib/tasks/devise_token_auth_tasks.rake
|
172
228
|
- test/controllers/custom/custom_confirmations_controller_test.rb
|
173
229
|
- test/controllers/custom/custom_omniauth_callbacks_controller_test.rb
|
@@ -192,6 +248,13 @@ files:
|
|
192
248
|
- test/controllers/overrides/sessions_controller_test.rb
|
193
249
|
- test/controllers/overrides/token_validations_controller_test.rb
|
194
250
|
- test/dummy/README.rdoc
|
251
|
+
- test/dummy/app/active_record/lockable_user.rb
|
252
|
+
- test/dummy/app/active_record/mang.rb
|
253
|
+
- test/dummy/app/active_record/only_email_user.rb
|
254
|
+
- test/dummy/app/active_record/scoped_user.rb
|
255
|
+
- test/dummy/app/active_record/unconfirmable_user.rb
|
256
|
+
- test/dummy/app/active_record/unregisterable_user.rb
|
257
|
+
- test/dummy/app/active_record/user.rb
|
195
258
|
- test/dummy/app/controllers/application_controller.rb
|
196
259
|
- test/dummy/app/controllers/auth_origin_controller.rb
|
197
260
|
- test/dummy/app/controllers/custom/confirmations_controller.rb
|
@@ -210,13 +273,14 @@ files:
|
|
210
273
|
- test/dummy/app/controllers/overrides/sessions_controller.rb
|
211
274
|
- test/dummy/app/controllers/overrides/token_validations_controller.rb
|
212
275
|
- test/dummy/app/helpers/application_helper.rb
|
213
|
-
- test/dummy/app/models/
|
214
|
-
- test/dummy/app/
|
215
|
-
- test/dummy/app/
|
216
|
-
- test/dummy/app/
|
217
|
-
- test/dummy/app/
|
218
|
-
- test/dummy/app/
|
219
|
-
- test/dummy/app/
|
276
|
+
- test/dummy/app/models/concerns/favorite_color.rb
|
277
|
+
- test/dummy/app/mongoid/lockable_user.rb
|
278
|
+
- test/dummy/app/mongoid/mang.rb
|
279
|
+
- test/dummy/app/mongoid/only_email_user.rb
|
280
|
+
- test/dummy/app/mongoid/scoped_user.rb
|
281
|
+
- test/dummy/app/mongoid/unconfirmable_user.rb
|
282
|
+
- test/dummy/app/mongoid/unregisterable_user.rb
|
283
|
+
- test/dummy/app/mongoid/user.rb
|
220
284
|
- test/dummy/app/views/layouts/application.html.erb
|
221
285
|
- test/dummy/config.ru
|
222
286
|
- test/dummy/config/application.rb
|
@@ -254,10 +318,14 @@ files:
|
|
254
318
|
- test/dummy/tmp/generators/app/views/devise/mailer/confirmation_instructions.html.erb
|
255
319
|
- test/dummy/tmp/generators/app/views/devise/mailer/reset_password_instructions.html.erb
|
256
320
|
- test/factories/users.rb
|
321
|
+
- test/lib/devise_token_auth/blacklist_test.rb
|
322
|
+
- test/lib/devise_token_auth/token_factory_test.rb
|
257
323
|
- test/lib/devise_token_auth/url_test.rb
|
258
324
|
- test/lib/generators/devise_token_auth/install_generator_test.rb
|
259
325
|
- test/lib/generators/devise_token_auth/install_generator_with_namespace_test.rb
|
260
326
|
- test/lib/generators/devise_token_auth/install_views_generator_test.rb
|
327
|
+
- test/models/concerns/mongoid_support_test.rb
|
328
|
+
- test/models/concerns/tokens_serialization_test.rb
|
261
329
|
- test/models/only_email_user_test.rb
|
262
330
|
- test/models/user_test.rb
|
263
331
|
- test/support/controllers/routes.rb
|
@@ -282,18 +350,26 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
282
350
|
version: '0'
|
283
351
|
requirements: []
|
284
352
|
rubyforge_project:
|
285
|
-
rubygems_version: 2.
|
353
|
+
rubygems_version: 2.7.9
|
286
354
|
signing_key:
|
287
355
|
specification_version: 4
|
288
356
|
summary: Token based authentication for rails. Uses Devise + OmniAuth.
|
289
357
|
test_files:
|
290
|
-
- test/dummy/app/
|
291
|
-
- test/dummy/app/
|
292
|
-
- test/dummy/app/
|
293
|
-
- test/dummy/app/
|
294
|
-
- test/dummy/app/
|
295
|
-
- test/dummy/app/
|
296
|
-
- test/dummy/app/
|
358
|
+
- test/dummy/app/mongoid/only_email_user.rb
|
359
|
+
- test/dummy/app/mongoid/scoped_user.rb
|
360
|
+
- test/dummy/app/mongoid/mang.rb
|
361
|
+
- test/dummy/app/mongoid/unregisterable_user.rb
|
362
|
+
- test/dummy/app/mongoid/lockable_user.rb
|
363
|
+
- test/dummy/app/mongoid/unconfirmable_user.rb
|
364
|
+
- test/dummy/app/mongoid/user.rb
|
365
|
+
- test/dummy/app/models/concerns/favorite_color.rb
|
366
|
+
- test/dummy/app/active_record/only_email_user.rb
|
367
|
+
- test/dummy/app/active_record/scoped_user.rb
|
368
|
+
- test/dummy/app/active_record/mang.rb
|
369
|
+
- test/dummy/app/active_record/unregisterable_user.rb
|
370
|
+
- test/dummy/app/active_record/lockable_user.rb
|
371
|
+
- test/dummy/app/active_record/unconfirmable_user.rb
|
372
|
+
- test/dummy/app/active_record/user.rb
|
297
373
|
- test/dummy/app/controllers/overrides/token_validations_controller.rb
|
298
374
|
- test/dummy/app/controllers/overrides/omniauth_callbacks_controller.rb
|
299
375
|
- test/dummy/app/controllers/overrides/passwords_controller.rb
|
@@ -350,10 +426,14 @@ test_files:
|
|
350
426
|
- test/dummy/tmp/generators/app/views/devise/mailer/reset_password_instructions.html.erb
|
351
427
|
- test/dummy/README.rdoc
|
352
428
|
- test/models/only_email_user_test.rb
|
429
|
+
- test/models/concerns/mongoid_support_test.rb
|
430
|
+
- test/models/concerns/tokens_serialization_test.rb
|
353
431
|
- test/models/user_test.rb
|
354
432
|
- test/support/controllers/routes.rb
|
355
433
|
- test/factories/users.rb
|
356
434
|
- test/lib/devise_token_auth/url_test.rb
|
435
|
+
- test/lib/devise_token_auth/blacklist_test.rb
|
436
|
+
- test/lib/devise_token_auth/token_factory_test.rb
|
357
437
|
- test/lib/generators/devise_token_auth/install_generator_test.rb
|
358
438
|
- test/lib/generators/devise_token_auth/install_views_generator_test.rb
|
359
439
|
- test/lib/generators/devise_token_auth/install_generator_with_namespace_test.rb
|
@@ -1,198 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Use this hook to configure devise mailer, warden hooks and so forth.
|
4
|
-
# Many of these configuration options can be set straight in your model.
|
5
|
-
Devise.setup do |config|
|
6
|
-
# The secret key used by Devise. Devise uses this key to generate
|
7
|
-
# random tokens. Changing this key will render invalid all existing
|
8
|
-
# confirmation, reset password and unlock tokens in the database.
|
9
|
-
# config.secret_key = 'd029dbc7262359b4f9906ec029bae825981dee112d9a1425643719765c8fd4884f12a37add35607fa3fa2d6fa6945a0077d7fe0f10a67f8ee66d69e9cc6ac19b'
|
10
|
-
|
11
|
-
# ==> Mailer Configuration
|
12
|
-
# Configure the e-mail address which will be shown in Devise::Mailer,
|
13
|
-
# note that it will be overwritten if you use your own mailer class
|
14
|
-
# with default "from" parameter.
|
15
|
-
config.mailer_sender = 'no-reply@example.com'
|
16
|
-
|
17
|
-
# Configure the class responsible to send e-mails.
|
18
|
-
# config.mailer = 'Devise::Mailer'
|
19
|
-
|
20
|
-
# ==> ORM configuration
|
21
|
-
# Load and configure the ORM. Supports :active_record (default) and
|
22
|
-
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
23
|
-
# available as additional gems.
|
24
|
-
require 'devise/orm/active_record'
|
25
|
-
|
26
|
-
# ==> Configuration for any authentication mechanism
|
27
|
-
# Configure which keys are used when authenticating a user. The default is
|
28
|
-
# just :email. You can configure it to use [:username, :subdomain], so for
|
29
|
-
# authenticating a user, both parameters are required. Remember that those
|
30
|
-
# parameters are used only when authenticating and not when retrieving from
|
31
|
-
# session. If you need permissions, you should implement that in a before filter.
|
32
|
-
# You can also supply a hash where the value is a boolean determining whether
|
33
|
-
# or not authentication should be aborted when the value is not present.
|
34
|
-
# config.authentication_keys = [ :email ]
|
35
|
-
|
36
|
-
# Configure parameters from the request object used for authentication. Each entry
|
37
|
-
# given should be a request method and it will automatically be passed to the
|
38
|
-
# find_for_authentication method and considered in your model lookup. For instance,
|
39
|
-
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
40
|
-
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
41
|
-
# config.request_keys = []
|
42
|
-
|
43
|
-
# Configure which authentication keys should be case-insensitive.
|
44
|
-
# These keys will be downcased upon creating or modifying a user and when used
|
45
|
-
# to authenticate or find a user. Default is :email.
|
46
|
-
config.case_insensitive_keys = [ :email ]
|
47
|
-
|
48
|
-
# Configure which authentication keys should have whitespace stripped.
|
49
|
-
# These keys will have whitespace before and after removed upon creating or
|
50
|
-
# modifying a user and when used to authenticate or find a user. Default is :email.
|
51
|
-
config.strip_whitespace_keys = [ :email ]
|
52
|
-
|
53
|
-
# Tell if authentication through request.params is enabled. True by default.
|
54
|
-
# It can be set to an array that will enable params authentication only for the
|
55
|
-
# given strategies, for example, `config.params_authenticatable = [:database]` will
|
56
|
-
# enable it only for database (email + password) authentication.
|
57
|
-
# config.params_authenticatable = true
|
58
|
-
|
59
|
-
# Tell if authentication through HTTP Auth is enabled. False by default.
|
60
|
-
# It can be set to an array that will enable http authentication only for the
|
61
|
-
# given strategies, for example, `config.http_authenticatable = [:database]` will
|
62
|
-
# enable it only for database authentication. The supported strategies are:
|
63
|
-
# :database = Support basic authentication with authentication key + password
|
64
|
-
# config.http_authenticatable = false
|
65
|
-
|
66
|
-
# If http headers should be returned for AJAX requests. True by default.
|
67
|
-
# config.http_authenticatable_on_xhr = true
|
68
|
-
|
69
|
-
# The realm used in Http Basic Authentication. 'Application' by default.
|
70
|
-
# config.http_authentication_realm = 'Application'
|
71
|
-
|
72
|
-
# It will change confirmation, password recovery and other workflows
|
73
|
-
# to behave the same regardless if the e-mail provided was right or wrong.
|
74
|
-
# Does not affect registerable.
|
75
|
-
# config.paranoid = true
|
76
|
-
|
77
|
-
# By default Devise will store the user in session. You can skip storage for
|
78
|
-
# particular strategies by setting this option.
|
79
|
-
# Notice that if you are skipping storage for all authentication paths, you
|
80
|
-
# may want to disable generating routes to Devise's sessions controller by
|
81
|
-
# passing skip: :sessions to `devise_for` in your config/routes.rb
|
82
|
-
config.skip_session_storage = [:http_auth]
|
83
|
-
|
84
|
-
# By default, Devise cleans up the CSRF token on authentication to
|
85
|
-
# avoid CSRF token fixation attacks. This means that, when using AJAX
|
86
|
-
# requests for sign in and sign up, you need to get a new CSRF token
|
87
|
-
# from the server. You can disable this option at your own risk.
|
88
|
-
# config.clean_up_csrf_token_on_authentication = true
|
89
|
-
|
90
|
-
# ==> Configuration for :database_authenticatable
|
91
|
-
# For bcrypt, this is the cost for hashing the password and defaults to 11. If
|
92
|
-
# using other algorithms, it sets how many times you want the password to be hashed.
|
93
|
-
#
|
94
|
-
# Limiting the stretches to just one in testing will increase the performance of
|
95
|
-
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
96
|
-
# a value less than 10 in other environments. Note that, for bcrypt (the default
|
97
|
-
# algorithm), the cost increases exponentially with the number of stretches (e.g.
|
98
|
-
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
|
99
|
-
config.stretches = Rails.env.test? ? 1 : 11
|
100
|
-
|
101
|
-
# Setup a pepper to generate the encrypted password.
|
102
|
-
# config.pepper = '8ff086600aff82d68ff1e00d23c99c821e66652ec8c2a5b48f58de4a56b325cb532f6db660cf58fc5ecb473b9d851be8cd1badff0a1053bc9dc045f78b6e6772'
|
103
|
-
|
104
|
-
# ==> Configuration for :confirmable
|
105
|
-
# A period that the user is allowed to access the website even without
|
106
|
-
# confirming their account. For instance, if set to 2.days, the user will be
|
107
|
-
# able to access the website for two days without confirming their account,
|
108
|
-
# access will be blocked just in the third day. Default is 0.days, meaning
|
109
|
-
# the user cannot access the website without confirming their account.
|
110
|
-
# config.allow_unconfirmed_access_for = 2.days
|
111
|
-
|
112
|
-
# A period that the user is allowed to confirm their account before their
|
113
|
-
# token becomes invalid. For example, if set to 3.days, the user can confirm
|
114
|
-
# their account within 3 days after the mail was sent, but on the fourth day
|
115
|
-
# their account can't be confirmed with the token any more.
|
116
|
-
# Default is nil, meaning there is no restriction on how long a user can take
|
117
|
-
# before confirming their account.
|
118
|
-
# config.confirm_within = 3.days
|
119
|
-
|
120
|
-
# If true, requires any email changes to be confirmed (exactly the same way as
|
121
|
-
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
122
|
-
# db field (see migrations). Until confirmed, new email is stored in
|
123
|
-
# unconfirmed_email column, and copied to email column on successful confirmation.
|
124
|
-
config.reconfirmable = true
|
125
|
-
|
126
|
-
# Defines which key will be used when confirming an account
|
127
|
-
# config.confirmation_keys = [ :email ]
|
128
|
-
|
129
|
-
# ==> Configuration for :rememberable
|
130
|
-
# The time the user will be remembered without asking for credentials again.
|
131
|
-
# config.remember_for = 2.weeks
|
132
|
-
|
133
|
-
# If true, extends the user's remember period when remembered via cookie.
|
134
|
-
# config.extend_remember_period = false
|
135
|
-
|
136
|
-
# Options to be passed to the created cookie. For instance, you can set
|
137
|
-
# secure: true in order to force SSL only cookies.
|
138
|
-
# config.rememberable_options = {}
|
139
|
-
|
140
|
-
# ==> Configuration for :validatable
|
141
|
-
# Range for password length.
|
142
|
-
config.password_length = 8..128
|
143
|
-
|
144
|
-
# Email regex used to validate email formats. It simply asserts that
|
145
|
-
# one (and only one) @ exists in the given string. This is mainly
|
146
|
-
# to give user feedback and not to assert the e-mail validity.
|
147
|
-
config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
|
148
|
-
|
149
|
-
# ==> Configuration for :timeoutable
|
150
|
-
# The time you want to timeout the user session without activity. After this
|
151
|
-
# time the user will be asked for credentials again. Default is 30 minutes.
|
152
|
-
# config.timeout_in = 30.minutes
|
153
|
-
|
154
|
-
# If true, expires auth token on session timeout.
|
155
|
-
# config.expire_auth_token_on_timeout = false
|
156
|
-
|
157
|
-
# ==> Configuration for :lockable
|
158
|
-
# Defines which strategy will be used to lock an account.
|
159
|
-
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
160
|
-
# :none = No lock strategy. You should handle locking by yourself.
|
161
|
-
# config.lock_strategy = :failed_attempts
|
162
|
-
|
163
|
-
# Defines which key will be used when locking and unlocking an account
|
164
|
-
# config.unlock_keys = [ :email ]
|
165
|
-
|
166
|
-
# Defines which strategy will be used to unlock an account.
|
167
|
-
# :email = Sends an unlock link to the user email
|
168
|
-
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
169
|
-
# :both = Enables both strategies
|
170
|
-
# :none = No unlock strategy. You should handle unlocking by yourself.
|
171
|
-
# config.unlock_strategy = :both
|
172
|
-
|
173
|
-
# Number of authentication tries before locking an account if lock_strategy
|
174
|
-
# is failed attempts.
|
175
|
-
# config.maximum_attempts = 20
|
176
|
-
|
177
|
-
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
178
|
-
# config.unlock_in = 1.hour
|
179
|
-
|
180
|
-
# Warn on the last attempt before the account is locked.
|
181
|
-
# config.last_attempt_warning = false
|
182
|
-
|
183
|
-
# ==> Configuration for :recoverable
|
184
|
-
#
|
185
|
-
# Defines which key will be used when recovering the password for an account
|
186
|
-
# config.reset_password_keys = [ :email ]
|
187
|
-
|
188
|
-
# Time interval you can reset your password with a reset password key.
|
189
|
-
# Don't put a too small interval or your users won't have the time to
|
190
|
-
# change their passwords.
|
191
|
-
config.reset_password_within = 6.hours
|
192
|
-
|
193
|
-
# The default HTTP method used to sign out a resource. Default is :delete.
|
194
|
-
config.sign_out_via = :delete
|
195
|
-
|
196
|
-
# don't serialize tokens
|
197
|
-
Devise::Models::Authenticatable::BLACKLIST_FOR_SERIALIZATION << :tokens
|
198
|
-
end
|
File without changes
|
File without changes
|
File without changes
|