sorcery 0.12.0 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sorcery might be problematic. Click here for more details.

Files changed (83) hide show
  1. checksums.yaml +5 -5
  2. data/.github/ISSUE_TEMPLATE.md +20 -0
  3. data/.rubocop.yml +52 -2
  4. data/.rubocop_todo.yml +1 -429
  5. data/.travis.yml +11 -21
  6. data/CHANGELOG.md +16 -0
  7. data/Gemfile +2 -2
  8. data/{LICENSE.txt → LICENSE.md} +1 -1
  9. data/README.md +7 -1
  10. data/gemfiles/{active_record-rails40.gemfile → active_record_rails_40.gemfile} +1 -2
  11. data/gemfiles/{active_record-rails41.gemfile → active_record_rails_41.gemfile} +1 -2
  12. data/gemfiles/{active_record-rails42.gemfile → active_record_rails_42.gemfile} +1 -2
  13. data/lib/generators/sorcery/USAGE +1 -1
  14. data/lib/generators/sorcery/install_generator.rb +21 -21
  15. data/lib/generators/sorcery/templates/initializer.rb +19 -1
  16. data/lib/sorcery/adapters/active_record_adapter.rb +1 -1
  17. data/lib/sorcery/adapters/mongoid_adapter.rb +23 -11
  18. data/lib/sorcery/controller.rb +22 -16
  19. data/lib/sorcery/controller/config.rb +2 -0
  20. data/lib/sorcery/controller/submodules/activity_logging.rb +4 -0
  21. data/lib/sorcery/controller/submodules/external.rb +37 -33
  22. data/lib/sorcery/controller/submodules/http_basic_auth.rb +1 -0
  23. data/lib/sorcery/controller/submodules/remember_me.rb +1 -7
  24. data/lib/sorcery/controller/submodules/session_timeout.rb +25 -4
  25. data/lib/sorcery/crypto_providers/aes256.rb +1 -0
  26. data/lib/sorcery/crypto_providers/bcrypt.rb +2 -1
  27. data/lib/sorcery/engine.rb +10 -3
  28. data/lib/sorcery/model.rb +9 -6
  29. data/lib/sorcery/model/config.rb +3 -3
  30. data/lib/sorcery/model/submodules/brute_force_protection.rb +6 -7
  31. data/lib/sorcery/model/submodules/external.rb +4 -3
  32. data/lib/sorcery/model/submodules/magic_login.rb +29 -36
  33. data/lib/sorcery/model/submodules/reset_password.rb +5 -4
  34. data/lib/sorcery/model/submodules/user_activation.rb +1 -1
  35. data/lib/sorcery/protocols/oauth.rb +1 -0
  36. data/lib/sorcery/providers/auth0.rb +46 -0
  37. data/lib/sorcery/providers/heroku.rb +1 -0
  38. data/lib/sorcery/providers/instagram.rb +73 -0
  39. data/lib/sorcery/providers/linkedin.rb +1 -1
  40. data/lib/sorcery/providers/vk.rb +1 -1
  41. data/lib/sorcery/providers/wechat.rb +8 -6
  42. data/lib/sorcery/test_helpers/internal.rb +5 -4
  43. data/lib/sorcery/test_helpers/internal/rails.rb +11 -11
  44. data/lib/sorcery/version.rb +1 -1
  45. data/sorcery.gemspec +25 -9
  46. data/spec/active_record/user_activation_spec.rb +2 -2
  47. data/spec/active_record/user_activity_logging_spec.rb +2 -2
  48. data/spec/active_record/user_brute_force_protection_spec.rb +2 -2
  49. data/spec/active_record/user_magic_login_spec.rb +4 -4
  50. data/spec/active_record/user_oauth_spec.rb +2 -2
  51. data/spec/active_record/user_remember_me_spec.rb +2 -2
  52. data/spec/active_record/user_reset_password_spec.rb +2 -2
  53. data/spec/active_record/user_spec.rb +0 -10
  54. data/spec/controllers/controller_http_basic_auth_spec.rb +1 -1
  55. data/spec/controllers/controller_oauth2_spec.rb +195 -123
  56. data/spec/controllers/controller_oauth_spec.rb +7 -7
  57. data/spec/controllers/controller_remember_me_spec.rb +11 -6
  58. data/spec/controllers/controller_session_timeout_spec.rb +90 -3
  59. data/spec/controllers/controller_spec.rb +2 -2
  60. data/spec/orm/active_record.rb +2 -2
  61. data/spec/providers/vk_spec.rb +13 -12
  62. data/spec/rails_app/app/controllers/sorcery_controller.rb +83 -32
  63. data/spec/rails_app/app/mailers/sorcery_mailer.rb +1 -1
  64. data/spec/rails_app/config/application.rb +8 -3
  65. data/spec/rails_app/config/boot.rb +1 -1
  66. data/spec/rails_app/config/environment.rb +1 -1
  67. data/spec/rails_app/config/routes.rb +7 -0
  68. data/spec/rails_app/config/secrets.yml +4 -0
  69. data/spec/rails_app/db/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb +2 -2
  70. data/spec/rails_app/db/migrate/invalidate_active_sessions/20180221093235_add_invalidate_active_sessions_before_to_users.rb +9 -0
  71. data/spec/rails_app/db/migrate/magic_login/20170924151831_add_magic_login_to_users.rb +3 -3
  72. data/spec/rails_app/db/schema.rb +7 -9
  73. data/spec/shared_examples/user_magic_login_shared_examples.rb +50 -50
  74. data/spec/shared_examples/user_oauth_shared_examples.rb +1 -1
  75. data/spec/shared_examples/user_remember_me_shared_examples.rb +1 -1
  76. data/spec/shared_examples/user_reset_password_shared_examples.rb +3 -3
  77. data/spec/shared_examples/user_shared_examples.rb +41 -43
  78. data/spec/sorcery_crypto_providers_spec.rb +1 -1
  79. data/spec/spec.opts +1 -1
  80. data/spec/spec_helper.rb +2 -2
  81. data/spec/support/migration_helper.rb +19 -0
  82. metadata +60 -38
  83. data/spec/rails_app/config/initializers/secret_token.rb +0 -7
@@ -53,7 +53,7 @@ describe 'Crypto Providers wrappers' do
53
53
 
54
54
  it 'matches password encrypted using salt and join token from upstream' do
55
55
  Sorcery::CryptoProviders::SHA1.join_token = 'test'
56
- expect(Sorcery::CryptoProviders::SHA1.encrypt(%w(password gq18WBnJYNh2arkC1kgH))).to eq '894b5bf1643b8d0e1b2eaddb22426be7036dab70'
56
+ expect(Sorcery::CryptoProviders::SHA1.encrypt(%w[password gq18WBnJYNh2arkC1kgH])).to eq '894b5bf1643b8d0e1b2eaddb22426be7036dab70'
57
57
  end
58
58
  end
59
59
 
@@ -1,2 +1,2 @@
1
1
  --color
2
- --format documentation
2
+ --format documentation
@@ -29,7 +29,7 @@ RSpec.configure do |config|
29
29
  config.include RSpec::Rails::ControllerExampleGroup, file_path: /controller(.)*_spec.rb$/
30
30
  config.mock_with :rspec
31
31
 
32
- config.use_transactional_fixtures = true
32
+ config.use_transactional_fixtures = false
33
33
 
34
34
  config.before(:suite) { setup_orm }
35
35
  config.after(:suite) { teardown_orm }
@@ -40,7 +40,7 @@ RSpec.configure do |config|
40
40
 
41
41
  if begin
42
42
  Module.const_defined?('::Rails::Controller::Testing')
43
- rescue
43
+ rescue StandardError
44
44
  false
45
45
  end
46
46
  config.include ::Rails::Controller::Testing::TestProcess, type: :controller
@@ -0,0 +1,19 @@
1
+ class MigrationHelper
2
+ class << self
3
+ def migrate(path)
4
+ if ActiveRecord.version >= Gem::Version.new('5.2.0')
5
+ ActiveRecord::MigrationContext.new(path).migrate
6
+ else
7
+ ActiveRecord::Migrator.migrate(path)
8
+ end
9
+ end
10
+
11
+ def rollback(path)
12
+ if ActiveRecord.version >= Gem::Version.new('5.2.0')
13
+ ActiveRecord::MigrationContext.new(path).rollback
14
+ else
15
+ ActiveRecord::Migrator.rollback(path)
16
+ end
17
+ end
18
+ end
19
+ end
metadata CHANGED
@@ -1,18 +1,33 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sorcery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noam Ben Ari
8
8
  - Kir Shatrov
9
9
  - Grzegorz Witek
10
10
  - Chase Gilliam
11
+ - Josh Buker
11
12
  autorequire:
12
13
  bindir: bin
13
14
  cert_chain: []
14
- date: 2018-04-23 00:00:00.000000000 Z
15
+ date: 2018-11-29 00:00:00.000000000 Z
15
16
  dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: bcrypt
19
+ requirement: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - "~>"
22
+ - !ruby/object:Gem::Version
23
+ version: '3.1'
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ requirements:
28
+ - - "~>"
29
+ - !ruby/object:Gem::Version
30
+ version: '3.1'
16
31
  - !ruby/object:Gem::Dependency
17
32
  name: oauth
18
33
  requirement: !ruby/object:Gem::Requirement
@@ -54,41 +69,35 @@ dependencies:
54
69
  - !ruby/object:Gem::Version
55
70
  version: 0.8.0
56
71
  - !ruby/object:Gem::Dependency
57
- name: bcrypt
72
+ name: byebug
58
73
  requirement: !ruby/object:Gem::Requirement
59
74
  requirements:
60
75
  - - "~>"
61
76
  - !ruby/object:Gem::Version
62
- version: '3.1'
63
- type: :runtime
77
+ version: 10.0.0
78
+ type: :development
64
79
  prerelease: false
65
80
  version_requirements: !ruby/object:Gem::Requirement
66
81
  requirements:
67
82
  - - "~>"
68
83
  - !ruby/object:Gem::Version
69
- version: '3.1'
84
+ version: 10.0.0
70
85
  - !ruby/object:Gem::Dependency
71
- name: yard
86
+ name: rspec-rails
72
87
  requirement: !ruby/object:Gem::Requirement
73
88
  requirements:
74
89
  - - "~>"
75
90
  - !ruby/object:Gem::Version
76
- version: 0.9.0
77
- - - ">="
78
- - !ruby/object:Gem::Version
79
- version: 0.9.12
91
+ version: 3.7.0
80
92
  type: :development
81
93
  prerelease: false
82
94
  version_requirements: !ruby/object:Gem::Requirement
83
95
  requirements:
84
96
  - - "~>"
85
97
  - !ruby/object:Gem::Version
86
- version: 0.9.0
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: 0.9.12
98
+ version: 3.7.0
90
99
  - !ruby/object:Gem::Dependency
91
- name: timecop
100
+ name: rubocop
92
101
  requirement: !ruby/object:Gem::Requirement
93
102
  requirements:
94
103
  - - ">="
@@ -116,69 +125,78 @@ dependencies:
116
125
  - !ruby/object:Gem::Version
117
126
  version: 0.3.8
118
127
  - !ruby/object:Gem::Dependency
119
- name: rspec-rails
128
+ name: test-unit
120
129
  requirement: !ruby/object:Gem::Requirement
121
130
  requirements:
122
131
  - - "~>"
123
132
  - !ruby/object:Gem::Version
124
- version: 3.7.0
133
+ version: 3.2.0
125
134
  type: :development
126
135
  prerelease: false
127
136
  version_requirements: !ruby/object:Gem::Requirement
128
137
  requirements:
129
138
  - - "~>"
130
139
  - !ruby/object:Gem::Version
131
- version: 3.7.0
140
+ version: 3.2.0
132
141
  - !ruby/object:Gem::Dependency
133
- name: test-unit
142
+ name: timecop
134
143
  requirement: !ruby/object:Gem::Requirement
135
144
  requirements:
136
- - - "~>"
145
+ - - ">="
137
146
  - !ruby/object:Gem::Version
138
- version: 3.2.0
147
+ version: '0'
139
148
  type: :development
140
149
  prerelease: false
141
150
  version_requirements: !ruby/object:Gem::Requirement
142
151
  requirements:
143
- - - "~>"
152
+ - - ">="
144
153
  - !ruby/object:Gem::Version
145
- version: 3.2.0
154
+ version: '0'
146
155
  - !ruby/object:Gem::Dependency
147
- name: byebug
156
+ name: webmock
148
157
  requirement: !ruby/object:Gem::Requirement
149
158
  requirements:
150
159
  - - "~>"
151
160
  - !ruby/object:Gem::Version
152
- version: 10.0.0
161
+ version: 3.3.0
153
162
  type: :development
154
163
  prerelease: false
155
164
  version_requirements: !ruby/object:Gem::Requirement
156
165
  requirements:
157
166
  - - "~>"
158
167
  - !ruby/object:Gem::Version
159
- version: 10.0.0
168
+ version: 3.3.0
160
169
  - !ruby/object:Gem::Dependency
161
- name: webmock
170
+ name: yard
162
171
  requirement: !ruby/object:Gem::Requirement
163
172
  requirements:
164
173
  - - "~>"
165
174
  - !ruby/object:Gem::Version
166
- version: 3.3.0
175
+ version: 0.9.0
176
+ - - ">="
177
+ - !ruby/object:Gem::Version
178
+ version: 0.9.12
167
179
  type: :development
168
180
  prerelease: false
169
181
  version_requirements: !ruby/object:Gem::Requirement
170
182
  requirements:
171
183
  - - "~>"
172
184
  - !ruby/object:Gem::Version
173
- version: 3.3.0
185
+ version: 0.9.0
186
+ - - ">="
187
+ - !ruby/object:Gem::Version
188
+ version: 0.9.12
174
189
  description: Provides common authentication needs such as signing in/out, activating
175
190
  by email and resetting password.
176
- email: chase.gilliam@gmail.com
191
+ email:
192
+ - chase.gilliam@gmail.com
193
+ - contact@joshbuker.com
177
194
  executables: []
178
195
  extensions: []
179
196
  extra_rdoc_files: []
180
197
  files:
181
198
  - ".document"
199
+ - ".github/ISSUE_TEMPLATE.md"
182
200
  - ".gitignore"
183
201
  - ".rspec"
184
202
  - ".rubocop.yml"
@@ -186,12 +204,12 @@ files:
186
204
  - ".travis.yml"
187
205
  - CHANGELOG.md
188
206
  - Gemfile
189
- - LICENSE.txt
207
+ - LICENSE.md
190
208
  - README.md
191
209
  - Rakefile
192
- - gemfiles/active_record-rails40.gemfile
193
- - gemfiles/active_record-rails41.gemfile
194
- - gemfiles/active_record-rails42.gemfile
210
+ - gemfiles/active_record_rails_40.gemfile
211
+ - gemfiles/active_record_rails_41.gemfile
212
+ - gemfiles/active_record_rails_42.gemfile
195
213
  - lib/generators/sorcery/USAGE
196
214
  - lib/generators/sorcery/helpers.rb
197
215
  - lib/generators/sorcery/install_generator.rb
@@ -237,11 +255,13 @@ files:
237
255
  - lib/sorcery/protocols/certs/ca-bundle.crt
238
256
  - lib/sorcery/protocols/oauth.rb
239
257
  - lib/sorcery/protocols/oauth2.rb
258
+ - lib/sorcery/providers/auth0.rb
240
259
  - lib/sorcery/providers/base.rb
241
260
  - lib/sorcery/providers/facebook.rb
242
261
  - lib/sorcery/providers/github.rb
243
262
  - lib/sorcery/providers/google.rb
244
263
  - lib/sorcery/providers/heroku.rb
264
+ - lib/sorcery/providers/instagram.rb
245
265
  - lib/sorcery/providers/jira.rb
246
266
  - lib/sorcery/providers/linkedin.rb
247
267
  - lib/sorcery/providers/liveid.rb
@@ -306,15 +326,16 @@ files:
306
326
  - spec/rails_app/config/initializers/compatible_legacy_migration.rb
307
327
  - spec/rails_app/config/initializers/inflections.rb
308
328
  - spec/rails_app/config/initializers/mime_types.rb
309
- - spec/rails_app/config/initializers/secret_token.rb
310
329
  - spec/rails_app/config/initializers/session_store.rb
311
330
  - spec/rails_app/config/locales/en.yml
312
331
  - spec/rails_app/config/routes.rb
332
+ - spec/rails_app/config/secrets.yml
313
333
  - spec/rails_app/db/migrate/activation/20101224223622_add_activation_to_users.rb
314
334
  - spec/rails_app/db/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb
315
335
  - spec/rails_app/db/migrate/brute_force_protection/20101224223626_add_brute_force_protection_to_users.rb
316
336
  - spec/rails_app/db/migrate/core/20101224223620_create_users.rb
317
337
  - spec/rails_app/db/migrate/external/20101224223628_create_authentications_and_user_providers.rb
338
+ - spec/rails_app/db/migrate/invalidate_active_sessions/20180221093235_add_invalidate_active_sessions_before_to_users.rb
318
339
  - spec/rails_app/db/migrate/magic_login/20170924151831_add_magic_login_to_users.rb
319
340
  - spec/rails_app/db/migrate/remember_me/20101224223623_add_remember_me_token_to_users.rb
320
341
  - spec/rails_app/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb
@@ -332,6 +353,7 @@ files:
332
353
  - spec/sorcery_temporary_token_spec.rb
333
354
  - spec/spec.opts
334
355
  - spec/spec_helper.rb
356
+ - spec/support/migration_helper.rb
335
357
  homepage: https://github.com/Sorcery/sorcery
336
358
  licenses:
337
359
  - MIT
@@ -346,7 +368,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
346
368
  requirements:
347
369
  - - ">="
348
370
  - !ruby/object:Gem::Version
349
- version: 2.2.2
371
+ version: 2.2.9
350
372
  required_rubygems_version: !ruby/object:Gem::Requirement
351
373
  requirements:
352
374
  - - ">="
@@ -354,7 +376,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
354
376
  version: '0'
355
377
  requirements: []
356
378
  rubyforge_project:
357
- rubygems_version: 2.6.14
379
+ rubygems_version: 2.7.7
358
380
  signing_key:
359
381
  specification_version: 4
360
382
  summary: Magical authentication for Rails applications
@@ -1,7 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Your secret key for verifying the integrity of signed cookies.
4
- # If you change this key, all old signed cookies will become invalid!
5
- # Make sure the secret is at least 30 characters and all random,
6
- # no regular words or you'll be exposed to dictionary attacks.
7
- AppRoot::Application.config.secret_token = 'a9789f869a0d0ac2f2b683d6e9410c530696b178bca28a7971f4a652b14ff2da89f2cf4dcbf0355f6bc41f81731aa8e46085674d1acc1980436f61cdba76ff5d'