openid_connect 2.3.1 → 2.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1846c96c032313eff89f8fcb9a753643c373ff00d6de12254b7f679d7802b4ab
4
- data.tar.gz: 58c0780a7873c51f18fad3d847272fa49b59d88992a0833cf3f3396edc6d9303
3
+ metadata.gz: deb0c8a4b1878a09d9a42f7051201bccfcf4bd4b17f7bdaae0835d30bb4de502
4
+ data.tar.gz: d7f73dd36717f85c2f084102aa5b89688ed4a76e4742816fbe158ccd0861cc69
5
5
  SHA512:
6
- metadata.gz: 4d605a9a6301af104cf1173b8626e5c1403a930b16cd49c738e2b7e08a8b8f23cfac4d53cfc649cb5484c73e22e1dc3c8b72941abda64942c405931cc17392e8
7
- data.tar.gz: 70c4fcd75e6f7913475b5d8c070df75d37c242e3888010b5ec30eba95784258577b6de1575f52e494d44bf0c475a6d62b76e180c67c7e573f198ff910cf35d7c
6
+ metadata.gz: '0801e7a784512bfa3d68cd2c0acd3532afbf1549905510541c0e4575abb1fff11f74bda75d10e770054617b1086510fcd0cbb344d9b9085c65d0292992770cb9'
7
+ data.tar.gz: c5406c9166d87823ca1a81d13101d6969db7af82d6f274cd9fcaa6152ac8c904003f3f088dab5ce20332f4429c024f3859c1758427cdeb0b24b01102251fedd8
@@ -11,21 +11,21 @@ permissions:
11
11
 
12
12
  jobs:
13
13
  spec:
14
+ runs-on: ubuntu-latest
15
+ name: Ruby ${{ matrix.ruby }}
14
16
  strategy:
15
17
  matrix:
16
- os: ['ubuntu-20.04', 'ubuntu-22.04']
17
- ruby-version: ['3.1', '3.2', '3.3']
18
- include:
19
- - os: 'ubuntu-20.04'
20
- ruby-version: '3.0'
21
- runs-on: ${{ matrix.os }}
22
-
18
+ ruby:
19
+ - '3.2'
20
+ - '3.3'
21
+ - '3.4'
22
+ - '4.0'
23
23
  steps:
24
24
  - uses: actions/checkout@v3
25
25
  - name: Set up Ruby
26
26
  uses: ruby/setup-ruby@v1
27
27
  with:
28
- ruby-version: ${{ matrix.ruby-version }}
28
+ ruby-version: ${{ matrix.ruby }}
29
29
  bundler-cache: true
30
30
  - name: Run Specs
31
31
  run: bundle exec rake spec
data/README.rdoc CHANGED
@@ -41,6 +41,10 @@ There is also OpenID Foudation Certified RP implementation using this gem below.
41
41
  (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
42
42
  * Send me a pull request. Bonus points for topic branches.
43
43
 
44
+ == Documentation
45
+
46
+ see GitHub Wiki (https://github.com/nov/openid_connect/wiki)
47
+
44
48
  == Copyright
45
49
 
46
50
  Copyright (c) 2011 nov matake. See LICENSE for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.1
1
+ 2.4.0
@@ -8,9 +8,17 @@ module OpenIDConnect
8
8
  @token_type = :bearer
9
9
  end
10
10
 
11
- def userinfo!(params = {})
11
+ def userinfo!(params = {}, http_method: :get, headers: {})
12
+ raise ArgumentError, 'http_method must be :get or :post' unless [:get, :post].include?(http_method)
13
+
12
14
  hash = resource_request do
13
- get client.userinfo_uri, params
15
+ case http_method
16
+ when :get
17
+ get client.userinfo_uri, params, headers
18
+ when :post
19
+ # Per OIDC Core §5.3.1
20
+ post client.userinfo_uri, params, { 'Content-Type' => 'application/x-www-form-urlencoded' }.merge(headers)
21
+ end
14
22
  end
15
23
  ResponseObject::UserInfo.new hash
16
24
  end
@@ -92,6 +92,28 @@ describe OpenIDConnect::AccessToken do
92
92
  userinfo.should be_instance_of OpenIDConnect::ResponseObject::UserInfo
93
93
  end
94
94
 
95
+ context 'when http_method is :post' do
96
+ it 'should make a POST request and return UserInfo' do
97
+ userinfo = mock_json :post, client.userinfo_uri, 'userinfo/openid', params: {}, request_header: { 'Content-Type' => 'application/x-www-form-urlencoded' } do
98
+ access_token.userinfo!(http_method: :post)
99
+ end
100
+ userinfo.should be_instance_of OpenIDConnect::ResponseObject::UserInfo
101
+ end
102
+
103
+ it 'should allow overriding Content-Type via headers' do
104
+ userinfo = mock_json :post, client.userinfo_uri, 'userinfo/openid', params: {}, request_header: { 'Content-Type' => 'application/json' } do
105
+ access_token.userinfo!(http_method: :post, headers: { 'Content-Type' => 'application/json' })
106
+ end
107
+ userinfo.should be_instance_of OpenIDConnect::ResponseObject::UserInfo
108
+ end
109
+ end
110
+
111
+ context 'when http_method is invalid' do
112
+ it 'should raise ArgumentError' do
113
+ expect { access_token.userinfo!(http_method: :delete) }.to raise_error ArgumentError, 'http_method must be :get or :post'
114
+ end
115
+ end
116
+
95
117
  describe 'error handling' do
96
118
  let(:endpoint) { client.userinfo_uri }
97
119
  let(:request) { access_token.userinfo! }
@@ -9,7 +9,7 @@ describe OpenIDConnect::Discovery::Provider::Config::Resource do
9
9
  describe '#endpoint' do
10
10
  context 'when invalid host' do
11
11
  before do
12
- resource.host = 'hoge*hoge'
12
+ resource.host = 'invalid:host'
13
13
  end
14
14
 
15
15
  it do
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openid_connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - nov matake
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-10-15 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: tzinfo
@@ -362,7 +361,6 @@ homepage: https://github.com/nov/openid_connect
362
361
  licenses:
363
362
  - MIT
364
363
  metadata: {}
365
- post_install_message:
366
364
  rdoc_options: []
367
365
  require_paths:
368
366
  - lib
@@ -377,8 +375,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
377
375
  - !ruby/object:Gem::Version
378
376
  version: '0'
379
377
  requirements: []
380
- rubygems_version: 3.5.16
381
- signing_key:
378
+ rubygems_version: 4.0.6
382
379
  specification_version: 4
383
380
  summary: OpenID Connect Server & Client Library
384
381
  test_files: