doorkeeper-jwt 0.4.2 → 0.4.3

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: '04826fc219f000cfbb34243981e137fdc91f54d4aaf9d2e4ee16c8db5bc80763'
4
- data.tar.gz: 2cd2fe00356eae0b93a461c0aa58b52c489ae457a93f69cd1dcd73757b51746e
3
+ metadata.gz: a2d8dbcaba58c45f27f3e2b7ca2c7800e4dc34826e90b537b67850beeca32796
4
+ data.tar.gz: 191472dd355643ddf4143cccc2e42e8962d4482d51dfc6729be3f83c5dcba915
5
5
  SHA512:
6
- metadata.gz: efa77d9a020f5a5665365acd3dccd9605a30c0bf7fd4d9b60027b0ed0827aa2a11f93dc45a7857609fe690be98fd8f8b34cabf025648dfcfd1a1cc5dd91f72ac
7
- data.tar.gz: bb8d14619a2a724047d46c25f6f3c0127bd52f94834128037059883f98842159fdac71edd88bdcc1d9f2fadf96cb7c9c896f24171d5a1eed9cd1e16474979568
6
+ metadata.gz: 013ecc163c7cbbb640165971572f37bb11a9903289a643dfbaf0cee41166cb24bb45a7903e111cc7ef21a5f7856fc8d267dbd797d5108d36fc85b5e8158fda09
7
+ data.tar.gz: 35b106bd511644278a27df3b2c7c396f95d5b8786a642d63e1600ef00929e05795f135caf8832838c5b35b66563e2b7677e3fbea9f8b8b86ec2f39350acd57be
@@ -0,0 +1,36 @@
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
+ jobs:
11
+ # Enforces the update of a changelog file on every pull request
12
+ changelog:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v7
16
+ - name: Check changed paths
17
+ id: changes
18
+ uses: dorny/paths-filter@v4
19
+ with:
20
+ filters: |
21
+ gem_changes:
22
+ - 'lib/**'
23
+ - 'app/**'
24
+ - 'config/**'
25
+ - '*.gemspec'
26
+ - 'Gemfile'
27
+ - 'Gemfile.lock'
28
+ - 'ext/**'
29
+
30
+ - name: Enforce changelog
31
+ if: |
32
+ steps.changes.outputs.gem_changes == 'true'
33
+ uses: dangoslen/changelog-enforcer@v3
34
+ with:
35
+ changeLogPath: CHANGELOG.md
36
+ skipLabels: "dependencies"
@@ -19,8 +19,6 @@ jobs:
19
19
  experimental: [false]
20
20
  os: [ ubuntu-latest ]
21
21
  ruby:
22
- - 2.6
23
- - 2.7
24
22
  - '3.0'
25
23
  - '3.1'
26
24
  steps:
data/CHANGELOG.md CHANGED
@@ -6,7 +6,12 @@ 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.2] - 2024-08-12
12
+
13
+ - Reuse Doorkeeper core config options DSL [#58](https://github.com/doorkeeper-gem/doorkeeper-jwt/pull/58)
14
+ - Include bin directory in gemspec correctly [#59](https://github.com/doorkeeper-gem/doorkeeper-jwt/pull/59)
10
15
 
11
16
  ## [0.4.2] - 2024-08-12
12
17
 
data/Gemfile CHANGED
@@ -5,6 +5,6 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in doorkeeper-jwt.gemspec
6
6
  gemspec
7
7
 
8
- gem "coveralls", require: false
8
+ gem "coveralls_reborn", require: false
9
9
  gem "rubocop", "~> 1.8", require: false
10
10
  gem "rubocop-rspec", "~> 3.0", require: false
data/README.md CHANGED
@@ -46,9 +46,9 @@ Doorkeeper::JWT.configure do
46
46
  token_payload do |opts|
47
47
  user = User.find(opts[:resource_owner_id])
48
48
 
49
- {
49
+ payload = {
50
50
  iss: 'My App',
51
- iat: Time.current.utc.to_i,
51
+ iat: opts[:created_at].utc.to_i,
52
52
  aud: opts[:application][:uid],
53
53
 
54
54
  # @see JWT reserved claims - https://tools.ietf.org/html/draft-jones-json-web-token-07#page-7
@@ -60,6 +60,9 @@ Doorkeeper::JWT.configure do
60
60
  email: user.email
61
61
  }
62
62
  }
63
+
64
+ payload[:exp] = (opts[:created_at] + opts[:expires_in]).utc.to_i if opts[:expires_in]
65
+ payload
63
66
  end
64
67
 
65
68
  # Optionally set additional headers for the JWT. See
@@ -17,14 +17,23 @@ 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/main/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
+
25
33
  spec.add_dependency "jwt", ">= 2.1"
26
34
 
27
- spec.add_development_dependency "bundler", ">= 1.16", "< 3"
35
+ spec.add_development_dependency "bundler", ">= 1.16"
36
+ spec.add_development_dependency "doorkeeper"
28
37
  spec.add_development_dependency "pry", "~> 0"
29
38
  spec.add_development_dependency "rake", "~> 13.0"
30
39
  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
@@ -50,70 +52,8 @@ module Doorkeeper
50
52
  end
51
53
  end
52
54
 
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
- end
115
-
116
- extend Option
55
+ mattr_reader(:builder_class) { Config::Builder }
56
+ extend ::Doorkeeper::Config::Option
117
57
 
118
58
  option(
119
59
  :token_payload,
@@ -10,7 +10,7 @@ module Doorkeeper
10
10
  # Semantic versioning
11
11
  MAJOR = 0
12
12
  MINOR = 4
13
- TINY = 2
13
+ TINY = 3
14
14
  PRE = nil
15
15
 
16
16
  # Full version number
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.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Warren
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2024-08-12 00:00:00.000000000 Z
12
+ date: 2026-07-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jwt
@@ -32,9 +32,6 @@ dependencies:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: '1.16'
35
- - - "<"
36
- - !ruby/object:Gem::Version
37
- version: '3'
38
35
  type: :development
39
36
  prerelease: false
40
37
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,9 +39,20 @@ dependencies:
42
39
  - - ">="
43
40
  - !ruby/object:Gem::Version
44
41
  version: '1.16'
45
- - - "<"
42
+ - !ruby/object:Gem::Dependency
43
+ name: doorkeeper
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
46
47
  - !ruby/object:Gem::Version
47
- version: '3'
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
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/main/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
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- set -euo pipefail
4
- IFS=$'\n\t'
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here.