grape-jwt-authentication 2.5.0 → 2.7.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: 1b3f2f11cb52a514981b47da3c788d812739f4b63a3d244e64ecb8f25feb318c
4
- data.tar.gz: 5223a66f76740f0adb9e0fa184059d6f16badc8c1a9fdc753c1a0765d7d6ff1c
3
+ metadata.gz: 18bf4cf6b306fb0c9bc7e4661d06ec1ad1c06ca5b98f8dd4c903abbbbece763e
4
+ data.tar.gz: 63ec416166cb35583f664d2b30c0c8a96fcb708ad83ca6a1f62599d475a278f5
5
5
  SHA512:
6
- metadata.gz: 6327e8b47d2fcb934c2fd1d2149a123d8e566a08270d060ea8064f3f26324bf9295bcae05fe50155af2be66d6aae8526c91daa121d942ec01dd72150a79768f1
7
- data.tar.gz: c2d3338513c43ac57415880d1b9954728de41bf7725f48e41a1c3cea70047bf20eadef31afaf2aa34a8af4f1e3141dba272af03d1fe65676f305f0c3f82a10e1
6
+ metadata.gz: eedd2923aa5da56a699323be30d240c045c53dfefa80f7fb69d7c629a0ec7cbddc66028db7de74f275accd91e1be885577c1f74023ee1f61b39684219c04ac98
7
+ data.tar.gz: 13724dfa53421372f14387778b7a59cd5772e30632e5404a5f585189692683fead0e413641b5937f9f88e73276a4066dbe54d95a3cd04c176db7331b03b4be72
@@ -18,8 +18,8 @@ jobs:
18
18
  strategy:
19
19
  fail-fast: false
20
20
  matrix:
21
- ruby: ['2.7']
22
- rails: ['5.2', '6.1', '7.1']
21
+ ruby: ['2.7', '3.0']
22
+ rails: ['6.1', '7.1']
23
23
  env:
24
24
  BUNDLE_GEMFILE: 'gemfiles/rails_${{ matrix.rails }}.gemfile'
25
25
  steps:
data/.rubocop.yml CHANGED
@@ -13,7 +13,7 @@ AllCops:
13
13
  SuggestExtensions: false
14
14
  DisplayCopNames: true
15
15
  TargetRubyVersion: 2.7
16
- TargetRailsVersion: 5.2
16
+ TargetRailsVersion: 6.1
17
17
  Exclude:
18
18
  - bin/**/*
19
19
  - vendor/**/*
data/Appraisals CHANGED
@@ -1,11 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- appraise 'rails-5.2' do
4
- gem 'activejob', '~> 5.2.0'
5
- gem 'activerecord', '~> 5.2.0'
6
- gem 'activesupport', '~> 5.2.0'
7
- end
8
-
9
3
  appraise 'rails-6.1' do
10
4
  gem 'activejob', '~> 6.1.0'
11
5
  gem 'activerecord', '~> 6.1.0'
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  * TODO: Replace this bullet point with an actual description of a change.
4
4
 
5
+ ### 2.7.0 (11 January 2025)
6
+
7
+ * Switched to Zeitwerk as autoloader (#17)
8
+
9
+ ### 2.6.0 (3 January 2025)
10
+
11
+ * Raised minimum supported Ruby/Rails version to 2.7/6.1 (#16)
12
+
5
13
  ### 2.5.0 (4 October 2024)
6
14
 
7
15
  * Upgraded the `recursive-open-struct` gem to `~> 2.0` (#15)
data/Gemfile CHANGED
@@ -14,7 +14,7 @@ gem 'countless', '~> 1.1'
14
14
  gem 'guard-rspec', '~> 4.7'
15
15
  gem 'rack', '~> 2.2'
16
16
  gem 'rack-test', '~> 2.0'
17
- gem 'railties', '>= 5.2'
17
+ gem 'railties', '>= 6.1'
18
18
  gem 'rake', '~> 13.0'
19
19
  gem 'rspec', '~> 3.12'
20
20
  gem 'rubocop', '~> 1.28'
@@ -8,7 +8,7 @@ gem "countless", "~> 1.1"
8
8
  gem "guard-rspec", "~> 4.7"
9
9
  gem "rack", "~> 2.2"
10
10
  gem "rack-test", "~> 2.0"
11
- gem "railties", ">= 5.2"
11
+ gem "railties", ">= 6.1"
12
12
  gem "rake", "~> 13.0"
13
13
  gem "rspec", "~> 3.12"
14
14
  gem "rubocop", "~> 1.28"
@@ -8,7 +8,7 @@ gem "countless", "~> 1.1"
8
8
  gem "guard-rspec", "~> 4.7"
9
9
  gem "rack", "~> 2.2"
10
10
  gem "rack-test", "~> 2.0"
11
- gem "railties", ">= 5.2"
11
+ gem "railties", ">= 6.1"
12
12
  gem "rake", "~> 13.0"
13
13
  gem "rspec", "~> 3.12"
14
14
  gem "rubocop", "~> 1.28"
@@ -33,10 +33,11 @@ Gem::Specification.new do |spec|
33
33
 
34
34
  spec.required_ruby_version = '>= 2.7'
35
35
 
36
- spec.add_runtime_dependency 'activesupport', '>= 5.2'
37
- spec.add_runtime_dependency 'grape', '>= 1.0', '< 3.0'
38
- spec.add_runtime_dependency 'httparty', '>= 0.21'
39
- spec.add_runtime_dependency 'jwt', '~> 2.6'
40
- spec.add_runtime_dependency 'keyless', '~> 1.4'
41
- spec.add_runtime_dependency 'recursive-open-struct', '~> 2.0'
36
+ spec.add_dependency 'activesupport', '>= 6.1'
37
+ spec.add_dependency 'grape', '>= 1.0', '< 3.0'
38
+ spec.add_dependency 'httparty', '>= 0.21'
39
+ spec.add_dependency 'jwt', '~> 2.6'
40
+ spec.add_dependency 'keyless', '~> 1.6'
41
+ spec.add_dependency 'recursive-open-struct', '~> 2.0'
42
+ spec.add_dependency 'zeitwerk', '~> 2.6'
42
43
  end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Grape
4
+ module Jwt
5
+ module Authentication
6
+ module Extensions
7
+ # Root-level handling of dependencies.
8
+ module Dependencies
9
+ # Specifies which configuration keys are shared between keyless
10
+ # and grape-jwt-authentication, so that we can easily pass through
11
+ # our configuration to keyless.
12
+ KEYLESS_CONFIGURATION = %i[
13
+ authenticator rsa_public_key_url rsa_public_key_caching
14
+ rsa_public_key_expiration jwt_issuer jwt_beholder jwt_options
15
+ jwt_verification_key
16
+ ].freeze
17
+
18
+ # (Re)configure our gem dependencies. We take care of setting up
19
+ # +Keyless+, which has been extracted from this gem.
20
+ def configure_dependencies
21
+ configure_keyless
22
+ end
23
+
24
+ # Configure the +Keyless+ gem with our configuration.
25
+ def configure_keyless
26
+ configuration = Grape::Jwt::Authentication.configuration
27
+
28
+ Keyless.configure do |keyless|
29
+ KEYLESS_CONFIGURATION.each do |option|
30
+ keyless.send("#{option}=", configuration.send(option))
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -5,7 +5,7 @@ module Grape
5
5
  # The gem version details.
6
6
  module Authentication
7
7
  # The version of the +grape-jwt-authentication+ gem
8
- VERSION = '2.5.0'
8
+ VERSION = '2.7.0'
9
9
 
10
10
  class << self
11
11
  # Returns the version of gem as a string.
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'zeitwerk'
3
4
  require 'active_support'
4
5
  require 'active_support/concern'
5
6
  require 'active_support/configurable'
@@ -10,10 +11,6 @@ require 'active_support/time_with_zone'
10
11
  require 'jwt'
11
12
  require 'keyless'
12
13
  require 'grape'
13
- require 'grape/jwt/authentication/version'
14
- require 'grape/jwt/authentication/configuration'
15
- require 'grape/jwt/authentication/dependencies'
16
- require 'grape/jwt/authentication/jwt_handler'
17
14
 
18
15
  module Grape
19
16
  module Jwt
@@ -22,32 +19,44 @@ module Grape
22
19
  extend ActiveSupport::Concern
23
20
  include Grape::DSL::API
24
21
 
22
+ # Setup a Zeitwerk autoloader instance and configure it
23
+ loader = Zeitwerk::Loader.for_gem_extension(Grape::Jwt)
24
+
25
+ # Finish the auto loader configuration
26
+ loader.setup
27
+
28
+ # Make sure to eager load all SDK constants
29
+ loader.eager_load
30
+
25
31
  class << self
26
32
  attr_writer :configuration
27
- end
28
33
 
29
- # Retrieve the current configuration object.
30
- #
31
- # @return [Configuration]
32
- def self.configuration
33
- @configuration ||= Configuration.new
34
- end
34
+ # Include top-level features
35
+ include Extensions::Dependencies
35
36
 
36
- # Configure the concern by providing a block which takes
37
- # care of this task. Example:
38
- #
39
- # Grape::Jwt::Authentication.configure do |conf|
40
- # # conf.xyz = [..]
41
- # end
42
- def self.configure
43
- yield(configuration)
44
- configure_dependencies
45
- end
37
+ # Retrieve the current configuration object.
38
+ #
39
+ # @return [Configuration]
40
+ def configuration
41
+ @configuration ||= Configuration.new
42
+ end
46
43
 
47
- # Reset the current configuration with the default one.
48
- def self.reset_configuration!
49
- self.configuration = Configuration.new
50
- configure_dependencies
44
+ # Configure the concern by providing a block which takes
45
+ # care of this task. Example:
46
+ #
47
+ # Grape::Jwt::Authentication.configure do |conf|
48
+ # # conf.xyz = [..]
49
+ # end
50
+ def configure
51
+ yield(configuration)
52
+ configure_dependencies
53
+ end
54
+
55
+ # Reset the current configuration with the default one.
56
+ def reset_configuration!
57
+ self.configuration = Configuration.new
58
+ configure_dependencies
59
+ end
51
60
  end
52
61
 
53
62
  included do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-jwt-authentication
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hermann Mayer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-04 00:00:00.000000000 Z
11
+ date: 2025-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5.2'
19
+ version: '6.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '5.2'
26
+ version: '6.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: grape
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -78,14 +78,14 @@ dependencies:
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '1.4'
81
+ version: '1.6'
82
82
  type: :runtime
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: '1.4'
88
+ version: '1.6'
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: recursive-open-struct
91
91
  requirement: !ruby/object:Gem::Requirement
@@ -100,6 +100,20 @@ dependencies:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
102
  version: '2.0'
103
+ - !ruby/object:Gem::Dependency
104
+ name: zeitwerk
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '2.6'
110
+ type: :runtime
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '2.6'
103
117
  description: A reusable Grape JWT authentication concern
104
118
  email:
105
119
  - hermann.mayer92@gmail.com
@@ -133,13 +147,12 @@ files:
133
147
  - config/docker/.inputrc
134
148
  - doc/assets/project.svg
135
149
  - docker-compose.yml
136
- - gemfiles/rails_5.2.gemfile
137
150
  - gemfiles/rails_6.1.gemfile
138
151
  - gemfiles/rails_7.1.gemfile
139
152
  - grape-jwt-authentication.gemspec
140
153
  - lib/grape/jwt/authentication.rb
141
154
  - lib/grape/jwt/authentication/configuration.rb
142
- - lib/grape/jwt/authentication/dependencies.rb
155
+ - lib/grape/jwt/authentication/extensions/dependencies.rb
143
156
  - lib/grape/jwt/authentication/jwt_handler.rb
144
157
  - lib/grape/jwt/authentication/version.rb
145
158
  homepage:
@@ -1,27 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "appraisal", "~> 2.4"
6
- gem "bundler", "~> 2.3"
7
- gem "countless", "~> 1.1"
8
- gem "guard-rspec", "~> 4.7"
9
- gem "rack", "~> 2.2"
10
- gem "rack-test", "~> 2.0"
11
- gem "railties", ">= 5.2"
12
- gem "rake", "~> 13.0"
13
- gem "rspec", "~> 3.12"
14
- gem "rubocop", "~> 1.28"
15
- gem "rubocop-rails", "~> 2.14"
16
- gem "rubocop-rspec", "~> 2.10"
17
- gem "simplecov", ">= 0.22"
18
- gem "timecop", ">= 0.9.6"
19
- gem "vcr", "~> 6.0"
20
- gem "webmock", "~> 3.18"
21
- gem "yard", ">= 0.9.28"
22
- gem "yard-activesupport-concern", ">= 0.0.1"
23
- gem "activejob", "~> 5.2.0"
24
- gem "activerecord", "~> 5.2.0"
25
- gem "activesupport", "~> 5.2.0"
26
-
27
- gemspec path: "../"
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Grape
4
- module Jwt
5
- # The Grape JWT authentication concern.
6
- module Authentication
7
- # Specifies which configuration keys are shared between keyless
8
- # and grape-jwt-authentication, so that we can easily pass through
9
- # our configuration to keyless.
10
- KEYLESS_CONFIGURATION = %i[
11
- authenticator rsa_public_key_url rsa_public_key_caching
12
- rsa_public_key_expiration jwt_issuer jwt_beholder jwt_options
13
- jwt_verification_key
14
- ].freeze
15
-
16
- # (Re)configure our gem dependencies. We take care of setting up
17
- # +Keyless+, which has been extracted from this gem.
18
- def self.configure_dependencies
19
- configure_keyless
20
- end
21
-
22
- # Configure the +Keyless+ gem with our configuration.
23
- def self.configure_keyless
24
- configuration = Grape::Jwt::Authentication.configuration
25
-
26
- Keyless.configure do |keyless|
27
- KEYLESS_CONFIGURATION.each do |option|
28
- keyless.send("#{option}=", configuration.send(option))
29
- end
30
- end
31
- end
32
- end
33
- end
34
- end