json-jwt 1.15.2 → 1.16.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of json-jwt might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 461b1855ba57fa3fefc481af74b1000d3d4bd23f7abaa5dbb1e9830b044e2ac5
4
- data.tar.gz: cb1e27cb8195b468265ca461b87ecd28404ed2d0e6e91d7cb5873a3aa22e4272
3
+ metadata.gz: 2097e754332fbc0d82af414efcce07c63da2bbd7cc3f2976a8df1c770dffb9b8
4
+ data.tar.gz: a7a9950a0501b58b249bb39d2c369ea315cd40d4f9297b6e19f66d82763ec2ce
5
5
  SHA512:
6
- metadata.gz: ad19ed8648a4106d1c87990e951235a223db45abbc1af6a2526f6fddcd880ec22b960d407d809c07ff47a698da96f8b9a3bceffcc308ebcaee053a3cb5ae4dbb
7
- data.tar.gz: ad654c4196e72116d7bcafd39c30c9293e16fc287fc108b2529081e1c05b15b1c28bc92868c927e016f0a36fc893110d4ab625a1a11cfc861a9945cdf3d30a47
6
+ metadata.gz: a0092471b468de8a24909cafa45a86c934ee67c0eedf40ae962427f72007d038e1a2dde5a1d32c39465e9594b0c06e634bed8f8bade183a7919f5a12222ee916
7
+ data.tar.gz: 5b5ff6abbd60b781b7d9d291153a80f83a108fe37d9358dfac8463ff810b0016c5224f849baac3a4720d0bdc8b6d8bbdc0131780b8fba29c6e4d49c72fa2c034
@@ -1,18 +1,20 @@
1
- name: Test Ruby
1
+ name: Spec
2
2
 
3
3
  on:
4
4
  push:
5
+ branches:
6
+ - master
5
7
  pull_request:
6
8
 
7
9
  permissions:
8
10
  contents: read
9
11
 
10
12
  jobs:
11
- test:
13
+ spec:
12
14
  strategy:
13
15
  matrix:
14
- os: ['ubuntu-18.04', 'ubuntu-20.04']
15
- ruby-version: ['2.5', '2.6', '2.7', '3.0', '3.1']
16
+ os: ['ubuntu-20.04']
17
+ ruby-version: ['2.6', '2.7', '3.0', '3.1']
16
18
  # ubuntu 22.04 only supports ssl 3 and thus only ruby 3.1
17
19
  include:
18
20
  - os: 'ubuntu-22.04'
@@ -26,5 +28,5 @@ jobs:
26
28
  with:
27
29
  ruby-version: ${{ matrix.ruby-version }}
28
30
  bundler-cache: true
29
- - name: Run tests
30
- run: bundle exec rake
31
+ - name: Run Specs
32
+ run: bundle exec rake spec
data/README.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  JSON Web Token and its family (JSON Web Signature, JSON Web Encryption and JSON Web Key) in Ruby
4
4
 
5
- [![Build Status](https://secure.travis-ci.org/nov/json-jwt.png)](http://travis-ci.org/nov/json-jwt)
6
-
7
5
  ## Installation
8
6
 
9
7
  ```
@@ -49,6 +47,17 @@ input = "jwt_header.jwt_claims.jwt_signature"
49
47
  JSON::JWT.decode(input, public_key)
50
48
  ```
51
49
 
50
+ If you need to get a JWK from `jwks_uri` of OpenID Connect IdP, you can use `JSON::JWK::Set::Fetcher` to fetch (& optionally cache) it.
51
+
52
+ ```ruby
53
+ # JWK Set Fetching & Caching
54
+ # NOTE: Optionally by setting cache instance, JWKs are cached by kid.
55
+ JSON::JWK::Set::Fetcher.cache = Rails.cache
56
+
57
+ JSON::JWK::Set::Fetcher.fetch(jwks_uri, kid: kid)
58
+ # => returns JSON::JWK instance or raise JSON::JWK::Set::KidNotFound
59
+ ```
60
+
52
61
  For more details, read [Documentation Wiki](https://github.com/nov/json-jwt/wiki).
53
62
 
54
63
  ## Note on Patches/Pull Requests
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.15.2
1
+ 1.16.0
data/json-jwt.gemspec CHANGED
@@ -16,7 +16,8 @@ Gem::Specification.new do |gem|
16
16
  gem.add_runtime_dependency 'activesupport', '>= 4.2'
17
17
  gem.add_runtime_dependency 'bindata'
18
18
  gem.add_runtime_dependency 'aes_key_wrap'
19
- gem.add_runtime_dependency 'httpclient'
19
+ gem.add_runtime_dependency 'faraday', '~> 2.0'
20
+ gem.add_runtime_dependency 'faraday-follow_redirects'
20
21
  gem.add_development_dependency 'rake'
21
22
  gem.add_development_dependency 'simplecov'
22
23
  gem.add_development_dependency 'webmock'
@@ -36,17 +36,13 @@ module JSON
36
36
  self.debugging = false
37
37
 
38
38
  def self.http_client
39
- _http_client_ = HTTPClient.new(
40
- agent_name: "JSON::JWK::Set::Fetcher (#{JSON::JWT::VERSION})"
41
- )
42
-
43
- # NOTE: httpclient gem seems stopped maintaining root certtificate set, use OS default.
44
- _http_client_.ssl_config.clear_cert_store
45
- _http_client_.ssl_config.cert_store.set_default_paths
46
-
47
- _http_client_.request_filter << Debugger::RequestFilter.new if debugging?
48
- http_config.try(:call, _http_client_)
49
- _http_client_
39
+ Faraday.new(headers: {user_agent: "JSON::JWK::Set::Fetcher #{VERSION}"}) do |faraday|
40
+ faraday.response :raise_error
41
+ faraday.response :follow_redirects
42
+ faraday.response :logger, JSON::JWK::Set::Fetcher.logger if debugging?
43
+ faraday.adapter Faraday.default_adapter
44
+ http_config.try(:call, faraday)
45
+ end
50
46
  end
51
47
  def self.http_config(&block)
52
48
  @@http_config ||= block
@@ -70,7 +66,7 @@ module JSON
70
66
  jwks = Set.new(
71
67
  JSON.parse(
72
68
  cache.fetch(cache_key, options) do
73
- http_client.get_content(jwks_uri)
69
+ http_client.get(jwks_uri).body
74
70
  end
75
71
  )
76
72
  )
data/lib/json/jwt.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'openssl'
2
2
  require 'base64'
3
- require 'httpclient'
3
+ require 'faraday'
4
+ require 'faraday/follow_redirects'
4
5
  require 'active_support'
5
6
  require 'active_support/core_ext'
6
7
  require 'json/jose'
@@ -137,5 +138,4 @@ require 'json/jwe'
137
138
  require 'json/jwk'
138
139
  require 'json/jwk/jwkizable'
139
140
  require 'json/jwk/set'
140
- require 'json/jwk/set/fetcher'
141
- require 'json/jwk/set/fetcher/debugger/request_filter'
141
+ require 'json/jwk/set/fetcher'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json-jwt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.15.2
4
+ version: 1.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - nov matake
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-14 00:00:00.000000000 Z
11
+ date: 2022-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -53,7 +53,21 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: httpclient
56
+ name: faraday
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: faraday-follow_redirects
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - ">="
@@ -140,23 +154,20 @@ description: JSON Web Token and its family (JSON Web Signature, JSON Web Encrypt
140
154
  and JSON Web Key) in Ruby
141
155
  email:
142
156
  - nov@matake.jp
143
- executables:
144
- - console
157
+ executables: []
145
158
  extensions: []
146
159
  extra_rdoc_files: []
147
160
  files:
148
161
  - ".github/FUNDING.yml"
149
- - ".github/workflows/test_ruby.yml"
162
+ - ".github/workflows/spec.yml"
150
163
  - ".gitignore"
151
164
  - ".gitmodules"
152
165
  - ".rspec"
153
- - ".travis.yml"
154
166
  - Gemfile
155
167
  - LICENSE
156
168
  - README.md
157
169
  - Rakefile
158
170
  - VERSION
159
- - bin/console
160
171
  - json-jwt.gemspec
161
172
  - lib/json/jose.rb
162
173
  - lib/json/jwe.rb
@@ -164,14 +175,13 @@ files:
164
175
  - lib/json/jwk/jwkizable.rb
165
176
  - lib/json/jwk/set.rb
166
177
  - lib/json/jwk/set/fetcher.rb
167
- - lib/json/jwk/set/fetcher/debugger/request_filter.rb
168
178
  - lib/json/jws.rb
169
179
  - lib/json/jwt.rb
170
180
  homepage: https://github.com/nov/json-jwt
171
181
  licenses:
172
182
  - MIT
173
183
  metadata: {}
174
- post_install_message:
184
+ post_install_message:
175
185
  rdoc_options: []
176
186
  require_paths:
177
187
  - lib
@@ -186,8 +196,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
196
  - !ruby/object:Gem::Version
187
197
  version: '0'
188
198
  requirements: []
189
- rubygems_version: 3.3.7
190
- signing_key:
199
+ rubygems_version: 3.1.6
200
+ signing_key:
191
201
  specification_version: 4
192
202
  summary: JSON Web Token and its family (JSON Web Signature, JSON Web Encryption and
193
203
  JSON Web Key) in Ruby
data/.travis.yml DELETED
@@ -1,11 +0,0 @@
1
- before_install:
2
- - gem install bundler
3
- - git submodule update --init --recursive
4
-
5
- rvm:
6
- - 2.7.6
7
- - 3.0.4
8
- - 3.1.2
9
-
10
- jdk:
11
- - openjdk11
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "json/jwt"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
@@ -1,34 +0,0 @@
1
- module JSON
2
- class JWK
3
- class Set
4
- module Fetcher
5
- module Debugger
6
- class RequestFilter
7
- # Callback called in HTTPClient (before sending a request)
8
- # request:: HTTP::Message
9
- def filter_request(request)
10
- started = "======= [JSON::JWK::Set::Fetcher] HTTP REQUEST STARTED ======="
11
- log started, request.dump
12
- end
13
-
14
- # Callback called in HTTPClient (after received a response)
15
- # request:: HTTP::Message
16
- # response:: HTTP::Message
17
- def filter_response(request, response)
18
- finished = "======= [JSON::JWK::Set::Fetcher] HTTP REQUEST FINISHED ======="
19
- log '-' * 50, response.dump, finished
20
- end
21
-
22
- private
23
-
24
- def log(*outputs)
25
- outputs.each do |output|
26
- JSON::JWK::Set::Fetcher.logger.info output
27
- end
28
- end
29
- end
30
- end
31
- end
32
- end
33
- end
34
- end