solidus_jwt 1.2.1 → 1.2.2

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: c4f62820292cb45a7c1e638d7c7f62006d379bb5c9bbad5efd840b8bc04ac574
4
- data.tar.gz: ea71387db0d75e9fd22966968516a35c26dc870dbeaa420229ed6bc6cc1d9e90
3
+ metadata.gz: 6af9d598ef8f7e34ec1c8bd219e16cddb9cd55fae9f2e4192b2b037c6d0aa75c
4
+ data.tar.gz: ba3c51213c6469e50891cb8d47e0ee6e61e71ded0093f2be18db249e11be2f89
5
5
  SHA512:
6
- metadata.gz: 334d6f0f28fc4c66f5d9f5b979f334ba8a56de9ec7fac0a41409cde8be3aa14e493d6309036768a00a9c15d712fcbced4a827511211772fc9c11a5696f033e26
7
- data.tar.gz: 459344ffa6e482fa1dab6baf1e2dd3d5249d9e12572546c3263ed7f0d4447022648647e6e3568f4b1554538b4e2db657d446d833be7410353fda8b516fcf45f2
6
+ metadata.gz: 00a30974bb6b3e9f09e96835b5433fa44d5007257643aad387b4de50bbc17be4d7531ca38e4326f54fc3c0172108f62eb7f195735709e52cdb7eb827631d51af
7
+ data.tar.gz: 2a199b684fe99e7cc8c0ffe722ef3215f2afbcf2527d8c89db6e86c3ac8e5ed5ebcddc73d62dcc55c6d41f4a9f66818e5d0fabf619a42b4e74f88cadc4e8d9b4
data/.circleci/config.yml CHANGED
@@ -1,6 +1,9 @@
1
1
  version: 2.1
2
2
 
3
3
  orbs:
4
+ # Required for feature specs.
5
+ browser-tools: circleci/browser-tools@1.1
6
+
4
7
  # Always take the latest version of the orb, this allows us to
5
8
  # run specs against Solidus supported versions only without the need
6
9
  # to change this configuration every time a Solidus version is released
@@ -8,28 +11,63 @@ orbs:
8
11
  solidusio_extensions: solidusio/extensions@volatile
9
12
 
10
13
  jobs:
11
- run-specs-with-postgres:
12
- executor: solidusio_extensions/postgres
14
+ run-specs:
15
+ parameters:
16
+ solidus:
17
+ type: string
18
+ default: main
19
+ db:
20
+ type: string
21
+ default: "postgres"
22
+ ruby:
23
+ type: string
24
+ default: "3.2"
25
+ executor:
26
+ name: solidusio_extensions/<< parameters.db >>
27
+ ruby_version: << parameters.ruby >>
13
28
  steps:
14
- - solidusio_extensions/run-tests
15
- run-specs-with-mysql:
16
- executor: solidusio_extensions/mysql
29
+ - checkout
30
+ - browser-tools/install-chrome
31
+ - solidusio_extensions/run-tests-solidus-<< parameters.solidus >>
32
+
33
+ lint-code:
34
+ executor:
35
+ name: solidusio_extensions/sqlite
36
+ ruby_version: "3.0"
17
37
  steps:
18
- - solidusio_extensions/run-tests
38
+ - solidusio_extensions/lint-code
19
39
 
20
40
  workflows:
21
41
  "Run specs on supported Solidus versions":
22
42
  jobs:
23
- - run-specs-with-postgres
24
- - run-specs-with-mysql
25
- "Weekly run specs against master":
43
+ - run-specs:
44
+ name: &name "run-specs-solidus-<< matrix.solidus >>-ruby-<< matrix.ruby >>-db-<< matrix.db >>"
45
+ matrix:
46
+ parameters: { solidus: ["main"], ruby: ["3.2"], db: ["postgres"] }
47
+ - run-specs:
48
+ name: *name
49
+ matrix:
50
+ parameters: { solidus: ["current"], ruby: ["3.1"], db: ["mysql"] }
51
+ - run-specs:
52
+ name: *name
53
+ matrix:
54
+ parameters: { solidus: ["older"], ruby: ["3.0"], db: ["sqlite"] }
55
+ - lint-code
56
+
57
+ "Weekly run specs against main":
26
58
  triggers:
27
59
  - schedule:
28
60
  cron: "0 0 * * 4" # every Thursday
29
61
  filters:
30
62
  branches:
31
63
  only:
32
- - master
64
+ - main
33
65
  jobs:
34
- - run-specs-with-postgres
35
- - run-specs-with-mysql
66
+ - run-specs:
67
+ name: *name
68
+ matrix:
69
+ parameters: { solidus: ["main"], ruby: ["3.2"], db: ["postgres"] }
70
+ - run-specs:
71
+ name: *name
72
+ matrix:
73
+ parameters: { solidus: ["current"], ruby: ["3.1"], db: ["mysql"] }
data/.rubocop.yml CHANGED
@@ -2,15 +2,4 @@ require:
2
2
  - solidus_dev_support/rubocop
3
3
 
4
4
  AllCops:
5
- Exclude:
6
- - sandbox/**/*
7
- - spec/dummy/**/*
8
-
9
- Metrics/LineLength:
10
- Enabled: false
11
-
12
- RSpec/MultipleExpectations:
13
- Enabled: false
14
-
15
- RSpec/NestedGroups:
16
- Enabled: false
5
+ NewCops: disable
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.5
1
+ 3.1.2
data/CHANGELOG.md CHANGED
@@ -1,98 +1,3 @@
1
1
  # Changelog
2
2
 
3
- ## [v1.2.1](https://github.com/solidusio-contrib/solidus_jwt/tree/v1.2.1) (2023-01-09)
4
-
5
- [Full Changelog](https://github.com/solidusio-contrib/solidus_jwt/compare/v1.2.0...v1.2.1)
6
-
7
- **Merged pull requests:**
8
-
9
- - Bump Solidus Version in Gemspec to Allow Above 3.0 [\#35](https://github.com/solidusio-contrib/solidus_jwt/pull/35) ([cpfergus1](https://github.com/cpfergus1))
10
- - Update to use forked solidus\_frontend when needed [\#34](https://github.com/solidusio-contrib/solidus_jwt/pull/34) ([waiting-for-dev](https://github.com/waiting-for-dev))
11
- - relaxing dependencies for working with solidus v3 [\#33](https://github.com/solidusio-contrib/solidus_jwt/pull/33) ([iLucker93](https://github.com/iLucker93))
12
- - relaxing solidus\_core lower than v3 dependency [\#32](https://github.com/solidusio-contrib/solidus_jwt/pull/32) ([iLucker93](https://github.com/iLucker93))
13
-
14
- ## [v1.2.0](https://github.com/solidusio-contrib/solidus_jwt/tree/v1.2.0) (2020-06-09)
15
-
16
- [Full Changelog](https://github.com/solidusio-contrib/solidus_jwt/compare/v1.0.0...v1.2.0)
17
-
18
- **Closed issues:**
19
-
20
- - Add helper method for matching user [\#25](https://github.com/solidusio-contrib/solidus_jwt/issues/25)
21
- - Update for solidus\_dev\_support [\#22](https://github.com/solidusio-contrib/solidus_jwt/issues/22)
22
- - Prefer Gem::Version [\#21](https://github.com/solidusio-contrib/solidus_jwt/issues/21)
23
-
24
- **Merged pull requests:**
25
-
26
- - Upgrade dev environment [\#28](https://github.com/solidusio-contrib/solidus_jwt/pull/28) ([skukx](https://github.com/skukx))
27
- - Add for jwt user method [\#26](https://github.com/solidusio-contrib/solidus_jwt/pull/26) ([skukx](https://github.com/skukx))
28
- - update solidus\_support to 0.5.0 [\#24](https://github.com/solidusio-contrib/solidus_jwt/pull/24) ([ccarruitero](https://github.com/ccarruitero))
29
- - 22 update gem for solidus dev support [\#23](https://github.com/solidusio-contrib/solidus_jwt/pull/23) ([skukx](https://github.com/skukx))
30
- - Handle other Warden strategy errors in API response [\#20](https://github.com/solidusio-contrib/solidus_jwt/pull/20) ([tvdeyen](https://github.com/tvdeyen))
31
- - Change Devise strategy base class [\#19](https://github.com/solidusio-contrib/solidus_jwt/pull/19) ([tvdeyen](https://github.com/tvdeyen))
32
- - Translate error response [\#18](https://github.com/solidusio-contrib/solidus_jwt/pull/18) ([tvdeyen](https://github.com/tvdeyen))
33
- - Fix specs [\#17](https://github.com/solidusio-contrib/solidus_jwt/pull/17) ([tvdeyen](https://github.com/tvdeyen))
34
- - Fix table\_name\_prefix [\#16](https://github.com/solidusio-contrib/solidus_jwt/pull/16) ([tvdeyen](https://github.com/tvdeyen))
35
- - Fix Solidus dependencies [\#15](https://github.com/solidusio-contrib/solidus_jwt/pull/15) ([tvdeyen](https://github.com/tvdeyen))
36
- - Add foreign key to users [\#14](https://github.com/solidusio-contrib/solidus_jwt/pull/14) ([tvdeyen](https://github.com/tvdeyen))
37
- - Remove asset installation [\#13](https://github.com/solidusio-contrib/solidus_jwt/pull/13) ([tvdeyen](https://github.com/tvdeyen))
38
-
39
- ## [v1.0.0](https://github.com/solidusio-contrib/solidus_jwt/tree/v1.0.0) (2019-12-09)
40
-
41
- [Full Changelog](https://github.com/solidusio-contrib/solidus_jwt/compare/v1.0.0.beta2...v1.0.0)
42
-
43
- ## [v1.0.0.beta2](https://github.com/solidusio-contrib/solidus_jwt/tree/v1.0.0.beta2) (2019-12-04)
44
-
45
- [Full Changelog](https://github.com/solidusio-contrib/solidus_jwt/compare/v1.0.0.beta1...v1.0.0.beta2)
46
-
47
- **Closed issues:**
48
-
49
- - Allow authentication through API? [\#2](https://github.com/solidusio-contrib/solidus_jwt/issues/2)
50
- - Add Refresh Token [\#1](https://github.com/solidusio-contrib/solidus_jwt/issues/1)
51
-
52
- ## [v1.0.0.beta1](https://github.com/solidusio-contrib/solidus_jwt/tree/v1.0.0.beta1) (2019-11-01)
53
-
54
- [Full Changelog](https://github.com/solidusio-contrib/solidus_jwt/compare/v0.1.0...v1.0.0.beta1)
55
-
56
- **Merged pull requests:**
57
-
58
- - WIP: Implement Refresh Tokens [\#5](https://github.com/solidusio-contrib/solidus_jwt/pull/5) ([skukx](https://github.com/skukx))
59
-
60
- ## [v0.1.0](https://github.com/solidusio-contrib/solidus_jwt/tree/v0.1.0) (2019-11-01)
61
-
62
- [Full Changelog](https://github.com/solidusio-contrib/solidus_jwt/compare/v0.0.2...v0.1.0)
63
-
64
- **Closed issues:**
65
-
66
- - JWT::InvalidPayload with jwt 2.2.1 [\#9](https://github.com/solidusio-contrib/solidus_jwt/issues/9)
67
- - Prefer using sub claim over id [\#8](https://github.com/solidusio-contrib/solidus_jwt/issues/8)
68
- - Allow claims to be passed through [\#4](https://github.com/solidusio-contrib/solidus_jwt/issues/4)
69
-
70
- **Merged pull requests:**
71
-
72
- - Update jwt claims [\#11](https://github.com/solidusio-contrib/solidus_jwt/pull/11) ([skukx](https://github.com/skukx))
73
-
74
- ## [v0.0.2](https://github.com/solidusio-contrib/solidus_jwt/tree/v0.0.2) (2019-06-18)
75
-
76
- [Full Changelog](https://github.com/solidusio-contrib/solidus_jwt/compare/v0.0.1...v0.0.2)
77
-
78
- **Closed issues:**
79
-
80
- - SQLite3::ConstraintException: UNIQUE constraint failed: spree\_users.uid [\#3](https://github.com/solidusio-contrib/solidus_jwt/issues/3)
81
-
82
- **Merged pull requests:**
83
-
84
- - Fix bug with iat [\#10](https://github.com/solidusio-contrib/solidus_jwt/pull/10) ([skukx](https://github.com/skukx))
85
- - Lock sqlite3 gem version [\#7](https://github.com/solidusio-contrib/solidus_jwt/pull/7) ([mdesantis](https://github.com/mdesantis))
86
- - Calculate 'exp' and 'iat' upon the same timestamp [\#6](https://github.com/solidusio-contrib/solidus_jwt/pull/6) ([mdesantis](https://github.com/mdesantis))
87
-
88
- ## [v0.0.1](https://github.com/solidusio-contrib/solidus_jwt/tree/v0.0.1) (2018-11-12)
89
-
90
- [Full Changelog](https://github.com/solidusio-contrib/solidus_jwt/compare/v0.0.1.pre...v0.0.1)
91
-
92
- ## [v0.0.1.pre](https://github.com/solidusio-contrib/solidus_jwt/tree/v0.0.1.pre) (2018-10-27)
93
-
94
- [Full Changelog](https://github.com/solidusio-contrib/solidus_jwt/compare/3e4c03b72d6259529a8cab3b0def7b338dc7b026...v0.0.1.pre)
95
-
96
-
97
-
98
- \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
3
+ See https://github.com/solidusio/solidus_jwt/releases or [OLD_CHANGELOG.md](OLD_CHANGELOG.md) for older versions.
data/Gemfile CHANGED
@@ -3,14 +3,10 @@
3
3
  source 'https://rubygems.org'
4
4
  git_source(:github) { |repo| "https://github.com/#{repo}.git" }
5
5
 
6
- branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
7
- solidus_git, solidus_frontend_git = if (branch == 'master') || (branch >= 'v3.2')
8
- %w[solidusio/solidus solidusio/solidus_frontend]
9
- else
10
- %w[solidusio/solidus] * 2
11
- end
12
- gem 'solidus', github: solidus_git, branch: branch
13
- gem 'solidus_frontend', github: solidus_frontend_git, branch: branch
6
+ branch = ENV.fetch('SOLIDUS_BRANCH', 'main')
7
+
8
+ gem 'solidus', github: 'solidusio/solidus', branch: branch
9
+ gem 'solidus_frontend', github: 'solidusio/solidus_frontend', branch: branch > 'v3.4' ? 'v3.4' : branch
14
10
 
15
11
  # Needed to help Bundler figure out how to resolve dependencies,
16
12
  # otherwise it takes forever to resolve them.
data/OLD_CHANGELOG.md ADDED
@@ -0,0 +1,98 @@
1
+ # Changelog
2
+
3
+ ## [v1.2.1](https://github.com/solidusio-contrib/solidus_jwt/tree/v1.2.1) (2023-01-09)
4
+
5
+ [Full Changelog](https://github.com/solidusio-contrib/solidus_jwt/compare/v1.2.0...v1.2.1)
6
+
7
+ **Merged pull requests:**
8
+
9
+ - Bump Solidus Version in Gemspec to Allow Above 3.0 [\#35](https://github.com/solidusio-contrib/solidus_jwt/pull/35) ([cpfergus1](https://github.com/cpfergus1))
10
+ - Update to use forked solidus\_frontend when needed [\#34](https://github.com/solidusio-contrib/solidus_jwt/pull/34) ([waiting-for-dev](https://github.com/waiting-for-dev))
11
+ - relaxing dependencies for working with solidus v3 [\#33](https://github.com/solidusio-contrib/solidus_jwt/pull/33) ([iLucker93](https://github.com/iLucker93))
12
+ - relaxing solidus\_core lower than v3 dependency [\#32](https://github.com/solidusio-contrib/solidus_jwt/pull/32) ([iLucker93](https://github.com/iLucker93))
13
+
14
+ ## [v1.2.0](https://github.com/solidusio-contrib/solidus_jwt/tree/v1.2.0) (2020-06-09)
15
+
16
+ [Full Changelog](https://github.com/solidusio-contrib/solidus_jwt/compare/v1.0.0...v1.2.0)
17
+
18
+ **Closed issues:**
19
+
20
+ - Add helper method for matching user [\#25](https://github.com/solidusio-contrib/solidus_jwt/issues/25)
21
+ - Update for solidus\_dev\_support [\#22](https://github.com/solidusio-contrib/solidus_jwt/issues/22)
22
+ - Prefer Gem::Version [\#21](https://github.com/solidusio-contrib/solidus_jwt/issues/21)
23
+
24
+ **Merged pull requests:**
25
+
26
+ - Upgrade dev environment [\#28](https://github.com/solidusio-contrib/solidus_jwt/pull/28) ([skukx](https://github.com/skukx))
27
+ - Add for jwt user method [\#26](https://github.com/solidusio-contrib/solidus_jwt/pull/26) ([skukx](https://github.com/skukx))
28
+ - update solidus\_support to 0.5.0 [\#24](https://github.com/solidusio-contrib/solidus_jwt/pull/24) ([ccarruitero](https://github.com/ccarruitero))
29
+ - 22 update gem for solidus dev support [\#23](https://github.com/solidusio-contrib/solidus_jwt/pull/23) ([skukx](https://github.com/skukx))
30
+ - Handle other Warden strategy errors in API response [\#20](https://github.com/solidusio-contrib/solidus_jwt/pull/20) ([tvdeyen](https://github.com/tvdeyen))
31
+ - Change Devise strategy base class [\#19](https://github.com/solidusio-contrib/solidus_jwt/pull/19) ([tvdeyen](https://github.com/tvdeyen))
32
+ - Translate error response [\#18](https://github.com/solidusio-contrib/solidus_jwt/pull/18) ([tvdeyen](https://github.com/tvdeyen))
33
+ - Fix specs [\#17](https://github.com/solidusio-contrib/solidus_jwt/pull/17) ([tvdeyen](https://github.com/tvdeyen))
34
+ - Fix table\_name\_prefix [\#16](https://github.com/solidusio-contrib/solidus_jwt/pull/16) ([tvdeyen](https://github.com/tvdeyen))
35
+ - Fix Solidus dependencies [\#15](https://github.com/solidusio-contrib/solidus_jwt/pull/15) ([tvdeyen](https://github.com/tvdeyen))
36
+ - Add foreign key to users [\#14](https://github.com/solidusio-contrib/solidus_jwt/pull/14) ([tvdeyen](https://github.com/tvdeyen))
37
+ - Remove asset installation [\#13](https://github.com/solidusio-contrib/solidus_jwt/pull/13) ([tvdeyen](https://github.com/tvdeyen))
38
+
39
+ ## [v1.0.0](https://github.com/solidusio-contrib/solidus_jwt/tree/v1.0.0) (2019-12-09)
40
+
41
+ [Full Changelog](https://github.com/solidusio-contrib/solidus_jwt/compare/v1.0.0.beta2...v1.0.0)
42
+
43
+ ## [v1.0.0.beta2](https://github.com/solidusio-contrib/solidus_jwt/tree/v1.0.0.beta2) (2019-12-04)
44
+
45
+ [Full Changelog](https://github.com/solidusio-contrib/solidus_jwt/compare/v1.0.0.beta1...v1.0.0.beta2)
46
+
47
+ **Closed issues:**
48
+
49
+ - Allow authentication through API? [\#2](https://github.com/solidusio-contrib/solidus_jwt/issues/2)
50
+ - Add Refresh Token [\#1](https://github.com/solidusio-contrib/solidus_jwt/issues/1)
51
+
52
+ ## [v1.0.0.beta1](https://github.com/solidusio-contrib/solidus_jwt/tree/v1.0.0.beta1) (2019-11-01)
53
+
54
+ [Full Changelog](https://github.com/solidusio-contrib/solidus_jwt/compare/v0.1.0...v1.0.0.beta1)
55
+
56
+ **Merged pull requests:**
57
+
58
+ - WIP: Implement Refresh Tokens [\#5](https://github.com/solidusio-contrib/solidus_jwt/pull/5) ([skukx](https://github.com/skukx))
59
+
60
+ ## [v0.1.0](https://github.com/solidusio-contrib/solidus_jwt/tree/v0.1.0) (2019-11-01)
61
+
62
+ [Full Changelog](https://github.com/solidusio-contrib/solidus_jwt/compare/v0.0.2...v0.1.0)
63
+
64
+ **Closed issues:**
65
+
66
+ - JWT::InvalidPayload with jwt 2.2.1 [\#9](https://github.com/solidusio-contrib/solidus_jwt/issues/9)
67
+ - Prefer using sub claim over id [\#8](https://github.com/solidusio-contrib/solidus_jwt/issues/8)
68
+ - Allow claims to be passed through [\#4](https://github.com/solidusio-contrib/solidus_jwt/issues/4)
69
+
70
+ **Merged pull requests:**
71
+
72
+ - Update jwt claims [\#11](https://github.com/solidusio-contrib/solidus_jwt/pull/11) ([skukx](https://github.com/skukx))
73
+
74
+ ## [v0.0.2](https://github.com/solidusio-contrib/solidus_jwt/tree/v0.0.2) (2019-06-18)
75
+
76
+ [Full Changelog](https://github.com/solidusio-contrib/solidus_jwt/compare/v0.0.1...v0.0.2)
77
+
78
+ **Closed issues:**
79
+
80
+ - SQLite3::ConstraintException: UNIQUE constraint failed: spree\_users.uid [\#3](https://github.com/solidusio-contrib/solidus_jwt/issues/3)
81
+
82
+ **Merged pull requests:**
83
+
84
+ - Fix bug with iat [\#10](https://github.com/solidusio-contrib/solidus_jwt/pull/10) ([skukx](https://github.com/skukx))
85
+ - Lock sqlite3 gem version [\#7](https://github.com/solidusio-contrib/solidus_jwt/pull/7) ([mdesantis](https://github.com/mdesantis))
86
+ - Calculate 'exp' and 'iat' upon the same timestamp [\#6](https://github.com/solidusio-contrib/solidus_jwt/pull/6) ([mdesantis](https://github.com/mdesantis))
87
+
88
+ ## [v0.0.1](https://github.com/solidusio-contrib/solidus_jwt/tree/v0.0.1) (2018-11-12)
89
+
90
+ [Full Changelog](https://github.com/solidusio-contrib/solidus_jwt/compare/v0.0.1.pre...v0.0.1)
91
+
92
+ ## [v0.0.1.pre](https://github.com/solidusio-contrib/solidus_jwt/tree/v0.0.1.pre) (2018-10-27)
93
+
94
+ [Full Changelog](https://github.com/solidusio-contrib/solidus_jwt/compare/3e4c03b72d6259529a8cab3b0def7b338dc7b026...v0.0.1.pre)
95
+
96
+
97
+
98
+ \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  SolidusJwt
2
2
  ==========
3
3
 
4
- [![CircleCI](https://circleci.com/gh/skukx/solidus_jwt.svg?style=svg)](https://circleci.com/gh/skukx/solidus_jwt)
4
+ [![CircleCI](https://circleci.com/gh/solidusio-contrib/solidus_jwt.svg?style=svg)](https://circleci.com/gh/solidusio-contrib/solidus_jwt)
5
5
  [![Gem Version](https://badge.fury.io/rb/solidus_jwt.svg)](https://badge.fury.io/rb/solidus_jwt)
6
6
 
7
7
  This gem gives [Solidus](https://github.com/solidusio/solidus) stores the ability to authenticate API requests with
data/Rakefile CHANGED
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
-
2
+ #
3
+ require 'bundler/gem_tasks'
3
4
  require 'solidus_dev_support/rake_tasks'
4
5
  SolidusDevSupport::RakeTasks.install
5
6
 
data/bin/rails-sandbox CHANGED
@@ -6,7 +6,7 @@ app_root = 'sandbox'
6
6
  unless File.exist? "#{app_root}/bin/rails"
7
7
  warn 'Creating the sandbox app...'
8
8
  Dir.chdir "#{__dir__}/.." do
9
- system "#{__dir__}/sandbox" or begin # rubocop:disable Style/AndOr
9
+ system "#{__dir__}/sandbox" or begin
10
10
  warn 'Automatic creation of the sandbox app failed'
11
11
  exit 1
12
12
  end
data/bin/sandbox CHANGED
@@ -22,7 +22,7 @@ if [ ! -z $SOLIDUS_BRANCH ]
22
22
  then
23
23
  BRANCH=$SOLIDUS_BRANCH
24
24
  else
25
- BRANCH="master"
25
+ BRANCH="main"
26
26
  fi
27
27
 
28
28
  extension_name="solidus_jwt"
@@ -10,7 +10,8 @@ module SolidusJwt
10
10
  end
11
11
 
12
12
  def run_migrations
13
- run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]'))
13
+ run_migrations = options[:auto_run_migrations] ||
14
+ ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]'))
14
15
  if run_migrations
15
16
  run 'bundle exec rake db:migrate'
16
17
  else
@@ -14,7 +14,8 @@ module SolidusJwt
14
14
  # }
15
15
  #
16
16
  # SolidusJwt.encode payload: payload
17
- # #=> 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEsImlhdCI6MTU4NDEzMjExOCwiZXhwIjoxNTg0MTM1NzE4LCJpc3MiOiJzb2xpZHVzIn0.OKZOGlawx435GdgKp2AGD8SKxW7sqn0h-Ef2qdVSxqQ'
17
+ # #=> 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEsImlhdCI6MTU4NDEzMjExOCwiZXhwIj
18
+ # oxNTg0MTM1NzE4LCJpc3MiOiJzb2xpZHVzIn0.OKZOGlawx435GdgKp2AGD8SKxW7sqn0h-Ef2qdVSxqQ'
18
19
  #
19
20
  # @param payload [Hash] Attributes to place within the jwt
20
21
  # @param expires_in [Integer] How long until token expires in Seconds (*Optional*).
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  FactoryBot.define do
4
- # Define your Spree extensions Factories within this file to enable applications, and other extensions to use and override them.
4
+ # Define your Spree extensions Factories within this file to enable applications,
5
+ # and other extensions to use and override them.
5
6
  #
6
7
  # Example adding this to your spec_helper will load these Factories for use:
7
8
  # require 'solidus_jwt/factories'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusJwt
4
- VERSION = '1.2.1'
4
+ VERSION = '1.2.2'
5
5
  end
data/solidus_jwt.gemspec CHANGED
@@ -15,8 +15,9 @@ Gem::Specification.new do |s|
15
15
 
16
16
  s.metadata['homepage_uri'] = s.homepage
17
17
  s.metadata['source_code_uri'] = s.homepage
18
+ s.metadata['changelog_uri'] = 'https://github.com/solidusio/solidus_jwt/releases'
18
19
 
19
- s.required_ruby_version = Gem::Requirement.new
20
+ s.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
20
21
 
21
22
  # Specify which files should be added to the gem when it is released.
22
23
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -30,7 +31,7 @@ Gem::Specification.new do |s|
30
31
 
31
32
  s.add_dependency 'jwt'
32
33
  s.add_dependency 'solidus_auth_devise'
33
- s.add_dependency 'solidus_core', ['>= 2.0.0', '< 4']
34
+ s.add_dependency 'solidus_core', ['>= 2.0.0', '< 5']
34
35
  s.add_dependency 'solidus_support'
35
36
 
36
37
  s.add_development_dependency 'byebug'
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helper'
4
- require 'spree/testing_support/factories/user_factory'
5
4
 
6
5
  RSpec.describe SolidusJwt::DeviseStrategies::Password do
7
6
  let(:request) { instance_double('ActionController::Request') }
@@ -10,14 +9,13 @@ RSpec.describe SolidusJwt::DeviseStrategies::Password do
10
9
  let(:params) do
11
10
  {
12
11
  username: user.email,
13
- password: password,
12
+ password: 'secret',
14
13
  grant_type: 'password'
15
14
  }
16
15
  end
17
16
 
18
17
  let(:headers) { {} }
19
- let(:user) { FactoryBot.create(:user, password: password) }
20
- let(:password) { 'secret' }
18
+ let(:user) { FactoryBot.create(:user, password: 'secret') }
21
19
 
22
20
  before do
23
21
  allow(request).to receive(:headers).and_return(:headers)
@@ -60,7 +58,7 @@ RSpec.describe SolidusJwt::DeviseStrategies::Password do
60
58
  {
61
59
  username: user.email,
62
60
  password: 'invalid',
63
- grant_type: password
61
+ grant_type: 'secret'
64
62
  }
65
63
  end
66
64
 
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helper'
4
- require 'spree/testing_support/factories/user_factory'
5
4
 
6
5
  RSpec.describe SolidusJwt::DeviseStrategies::RefreshToken do
7
6
  let(:request) { instance_double('ActionController::Request') }
@@ -14,13 +13,11 @@ RSpec.describe SolidusJwt::DeviseStrategies::RefreshToken do
14
13
  }
15
14
  end
16
15
 
17
- let(:headers) { {} }
18
- let(:user) { FactoryBot.create(:user, password: password) }
19
- let(:password) { 'secret' }
16
+ let(:user) { FactoryBot.create(:user, password: 'secret') }
20
17
  let(:token) { user.auth_tokens.create! }
21
18
 
22
19
  before do
23
- allow(request).to receive(:headers).and_return(:headers)
20
+ allow(request).to receive(:headers).and_return({})
24
21
 
25
22
  allow(strategy).to receive(:request).and_return(request)
26
23
  allow(strategy).to receive(:params).and_return(params)
@@ -15,9 +15,11 @@ RSpec.describe SolidusJwt::Token, type: :model do
15
15
  let(:instance) { FactoryBot.build(:token, token: nil) }
16
16
 
17
17
  it 'generates one automatically' do
18
- expect(instance.token).to be_nil
19
- instance.save
20
- expect(instance.token).to be_present
18
+ aggregate_failures do
19
+ expect(instance.token).to be_nil
20
+ instance.save
21
+ expect(instance.token).to be_present
22
+ end
21
23
  end
22
24
  end
23
25
 
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helper'
4
- require 'spree/testing_support/factories/user_factory'
5
4
 
6
5
  RSpec.describe 'SolidusJwt Authentication', type: :request do
7
6
  let(:params) do
@@ -22,8 +21,10 @@ RSpec.describe 'SolidusJwt Authentication', type: :request do
22
21
  it 'renders invalid_api_key' do
23
22
  get spree.api_user_path(user.id), params: params
24
23
 
25
- expect(response.status).to be(401)
26
- expect(response.body).to include('Invalid API key')
24
+ aggregate_failures do
25
+ expect(response.status).to be(401)
26
+ expect(response.body).to include('Invalid API key')
27
+ end
27
28
  end
28
29
  end
29
30
 
@@ -1,14 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helper'
4
- require 'spree/testing_support/factories/user_factory'
5
4
 
6
5
  RSpec.describe 'Token Retrieval', type: :request do
7
6
  let(:user) { FactoryBot.create(:user, password: 'password') }
8
7
 
9
8
  describe '/api/token' do
10
9
  context 'when username and password are provided' do
11
- context 'when success' do
10
+ context 'when success' do # rubocop:disable RSpec/NestedGroups
12
11
  before do
13
12
  post '/oauth/token', params: { username: user.email, password: 'password', grant_type: 'password' }
14
13
  end
@@ -20,39 +19,45 @@ RSpec.describe 'Token Retrieval', type: :request do
20
19
  it 'responds with access_token and refresh_token' do
21
20
  json = JSON.parse(response.body)
22
21
 
23
- expect(json).to have_key('access_token')
24
- expect(json).to have_key('refresh_token')
22
+ aggregate_failures do
23
+ expect(json).to have_key('access_token')
24
+ expect(json).to have_key('refresh_token')
25
+ end
25
26
  end
26
27
  end
27
28
 
28
- context 'when warden failure' do
29
+ context 'when warden failure' do # rubocop:disable RSpec/NestedGroups
29
30
  def send_request
30
31
  post '/oauth/token', params: { username: user.email, password: 'password', grant_type: 'password' }
31
32
  end
32
33
 
33
34
  it 'responds with status 401' do
34
- expect_any_instance_of(Spree::Api::OauthsController).to receive(:try_authenticate_user) do # rubocop:disable RSpec/AnyInstance
35
- throw(:warden, scope: :spree_user, message: :locked)
36
- end
35
+ aggregate_failures do
36
+ expect_any_instance_of(Spree::Api::OauthsController).to receive(:try_authenticate_user) do # rubocop:disable RSpec/AnyInstance
37
+ throw(:warden, scope: :spree_user, message: :locked)
38
+ end
37
39
 
38
- send_request
39
- expect(response).to have_http_status(:unauthorized)
40
+ send_request
41
+ expect(response).to have_http_status(:unauthorized)
42
+ end
40
43
  end
41
44
 
42
45
  it 'responds with translated Devise error message' do
43
- expect_any_instance_of(Spree::Api::OauthsController).to receive(:try_authenticate_user) do # rubocop:disable RSpec/AnyInstance
44
- throw(:warden, scope: :spree_user, message: :locked)
45
- end
46
+ aggregate_failures do
47
+ expect_any_instance_of(Spree::Api::OauthsController).to receive(:try_authenticate_user) do # rubocop:disable RSpec/AnyInstance
48
+ throw(:warden, scope: :spree_user, message: :locked)
49
+ end
46
50
 
47
- send_request
48
- json = JSON.parse(response.body)
51
+ send_request
52
+ json = JSON.parse(response.body)
49
53
 
50
- expect(json).to have_key('error')
51
- expect(json['error']).to eq('Your account is locked.')
54
+ expect(json).to have_key('error')
55
+ expect(json['error']).to eq('Your account is locked.')
56
+ end
52
57
  end
53
58
  end
54
59
 
55
- context 'when invalid password' do
60
+ context 'when invalid password' do # rubocop:disable RSpec/NestedGroups
56
61
  def send_request
57
62
  post '/oauth/token', params: { username: user.email, password: 'invalid', grant_type: 'password' }
58
63
  end
@@ -67,11 +72,13 @@ RSpec.describe 'Token Retrieval', type: :request do
67
72
 
68
73
  json = JSON.parse(response.body)
69
74
 
70
- expect(json).to have_key('error')
71
- expect(json['error']).to eq('invalid username or password')
75
+ aggregate_failures do
76
+ expect(json).to have_key('error')
77
+ expect(json['error']).to eq('invalid username or password')
78
+ end
72
79
  end
73
80
 
74
- context 'with error message translation' do
81
+ context 'with error message translation' do # rubocop:disable RSpec/NestedGroups
75
82
  before do
76
83
  allow(I18n).to receive(:t).with(:invalid_credentials, scope: 'solidus_jwt').and_return('Wrong token!')
77
84
  end
@@ -81,8 +88,10 @@ RSpec.describe 'Token Retrieval', type: :request do
81
88
 
82
89
  json = JSON.parse(response.body)
83
90
 
84
- expect(json).to have_key('error')
85
- expect(json['error']).to eq('Wrong token!')
91
+ aggregate_failures do
92
+ expect(json).to have_key('error')
93
+ expect(json['error']).to eq('Wrong token!')
94
+ end
86
95
  end
87
96
  end
88
97
  end
@@ -91,7 +100,7 @@ RSpec.describe 'Token Retrieval', type: :request do
91
100
  context 'when refresh token provided' do
92
101
  let(:refresh_token) { user.auth_tokens.create! }
93
102
 
94
- context 'when success' do
103
+ context 'when success' do # rubocop:disable RSpec/NestedGroups
95
104
  before do
96
105
  post '/oauth/token', params: { refresh_token: refresh_token.token, grant_type: 'refresh_token' }
97
106
  end
@@ -103,12 +112,14 @@ RSpec.describe 'Token Retrieval', type: :request do
103
112
  it 'responds with access_token and refresh_token' do
104
113
  json = JSON.parse(response.body)
105
114
 
106
- expect(json).to have_key('access_token')
107
- expect(json).to have_key('refresh_token')
115
+ aggregate_failures do
116
+ expect(json).to have_key('access_token')
117
+ expect(json).to have_key('refresh_token')
118
+ end
108
119
  end
109
120
  end
110
121
 
111
- context 'when failure' do
122
+ context 'when failure' do # rubocop:disable RSpec/NestedGroups
112
123
  before do
113
124
  post '/oauth/token', params: { refresh_token: 'invalid', grant_type: 'refresh_token' }
114
125
  end
data/spec/spec_helper.rb CHANGED
@@ -8,17 +8,19 @@ require 'byebug'
8
8
  # Run Coverage report
9
9
  require 'solidus_dev_support/rspec/coverage'
10
10
 
11
- require File.expand_path('dummy/config/environment.rb', __dir__)
11
+ dummy_env = "#{__dir__}/dummy/config/environment.rb"
12
+ system 'bin/rake extension:test_app' unless File.exist? dummy_env
13
+ require dummy_env
12
14
 
13
15
  # Requires factories and other useful helpers defined in spree_core.
14
16
  require 'solidus_dev_support/rspec/feature_helper'
15
17
 
16
18
  # Requires supporting ruby files with custom matchers and macros, etc,
17
19
  # in spec/support/ and its subdirectories.
18
- Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }
20
+ Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].sort.each { |f| require f }
19
21
 
20
- # Requires factories defined in lib/solidus_jwt/factories.rb
21
- require 'solidus_jwt/factories'
22
+ # Requires factories defined in lib/solidus_jwt/testing_support/factories.rb
23
+ SolidusDevSupport::TestingSupport::Factories.load_for(SolidusJwt::Engine)
22
24
 
23
25
  RSpec.configure do |config|
24
26
  config.infer_spec_type_from_file_location!
@@ -14,10 +14,12 @@ RSpec.shared_examples 'Decodeable Examples' do
14
14
 
15
15
  decoded_token = subject.decode(token)
16
16
 
17
- expect(JWT).to have_received(:decode).with(token, SolidusJwt::Config.jwt_secret,
18
- true, hash_including(algorithm: SolidusJwt::Config.jwt_algorithm))
19
- expect(decoded_token).to be_kind_of(Array)
20
- expect(decoded_token.first).to include(payload.as_json)
17
+ aggregate_failures do
18
+ expect(JWT).to have_received(:decode).with(token, SolidusJwt::Config.jwt_secret,
19
+ true, hash_including(algorithm: SolidusJwt::Config.jwt_algorithm))
20
+ expect(decoded_token).to be_kind_of(Array)
21
+ expect(decoded_token.first).to include(payload.as_json)
22
+ end
21
23
  end
22
24
  end
23
25
  end
@@ -9,9 +9,11 @@ RSpec.shared_examples 'Encodeable Examples' do
9
9
 
10
10
  token = subject.encode(payload: payload)
11
11
 
12
- expect(JWT).to have_received(:encode).with(hash_including('iat', 'user_id' => 1),
13
- SolidusJwt::Config.jwt_secret, SolidusJwt::Config.jwt_algorithm)
14
- expect(token).to be_kind_of String
12
+ aggregate_failures do
13
+ expect(JWT).to have_received(:encode).with(hash_including('iat', 'user_id' => 1),
14
+ SolidusJwt::Config.jwt_secret, SolidusJwt::Config.jwt_algorithm)
15
+ expect(token).to be_kind_of String
16
+ end
15
17
  end
16
18
 
17
19
  context 'when expiration is passed in' do
@@ -20,9 +22,11 @@ RSpec.shared_examples 'Encodeable Examples' do
20
22
 
21
23
  token = subject.encode(payload: payload, expires_in: 60)
22
24
 
23
- expect(JWT).to have_received(:encode).with(hash_including('iat', 'exp', 'user_id' => 1),
24
- SolidusJwt::Config.jwt_secret, SolidusJwt::Config.jwt_algorithm)
25
- expect(token).to be_kind_of String
25
+ aggregate_failures do
26
+ expect(JWT).to have_received(:encode).with(hash_including('iat', 'exp', 'user_id' => 1),
27
+ SolidusJwt::Config.jwt_secret, SolidusJwt::Config.jwt_algorithm)
28
+ expect(token).to be_kind_of String
29
+ end
26
30
  end
27
31
  end
28
32
  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.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taylor Scott
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-09 00:00:00.000000000 Z
11
+ date: 2023-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt
@@ -47,7 +47,7 @@ dependencies:
47
47
  version: 2.0.0
48
48
  - - "<"
49
49
  - !ruby/object:Gem::Version
50
- version: '4'
50
+ version: '5'
51
51
  type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
@@ -57,7 +57,7 @@ dependencies:
57
57
  version: 2.0.0
58
58
  - - "<"
59
59
  - !ruby/object:Gem::Version
60
- version: '4'
60
+ version: '5'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: solidus_support
63
63
  requirement: !ruby/object:Gem::Requirement
@@ -118,6 +118,7 @@ files:
118
118
  - CHANGELOG.md
119
119
  - Gemfile
120
120
  - LICENSE
121
+ - OLD_CHANGELOG.md
121
122
  - README.md
122
123
  - Rakefile
123
124
  - _config.yml
@@ -149,12 +150,10 @@ files:
149
150
  - lib/solidus_jwt/devise_strategies/refresh_token.rb
150
151
  - lib/solidus_jwt/distributor/devise.rb
151
152
  - lib/solidus_jwt/engine.rb
152
- - lib/solidus_jwt/factories.rb
153
153
  - lib/solidus_jwt/preferences.rb
154
+ - lib/solidus_jwt/testing_support/factories.rb
154
155
  - lib/solidus_jwt/version.rb
155
156
  - solidus_jwt.gemspec
156
- - spec/lib/solidus_jwt/concerns/decodeable_spec.rb
157
- - spec/lib/solidus_jwt/concerns/encodeable_spec.rb
158
157
  - spec/lib/solidus_jwt/config_spec.rb
159
158
  - spec/lib/solidus_jwt/devise_strategies/password_spec.rb
160
159
  - spec/lib/solidus_jwt/devise_strategies/refresh_token_spec.rb
@@ -172,6 +171,7 @@ licenses:
172
171
  metadata:
173
172
  homepage_uri: https://github.com/solidusio-contrib/solidus_jwt
174
173
  source_code_uri: https://github.com/solidusio-contrib/solidus_jwt
174
+ changelog_uri: https://github.com/solidusio/solidus_jwt/releases
175
175
  post_install_message:
176
176
  rdoc_options: []
177
177
  require_paths:
@@ -180,7 +180,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
180
180
  requirements:
181
181
  - - ">="
182
182
  - !ruby/object:Gem::Version
183
- version: '0'
183
+ version: 2.5.0
184
184
  required_rubygems_version: !ruby/object:Gem::Requirement
185
185
  requirements:
186
186
  - - ">="
@@ -192,8 +192,6 @@ signing_key:
192
192
  specification_version: 4
193
193
  summary: Add Json Web Tokens to Solidus API
194
194
  test_files:
195
- - spec/lib/solidus_jwt/concerns/decodeable_spec.rb
196
- - spec/lib/solidus_jwt/concerns/encodeable_spec.rb
197
195
  - spec/lib/solidus_jwt/config_spec.rb
198
196
  - spec/lib/solidus_jwt/devise_strategies/password_spec.rb
199
197
  - spec/lib/solidus_jwt/devise_strategies/refresh_token_spec.rb
File without changes
File without changes