solidus_jwt 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +35 -0
  3. data/.gem_release.yml +5 -0
  4. data/.github/CODEOWNERS +4 -0
  5. data/.github/stale.yml +17 -0
  6. data/.gitignore +19 -0
  7. data/.rspec +1 -0
  8. data/.rubocop.yml +33 -0
  9. data/.ruby-gemset +1 -0
  10. data/.ruby-version +1 -0
  11. data/Gemfile +31 -0
  12. data/Rakefile +4 -28
  13. data/_config.yml +1 -0
  14. data/app/controllers/spree/api/oauths_controller.rb +12 -5
  15. data/app/decorators/solidus_jwt/spree/api/base_controller_decorator.rb +39 -0
  16. data/app/decorators/solidus_jwt/spree/user_decorator.rb +36 -0
  17. data/app/models/solidus_jwt/base_record.rb +11 -0
  18. data/app/models/solidus_jwt/token.rb +17 -4
  19. data/bin/console +17 -0
  20. data/bin/rails +18 -0
  21. data/bin/sandbox +81 -0
  22. data/bin/setup +8 -0
  23. data/config/locales/en.yml +2 -1
  24. data/db/migrate/20191212083655_add_foreign_key_to_users_table.rb +5 -0
  25. data/lib/generators/solidus_jwt/install/install_generator.rb +1 -11
  26. data/lib/solidus_jwt.rb +2 -0
  27. data/lib/solidus_jwt/concerns/decodeable.rb +5 -1
  28. data/lib/solidus_jwt/concerns/encodeable.rb +12 -2
  29. data/lib/solidus_jwt/devise_strategies/base.rb +23 -0
  30. data/lib/solidus_jwt/devise_strategies/password.rb +5 -11
  31. data/lib/solidus_jwt/devise_strategies/refresh_token.rb +7 -10
  32. data/lib/solidus_jwt/distributor/devise.rb +1 -1
  33. data/lib/solidus_jwt/engine.rb +6 -12
  34. data/lib/solidus_jwt/version.rb +1 -9
  35. data/solidus_jwt.gemspec +36 -0
  36. data/spec/lib/solidus_jwt/concerns/decodeable_spec.rb +0 -0
  37. data/spec/lib/solidus_jwt/concerns/encodeable_spec.rb +0 -0
  38. data/spec/lib/solidus_jwt/config_spec.rb +5 -0
  39. data/spec/lib/solidus_jwt/devise_strategies/password_spec.rb +76 -0
  40. data/spec/lib/solidus_jwt/devise_strategies/refresh_token_spec.rb +72 -0
  41. data/spec/lib/solidus_jwt/preferences_spec.rb +37 -0
  42. data/spec/lib/solidus_jwt_spec.rb +6 -0
  43. data/spec/models/solidus_jwt/token_spec.rb +41 -0
  44. data/spec/requests/spree/api/json_web_tokens_spec.rb +75 -0
  45. data/spec/requests/spree/api/oauths_spec.rb +120 -0
  46. data/spec/spec_helper.rb +24 -0
  47. data/spec/support/shared_examples/decodeable_examples.rb +21 -0
  48. data/spec/support/shared_examples/encodeable_examples.rb +27 -0
  49. metadata +65 -227
  50. data/app/assets/javascripts/spree/backend/solidus_jwt.js +0 -2
  51. data/app/assets/javascripts/spree/frontend/solidus_jwt.js +0 -2
  52. data/app/assets/stylesheets/spree/backend/solidus_jwt.css +0 -4
  53. data/app/assets/stylesheets/spree/frontend/solidus_jwt.css +0 -4
  54. data/app/controllers/spree/api/base_controller/json_web_tokens.rb +0 -22
  55. data/app/controllers/spree/api/base_controller_decorator.rb +0 -17
  56. data/app/models/application_record.rb +0 -3
  57. data/app/models/solidus_jwt/application_record.rb +0 -9
  58. data/app/models/spree/user_decorator.rb +0 -34
@@ -0,0 +1,37 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe SolidusJwt::Preferences do
4
+ let(:instance) { described_class.new }
5
+
6
+ it { is_expected.to be_kind_of(Spree::Preferences::Configuration) }
7
+
8
+ describe '#jwt_secret' do
9
+ subject { instance.jwt_secret }
10
+
11
+ it { is_expected.to eql Rails.application.secret_key_base }
12
+ end
13
+
14
+ describe '#allow_spree_api_key' do
15
+ subject { instance.allow_spree_api_key }
16
+
17
+ it { is_expected.to be true }
18
+ end
19
+
20
+ describe '#jwt_algorithm' do
21
+ subject { instance.jwt_algorithm }
22
+
23
+ it { is_expected.to eql 'HS256' }
24
+ end
25
+
26
+ describe '#jwt_expiration' do
27
+ subject { instance.jwt_expiration }
28
+
29
+ it { is_expected.to be 3600 }
30
+ end
31
+
32
+ describe '#jwt_options' do
33
+ subject { instance.jwt_options }
34
+
35
+ it { is_expected.to be_kind_of Hash }
36
+ end
37
+ end
@@ -0,0 +1,6 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe SolidusJwt do
4
+ include_examples 'Decodeable Examples'
5
+ include_examples 'Encodeable Examples'
6
+ end
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe SolidusJwt::Token, type: :model do
4
+ subject { instance }
5
+
6
+ let(:instance) { FactoryBot.create(:token) }
7
+
8
+ it { is_expected.to be_valid }
9
+ it { is_expected.to be_active }
10
+ it { is_expected.not_to be_expired }
11
+
12
+ context 'when token is nil' do
13
+ let(:instance) { FactoryBot.build(:token, token: nil) }
14
+
15
+ it 'generates one automatically' do
16
+ expect(instance.token).to be_nil
17
+ instance.save
18
+ expect(instance.token).to be_present
19
+ end
20
+ end
21
+
22
+ describe '.honor?' do
23
+ subject { described_class.honor?(token) }
24
+
25
+ let(:token) { instance.token }
26
+
27
+ it { is_expected.to be true }
28
+
29
+ context 'when token is inactive' do
30
+ let(:instance) { FactoryBot.create(:token, :inactive) }
31
+
32
+ it { is_expected.to be false }
33
+ end
34
+
35
+ context 'when token is expired' do
36
+ let(:instance) { FactoryBot.create(:token, :expired) }
37
+
38
+ it { is_expected.to be false }
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,75 @@
1
+ require 'spec_helper'
2
+ require 'spree/testing_support/factories/user_factory'
3
+
4
+ RSpec.describe 'SolidusJwt Authentication', type: :request do
5
+ let(:params) do
6
+ { token: token }
7
+ end
8
+
9
+ let(:token) { nil }
10
+ let(:user) { FactoryBot.create(:user, spree_api_key: 'secret') }
11
+
12
+ it 'fails if user visits api without authenticating' do
13
+ get spree.api_user_path(user.id)
14
+ expect(response.status).to be(401)
15
+ end
16
+
17
+ context 'when jwt fails to decode' do
18
+ let(:token) { 'abc.123.efg' }
19
+
20
+ it 'renders invalid_api_key' do
21
+ get spree.api_user_path(user.id), params: params
22
+
23
+ expect(response.status).to be(401)
24
+ expect(response.body).to include('Invalid API key')
25
+ end
26
+ end
27
+
28
+ context 'when spree api key is allowed' do
29
+ context 'when spree api key is present' do
30
+ let(:token) { user.spree_api_key }
31
+
32
+ it 'passes authentication' do
33
+ get spree.api_user_path(user.id), params: params
34
+ expect(response.status).to be(200)
35
+ end
36
+ end
37
+
38
+ context 'when json web token is used' do
39
+ let(:token) { user.generate_jwt }
40
+
41
+ it 'passes authentication' do
42
+ get spree.api_user_path(user.id), params: params
43
+ expect(response.status).to be(200)
44
+ end
45
+ end
46
+ end
47
+
48
+ context 'when spree api key is not allowed' do
49
+ before(:all) do
50
+ SolidusJwt::Config.allow_spree_api_key = false
51
+ end
52
+
53
+ after(:all) do
54
+ SolidusJwt::Config.allow_spree_api_key = true
55
+ end
56
+
57
+ context 'when spree api key is present' do
58
+ let(:token) { user.spree_api_key }
59
+
60
+ it 'fails authentication' do
61
+ get spree.api_user_path(user.id), params: params
62
+ expect(response.status).to be(401)
63
+ end
64
+ end
65
+
66
+ context 'when json web token is used' do
67
+ let(:token) { user.generate_jwt }
68
+
69
+ it 'passes authentication' do
70
+ get spree.api_user_path(user.id), params: params
71
+ expect(response.status).to be(200)
72
+ end
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,120 @@
1
+ require 'spec_helper'
2
+ require 'spree/testing_support/factories/user_factory'
3
+
4
+ RSpec.describe 'Token Retrieval', type: :request do
5
+ let(:user) { FactoryBot.create(:user, password: 'password') }
6
+
7
+ describe '/api/token' do
8
+ context 'when username and password are provided' do
9
+ context 'when success' do
10
+ before do
11
+ post '/oauth/token', params: { username: user.email, password: 'password', grant_type: 'password' }
12
+ end
13
+
14
+ it 'responds with status 200' do
15
+ expect(response).to have_http_status(:ok)
16
+ end
17
+
18
+ it 'responds with access_token and refresh_token' do
19
+ json = JSON.parse(response.body)
20
+
21
+ expect(json).to have_key('access_token')
22
+ expect(json).to have_key('refresh_token')
23
+ end
24
+ end
25
+
26
+ context 'when warden failure' do
27
+ def send_request
28
+ post '/oauth/token', params: { username: user.email, password: 'password', grant_type: 'password' }
29
+ end
30
+
31
+ it 'responds with status 401' do
32
+ expect_any_instance_of(Spree::Api::OauthsController).to receive(:try_authenticate_user) do # rubocop:disable RSpec/AnyInstance
33
+ throw(:warden, scope: :spree_user, message: :locked)
34
+ end
35
+
36
+ send_request
37
+ expect(response).to have_http_status(:unauthorized)
38
+ end
39
+
40
+ it 'responds with translated Devise error message' do
41
+ expect_any_instance_of(Spree::Api::OauthsController).to receive(:try_authenticate_user) do # rubocop:disable RSpec/AnyInstance
42
+ throw(:warden, scope: :spree_user, message: :locked)
43
+ end
44
+
45
+ send_request
46
+ json = JSON.parse(response.body)
47
+
48
+ expect(json).to have_key('error')
49
+ expect(json['error']).to eq('Your account is locked.')
50
+ end
51
+ end
52
+
53
+ context 'when invalid password' do
54
+ def send_request
55
+ post '/oauth/token', params: { username: user.email, password: 'invalid', grant_type: 'password' }
56
+ end
57
+
58
+ it 'responds with status 401' do
59
+ send_request
60
+ expect(response).to have_http_status(:unauthorized)
61
+ end
62
+
63
+ it 'responds with invalid username or password' do
64
+ send_request
65
+
66
+ json = JSON.parse(response.body)
67
+
68
+ expect(json).to have_key('error')
69
+ expect(json['error']).to eq('invalid username or password')
70
+ end
71
+
72
+ context 'with error message translation' do
73
+ before do
74
+ allow(I18n).to receive(:t).with(:invalid_credentials, scope: 'solidus_jwt').and_return('Wrong token!')
75
+ end
76
+
77
+ it 'responds with translated error message' do
78
+ send_request
79
+
80
+ json = JSON.parse(response.body)
81
+
82
+ expect(json).to have_key('error')
83
+ expect(json['error']).to eq('Wrong token!')
84
+ end
85
+ end
86
+ end
87
+ end
88
+
89
+ context 'when refresh token provided' do
90
+ let(:refresh_token) { user.auth_tokens.create! }
91
+
92
+ context 'when success' do
93
+ before do
94
+ post '/oauth/token', params: { refresh_token: refresh_token.token, grant_type: 'refresh_token' }
95
+ end
96
+
97
+ it 'responds with status 200' do
98
+ expect(response).to have_http_status(:ok)
99
+ end
100
+
101
+ it 'responds with access_token and refresh_token' do
102
+ json = JSON.parse(response.body)
103
+
104
+ expect(json).to have_key('access_token')
105
+ expect(json).to have_key('refresh_token')
106
+ end
107
+ end
108
+
109
+ context 'when failure' do
110
+ before do
111
+ post '/oauth/token', params: { refresh_token: 'invalid', grant_type: 'refresh_token' }
112
+ end
113
+
114
+ it 'response with status 401' do
115
+ expect(response).to have_http_status(:unauthorized)
116
+ end
117
+ end
118
+ end
119
+ end
120
+ end
@@ -0,0 +1,24 @@
1
+ # Configure Rails Environment
2
+ ENV['RAILS_ENV'] = 'test'
3
+
4
+ require 'byebug'
5
+
6
+ # Run Coverage report
7
+ require 'solidus_dev_support/rspec/coverage'
8
+
9
+ require File.expand_path('dummy/config/environment.rb', __dir__)
10
+
11
+ # Requires factories and other useful helpers defined in spree_core.
12
+ require 'solidus_dev_support/rspec/feature_helper'
13
+
14
+ # Requires supporting ruby files with custom matchers and macros, etc,
15
+ # in spec/support/ and its subdirectories.
16
+ Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }
17
+
18
+ # Requires factories defined in lib/solidus_jwt/factories.rb
19
+ require 'solidus_jwt/factories'
20
+
21
+ RSpec.configure do |config|
22
+ config.infer_spec_type_from_file_location!
23
+ config.use_transactional_fixtures = false
24
+ end
@@ -0,0 +1,21 @@
1
+ RSpec.shared_examples 'Decodeable Examples' do
2
+ describe 'decode' do
3
+ let(:token) do
4
+ JWT.encode(payload, SolidusJwt::Config.jwt_secret,
5
+ SolidusJwt::Config.jwt_algorithm)
6
+ end
7
+
8
+ let(:payload) { { sub: 1 } }
9
+
10
+ it 'decodes a json web token' do
11
+ allow(JWT).to receive(:decode).and_call_original
12
+
13
+ decoded_token = subject.decode(token)
14
+
15
+ expect(JWT).to have_received(:decode).with(token, SolidusJwt::Config.jwt_secret,
16
+ true, hash_including(algorithm: SolidusJwt::Config.jwt_algorithm))
17
+ expect(decoded_token).to be_kind_of(Array)
18
+ expect(decoded_token.first).to include(payload.as_json)
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,27 @@
1
+ RSpec.shared_examples 'Encodeable Examples' do
2
+ describe 'encode' do
3
+ let(:payload) { { user_id: 1 } }
4
+
5
+ it 'encodes a json web token' do
6
+ allow(JWT).to receive(:encode).and_call_original
7
+
8
+ token = subject.encode(payload: payload)
9
+
10
+ expect(JWT).to have_received(:encode).with(hash_including('iat', 'user_id' => 1),
11
+ SolidusJwt::Config.jwt_secret, SolidusJwt::Config.jwt_algorithm)
12
+ expect(token).to be_kind_of String
13
+ end
14
+
15
+ context 'when expiration is passed in' do
16
+ it 'encodes a json web token with expiration date' do
17
+ allow(JWT).to receive(:encode).and_call_original
18
+
19
+ token = subject.encode(payload: payload, expires_in: 60)
20
+
21
+ expect(JWT).to have_received(:encode).with(hash_including('iat', 'exp', 'user_id' => 1),
22
+ SolidusJwt::Config.jwt_secret, SolidusJwt::Config.jwt_algorithm)
23
+ expect(token).to be_kind_of String
24
+ end
25
+ end
26
+ end
27
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_jwt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taylor Scott
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-09 00:00:00.000000000 Z
11
+ date: 2020-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt
@@ -38,33 +38,13 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: solidus_backend
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '1.0'
48
- - - "<"
49
- - !ruby/object:Gem::Version
50
- version: '3'
51
- type: :runtime
52
- prerelease: false
53
- version_requirements: !ruby/object:Gem::Requirement
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- version: '1.0'
58
- - - "<"
59
- - !ruby/object:Gem::Version
60
- version: '3'
61
41
  - !ruby/object:Gem::Dependency
62
42
  name: solidus_core
63
43
  requirement: !ruby/object:Gem::Requirement
64
44
  requirements:
65
45
  - - ">="
66
46
  - !ruby/object:Gem::Version
67
- version: '1.0'
47
+ version: 2.0.0
68
48
  - - "<"
69
49
  - !ruby/object:Gem::Version
70
50
  version: '3'
@@ -74,7 +54,7 @@ dependencies:
74
54
  requirements:
75
55
  - - ">="
76
56
  - !ruby/object:Gem::Version
77
- version: '1.0'
57
+ version: 2.0.0
78
58
  - - "<"
79
59
  - !ruby/object:Gem::Version
80
60
  version: '3'
@@ -82,16 +62,16 @@ dependencies:
82
62
  name: solidus_support
83
63
  requirement: !ruby/object:Gem::Requirement
84
64
  requirements:
85
- - - ">="
65
+ - - "~>"
86
66
  - !ruby/object:Gem::Version
87
- version: 0.1.3
67
+ version: 0.4.0
88
68
  type: :runtime
89
69
  prerelease: false
90
70
  version_requirements: !ruby/object:Gem::Requirement
91
71
  requirements:
92
- - - ">="
72
+ - - "~>"
93
73
  - !ruby/object:Gem::Version
94
- version: 0.1.3
74
+ version: 0.4.0
95
75
  - !ruby/object:Gem::Dependency
96
76
  name: byebug
97
77
  requirement: !ruby/object:Gem::Requirement
@@ -107,189 +87,7 @@ dependencies:
107
87
  - !ruby/object:Gem::Version
108
88
  version: '0'
109
89
  - !ruby/object:Gem::Dependency
110
- name: capybara
111
- requirement: !ruby/object:Gem::Requirement
112
- requirements:
113
- - - ">="
114
- - !ruby/object:Gem::Version
115
- version: '0'
116
- type: :development
117
- prerelease: false
118
- version_requirements: !ruby/object:Gem::Requirement
119
- requirements:
120
- - - ">="
121
- - !ruby/object:Gem::Version
122
- version: '0'
123
- - !ruby/object:Gem::Dependency
124
- name: coffee-rails
125
- requirement: !ruby/object:Gem::Requirement
126
- requirements:
127
- - - ">="
128
- - !ruby/object:Gem::Version
129
- version: '0'
130
- type: :development
131
- prerelease: false
132
- version_requirements: !ruby/object:Gem::Requirement
133
- requirements:
134
- - - ">="
135
- - !ruby/object:Gem::Version
136
- version: '0'
137
- - !ruby/object:Gem::Dependency
138
- name: database_cleaner
139
- requirement: !ruby/object:Gem::Requirement
140
- requirements:
141
- - - ">="
142
- - !ruby/object:Gem::Version
143
- version: '0'
144
- type: :development
145
- prerelease: false
146
- version_requirements: !ruby/object:Gem::Requirement
147
- requirements:
148
- - - ">="
149
- - !ruby/object:Gem::Version
150
- version: '0'
151
- - !ruby/object:Gem::Dependency
152
- name: factory_bot
153
- requirement: !ruby/object:Gem::Requirement
154
- requirements:
155
- - - ">="
156
- - !ruby/object:Gem::Version
157
- version: '0'
158
- type: :development
159
- prerelease: false
160
- version_requirements: !ruby/object:Gem::Requirement
161
- requirements:
162
- - - ">="
163
- - !ruby/object:Gem::Version
164
- version: '0'
165
- - !ruby/object:Gem::Dependency
166
- name: ffaker
167
- requirement: !ruby/object:Gem::Requirement
168
- requirements:
169
- - - ">="
170
- - !ruby/object:Gem::Version
171
- version: '0'
172
- type: :development
173
- prerelease: false
174
- version_requirements: !ruby/object:Gem::Requirement
175
- requirements:
176
- - - ">="
177
- - !ruby/object:Gem::Version
178
- version: '0'
179
- - !ruby/object:Gem::Dependency
180
- name: gem-release
181
- requirement: !ruby/object:Gem::Requirement
182
- requirements:
183
- - - ">="
184
- - !ruby/object:Gem::Version
185
- version: '0'
186
- type: :development
187
- prerelease: false
188
- version_requirements: !ruby/object:Gem::Requirement
189
- requirements:
190
- - - ">="
191
- - !ruby/object:Gem::Version
192
- version: '0'
193
- - !ruby/object:Gem::Dependency
194
- name: poltergeist
195
- requirement: !ruby/object:Gem::Requirement
196
- requirements:
197
- - - ">="
198
- - !ruby/object:Gem::Version
199
- version: '0'
200
- type: :development
201
- prerelease: false
202
- version_requirements: !ruby/object:Gem::Requirement
203
- requirements:
204
- - - ">="
205
- - !ruby/object:Gem::Version
206
- version: '0'
207
- - !ruby/object:Gem::Dependency
208
- name: rspec-rails
209
- requirement: !ruby/object:Gem::Requirement
210
- requirements:
211
- - - ">="
212
- - !ruby/object:Gem::Version
213
- version: '0'
214
- type: :development
215
- prerelease: false
216
- version_requirements: !ruby/object:Gem::Requirement
217
- requirements:
218
- - - ">="
219
- - !ruby/object:Gem::Version
220
- version: '0'
221
- - !ruby/object:Gem::Dependency
222
- name: rubocop
223
- requirement: !ruby/object:Gem::Requirement
224
- requirements:
225
- - - ">="
226
- - !ruby/object:Gem::Version
227
- version: '0'
228
- type: :development
229
- prerelease: false
230
- version_requirements: !ruby/object:Gem::Requirement
231
- requirements:
232
- - - ">="
233
- - !ruby/object:Gem::Version
234
- version: '0'
235
- - !ruby/object:Gem::Dependency
236
- name: rubocop-rspec
237
- requirement: !ruby/object:Gem::Requirement
238
- requirements:
239
- - - ">="
240
- - !ruby/object:Gem::Version
241
- version: '0'
242
- type: :development
243
- prerelease: false
244
- version_requirements: !ruby/object:Gem::Requirement
245
- requirements:
246
- - - ">="
247
- - !ruby/object:Gem::Version
248
- version: '0'
249
- - !ruby/object:Gem::Dependency
250
- name: sass-rails
251
- requirement: !ruby/object:Gem::Requirement
252
- requirements:
253
- - - ">="
254
- - !ruby/object:Gem::Version
255
- version: '0'
256
- type: :development
257
- prerelease: false
258
- version_requirements: !ruby/object:Gem::Requirement
259
- requirements:
260
- - - ">="
261
- - !ruby/object:Gem::Version
262
- version: '0'
263
- - !ruby/object:Gem::Dependency
264
- name: selenium-webdriver
265
- requirement: !ruby/object:Gem::Requirement
266
- requirements:
267
- - - ">="
268
- - !ruby/object:Gem::Version
269
- version: '0'
270
- type: :development
271
- prerelease: false
272
- version_requirements: !ruby/object:Gem::Requirement
273
- requirements:
274
- - - ">="
275
- - !ruby/object:Gem::Version
276
- version: '0'
277
- - !ruby/object:Gem::Dependency
278
- name: simplecov
279
- requirement: !ruby/object:Gem::Requirement
280
- requirements:
281
- - - ">="
282
- - !ruby/object:Gem::Version
283
- version: '0'
284
- type: :development
285
- prerelease: false
286
- version_requirements: !ruby/object:Gem::Requirement
287
- requirements:
288
- - - ">="
289
- - !ruby/object:Gem::Version
290
- version: '0'
291
- - !ruby/object:Gem::Dependency
292
- name: sqlite3
90
+ name: solidus_dev_support
293
91
  requirement: !ruby/object:Gem::Requirement
294
92
  requirements:
295
93
  - - ">="
@@ -308,28 +106,39 @@ executables: []
308
106
  extensions: []
309
107
  extra_rdoc_files: []
310
108
  files:
109
+ - ".circleci/config.yml"
110
+ - ".gem_release.yml"
111
+ - ".github/CODEOWNERS"
112
+ - ".github/stale.yml"
113
+ - ".gitignore"
114
+ - ".rspec"
115
+ - ".rubocop.yml"
116
+ - ".ruby-gemset"
117
+ - ".ruby-version"
118
+ - Gemfile
311
119
  - LICENSE
312
120
  - README.md
313
121
  - Rakefile
314
- - app/assets/javascripts/spree/backend/solidus_jwt.js
315
- - app/assets/javascripts/spree/frontend/solidus_jwt.js
316
- - app/assets/stylesheets/spree/backend/solidus_jwt.css
317
- - app/assets/stylesheets/spree/frontend/solidus_jwt.css
318
- - app/controllers/spree/api/base_controller/json_web_tokens.rb
319
- - app/controllers/spree/api/base_controller_decorator.rb
122
+ - _config.yml
320
123
  - app/controllers/spree/api/oauths_controller.rb
321
- - app/models/application_record.rb
322
- - app/models/solidus_jwt/application_record.rb
124
+ - app/decorators/solidus_jwt/spree/api/base_controller_decorator.rb
125
+ - app/decorators/solidus_jwt/spree/user_decorator.rb
126
+ - app/models/solidus_jwt/base_record.rb
323
127
  - app/models/solidus_jwt/token.rb
324
- - app/models/spree/user_decorator.rb
128
+ - bin/console
129
+ - bin/rails
130
+ - bin/sandbox
131
+ - bin/setup
325
132
  - config/locales/en.yml
326
133
  - config/routes.rb
327
134
  - db/migrate/20190222220038_create_solidus_jwt_tokens.rb
135
+ - db/migrate/20191212083655_add_foreign_key_to_users_table.rb
328
136
  - lib/generators/solidus_jwt/install/install_generator.rb
329
137
  - lib/solidus_jwt.rb
330
138
  - lib/solidus_jwt/concerns/decodeable.rb
331
139
  - lib/solidus_jwt/concerns/encodeable.rb
332
140
  - lib/solidus_jwt/config.rb
141
+ - lib/solidus_jwt/devise_strategies/base.rb
333
142
  - lib/solidus_jwt/devise_strategies/password.rb
334
143
  - lib/solidus_jwt/devise_strategies/refresh_token.rb
335
144
  - lib/solidus_jwt/distributor/devise.rb
@@ -337,27 +146,56 @@ files:
337
146
  - lib/solidus_jwt/factories.rb
338
147
  - lib/solidus_jwt/preferences.rb
339
148
  - lib/solidus_jwt/version.rb
340
- homepage: https://github.com/skukx
149
+ - solidus_jwt.gemspec
150
+ - spec/lib/solidus_jwt/concerns/decodeable_spec.rb
151
+ - spec/lib/solidus_jwt/concerns/encodeable_spec.rb
152
+ - spec/lib/solidus_jwt/config_spec.rb
153
+ - spec/lib/solidus_jwt/devise_strategies/password_spec.rb
154
+ - spec/lib/solidus_jwt/devise_strategies/refresh_token_spec.rb
155
+ - spec/lib/solidus_jwt/preferences_spec.rb
156
+ - spec/lib/solidus_jwt_spec.rb
157
+ - spec/models/solidus_jwt/token_spec.rb
158
+ - spec/requests/spree/api/json_web_tokens_spec.rb
159
+ - spec/requests/spree/api/oauths_spec.rb
160
+ - spec/spec_helper.rb
161
+ - spec/support/shared_examples/decodeable_examples.rb
162
+ - spec/support/shared_examples/encodeable_examples.rb
163
+ homepage: https://github.com/skukx/solidus_jwt
341
164
  licenses:
342
165
  - BSD-3-Clause
343
- metadata: {}
166
+ metadata:
167
+ homepage_uri: https://github.com/skukx/solidus_jwt
168
+ source_code_uri: https://github.com/skukx/solidus_jwt
344
169
  post_install_message:
345
170
  rdoc_options: []
346
171
  require_paths:
347
172
  - lib
348
173
  required_ruby_version: !ruby/object:Gem::Requirement
349
174
  requirements:
350
- - - ">="
175
+ - - "~>"
351
176
  - !ruby/object:Gem::Version
352
- version: '0'
177
+ version: '2.4'
353
178
  required_rubygems_version: !ruby/object:Gem::Requirement
354
179
  requirements:
355
180
  - - ">="
356
181
  - !ruby/object:Gem::Version
357
182
  version: '0'
358
183
  requirements: []
359
- rubygems_version: 3.0.3
184
+ rubygems_version: 3.0.8
360
185
  signing_key:
361
186
  specification_version: 4
362
187
  summary: Add Json Web Tokens to Solidus API
363
- test_files: []
188
+ test_files:
189
+ - spec/lib/solidus_jwt/concerns/decodeable_spec.rb
190
+ - spec/lib/solidus_jwt/concerns/encodeable_spec.rb
191
+ - spec/lib/solidus_jwt/config_spec.rb
192
+ - spec/lib/solidus_jwt/devise_strategies/password_spec.rb
193
+ - spec/lib/solidus_jwt/devise_strategies/refresh_token_spec.rb
194
+ - spec/lib/solidus_jwt/preferences_spec.rb
195
+ - spec/lib/solidus_jwt_spec.rb
196
+ - spec/models/solidus_jwt/token_spec.rb
197
+ - spec/requests/spree/api/json_web_tokens_spec.rb
198
+ - spec/requests/spree/api/oauths_spec.rb
199
+ - spec/spec_helper.rb
200
+ - spec/support/shared_examples/decodeable_examples.rb
201
+ - spec/support/shared_examples/encodeable_examples.rb