openid_connect 2.3.1 → 2.5.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 +10 -2
- data/lib/openid_connect/response_object/user_info.rb +1 -1
- data/lib/openid_connect.rb +0 -1
- data/openid_connect.gemspec +0 -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 -20
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 605cbe04505cb2af337c82b012039c9b13be826348fa790f6b0cd1d90cdd0cc3
|
|
4
|
+
data.tar.gz: 240523a1e7b9e755827a8be1499918f8684f413ee0e8a81af00cb062ccf2699a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 60150ee35c5bf11ec4d945e692450b5eef982b47bfb800bb81fd40a328872f8bff124f683f42dc9c1689a2b2c910da0f3a5fd9a92e4f3481a0cde9032744ac80
|
|
7
|
+
data.tar.gz: a4b25a2ae74e5d2dcabe811e104c5cf7d8075e07a376d948fae8483d90dd1948c592160b3f68a1838c821288d21269b9a76b5a28043b7874b8fbaff28982696d
|
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.5.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
|
|
@@ -29,7 +29,7 @@ module OpenIDConnect
|
|
|
29
29
|
validates :email_verified, :phone_number_verified, allow_nil: true, inclusion: {in: [true, false]}
|
|
30
30
|
validates :zoneinfo, allow_nil: true, inclusion: {in: TZInfo::TimezoneProxy.all.collect(&:name)}
|
|
31
31
|
validates :profile, :picture, :website, allow_nil: true, url: true
|
|
32
|
-
validates :email, allow_nil: true,
|
|
32
|
+
validates :email, allow_nil: true, format: { with: /\A[^@\s]+@[^@\s]+\.[^@\s]+\z/ }
|
|
33
33
|
validates :updated_at, allow_nil: true, numericality: {only_integer: true}
|
|
34
34
|
validate :validate_address
|
|
35
35
|
validate :require_at_least_one_attributes
|
data/lib/openid_connect.rb
CHANGED
data/openid_connect.gemspec
CHANGED
|
@@ -16,7 +16,6 @@ Gem::Specification.new do |s|
|
|
|
16
16
|
s.add_runtime_dependency "attr_required", ">= 1.0.0"
|
|
17
17
|
s.add_runtime_dependency "activemodel"
|
|
18
18
|
s.add_runtime_dependency "validate_url"
|
|
19
|
-
s.add_runtime_dependency "email_validator"
|
|
20
19
|
s.add_runtime_dependency "mail"
|
|
21
20
|
s.add_runtime_dependency 'faraday', '~> 2.0'
|
|
22
21
|
s.add_runtime_dependency 'faraday-follow_redirects'
|
|
@@ -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.5.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
|
|
@@ -66,20 +65,6 @@ dependencies:
|
|
|
66
65
|
- - ">="
|
|
67
66
|
- !ruby/object:Gem::Version
|
|
68
67
|
version: '0'
|
|
69
|
-
- !ruby/object:Gem::Dependency
|
|
70
|
-
name: email_validator
|
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
|
72
|
-
requirements:
|
|
73
|
-
- - ">="
|
|
74
|
-
- !ruby/object:Gem::Version
|
|
75
|
-
version: '0'
|
|
76
|
-
type: :runtime
|
|
77
|
-
prerelease: false
|
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
-
requirements:
|
|
80
|
-
- - ">="
|
|
81
|
-
- !ruby/object:Gem::Version
|
|
82
|
-
version: '0'
|
|
83
68
|
- !ruby/object:Gem::Dependency
|
|
84
69
|
name: mail
|
|
85
70
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -362,7 +347,6 @@ homepage: https://github.com/nov/openid_connect
|
|
|
362
347
|
licenses:
|
|
363
348
|
- MIT
|
|
364
349
|
metadata: {}
|
|
365
|
-
post_install_message:
|
|
366
350
|
rdoc_options: []
|
|
367
351
|
require_paths:
|
|
368
352
|
- lib
|
|
@@ -377,8 +361,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
377
361
|
- !ruby/object:Gem::Version
|
|
378
362
|
version: '0'
|
|
379
363
|
requirements: []
|
|
380
|
-
rubygems_version:
|
|
381
|
-
signing_key:
|
|
364
|
+
rubygems_version: 4.0.10
|
|
382
365
|
specification_version: 4
|
|
383
366
|
summary: OpenID Connect Server & Client Library
|
|
384
367
|
test_files:
|