doorkeeper-jwt 0.4.2 → 0.4.4
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/changelog.yml +40 -0
- data/.github/workflows/ci.yml +12 -3
- data/CHANGELOG.md +11 -1
- data/Gemfile +7 -1
- data/README.md +20 -7
- data/doorkeeper-jwt.gemspec +13 -2
- data/lib/doorkeeper/jwt/config.rb +4 -80
- data/lib/doorkeeper/jwt/version.rb +1 -1
- metadata +23 -11
- data/bin/console +0 -17
- data/bin/setup +0 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3ce5cf8224951ed71ef293afd6c863ad606300ec2082f4f9c821228890ae384c
|
|
4
|
+
data.tar.gz: 92f97889cb72c6a6d5fc17cabeeb54fa934f30c2f23296ca24f1e5fe4490a574
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 27d14827f9e9a5c9b5dcacf85f7a30c3d4714c95017dade01e85b27c8232883cf2f9a79dd9975b94db2ba904d3097307f5b05167eb94d7961cb61dc0ed93ea6e
|
|
7
|
+
data.tar.gz: 6847396d8b1a00f7c5abd9f4955e978bc148d559dc7de15a438f1df25790237b5e200a67bee6429eb5f25a1b986379f27557d692f34161797ec7515d08c73abc
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: "Changelog verifier"
|
|
2
|
+
on:
|
|
3
|
+
pull_request:
|
|
4
|
+
# The specific activity types are listed here to include "labeled" and "unlabeled"
|
|
5
|
+
# (which are not included by default for the "pull_request" trigger).
|
|
6
|
+
# This is needed to allow skipping enforcement of the changelog in PRs with specific labels,
|
|
7
|
+
# as defined in the (optional) "skipLabels" property.
|
|
8
|
+
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
pull-requests: read
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
# Enforces the update of a changelog file on every pull request
|
|
16
|
+
changelog:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v7
|
|
20
|
+
- name: Check changed paths
|
|
21
|
+
id: changes
|
|
22
|
+
uses: dorny/paths-filter@v4
|
|
23
|
+
with:
|
|
24
|
+
filters: |
|
|
25
|
+
gem_changes:
|
|
26
|
+
- 'lib/**'
|
|
27
|
+
- 'app/**'
|
|
28
|
+
- 'config/**'
|
|
29
|
+
- '*.gemspec'
|
|
30
|
+
- 'Gemfile'
|
|
31
|
+
- 'Gemfile.lock'
|
|
32
|
+
- 'ext/**'
|
|
33
|
+
|
|
34
|
+
- name: Enforce changelog
|
|
35
|
+
if: |
|
|
36
|
+
steps.changes.outputs.gem_changes == 'true'
|
|
37
|
+
uses: dangoslen/changelog-enforcer@v3
|
|
38
|
+
with:
|
|
39
|
+
changeLogPath: CHANGELOG.md
|
|
40
|
+
skipLabels: "dependencies"
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -2,12 +2,16 @@ name: CI
|
|
|
2
2
|
|
|
3
3
|
on: [push, pull_request]
|
|
4
4
|
|
|
5
|
+
permissions:
|
|
6
|
+
contents: read
|
|
7
|
+
|
|
5
8
|
jobs:
|
|
6
9
|
build:
|
|
7
10
|
name: >-
|
|
8
|
-
Ruby ${{ matrix.ruby }}
|
|
11
|
+
Ruby ${{ matrix.ruby }} / Doorkeeper ${{ matrix.doorkeeper }}
|
|
9
12
|
env:
|
|
10
13
|
CI: true
|
|
14
|
+
DOORKEEPER_VERSION: ${{ matrix.doorkeeper }}
|
|
11
15
|
runs-on: ${{ matrix.os }}
|
|
12
16
|
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' || matrix.experimental }}
|
|
13
17
|
if: |
|
|
@@ -19,10 +23,13 @@ jobs:
|
|
|
19
23
|
experimental: [false]
|
|
20
24
|
os: [ ubuntu-latest ]
|
|
21
25
|
ruby:
|
|
22
|
-
- 2.6
|
|
23
|
-
- 2.7
|
|
24
26
|
- '3.0'
|
|
25
27
|
- '3.1'
|
|
28
|
+
# The minimum declared in the gemspec and the latest release. 5.4 is the oldest
|
|
29
|
+
# version whose options DSL resolves against our own config builder.
|
|
30
|
+
doorkeeper:
|
|
31
|
+
- '5.4.0'
|
|
32
|
+
- 'latest'
|
|
26
33
|
steps:
|
|
27
34
|
- name: Repo checkout
|
|
28
35
|
uses: actions/checkout@v2
|
|
@@ -32,6 +39,8 @@ jobs:
|
|
|
32
39
|
with:
|
|
33
40
|
ruby-version: ${{ matrix.ruby }}
|
|
34
41
|
bundler-cache: true
|
|
42
|
+
# Each Doorkeeper pin resolves to a different bundle.
|
|
43
|
+
cache-version: doorkeeper-${{ matrix.doorkeeper }}
|
|
35
44
|
|
|
36
45
|
- name: Run tests
|
|
37
46
|
timeout-minutes: 10
|
data/CHANGELOG.md
CHANGED
|
@@ -6,7 +6,17 @@ project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
6
6
|
|
|
7
7
|
## master
|
|
8
8
|
|
|
9
|
-
Add here
|
|
9
|
+
- Add your entry here
|
|
10
|
+
|
|
11
|
+
# [0.4.4] - 2026-08-21
|
|
12
|
+
|
|
13
|
+
- Fix `[DOORKEEPER] Option ... already defined and will be overridden` warnings on gem load [#61](https://github.com/doorkeeper-gem/doorkeeper-jwt/pull/61)
|
|
14
|
+
- Declare `doorkeeper >= 5.4` as a runtime dependency and verify the supported range on CI [#64](https://github.com/doorkeeper-gem/doorkeeper-jwt/pull/64)
|
|
15
|
+
|
|
16
|
+
## [0.4.3] - 2026-07-20
|
|
17
|
+
|
|
18
|
+
- Reuse Doorkeeper core config options DSL [#58](https://github.com/doorkeeper-gem/doorkeeper-jwt/pull/58)
|
|
19
|
+
- Include bin directory in gemspec correctly [#59](https://github.com/doorkeeper-gem/doorkeeper-jwt/pull/59)
|
|
10
20
|
|
|
11
21
|
## [0.4.2] - 2024-08-12
|
|
12
22
|
|
data/Gemfile
CHANGED
|
@@ -5,6 +5,12 @@ source "https://rubygems.org"
|
|
|
5
5
|
# Specify your gem's dependencies in doorkeeper-jwt.gemspec
|
|
6
6
|
gemspec
|
|
7
7
|
|
|
8
|
-
gem
|
|
8
|
+
# Pin Doorkeeper to check a specific version of it against this gem. Unset means
|
|
9
|
+
# "the newest version the gemspec allows"; CI sets it to both ends of the
|
|
10
|
+
# supported range. See .github/workflows/ci.yml.
|
|
11
|
+
doorkeeper_version = ENV.fetch("DOORKEEPER_VERSION", "latest")
|
|
12
|
+
gem "doorkeeper", doorkeeper_version unless doorkeeper_version == "latest"
|
|
13
|
+
|
|
14
|
+
gem "coveralls_reborn", require: false
|
|
9
15
|
gem "rubocop", "~> 1.8", require: false
|
|
10
16
|
gem "rubocop-rspec", "~> 3.0", require: false
|
data/README.md
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
[](https://rubygems.org/gems/doorkeeper-jwt)
|
|
2
2
|
[](https://coveralls.io/github/doorkeeper-gem/doorkeeper-jwt?branch=master)
|
|
3
|
-
[](https://github.com/doorkeeper-gem/doorkeeper-jwt/actions/workflows/ci.yml)
|
|
4
4
|
[](https://codeclimate.com/github/doorkeeper-gem/doorkeeper-jwt/maintainability)
|
|
5
5
|
|
|
6
6
|
# Doorkeeper::JWT
|
|
7
7
|
|
|
8
|
-
Doorkeeper JWT adds JWT token support to the Doorkeeper OAuth library.
|
|
9
|
-
Untested with later versions of Doorkeeper.
|
|
8
|
+
Doorkeeper JWT adds JWT token support to the Doorkeeper OAuth library.
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
## Compatibility
|
|
11
|
+
|
|
12
|
+
Requires Doorkeeper 5.4 or newer. Doorkeeper 5.0 and earlier cannot load this gem at all, because they ship no
|
|
13
|
+
`doorkeeper/config/option`. Doorkeeper 5.1 - 5.3 load it but misconfigure it: their options DSL defines the
|
|
14
|
+
methods on Doorkeeper's own config builder instead of this gem's.
|
|
15
|
+
|
|
16
|
+
The minimum supported version and the latest release run on every CI build - see the `doorkeeper` axis of the matrix
|
|
17
|
+
in [`.github/workflows/ci.yml`](.github/workflows/ci.yml). To check a version that is not covered there, point the
|
|
18
|
+
test suite at it:
|
|
19
|
+
|
|
20
|
+
```console
|
|
21
|
+
$ DOORKEEPER_VERSION=5.6.0 bundle install
|
|
22
|
+
$ DOORKEEPER_VERSION=5.6.0 bundle exec rake test
|
|
13
23
|
```
|
|
14
24
|
|
|
15
25
|
## Installation
|
|
@@ -46,9 +56,9 @@ Doorkeeper::JWT.configure do
|
|
|
46
56
|
token_payload do |opts|
|
|
47
57
|
user = User.find(opts[:resource_owner_id])
|
|
48
58
|
|
|
49
|
-
{
|
|
59
|
+
payload = {
|
|
50
60
|
iss: 'My App',
|
|
51
|
-
iat:
|
|
61
|
+
iat: opts[:created_at].utc.to_i,
|
|
52
62
|
aud: opts[:application][:uid],
|
|
53
63
|
|
|
54
64
|
# @see JWT reserved claims - https://tools.ietf.org/html/draft-jones-json-web-token-07#page-7
|
|
@@ -60,6 +70,9 @@ Doorkeeper::JWT.configure do
|
|
|
60
70
|
email: user.email
|
|
61
71
|
}
|
|
62
72
|
}
|
|
73
|
+
|
|
74
|
+
payload[:exp] = (opts[:created_at] + opts[:expires_in]).utc.to_i if opts[:expires_in]
|
|
75
|
+
payload
|
|
63
76
|
end
|
|
64
77
|
|
|
65
78
|
# Optionally set additional headers for the JWT. See
|
data/doorkeeper-jwt.gemspec
CHANGED
|
@@ -17,14 +17,25 @@ Gem::Specification.new do |spec|
|
|
|
17
17
|
spec.license = "MIT"
|
|
18
18
|
|
|
19
19
|
spec.bindir = "exe"
|
|
20
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
20
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|bin)/}) }
|
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
22
22
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
23
23
|
spec.require_paths = ["lib"]
|
|
24
24
|
|
|
25
|
+
spec.metadata = {
|
|
26
|
+
"homepage_uri" => "https://github.com/doorkeeper-gem/doorkeeper-jwt",
|
|
27
|
+
"changelog_uri" => "https://github.com/doorkeeper-gem/doorkeeper-jwt/blob/master/CHANGELOG.md",
|
|
28
|
+
"source_code_uri" => "https://github.com/doorkeeper-gem/doorkeeper-jwt",
|
|
29
|
+
"bug_tracker_uri" => "https://github.com/doorkeeper-gem/doorkeeper-jwt/issues",
|
|
30
|
+
"funding_uri" => "https://opencollective.com/doorkeeper-gem",
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
# Loaded at require time by lib/doorkeeper/jwt/config.rb. The options DSL it
|
|
34
|
+
# relies on only resolves against our own builder since Doorkeeper 5.4.
|
|
35
|
+
spec.add_dependency "doorkeeper", ">= 5.4"
|
|
25
36
|
spec.add_dependency "jwt", ">= 2.1"
|
|
26
37
|
|
|
27
|
-
spec.add_development_dependency "bundler", ">= 1.16"
|
|
38
|
+
spec.add_development_dependency "bundler", ">= 1.16"
|
|
28
39
|
spec.add_development_dependency "pry", "~> 0"
|
|
29
40
|
spec.add_development_dependency "rake", "~> 13.0"
|
|
30
41
|
spec.add_development_dependency "rspec", "~> 3.8"
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "doorkeeper/config/option"
|
|
4
|
+
|
|
3
5
|
module Doorkeeper
|
|
4
6
|
module JWT
|
|
5
7
|
class MissingConfiguration < StandardError
|
|
@@ -27,93 +29,15 @@ module Doorkeeper
|
|
|
27
29
|
@config
|
|
28
30
|
end
|
|
29
31
|
|
|
30
|
-
def use_application_secret(value)
|
|
31
|
-
@config.instance_variable_set("@use_application_secret", value)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def secret_key(value)
|
|
35
|
-
@config.instance_variable_set("@secret_key", value)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def secret_key_path(value)
|
|
39
|
-
@config.instance_variable_set("@secret_key_path", value)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
32
|
# For backward compatibility. This library does not support encryption.
|
|
43
33
|
def encryption_method(value)
|
|
44
34
|
@config.instance_variable_set("@signing_method", value)
|
|
45
35
|
Kernel.warn("[DOORKEEPER-JWT]: Please use signing_method instead, this option is deprecated and will be removed soon")
|
|
46
36
|
end
|
|
47
|
-
|
|
48
|
-
def signing_method(value)
|
|
49
|
-
@config.instance_variable_set("@signing_method", value)
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
module Option
|
|
54
|
-
# Defines configuration options.
|
|
55
|
-
#
|
|
56
|
-
# When you call option, it defines two methods. One method will take
|
|
57
|
-
# place in the +Config+ class and the other method will take place in
|
|
58
|
-
# the +Builder+ class.
|
|
59
|
-
#
|
|
60
|
-
# The +name+ parameter will set both builder method and config
|
|
61
|
-
# attribute. If the +:as+ option is defined, the builder method will be
|
|
62
|
-
# the specified option while the config attribute will be the +name+
|
|
63
|
-
# parameter.
|
|
64
|
-
#
|
|
65
|
-
# If you want to introduce another level of config DSL you can define
|
|
66
|
-
# +builder_class+ parameter. Builder should take a block as the
|
|
67
|
-
# initializer parameter and respond to function +build+ that returns the
|
|
68
|
-
# value of the config attribute.
|
|
69
|
-
#
|
|
70
|
-
# ==== Options
|
|
71
|
-
#
|
|
72
|
-
# * [+:as+] Set the builder method that goes inside +configure+ block.
|
|
73
|
-
# * [+:default+] The default value in case no option was set.
|
|
74
|
-
#
|
|
75
|
-
# ==== Examples
|
|
76
|
-
#
|
|
77
|
-
# option :name
|
|
78
|
-
# option :name, as: :set_name
|
|
79
|
-
# option :name, default: 'My Name'
|
|
80
|
-
# option :scopes, builder_class: ScopesBuilder
|
|
81
|
-
def option(name, options = {})
|
|
82
|
-
attribute = options[:as] || name
|
|
83
|
-
attribute_builder = options[:builder_class]
|
|
84
|
-
attribute_symbol = :"@#{attribute}"
|
|
85
|
-
|
|
86
|
-
Builder.instance_eval do
|
|
87
|
-
define_method name do |*args, &block|
|
|
88
|
-
# TODO: is builder_class option being used?
|
|
89
|
-
value =
|
|
90
|
-
if attribute_builder
|
|
91
|
-
attribute_builder.new(&block).build
|
|
92
|
-
else
|
|
93
|
-
block || args.first
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
@config.instance_variable_set(attribute_symbol, value)
|
|
97
|
-
end
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
define_method attribute do |*|
|
|
101
|
-
if instance_variable_defined?(attribute_symbol)
|
|
102
|
-
instance_variable_get(attribute_symbol)
|
|
103
|
-
else
|
|
104
|
-
options[:default]
|
|
105
|
-
end
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
public attribute
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
def extended(base)
|
|
112
|
-
base.send(:private, :option)
|
|
113
|
-
end
|
|
114
37
|
end
|
|
115
38
|
|
|
116
|
-
|
|
39
|
+
mattr_reader(:builder_class) { Config::Builder }
|
|
40
|
+
extend ::Doorkeeper::Config::Option
|
|
117
41
|
|
|
118
42
|
option(
|
|
119
43
|
:token_payload,
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: doorkeeper-jwt
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Warren
|
|
@@ -9,8 +9,22 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: exe
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2026-08-21 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
|
+
- !ruby/object:Gem::Dependency
|
|
15
|
+
name: doorkeeper
|
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
|
17
|
+
requirements:
|
|
18
|
+
- - ">="
|
|
19
|
+
- !ruby/object:Gem::Version
|
|
20
|
+
version: '5.4'
|
|
21
|
+
type: :runtime
|
|
22
|
+
prerelease: false
|
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
24
|
+
requirements:
|
|
25
|
+
- - ">="
|
|
26
|
+
- !ruby/object:Gem::Version
|
|
27
|
+
version: '5.4'
|
|
14
28
|
- !ruby/object:Gem::Dependency
|
|
15
29
|
name: jwt
|
|
16
30
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -32,9 +46,6 @@ dependencies:
|
|
|
32
46
|
- - ">="
|
|
33
47
|
- !ruby/object:Gem::Version
|
|
34
48
|
version: '1.16'
|
|
35
|
-
- - "<"
|
|
36
|
-
- !ruby/object:Gem::Version
|
|
37
|
-
version: '3'
|
|
38
49
|
type: :development
|
|
39
50
|
prerelease: false
|
|
40
51
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -42,9 +53,6 @@ dependencies:
|
|
|
42
53
|
- - ">="
|
|
43
54
|
- !ruby/object:Gem::Version
|
|
44
55
|
version: '1.16'
|
|
45
|
-
- - "<"
|
|
46
|
-
- !ruby/object:Gem::Version
|
|
47
|
-
version: '3'
|
|
48
56
|
- !ruby/object:Gem::Dependency
|
|
49
57
|
name: pry
|
|
50
58
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -95,6 +103,7 @@ extensions: []
|
|
|
95
103
|
extra_rdoc_files: []
|
|
96
104
|
files:
|
|
97
105
|
- ".github/dependabot.yml"
|
|
106
|
+
- ".github/workflows/changelog.yml"
|
|
98
107
|
- ".github/workflows/ci.yml"
|
|
99
108
|
- ".gitignore"
|
|
100
109
|
- ".hound.yml"
|
|
@@ -105,8 +114,6 @@ files:
|
|
|
105
114
|
- LICENSE.txt
|
|
106
115
|
- README.md
|
|
107
116
|
- Rakefile
|
|
108
|
-
- bin/console
|
|
109
|
-
- bin/setup
|
|
110
117
|
- doorkeeper-jwt.gemspec
|
|
111
118
|
- lib/doorkeeper/jwt.rb
|
|
112
119
|
- lib/doorkeeper/jwt/config.rb
|
|
@@ -114,7 +121,12 @@ files:
|
|
|
114
121
|
homepage: https://github.com/chriswarren/doorkeeper-jwt
|
|
115
122
|
licenses:
|
|
116
123
|
- MIT
|
|
117
|
-
metadata:
|
|
124
|
+
metadata:
|
|
125
|
+
homepage_uri: https://github.com/doorkeeper-gem/doorkeeper-jwt
|
|
126
|
+
changelog_uri: https://github.com/doorkeeper-gem/doorkeeper-jwt/blob/master/CHANGELOG.md
|
|
127
|
+
source_code_uri: https://github.com/doorkeeper-gem/doorkeeper-jwt
|
|
128
|
+
bug_tracker_uri: https://github.com/doorkeeper-gem/doorkeeper-jwt/issues
|
|
129
|
+
funding_uri: https://opencollective.com/doorkeeper-gem
|
|
118
130
|
post_install_message:
|
|
119
131
|
rdoc_options: []
|
|
120
132
|
require_paths:
|
data/bin/console
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# frozen_string_literal: true
|
|
3
|
-
|
|
4
|
-
require "bundler/setup"
|
|
5
|
-
require "doorkeeper-jwt"
|
|
6
|
-
|
|
7
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
|
8
|
-
# with your gem easier. You can also use a different console, if you like.
|
|
9
|
-
|
|
10
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
11
|
-
# require 'pry'
|
|
12
|
-
#
|
|
13
|
-
# Pry.start
|
|
14
|
-
|
|
15
|
-
require "irb"
|
|
16
|
-
|
|
17
|
-
IRB.start
|