omniauth_openid_connect 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d6a11bcb166756152adda96fe4326a0f2f64b6181cafeab56e2b8e0328830adc
4
- data.tar.gz: bcc46e52cc5223ec916874d9adab8692d0d8662152106988b727e926a58c0090
3
+ metadata.gz: 4c2be6aafa448af62c29c2183954e27a374018d270ac09137b04eb6b5e0aaeba
4
+ data.tar.gz: 3254e1780018a43ee507d7a43ad310dcbec9abe4c0de20ba7e93f78f22c61067
5
5
  SHA512:
6
- metadata.gz: eb43c6b0f6c9ff6efa0bf7ca424c24a73c12572401c785f92a8c35e0da459f5a022020d5947155bbe6d80c4ad7af8e12e849f786b29249c8f3bc41a6c313a049
7
- data.tar.gz: 657003a0f621975fb906be54e7c2d256f53c9b5539fed4d44f9309be0bf906eccd0ec55277a54fbee58556970a6caaffcd61bcfa1769a8baa4102d22b6fee933
6
+ metadata.gz: 00060df4350aad1ed5a402e24562a4e774ef43fcba0cf501286e8d8f25a6d3d35a15b7c3f61541adb316b213fea64bab41ab3dea2a53eebaf9a84f427ea11a5e
7
+ data.tar.gz: 9bdfc6dae8d63c6831611514e02c5108a5f3e417a2409f0e859a1c5262eb0d2939a476d4b70f8582c70bf5f6084e3f84301e9c9cbe7441691aa2b0e076dfc783
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Unreleased
2
2
 
3
+ # v0.7.1 (26.04.2023)
4
+
5
+ - Fix handling of JWKS response (https://github.com/omniauth/omniauth_openid_connect/pull/157)
6
+
3
7
  # v0.7.0 (25.04.2023)
4
8
 
5
9
  - Update openid_connect to 2.2 (https://github.com/omniauth/omniauth_openid_connect/pull/153)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module OpenIDConnect
5
- VERSION = '0.7.0'
5
+ VERSION = '0.7.1'
6
6
  end
7
7
  end
@@ -404,7 +404,7 @@ module OmniAuth
404
404
  end
405
405
 
406
406
  def parse_jwk_key(key)
407
- json = JSON.parse(key)
407
+ json = key.is_a?(String) ? JSON.parse(key) : key
408
408
  return JSON::JWK::Set.new(json['keys']) if json.key?('keys')
409
409
 
410
410
  JSON::JWK.new(json)
@@ -39,4 +39,5 @@ Gem::Specification.new do |spec|
39
39
  spec.add_development_dependency 'rubocop', '~> 1.12'
40
40
  spec.add_development_dependency 'simplecov', '~> 0.21'
41
41
  spec.add_development_dependency 'simplecov-lcov', '~> 0.8'
42
+ spec.add_development_dependency 'webmock', '~> 3.18'
42
43
  end
@@ -520,14 +520,10 @@ module OmniAuth
520
520
  strategy.options.client_options.jwks_uri = 'https://jwks.example.com'
521
521
  strategy.options.response_type = 'id_token'
522
522
 
523
- ::OpenIDConnect.stubs(:http_client)
524
- .returns(
525
- Faraday.new do |builder|
526
- builder.adapter :test do |stubs|
527
- stubs.get(strategy.options.client_options.jwks_uri) { [200, {}, jwks.to_json] }
528
- end
529
- end
530
- )
523
+ stub_request(:get, strategy.options.client_options.jwks_uri).to_return(
524
+ body: jwks.to_json,
525
+ headers: { 'Content-Type' => 'application/json' }
526
+ )
531
527
 
532
528
  strategy.unstub(:user_info)
533
529
  access_token = stub('OpenIDConnect::AccessToken')
@@ -812,19 +808,13 @@ module OmniAuth
812
808
  id_token.stubs(:verify!).with(issuer: strategy.options.issuer, client_id: @identifier, nonce: nonce).returns(true)
813
809
  ::OpenIDConnect::ResponseObject::IdToken.stubs(:decode).returns(id_token)
814
810
 
815
- ::Rack::OAuth2.stubs(:http_client)
816
- .returns(
817
- Faraday.new do |builder|
818
- builder.adapter :test do |stubs|
819
- stubs.post(
820
- "#{ opts.scheme }://#{ opts.host }:#{ opts.port }#{ opts.token_endpoint }",
821
- { scope: 'openid', grant_type: :client_credentials, client_id: @identifier, client_secret: @secret }
822
- ) do
823
- [200, {}, json_response]
824
- end
825
- end
826
- end
827
- )
811
+ url = "#{ opts.scheme }://#{ opts.host }:#{ opts.port }#{ opts.token_endpoint }"
812
+ body = { scope: 'openid', grant_type: 'client_credentials', client_id: @identifier, client_secret: @secret }
813
+
814
+ stub_request(:post, url).with(body: body).to_return(
815
+ body: json_response.to_json,
816
+ headers: { 'Content-Type' => 'application/json' }
817
+ )
828
818
 
829
819
  assert(strategy.send(:access_token))
830
820
  end
data/test/test_helper.rb CHANGED
@@ -5,6 +5,7 @@ require 'minitest/autorun'
5
5
  require 'mocha/minitest'
6
6
  require 'faker'
7
7
  require 'active_support'
8
+ require 'webmock/minitest'
8
9
 
9
10
  SimpleCov.start do
10
11
  if ENV['CI']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth_openid_connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Bohn
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-04-25 00:00:00.000000000 Z
12
+ date: 2023-04-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omniauth
@@ -185,6 +185,20 @@ dependencies:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
187
  version: '0.8'
188
+ - !ruby/object:Gem::Dependency
189
+ name: webmock
190
+ requirement: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '3.18'
195
+ type: :development
196
+ prerelease: false
197
+ version_requirements: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "~>"
200
+ - !ruby/object:Gem::Version
201
+ version: '3.18'
188
202
  description: OpenID Connect Strategy for OmniAuth.
189
203
  email:
190
204
  - jjbohn@gmail.com
@@ -219,8 +233,8 @@ licenses:
219
233
  metadata:
220
234
  bug_tracker_uri: https://github.com/m0n9oose/omniauth_openid_connect/issues
221
235
  changelog_uri: https://github.com/m0n9oose/omniauth_openid_connect/releases
222
- documentation_uri: https://github.com/m0n9oose/omniauth_openid_connect/tree/v0.7.0#readme
223
- source_code_uri: https://github.com/m0n9oose/omniauth_openid_connect/tree/v0.7.0
236
+ documentation_uri: https://github.com/m0n9oose/omniauth_openid_connect/tree/v0.7.1#readme
237
+ source_code_uri: https://github.com/m0n9oose/omniauth_openid_connect/tree/v0.7.1
224
238
  rubygems_mfa_required: 'true'
225
239
  post_install_message:
226
240
  rdoc_options: []