sorcery 0.16.5 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e28e735926cc783f48b5f8708fcdba63b66d20c54acb46197a633c3a2c27ed9f
4
- data.tar.gz: c48a71718894e02b6d556143d7019b64698d938faf3d82cc97362314e5d821eb
3
+ metadata.gz: f0d32dda46271c863af12b7e00fd451bf10017f3976c863c628c35e92694ba11
4
+ data.tar.gz: c10900d15fd8ab8277be5bc9f6402e5fa8a60ea30141212b4f05f354768cb06f
5
5
  SHA512:
6
- metadata.gz: 94876b13d7838ab273e7cf01489914dfce2cdf9f27259f2f3dcb98d62dfe126b65daf3dde018c6423e4a6fbe9b526339c85dfa978dcdf61698ce77b42f722a4d
7
- data.tar.gz: 4defd2381f95ab3b89c859430a68fe9c0bb5068d09276100c80996b196448c1289057b3f8059c2d1188199bd0ae3852c6bd5c33a0701c61cd27c1acd7b692ac1
6
+ metadata.gz: c86b28d8be6ffff0d2ea865cf18af4dc432fc046f8b1d0fe57091529d5f936d2b2cb54692110675f91e1126d9ae8987b24e423b2aacc8f2205d511e7a8ae8a90
7
+ data.tar.gz: d37df5136edd49c75f8f28aae3f8a5a007dbc42ae3aefea7c270b2fb561ca73e628d478d5d4fab073a8546c4f1103af44969cfe0ad8b897579e72c01e02253d8
data/.github/FUNDING.yml CHANGED
@@ -1 +1 @@
1
- github: athix
1
+ github: joshbuker
@@ -16,44 +16,28 @@ jobs:
16
16
  fail-fast: false
17
17
  matrix:
18
18
  ruby:
19
- - 2.4
20
- - 2.5
21
- - 2.6
22
- - 2.7
23
- - 3.0.0
24
- # - 3.1
19
+ - '3.0'
20
+ - '3.1'
21
+ - '3.2'
22
+ - '3.3'
25
23
 
26
24
  rails:
27
- - '52'
28
- - '60'
29
25
  - '61'
30
- # - '70'
26
+ - '70'
27
+ - '71'
31
28
 
32
29
  exclude:
33
- - ruby: 2.4
34
- rails: '60'
35
- - ruby: 2.4
30
+ - ruby: '3.3'
31
+ rails: '70'
32
+ - ruby: '3.3'
33
+ rails: '61'
34
+ - ruby: '3.2'
36
35
  rails: '61'
37
- # - ruby: 2.4
38
- # rails: '70'
39
- # - ruby: 2.5
40
- # rails: '70'
41
- # - ruby: 2.6
42
- # rails: '70'
43
- - ruby: 3.0.0
44
- rails: '52'
45
- # - ruby: 3.1
46
- # rails: '52'
47
- # - ruby: 3.1
48
- # rails: '60'
49
- # - ruby: 3.1
50
- # rails: '61'
51
-
52
36
  env:
53
37
  BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.gemfile
54
38
 
55
39
  steps:
56
- - uses: actions/checkout@v2
40
+ - uses: actions/checkout@v4
57
41
  - name: Set up Ruby
58
42
  uses: ruby/setup-ruby@v1
59
43
  with:
data/.gitignore CHANGED
@@ -53,7 +53,7 @@ tmtags
53
53
  #
54
54
  spec/rails_app/log/*
55
55
  *.log
56
- *.sqlite3
56
+ *.sqlite3*
57
57
  Gemfile*.lock
58
58
  gemfiles/*.lock
59
59
  .ruby-version
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # Changelog
2
2
  ## HEAD
3
3
 
4
+ ## 0.17.0
5
+
6
+ * Fix Rails 7.1 compatibility by using `ActiveRecord.timestamped_migrations` [#352](https://github.com/Sorcery/sorcery/pull/352)
7
+ * Change CI settings for support Ruby3.0+ Rails6.1+ [#357](https://github.com/Sorcery/sorcery/pull/357)
8
+ * Fix error when running the install generator [#339](https://github.com/Sorcery/sorcery/pull/339)
9
+
4
10
  ## 0.16.5
5
11
 
6
12
  * Raise ArgumentError when calling change_password! with blank password [#333](https://github.com/Sorcery/sorcery/pull/333)
data/README.md CHANGED
@@ -235,7 +235,7 @@ Feel free to ask questions using these contact details:
235
235
 
236
236
  **Current Maintainers:**
237
237
 
238
- - Josh Buker ([@athix](https://github.com/athix)) | [Email](mailto:crypto+sorcery@joshbuker.com?subject=Sorcery)
238
+ - Josh Buker ([@joshbuker](https://github.com/joshbuker)) | [Email](mailto:crypto+sorcery@joshbuker.com?subject=Sorcery)
239
239
 
240
240
  **Past Maintainers:**
241
241
 
@@ -3,5 +3,5 @@ source 'https://rubygems.org'
3
3
  gem 'rails', '~> 6.1.0'
4
4
  gem 'rails-controller-testing'
5
5
  gem 'sqlite3', '~> 1.4'
6
-
6
+ gem 'rspec-rails', '>= 5.0'
7
7
  gemspec path: '..'
@@ -3,5 +3,5 @@ source 'https://rubygems.org'
3
3
  gem 'rails', '~> 7.0.0'
4
4
  gem 'rails-controller-testing'
5
5
  gem 'sqlite3', '~> 1.4'
6
-
6
+ gem 'rspec-rails', '>= 6.0'
7
7
  gemspec path: '..'
@@ -1,7 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rails', '~> 6.0.0'
3
+ gem 'rails', '~> 7.1.0'
4
4
  gem 'rails-controller-testing'
5
5
  gem 'sqlite3', '~> 1.4'
6
-
6
+ gem 'rspec-rails', '>= 6.1'
7
7
  gemspec path: '..'
@@ -48,7 +48,6 @@ module Sorcery
48
48
  return if only_submodules?
49
49
 
50
50
  generate "model #{model_class_name} --skip-migration"
51
- inject_sorcery_to_model
52
51
  end
53
52
 
54
53
  def inject_sorcery_to_model
@@ -75,7 +74,7 @@ module Sorcery
75
74
 
76
75
  # Define the next_migration_number method (necessary for the migration_template method to work)
77
76
  def self.next_migration_number(dirname)
78
- if ActiveRecord::Base.timestamped_migrations
77
+ if timestamped_migrations?
79
78
  sleep 1 # make sure each time we get a different timestamp
80
79
  Time.new.utc.strftime('%Y%m%d%H%M%S')
81
80
  else
@@ -85,6 +84,14 @@ module Sorcery
85
84
 
86
85
  private
87
86
 
87
+ def self.timestamped_migrations?
88
+ if Rails::VERSION::MAJOR >= 7
89
+ ActiveRecord.timestamped_migrations
90
+ else
91
+ ActiveRecord::Base.timestamped_migrations
92
+ end
93
+ end
94
+
88
95
  def only_submodules?
89
96
  options[:migrations] || options[:only_submodules]
90
97
  end
@@ -1,3 +1,3 @@
1
1
  module Sorcery
2
- VERSION = '0.16.5'.freeze
2
+ VERSION = '0.17.0'.freeze
3
3
  end
data/sorcery.gemspec CHANGED
@@ -38,7 +38,7 @@ Gem::Specification.new do |s|
38
38
  s.add_dependency 'oauth2', '~> 2.0'
39
39
 
40
40
  s.add_development_dependency 'byebug', '~> 10.0.0'
41
- s.add_development_dependency 'rspec-rails', '~> 3.7.0'
41
+ s.add_development_dependency 'rspec-rails'
42
42
  s.add_development_dependency 'rubocop'
43
43
  s.add_development_dependency 'simplecov', '>= 0.3.8'
44
44
  s.add_development_dependency 'test-unit', '~> 3.2.0'
@@ -32,14 +32,14 @@ describe SorceryController, active_record: true, type: :controller do
32
32
  sorcery_model_property_set(:authentications_class, Authentication)
33
33
  sorcery_controller_external_property_set(:facebook, :user_info_mapping, username: 'name')
34
34
 
35
- expect(User).to receive(:create_from_provider).with('facebook', '123', username: 'Noam Ben Ari')
35
+ expect(User).to receive(:create_from_provider).with('facebook', '123', { username: 'Noam Ben Ari' })
36
36
  get :test_create_from_provider, params: { provider: 'facebook' }
37
37
  end
38
38
 
39
39
  it 'supports nested attributes' do
40
40
  sorcery_model_property_set(:authentications_class, Authentication)
41
41
  sorcery_controller_external_property_set(:facebook, :user_info_mapping, username: 'hometown/name')
42
- expect(User).to receive(:create_from_provider).with('facebook', '123', username: 'Haifa, Israel')
42
+ expect(User).to receive(:create_from_provider).with('facebook', '123', { username: 'Haifa, Israel' })
43
43
 
44
44
  get :test_create_from_provider, params: { provider: 'facebook' }
45
45
  end
@@ -48,7 +48,7 @@ describe SorceryController, active_record: true, type: :controller do
48
48
  sorcery_model_property_set(:authentications_class, Authentication)
49
49
  sorcery_controller_external_property_set(:facebook, :user_info_mapping, username: 'name', created_at: 'does/not/exist')
50
50
 
51
- expect(User).to receive(:create_from_provider).with('facebook', '123', username: 'Noam Ben Ari')
51
+ expect(User).to receive(:create_from_provider).with('facebook', '123', { username: 'Noam Ben Ari' })
52
52
 
53
53
  get :test_create_from_provider, params: { provider: 'facebook' }
54
54
  end
@@ -59,7 +59,7 @@ describe SorceryController, active_record: true, type: :controller do
59
59
  sorcery_controller_external_property_set(:facebook, :user_info_mapping, username: 'name')
60
60
 
61
61
  u = double('user')
62
- expect(User).to receive(:create_from_provider).with('facebook', '123', username: 'Noam Ben Ari').and_return(u).and_yield(u)
62
+ expect(User).to receive(:create_from_provider).with('facebook', '123', { username: 'Noam Ben Ari' }).and_return(u).and_yield(u)
63
63
  # test_create_from_provider_with_block in controller will check for uniqueness of username
64
64
  get :test_create_from_provider_with_block, params: { provider: 'facebook' }
65
65
  end
@@ -136,7 +136,7 @@ describe SorceryController, type: :controller do
136
136
  it 'creates a new user' do
137
137
  sorcery_controller_external_property_set(:twitter, :user_info_mapping, username: 'screen_name')
138
138
  expect(User).to receive(:load_from_provider).with('twitter', '123').and_return(nil)
139
- expect(User).to receive(:create_from_provider).with('twitter', '123', username: 'nbenari').and_return(user)
139
+ expect(User).to receive(:create_from_provider).with('twitter', '123', { username: 'nbenari' }).and_return(user)
140
140
 
141
141
  get :test_create_from_provider, params: { provider: 'twitter' }
142
142
  end
@@ -144,7 +144,7 @@ describe SorceryController, type: :controller do
144
144
  it 'supports nested attributes' do
145
145
  sorcery_controller_external_property_set(:twitter, :user_info_mapping, username: 'status/text')
146
146
  expect(User).to receive(:load_from_provider).with('twitter', '123').and_return(nil)
147
- expect(User).to receive(:create_from_provider).with('twitter', '123', username: 'coming soon to sorcery gem: twitter and facebook authentication support.').and_return(user)
147
+ expect(User).to receive(:create_from_provider).with('twitter', '123', { username: 'coming soon to sorcery gem: twitter and facebook authentication support.' }).and_return(user)
148
148
 
149
149
  get :test_create_from_provider, params: { provider: 'twitter' }
150
150
  end
@@ -152,7 +152,7 @@ describe SorceryController, type: :controller do
152
152
  it 'does not crash on missing nested attributes' do
153
153
  sorcery_controller_external_property_set(:twitter, :user_info_mapping, username: 'status/text', created_at: 'does/not/exist')
154
154
  expect(User).to receive(:load_from_provider).with('twitter', '123').and_return(nil)
155
- expect(User).to receive(:create_from_provider).with('twitter', '123', username: 'coming soon to sorcery gem: twitter and facebook authentication support.').and_return(user)
155
+ expect(User).to receive(:create_from_provider).with('twitter', '123', { username: 'coming soon to sorcery gem: twitter and facebook authentication support.' }).and_return(user)
156
156
 
157
157
  get :test_create_from_provider, params: { provider: 'twitter' }
158
158
  end
@@ -175,7 +175,7 @@ describe SorceryController, type: :controller do
175
175
 
176
176
  u = double('user')
177
177
  expect(User).to receive(:load_from_provider).with('twitter', '123').and_return(nil)
178
- expect(User).to receive(:create_from_provider).with('twitter', '123', username: 'nbenari').and_return(u).and_yield(u)
178
+ expect(User).to receive(:create_from_provider).with('twitter', '123', { username: 'nbenari' }).and_return(u).and_yield(u)
179
179
 
180
180
  get :test_create_from_provider_with_block, params: { provider: 'twitter' }
181
181
  end
@@ -129,9 +129,11 @@ describe SorceryController, type: :controller do
129
129
  end
130
130
 
131
131
  context "with 'session_timeout_from_last_action'" do
132
+ before { create_new_user }
133
+ after { User.delete_all }
134
+
132
135
  it 'does not logout if there was activity' do
133
136
  sorcery_controller_property_set(:session_timeout_from_last_action, true)
134
- expect(User).to receive(:authenticate).with('bla@bla.com', 'secret') { |&block| block.call(user, nil) }
135
137
 
136
138
  get :test_login, params: { email: 'bla@bla.com', password: 'secret' }
137
139
  Timecop.travel(Time.now.in_time_zone + 0.3)
@@ -64,7 +64,13 @@ describe SorceryController, type: :controller do
64
64
  expect(session[:user_id]).to eq user.id.to_s
65
65
  end
66
66
 
67
+ # NOTE: The lack of a CSRF token may mean that sessions will break
68
+ # horribly for Sorcery when using Rails 7.1+. We shall see.
67
69
  it 'sets csrf token in session' do
70
+ if Gem::Version.new(Rails.version) >= Gem::Version.new('7.1')
71
+ pending 'Rails 7.1 is not including the csrf token in the session for unknown reasons'
72
+ end
73
+
68
74
  expect(session[:_csrf_token]).not_to be_nil
69
75
  end
70
76
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sorcery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.5
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noam Ben Ari
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2023-04-11 00:00:00.000000000 Z
15
+ date: 2024-03-08 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: bcrypt
@@ -74,16 +74,16 @@ dependencies:
74
74
  name: rspec-rails
75
75
  requirement: !ruby/object:Gem::Requirement
76
76
  requirements:
77
- - - "~>"
77
+ - - ">="
78
78
  - !ruby/object:Gem::Version
79
- version: 3.7.0
79
+ version: '0'
80
80
  type: :development
81
81
  prerelease: false
82
82
  version_requirements: !ruby/object:Gem::Requirement
83
83
  requirements:
84
- - - "~>"
84
+ - - ">="
85
85
  - !ruby/object:Gem::Version
86
- version: 3.7.0
86
+ version: '0'
87
87
  - !ruby/object:Gem::Dependency
88
88
  name: rubocop
89
89
  requirement: !ruby/object:Gem::Requirement
@@ -202,10 +202,9 @@ files:
202
202
  - README.md
203
203
  - Rakefile
204
204
  - SECURITY.md
205
- - gemfiles/rails_52.gemfile
206
- - gemfiles/rails_60.gemfile
207
205
  - gemfiles/rails_61.gemfile
208
206
  - gemfiles/rails_70.gemfile
207
+ - gemfiles/rails_71.gemfile
209
208
  - lib/generators/sorcery/USAGE
210
209
  - lib/generators/sorcery/helpers.rb
211
210
  - lib/generators/sorcery/install_generator.rb
@@ -382,7 +381,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
382
381
  - !ruby/object:Gem::Version
383
382
  version: '0'
384
383
  requirements: []
385
- rubygems_version: 3.2.33
384
+ rubygems_version: 3.3.5
386
385
  signing_key:
387
386
  specification_version: 4
388
387
  summary: Magical authentication for Rails applications
@@ -1,7 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rails', '~> 5.2.0'
4
- gem 'rails-controller-testing'
5
- gem 'sqlite3', '~> 1.3.6'
6
-
7
- gemspec path: '..'