keyless 1.7.1 → 2.1.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/release.yml +4 -4
- data/.github/workflows/test.yml +3 -3
- data/.rubocop.yml +2 -2
- data/Appraisals +12 -4
- data/CHANGELOG.md +12 -0
- data/Dockerfile +2 -2
- data/Gemfile +3 -3
- data/docker-compose.yml +0 -1
- data/gemfiles/rails_7.1.gemfile +3 -3
- data/gemfiles/rails_7.2.gemfile +23 -0
- data/gemfiles/rails_8.0.gemfile +23 -0
- data/gemfiles/rails_8.1.gemfile +23 -0
- data/keyless.gemspec +3 -3
- data/lib/keyless/configuration.rb +40 -2
- data/lib/keyless/jwt.rb +0 -5
- data/lib/keyless/version.rb +1 -1
- data/lib/keyless.rb +2 -1
- metadata +13 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e7856a57560d9da148dd9fd926e99a12b7e4893c817d60aeebe43f595abb2297
|
|
4
|
+
data.tar.gz: 6ae408a15651a845a135ea9cd70f478e38d35087be27adc0756cb755b623e111
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 98c7a9d1cb2637c1d2f1f359071b5354a43955c207cf35b03aae0eb072427aeb57999b8d81c59e8f99607e15a71320411239a8c12976a14a4a5fb682c540fade
|
|
7
|
+
data.tar.gz: 55742a9c23e02127190bbf56869dc6c4ee9d10a1411d936260d235c1432c28aa6f913f615c758b5c89c8932502b940b5d534bf46ad67580b48605aa3f9b755fc
|
|
@@ -16,16 +16,16 @@ jobs:
|
|
|
16
16
|
docs:
|
|
17
17
|
name: Release the gem
|
|
18
18
|
runs-on: ubuntu-22.04
|
|
19
|
-
timeout-minutes:
|
|
19
|
+
timeout-minutes: 10
|
|
20
20
|
steps:
|
|
21
21
|
- uses: actions/checkout@v4
|
|
22
22
|
|
|
23
|
-
- name: Install Ruby 2
|
|
23
|
+
- name: Install Ruby 3.2
|
|
24
24
|
uses: ruby/setup-ruby@v1
|
|
25
25
|
with:
|
|
26
|
-
ruby-version: 2
|
|
26
|
+
ruby-version: 3.2
|
|
27
27
|
bundler-cache: true
|
|
28
|
-
rubygems: '3.
|
|
28
|
+
rubygems: '3.6.9'
|
|
29
29
|
|
|
30
30
|
- name: Prepare the virtual environment
|
|
31
31
|
uses: hausgold/actions/ci@master
|
data/.github/workflows/test.yml
CHANGED
|
@@ -18,8 +18,8 @@ jobs:
|
|
|
18
18
|
strategy:
|
|
19
19
|
fail-fast: false
|
|
20
20
|
matrix:
|
|
21
|
-
ruby: ['
|
|
22
|
-
rails: ['
|
|
21
|
+
ruby: ['3.2', '3.3', '3.4']
|
|
22
|
+
rails: ['7.1', '7.2', '8.0', '8.1']
|
|
23
23
|
env:
|
|
24
24
|
BUNDLE_GEMFILE: 'gemfiles/rails_${{ matrix.rails }}.gemfile'
|
|
25
25
|
steps:
|
|
@@ -30,7 +30,7 @@ jobs:
|
|
|
30
30
|
with:
|
|
31
31
|
ruby-version: ${{ matrix.ruby }}
|
|
32
32
|
bundler-cache: true
|
|
33
|
-
rubygems: '3.
|
|
33
|
+
rubygems: '3.6.9'
|
|
34
34
|
|
|
35
35
|
- name: Prepare the virtual environment
|
|
36
36
|
uses: hausgold/actions/ci@master
|
data/.rubocop.yml
CHANGED
data/Appraisals
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
appraise 'rails-6.1' do
|
|
4
|
-
gem 'activesupport', '~> 6.1.0'
|
|
5
|
-
end
|
|
6
|
-
|
|
7
3
|
appraise 'rails-7.1' do
|
|
8
4
|
gem 'activesupport', '~> 7.1.0'
|
|
9
5
|
end
|
|
6
|
+
|
|
7
|
+
appraise 'rails-7.2' do
|
|
8
|
+
gem 'activesupport', '~> 7.2.0'
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
appraise 'rails-8.0' do
|
|
12
|
+
gem 'activesupport', '~> 8.0.0'
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
appraise 'rails-8.1' do
|
|
16
|
+
gem 'activesupport', '~> 8.1.0'
|
|
17
|
+
end
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
* TODO: Replace this bullet point with an actual description of a change.
|
|
4
4
|
|
|
5
|
+
### 2.1.0 (23 October 2025)
|
|
6
|
+
|
|
7
|
+
* Dropped Reek ([#14](https://github.com/hausgold/keyless/pull/14))
|
|
8
|
+
* Added support for Rails 8.1 ([#15](https://github.com/hausgold/keyless/pull/15))
|
|
9
|
+
* Switched from `ActiveSupport::Configurable` to a custom implementation based
|
|
10
|
+
on `ActiveSupport::OrderedOptions` ([#16](https://github.com/hausgold/keyless/pull/16))
|
|
11
|
+
|
|
12
|
+
### 2.0.0 (28 June 2025)
|
|
13
|
+
|
|
14
|
+
* Corrected some RuboCop glitches ([#12](https://github.com/hausgold/keyless/pull/12))
|
|
15
|
+
* Drop Ruby 2 and end of life Rails (<7.1) ([#13](https://github.com/hausgold/keyless/pull/13))
|
|
16
|
+
|
|
5
17
|
### 1.7.1 (21 May 2025)
|
|
6
18
|
|
|
7
19
|
* Corrected some RuboCop glitches ([#10](https://github.com/hausgold/keyless/pull/10))
|
data/Dockerfile
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
FROM hausgold/ruby:2
|
|
1
|
+
FROM hausgold/ruby:3.2
|
|
2
2
|
LABEL org.opencontainers.image.authors="containers@hausgold.de"
|
|
3
3
|
|
|
4
4
|
# Update system gem
|
|
@@ -11,7 +11,7 @@ RUN apt-get update -yqqq && \
|
|
|
11
11
|
ca-certificates \
|
|
12
12
|
bash-completion inotify-tools && \
|
|
13
13
|
echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && /usr/sbin/locale-gen && \
|
|
14
|
-
gem install bundler -v '~> 2.
|
|
14
|
+
gem install bundler -v '~> 2.6.9' --no-document --no-prerelease
|
|
15
15
|
|
|
16
16
|
# Add new web user
|
|
17
17
|
RUN mkdir /app && \
|
data/Gemfile
CHANGED
|
@@ -9,10 +9,10 @@ gemspec
|
|
|
9
9
|
|
|
10
10
|
# Development dependencies
|
|
11
11
|
gem 'appraisal', '~> 2.4'
|
|
12
|
-
gem 'bundler', '~> 2.
|
|
13
|
-
gem 'countless', '~>
|
|
12
|
+
gem 'bundler', '~> 2.6'
|
|
13
|
+
gem 'countless', '~> 2.2'
|
|
14
14
|
gem 'guard-rspec', '~> 4.7'
|
|
15
|
-
gem 'railties', '>=
|
|
15
|
+
gem 'railties', '>= 7.1'
|
|
16
16
|
gem 'rake', '~> 13.0'
|
|
17
17
|
gem 'rspec', '~> 3.12'
|
|
18
18
|
gem 'rubocop'
|
data/docker-compose.yml
CHANGED
data/gemfiles/rails_7.1.gemfile
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
source "https://rubygems.org"
|
|
4
4
|
|
|
5
5
|
gem "appraisal", "~> 2.4"
|
|
6
|
-
gem "bundler", "~> 2.
|
|
7
|
-
gem "countless", "~>
|
|
6
|
+
gem "bundler", "~> 2.6"
|
|
7
|
+
gem "countless", "~> 2.2"
|
|
8
8
|
gem "guard-rspec", "~> 4.7"
|
|
9
|
-
gem "railties", ">=
|
|
9
|
+
gem "railties", ">= 7.1"
|
|
10
10
|
gem "rake", "~> 13.0"
|
|
11
11
|
gem "rspec", "~> 3.12"
|
|
12
12
|
gem "rubocop"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# This file was generated by Appraisal
|
|
2
|
+
|
|
3
|
+
source "https://rubygems.org"
|
|
4
|
+
|
|
5
|
+
gem "appraisal", "~> 2.4"
|
|
6
|
+
gem "bundler", "~> 2.6"
|
|
7
|
+
gem "countless", "~> 2.2"
|
|
8
|
+
gem "guard-rspec", "~> 4.7"
|
|
9
|
+
gem "railties", ">= 7.1"
|
|
10
|
+
gem "rake", "~> 13.0"
|
|
11
|
+
gem "rspec", "~> 3.12"
|
|
12
|
+
gem "rubocop"
|
|
13
|
+
gem "rubocop-rails"
|
|
14
|
+
gem "rubocop-rspec"
|
|
15
|
+
gem "simplecov", ">= 0.22"
|
|
16
|
+
gem "timecop", ">= 0.9.6"
|
|
17
|
+
gem "vcr", "~> 6.0"
|
|
18
|
+
gem "webmock", "~> 3.18"
|
|
19
|
+
gem "yard", ">= 0.9.28"
|
|
20
|
+
gem "yard-activesupport-concern", ">= 0.0.1"
|
|
21
|
+
gem "activesupport", "~> 7.2.0"
|
|
22
|
+
|
|
23
|
+
gemspec path: "../"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# This file was generated by Appraisal
|
|
2
|
+
|
|
3
|
+
source "https://rubygems.org"
|
|
4
|
+
|
|
5
|
+
gem "appraisal", "~> 2.4"
|
|
6
|
+
gem "bundler", "~> 2.6"
|
|
7
|
+
gem "countless", "~> 2.2"
|
|
8
|
+
gem "guard-rspec", "~> 4.7"
|
|
9
|
+
gem "railties", ">= 7.1"
|
|
10
|
+
gem "rake", "~> 13.0"
|
|
11
|
+
gem "rspec", "~> 3.12"
|
|
12
|
+
gem "rubocop"
|
|
13
|
+
gem "rubocop-rails"
|
|
14
|
+
gem "rubocop-rspec"
|
|
15
|
+
gem "simplecov", ">= 0.22"
|
|
16
|
+
gem "timecop", ">= 0.9.6"
|
|
17
|
+
gem "vcr", "~> 6.0"
|
|
18
|
+
gem "webmock", "~> 3.18"
|
|
19
|
+
gem "yard", ">= 0.9.28"
|
|
20
|
+
gem "yard-activesupport-concern", ">= 0.0.1"
|
|
21
|
+
gem "activesupport", "~> 8.0.0"
|
|
22
|
+
|
|
23
|
+
gemspec path: "../"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# This file was generated by Appraisal
|
|
2
|
+
|
|
3
|
+
source "https://rubygems.org"
|
|
4
|
+
|
|
5
|
+
gem "appraisal", "~> 2.4"
|
|
6
|
+
gem "bundler", "~> 2.6"
|
|
7
|
+
gem "countless", "~> 2.2"
|
|
8
|
+
gem "guard-rspec", "~> 4.7"
|
|
9
|
+
gem "railties", ">= 7.1"
|
|
10
|
+
gem "rake", "~> 13.0"
|
|
11
|
+
gem "rspec", "~> 3.12"
|
|
12
|
+
gem "rubocop"
|
|
13
|
+
gem "rubocop-rails"
|
|
14
|
+
gem "rubocop-rspec"
|
|
15
|
+
gem "simplecov", ">= 0.22"
|
|
16
|
+
gem "timecop", ">= 0.9.6"
|
|
17
|
+
gem "vcr", "~> 6.0"
|
|
18
|
+
gem "webmock", "~> 3.18"
|
|
19
|
+
gem "yard", ">= 0.9.28"
|
|
20
|
+
gem "yard-activesupport-concern", ">= 0.0.1"
|
|
21
|
+
gem "activesupport", "~> 8.1.0"
|
|
22
|
+
|
|
23
|
+
gemspec path: "../"
|
data/keyless.gemspec
CHANGED
|
@@ -33,12 +33,12 @@ Gem::Specification.new do |spec|
|
|
|
33
33
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
34
34
|
spec.require_paths = ['lib']
|
|
35
35
|
|
|
36
|
-
spec.required_ruby_version = '>= 2
|
|
36
|
+
spec.required_ruby_version = '>= 3.2'
|
|
37
37
|
|
|
38
|
-
spec.add_dependency 'activesupport', '>=
|
|
38
|
+
spec.add_dependency 'activesupport', '>= 7.1'
|
|
39
39
|
spec.add_dependency 'httparty', '>= 0.21'
|
|
40
40
|
spec.add_dependency 'jwt', '~> 2.6'
|
|
41
|
-
spec.add_dependency 'mutex_m', '
|
|
41
|
+
spec.add_dependency 'mutex_m', '>= 0.3'
|
|
42
42
|
spec.add_dependency 'recursive-open-struct', '~> 2.0'
|
|
43
43
|
spec.add_dependency 'zeitwerk', '~> 2.6'
|
|
44
44
|
end
|
|
@@ -2,8 +2,46 @@
|
|
|
2
2
|
|
|
3
3
|
module Keyless
|
|
4
4
|
# The configuration for the JWT authentication concern.
|
|
5
|
-
class Configuration
|
|
6
|
-
|
|
5
|
+
class Configuration < ActiveSupport::OrderedOptions
|
|
6
|
+
# Track our configurations settings (+Symbol+ keys) and their defaults as
|
|
7
|
+
# lazy-loaded +Proc+'s values
|
|
8
|
+
class_attribute :defaults,
|
|
9
|
+
instance_reader: true,
|
|
10
|
+
instance_writer: false,
|
|
11
|
+
instance_predicate: false,
|
|
12
|
+
default: {}
|
|
13
|
+
|
|
14
|
+
# Create a new +Configuration+ instance with all settings populated with
|
|
15
|
+
# their respective defaults.
|
|
16
|
+
#
|
|
17
|
+
# @param args [Hash{Symbol => Mixed}] additional settings which
|
|
18
|
+
# overwrite the defaults
|
|
19
|
+
# @return [Configuration] the new configuration instance
|
|
20
|
+
def initialize(**args)
|
|
21
|
+
super()
|
|
22
|
+
defaults.each { |key, default| self[key] = instance_exec(&default) }
|
|
23
|
+
merge!(**args)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# A simple DSL method to define new configuration accessors/settings with
|
|
27
|
+
# their defaults. The defaults can be retrieved with
|
|
28
|
+
# +Configuration.defaults+ or +Configuration.new.defaults+.
|
|
29
|
+
#
|
|
30
|
+
# @param name [Symbol, String] the name of the configuration
|
|
31
|
+
# accessor/setting
|
|
32
|
+
# @param default [Mixed, nil] a non-lazy-loaded static value, serving as a
|
|
33
|
+
# default value for the setting
|
|
34
|
+
# @param block [Proc] when given, the default value will be lazy-loaded
|
|
35
|
+
# (result of the Proc)
|
|
36
|
+
def self.config_accessor(name, default = nil, &block)
|
|
37
|
+
# Save the given configuration accessor default value
|
|
38
|
+
defaults[name.to_sym] = block || -> { default }
|
|
39
|
+
|
|
40
|
+
# Compile reader/writer methods so we don't have to go through
|
|
41
|
+
# +ActiveSupport::OrderedOptions#method_missing+.
|
|
42
|
+
define_method(name) { self[name] }
|
|
43
|
+
define_method("#{name}=") { |value| self[name] = value }
|
|
44
|
+
end
|
|
7
45
|
|
|
8
46
|
# The authenticator function which must be defined by the user to
|
|
9
47
|
# verify the given JSON Web Token. Here comes all your logic to lookup
|
data/lib/keyless/jwt.rb
CHANGED
|
@@ -20,8 +20,6 @@ module Keyless
|
|
|
20
20
|
::JWT::InvalidPayload
|
|
21
21
|
].freeze
|
|
22
22
|
|
|
23
|
-
# :reek:Attribute because its fine to be extern-modifiable at these
|
|
24
|
-
# instances
|
|
25
23
|
attr_reader :payload, :token
|
|
26
24
|
attr_writer :verification_key, :jwt_options
|
|
27
25
|
attr_accessor :issuer, :beholder
|
|
@@ -95,9 +93,6 @@ module Keyless
|
|
|
95
93
|
# JWT string representation and check this.
|
|
96
94
|
#
|
|
97
95
|
# @return [Boolean] Whenever the token is valid or not
|
|
98
|
-
#
|
|
99
|
-
# :reek:NilCheck because we have to check the token
|
|
100
|
-
# origin and react on it
|
|
101
96
|
def valid?
|
|
102
97
|
JWT.decode(token, verification_key, true, jwt_options) && true
|
|
103
98
|
rescue *RESCUE_JWT_EXCEPTIONS
|
data/lib/keyless/version.rb
CHANGED
data/lib/keyless.rb
CHANGED
|
@@ -4,8 +4,9 @@ require 'zeitwerk'
|
|
|
4
4
|
require 'logger'
|
|
5
5
|
require 'active_support'
|
|
6
6
|
require 'active_support/concern'
|
|
7
|
-
require 'active_support/
|
|
7
|
+
require 'active_support/ordered_options'
|
|
8
8
|
require 'active_support/cache'
|
|
9
|
+
require 'active_support/core_ext/class/attribute'
|
|
9
10
|
require 'active_support/core_ext/hash'
|
|
10
11
|
require 'active_support/time'
|
|
11
12
|
require 'active_support/time_with_zone'
|
metadata
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: keyless
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 2.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Hermann Mayer
|
|
8
8
|
- Christopher Mühl
|
|
9
9
|
- Marcus Geißler
|
|
10
|
-
autorequire:
|
|
11
10
|
bindir: exe
|
|
12
11
|
cert_chain: []
|
|
13
|
-
date:
|
|
12
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
14
13
|
dependencies:
|
|
15
14
|
- !ruby/object:Gem::Dependency
|
|
16
15
|
name: activesupport
|
|
@@ -18,14 +17,14 @@ dependencies:
|
|
|
18
17
|
requirements:
|
|
19
18
|
- - ">="
|
|
20
19
|
- !ruby/object:Gem::Version
|
|
21
|
-
version: '
|
|
20
|
+
version: '7.1'
|
|
22
21
|
type: :runtime
|
|
23
22
|
prerelease: false
|
|
24
23
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
24
|
requirements:
|
|
26
25
|
- - ">="
|
|
27
26
|
- !ruby/object:Gem::Version
|
|
28
|
-
version: '
|
|
27
|
+
version: '7.1'
|
|
29
28
|
- !ruby/object:Gem::Dependency
|
|
30
29
|
name: httparty
|
|
31
30
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -58,16 +57,16 @@ dependencies:
|
|
|
58
57
|
name: mutex_m
|
|
59
58
|
requirement: !ruby/object:Gem::Requirement
|
|
60
59
|
requirements:
|
|
61
|
-
- - "
|
|
60
|
+
- - ">="
|
|
62
61
|
- !ruby/object:Gem::Version
|
|
63
|
-
version: 0.3
|
|
62
|
+
version: '0.3'
|
|
64
63
|
type: :runtime
|
|
65
64
|
prerelease: false
|
|
66
65
|
version_requirements: !ruby/object:Gem::Requirement
|
|
67
66
|
requirements:
|
|
68
|
-
- - "
|
|
67
|
+
- - ">="
|
|
69
68
|
- !ruby/object:Gem::Version
|
|
70
|
-
version: 0.3
|
|
69
|
+
version: '0.3'
|
|
71
70
|
- !ruby/object:Gem::Dependency
|
|
72
71
|
name: recursive-open-struct
|
|
73
72
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -133,13 +132,15 @@ files:
|
|
|
133
132
|
- docker-compose.yml
|
|
134
133
|
- gemfiles/rails_6.1.gemfile
|
|
135
134
|
- gemfiles/rails_7.1.gemfile
|
|
135
|
+
- gemfiles/rails_7.2.gemfile
|
|
136
|
+
- gemfiles/rails_8.0.gemfile
|
|
137
|
+
- gemfiles/rails_8.1.gemfile
|
|
136
138
|
- keyless.gemspec
|
|
137
139
|
- lib/keyless.rb
|
|
138
140
|
- lib/keyless/configuration.rb
|
|
139
141
|
- lib/keyless/jwt.rb
|
|
140
142
|
- lib/keyless/rsa_public_key.rb
|
|
141
143
|
- lib/keyless/version.rb
|
|
142
|
-
homepage:
|
|
143
144
|
licenses:
|
|
144
145
|
- MIT
|
|
145
146
|
metadata:
|
|
@@ -148,7 +149,6 @@ metadata:
|
|
|
148
149
|
changelog_uri: https://github.com/hausgold/keyless/blob/master/CHANGELOG.md
|
|
149
150
|
bug_tracker_uri: https://github.com/hausgold/keyless/issues
|
|
150
151
|
documentation_uri: https://www.rubydoc.info/gems/keyless
|
|
151
|
-
post_install_message:
|
|
152
152
|
rdoc_options: []
|
|
153
153
|
require_paths:
|
|
154
154
|
- lib
|
|
@@ -156,15 +156,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
156
156
|
requirements:
|
|
157
157
|
- - ">="
|
|
158
158
|
- !ruby/object:Gem::Version
|
|
159
|
-
version: '2
|
|
159
|
+
version: '3.2'
|
|
160
160
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
161
161
|
requirements:
|
|
162
162
|
- - ">="
|
|
163
163
|
- !ruby/object:Gem::Version
|
|
164
164
|
version: '0'
|
|
165
165
|
requirements: []
|
|
166
|
-
rubygems_version: 3.
|
|
167
|
-
signing_key:
|
|
166
|
+
rubygems_version: 3.6.9
|
|
168
167
|
specification_version: 4
|
|
169
168
|
summary: A reusable JWT authentication helper
|
|
170
169
|
test_files: []
|