grape-jwt-authentication 2.5.0 → 2.7.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 +4 -4
- data/.github/workflows/test.yml +2 -2
- data/.rubocop.yml +1 -1
- data/Appraisals +0 -6
- data/CHANGELOG.md +8 -0
- data/Gemfile +1 -1
- data/gemfiles/rails_6.1.gemfile +1 -1
- data/gemfiles/rails_7.1.gemfile +1 -1
- data/grape-jwt-authentication.gemspec +7 -6
- data/lib/grape/jwt/authentication/extensions/dependencies.rb +38 -0
- data/lib/grape/jwt/authentication/version.rb +1 -1
- data/lib/grape/jwt/authentication.rb +34 -25
- metadata +21 -8
- data/gemfiles/rails_5.2.gemfile +0 -27
- data/lib/grape/jwt/authentication/dependencies.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18bf4cf6b306fb0c9bc7e4661d06ec1ad1c06ca5b98f8dd4c903abbbbece763e
|
4
|
+
data.tar.gz: 63ec416166cb35583f664d2b30c0c8a96fcb708ad83ca6a1f62599d475a278f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eedd2923aa5da56a699323be30d240c045c53dfefa80f7fb69d7c629a0ec7cbddc66028db7de74f275accd91e1be885577c1f74023ee1f61b39684219c04ac98
|
7
|
+
data.tar.gz: 13724dfa53421372f14387778b7a59cd5772e30632e5404a5f585189692683fead0e413641b5937f9f88e73276a4066dbe54d95a3cd04c176db7331b03b4be72
|
data/.github/workflows/test.yml
CHANGED
data/.rubocop.yml
CHANGED
data/Appraisals
CHANGED
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
data/gemfiles/rails_6.1.gemfile
CHANGED
data/gemfiles/rails_7.1.gemfile
CHANGED
@@ -33,10 +33,11 @@ Gem::Specification.new do |spec|
|
|
33
33
|
|
34
34
|
spec.required_ruby_version = '>= 2.7'
|
35
35
|
|
36
|
-
spec.
|
37
|
-
spec.
|
38
|
-
spec.
|
39
|
-
spec.
|
40
|
-
spec.
|
41
|
-
spec.
|
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
|
@@ -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
|
-
|
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
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
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
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
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.
|
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:
|
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: '
|
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: '
|
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.
|
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.
|
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:
|
data/gemfiles/rails_5.2.gemfile
DELETED
@@ -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
|