openid_connect 2.3.0 → 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 +4 -4
- data/.github/workflows/spec.yml +8 -8
- data/README.rdoc +4 -0
- data/VERSION +1 -1
- data/lib/openid_connect/access_token.rb +12 -4
- data/lib/openid_connect/client/registrar.rb +1 -1
- data/spec/openid_connect/access_token_spec.rb +22 -0
- data/spec/openid_connect/discovery/provider/config/resource_spec.rb +1 -1
- metadata +3 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: deb0c8a4b1878a09d9a42f7051201bccfcf4bd4b17f7bdaae0835d30bb4de502
|
|
4
|
+
data.tar.gz: d7f73dd36717f85c2f084102aa5b89688ed4a76e4742816fbe158ccd0861cc69
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '0801e7a784512bfa3d68cd2c0acd3532afbf1549905510541c0e4575abb1fff11f74bda75d10e770054617b1086510fcd0cbb344d9b9085c65d0292992770cb9'
|
|
7
|
+
data.tar.gz: c5406c9166d87823ca1a81d13101d6969db7af82d6f274cd9fcaa6152ac8c904003f3f088dab5ce20332f4429c024f3859c1758427cdeb0b24b01102251fedd8
|
data/.github/workflows/spec.yml
CHANGED
|
@@ -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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
|
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.
|
|
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
|
-
|
|
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
|
|
@@ -30,7 +38,7 @@ module OpenIDConnect
|
|
|
30
38
|
when 200
|
|
31
39
|
res.body.with_indifferent_access
|
|
32
40
|
when 400
|
|
33
|
-
raise BadRequest.new('API Access
|
|
41
|
+
raise BadRequest.new('API Access Failed', res)
|
|
34
42
|
when 401
|
|
35
43
|
raise Unauthorized.new('Access Token Invalid or Expired', res)
|
|
36
44
|
when 403
|
|
@@ -42,4 +50,4 @@ module OpenIDConnect
|
|
|
42
50
|
end
|
|
43
51
|
end
|
|
44
52
|
|
|
45
|
-
require 'openid_connect/access_token/mtls'
|
|
53
|
+
require 'openid_connect/access_token/mtls'
|
|
@@ -118,7 +118,7 @@ module OpenIDConnect
|
|
|
118
118
|
|
|
119
119
|
def valid_uri?(uri, schemes = ['http', 'https'])
|
|
120
120
|
# NOTE: specify nil for schemes to allow any schemes
|
|
121
|
-
URI::
|
|
121
|
+
URI::DEFAULT_PARSER.make_regexp(schemes).match(uri).present?
|
|
122
122
|
end
|
|
123
123
|
|
|
124
124
|
def validate_contacts
|
|
@@ -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! }
|
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.
|
|
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:
|
|
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:
|
|
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:
|