warden-jwt_auth 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 260c2b0490d54bd3d4c2b359774209e3f326429b41fc7cbceb310253e9d55b46
4
- data.tar.gz: 6f43001c9de49f7cbd9c071a881344d50e0eb9c157552100407f0fa65c1ff3a5
3
+ metadata.gz: 0b1a585fc4b4ab038046cf25e745fdebb4363001374d31a3ab4c31b41e35b10e
4
+ data.tar.gz: e6e3ed8c59296a260b80d851a26fbd347662571b6650987d791dcaa1e9e2ef44
5
5
  SHA512:
6
- metadata.gz: 6c017145c06a747e5966e382940cf94b2dc247027a9c19b466a127a85ad5809db085d8e17483531a341c1f208b2fc25e8b007a994b387afc5fcf41c6d2256104
7
- data.tar.gz: 5fee963870a4f3bf0ecb356d764610e146f6d4557817b21c0d9f53ef4ba304449b3ea35d12e548ffaa02a9b12060e8099af18a4b9f68a47b4878cc8755df2a47
6
+ metadata.gz: 38e048fa380035adf7907ce3839911d0515686537a2cc6e7e96bce559006ef54aadcfadbfaf0edf73ab26d285e9de3593d5cbbd35e935c050f8b3423e4db8a2d
7
+ data.tar.gz: 80ffb413ffcf71cea9cf68e766a55a4f22a03f7f1f9128a7746be1357b2cca2b06a60ca8863533625c6c2298ffd859e6afd9303bc19be5580d9e52fdcb8196af
@@ -0,0 +1,21 @@
1
+ name: CI
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ matrix:
10
+ ruby-version: ['3.0', '3.1', '3.2', '3.3', ruby-head]
11
+
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - name: Set up Ruby ${{ matrix.ruby-version }}
15
+ uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: ${{ matrix.ruby-version }}
18
+ bundler-cache: true # 'bundle install' and cache
19
+ - name: Run specs
20
+ run: |
21
+ bundle exec rspec
@@ -0,0 +1,17 @@
1
+ name: Lint
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ lint:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v4
10
+ - name: Set up Ruby ${{ matrix.ruby-version }}
11
+ uses: ruby/setup-ruby@v1
12
+ with:
13
+ ruby-version: 2.7
14
+ bundler-cache: true # 'bundle install' and cache
15
+ - name: Run specs
16
+ run: |
17
+ bundle exec rubocop
data/CHANGELOG.md CHANGED
@@ -4,10 +4,13 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
- ## [0.10.0] - 2024-07-10
8
- - Add support for configurable token header ([55](https://github.com/waiting-for-dev/warden-jwt_auth/pull/55))
7
+ ## [0.11.0] - 2024-12-20
8
+ - Prevent strategy from running when the current path matches a dispatch request ([60](https://github.com/waiting-for-dev/warden-jwt_auth/pull/60))
9
9
 
10
- ## [0.9.0] - 2024-06-28
10
+ ## [0.10.1] - 2024-12-15
11
+ - Fix version mismatch
12
+
13
+ ## [0.8.0] - 2024-06-28
11
14
  - Add support for issue claim ([56](https://github.com/waiting-for-dev/warden-jwt_auth/pull/56))
12
15
 
13
16
  ## [0.8.0] - 2023-01-31
data/README.md CHANGED
@@ -175,7 +175,7 @@ config.revocation_strategies = { user: RevocationStrategy }
175
175
 
176
176
  The implementation of the revocation strategy is also on your side. They just need to implement two methods: `jwt_revoked?` and `revoke_jwt`, both of them accepting as parameters the JWT payload and the user record, in this order.
177
177
 
178
- You can read about which [JWT recovation strategies](http://waiting-for-dev.github.io/blog/2017/01/24/jwt_revocation_strategies/) can be implement with their pros and cons.
178
+ You can read about which [JWT recovation strategies](http://waiting-for-dev.github.io/blog/2017/01/24/jwt_revocation_strategies) can be implement with their pros and cons.
179
179
 
180
180
  ```ruby
181
181
  module RevocationStrategy
@@ -47,8 +47,7 @@ module Warden
47
47
  end
48
48
 
49
49
  def request_matches?(path_info, method)
50
- dispatch_requests.each do |tuple|
51
- dispatch_method, dispatch_path = tuple
50
+ dispatch_requests.each do |(dispatch_method, dispatch_path)|
52
51
  return true if path_info.match(dispatch_path) &&
53
52
  method == dispatch_method
54
53
  end
@@ -7,8 +7,10 @@ module Warden
7
7
  # Warden strategy to authenticate an user through a JWT token in the
8
8
  # `Authorization` request header
9
9
  class Strategy < Warden::Strategies::Base
10
+ include JWTAuth::Import['dispatch_requests']
11
+
10
12
  def valid?
11
- token_exists? && issuer_claim_valid?
13
+ token_exists? && issuer_claim_valid? && !path_is_dispatch_request_path?
12
14
  end
13
15
 
14
16
  def store?
@@ -25,6 +27,14 @@ module Warden
25
27
 
26
28
  private
27
29
 
30
+ def path_is_dispatch_request_path?
31
+ current_path = EnvHelper.path_info(env)
32
+ request_method = EnvHelper.request_method(env)
33
+ dispatch_requests.any? do |(dispatch_method, dispatch_path)|
34
+ request_method == dispatch_method && current_path.match(dispatch_path)
35
+ end
36
+ end
37
+
28
38
  def issuer_claim_valid?
29
39
  configured_issuer = Warden::JWTAuth.config.issuer
30
40
  return true if configured_issuer.nil?
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Warden
4
4
  module JWTAuth
5
- VERSION = '0.10.0'
5
+ VERSION = '0.11.0'
6
6
  end
7
7
  end
@@ -19,6 +19,8 @@ module Warden
19
19
  module JWTAuth
20
20
  extend Dry::Configurable
21
21
 
22
+ module_function
23
+
22
24
  def symbolize_keys(hash)
23
25
  hash.transform_keys(&:to_sym)
24
26
  end
@@ -36,8 +38,6 @@ module Warden
36
38
  end
37
39
  end
38
40
 
39
- module_function :constantize_values, :symbolize_keys, :upcase_first_items
40
-
41
41
  # The secret used to encode the token
42
42
  setting :secret
43
43
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: warden-jwt_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marc Busqué
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-10 00:00:00.000000000 Z
11
+ date: 2024-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-auto_inject
@@ -214,10 +214,11 @@ extra_rdoc_files: []
214
214
  files:
215
215
  - ".codeclimate.yml"
216
216
  - ".github/FUNDING.yml"
217
+ - ".github/workflows/ci.yml"
218
+ - ".github/workflows/lint.yml"
217
219
  - ".gitignore"
218
220
  - ".rspec"
219
221
  - ".rubocop.yml"
220
- - ".travis.yml"
221
222
  - CHANGELOG.md
222
223
  - CODE_OF_CONDUCT.md
223
224
  - Dockerfile
data/.travis.yml DELETED
@@ -1,21 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- rvm:
4
- - 2.6
5
- - 2.7
6
- - 3.0
7
- - ruby-head
8
- before_install:
9
- - gem update --system --no-doc
10
- - gem install bundler
11
- script:
12
- - bundle exec rspec
13
- - bundle exec rubocop
14
- - bundle exec codeclimate-test-reporter
15
- jobs:
16
- allow_failures:
17
- - rvm: ruby-head
18
- addons:
19
- code_climate:
20
- repo_token:
21
- secure: neJ5LVLV6vgeCnerSQjUpLuQDvxEH87iW8swCSWl2hTtPcD/GuwYSeSXnhH72HVHi/9basHHhaYPcE2YeBwBCr39PhiHMNwS5GGGk/RGjKpU/Gt1KXV8KXTbNGT4v+ZMM3cdsdDfe8OnzGguNVsdxseHa3KE2pyuvo2a0swXwKa7BU9VB/3ZoZvvfI3Xr9im4eklWam5yCwVR0FOF7epzmNTKMXcUga2BOc9PV5aVELzLILLCHCJSCupe5Rx8mfcsRoRmZXKduF8Ke3eq8eULvLEo4EGfC107najOqrKt7x8uDVIsuGrP4LUQ4ainmNEb2jIvpjuqAxpusMjhpjCINF1Tn0OXK93OXAp4QKeIYoYEqKtzRxX0TWFNWHB8ombF9HTMF2DmloDZyFRiI40JSMImU0hc4MDxRgiTW5MDWGbohDaJ+9VV6+rIqtlEfLhgj1grFBAroaJce9BB7RQEmfsZPzhC2VXwGxHw/YkJgzBNGq1/9E1DoTY9RPSNTQfSRodhI3XW8LSQSHTBeXZvymVcjeOyYgjzJYviLHR8QS4cXpUALtlFXyaMkPHUBLUn8XsBa5Azfh5y3qPMGiJq1/qaHA4mKj5ls+ngFbzOq82sYGAKgQHj/ZDb+FZMQQanp4jyWADKcpXcmINb9jEQwkU0bjpuhUYtghASxH1Kl8=