oauth2 2.0.21 → 2.0.23
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
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +45 -1
- data/LICENSE.md +1 -0
- data/README.md +4 -3
- data/lib/oauth2/access_token.rb +23 -17
- data/lib/oauth2/client.rb +63 -16
- data/lib/oauth2/error.rb +8 -6
- data/lib/oauth2/response.rb +16 -12
- data/lib/oauth2/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +19 -22
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 01151dc8f48c49a5a925098de896b74bca26c0791d4667f9f87edd6329a5c8ab
|
|
4
|
+
data.tar.gz: d49ddb0357387cf39b3cd961e4c4747328f8b8495081efc9f65389bb7187cc79
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 45cab4b58795551fd1e0b827b5ee8e155ae741a5af983f1f777926cac677eeeea89f9220d1fd478e2529632e01d27291da0c37e6ef6c7e88771dc8f4a1affefd
|
|
7
|
+
data.tar.gz: 981305491fe56a81552efcc9d9719313e159f8d4f2251fe3a0753637c0958509fdb99bdbc46f2202b7b938f1bb7e6b827bb08213eb467d0fb2e8704435e0c647
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/CHANGELOG.md
CHANGED
|
@@ -30,6 +30,46 @@ Please file a bug if you notice a violation of semantic versioning.
|
|
|
30
30
|
|
|
31
31
|
### Security
|
|
32
32
|
|
|
33
|
+
## [2.0.23] - 2026-06-13
|
|
34
|
+
|
|
35
|
+
- TAG: [v2.0.23][2.0.23t]
|
|
36
|
+
- COVERAGE: 100.00% -- 562/562 lines in 15 files
|
|
37
|
+
- BRANCH COVERAGE: 97.89% -- 186/190 branches in 15 files
|
|
38
|
+
- 88.35% documented
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
|
|
42
|
+
- Upgraded to snaky_hash v2.0.6 by @pboling
|
|
43
|
+
- Refreshed generated GHA workflow action SHA pins by @pboling
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
|
|
47
|
+
- Addressed Reek code-quality checks with targeted cleanup and documented compatibility exclusions by @pboling
|
|
48
|
+
- Fixed deprecation warning from MultiXML by @robzolkos
|
|
49
|
+
|
|
50
|
+
[gh!733]: https://github.com/ruby-oauth/oauth2/pull/733
|
|
51
|
+
|
|
52
|
+
- Fixed head appraisal dependency conflicts and Ruby 2.4 protocol-relative redirect handling by @pboling
|
|
53
|
+
|
|
54
|
+
## [2.0.22] - 2026-06-07
|
|
55
|
+
|
|
56
|
+
- TAG: [v2.0.22][2.0.22t]
|
|
57
|
+
- COVERAGE: 100.00% -- 542/542 lines in 15 files
|
|
58
|
+
- BRANCH COVERAGE: 100.00% -- 180/180 branches in 15 files
|
|
59
|
+
- 88.35% documented
|
|
60
|
+
|
|
61
|
+
### Changed
|
|
62
|
+
|
|
63
|
+
- Raised generated development tooling floors to `kettle-dev` >= 2.1.1 and
|
|
64
|
+
`version_gem` >= 1.1.11.
|
|
65
|
+
- Raised the runtime dependency floor for `snaky_hash` to `>= 2.0.5`.
|
|
66
|
+
|
|
67
|
+
### Security
|
|
68
|
+
|
|
69
|
+
- [GHSA-pp92-crg2-gfv9][GHSA-pp92-crg2-gfv9] Prevent protocol-relative redirect `Location` values from changing request authority, and strip `Authorization` headers from cross-origin redirects by @tonghuaroot and @pboling
|
|
70
|
+
|
|
71
|
+
[GHSA-pp92-crg2-gfv9]: https://github.com/ruby-oauth/oauth2/security/advisories/GHSA-pp92-crg2-gfv9
|
|
72
|
+
|
|
33
73
|
## [2.0.21] - 2026-06-06
|
|
34
74
|
|
|
35
75
|
- TAG: [v2.0.21][2.0.21t]
|
|
@@ -846,7 +886,11 @@ Please file a bug if you notice a violation of semantic versioning.
|
|
|
846
886
|
|
|
847
887
|
[gemfiles/readme]: gemfiles/README.md
|
|
848
888
|
|
|
849
|
-
[Unreleased]: https://github.com/ruby-oauth/oauth2/compare/v2.0.
|
|
889
|
+
[Unreleased]: https://github.com/ruby-oauth/oauth2/compare/v2.0.23...HEAD
|
|
890
|
+
[2.0.23]: https://github.com/ruby-oauth/oauth2/compare/v2.0.22...v2.0.23
|
|
891
|
+
[2.0.23t]: https://github.com/ruby-oauth/oauth2/releases/tag/v2.0.23
|
|
892
|
+
[2.0.22]: https://github.com/ruby-oauth/oauth2/compare/v2.0.21...v2.0.22
|
|
893
|
+
[2.0.22t]: https://github.com/ruby-oauth/oauth2/releases/tag/v2.0.22
|
|
850
894
|
[2.0.21]: https://github.com/ruby-oauth/oauth2/compare/v2.0.20...v2.0.21
|
|
851
895
|
[2.0.21t]: https://github.com/ruby-oauth/oauth2/releases/tag/v2.0.21
|
|
852
896
|
[2.0.20]: https://github.com/ruby-oauth/oauth2/compare/v2.0.19...v2.0.20
|
data/LICENSE.md
CHANGED
data/README.md
CHANGED
|
@@ -871,6 +871,7 @@ See [LICENSE.md][📄license] for the official copyright notice.
|
|
|
871
871
|
- Copyright (c) 2025 Sasa Rosic
|
|
872
872
|
- Copyright (c) 2026 Jonathan Grinstead
|
|
873
873
|
- Copyright (c) 2026 kain
|
|
874
|
+
- Copyright (c) 2026 Rob Zolkos
|
|
874
875
|
- Copyright (c) 2026 StepSecurity Bot
|
|
875
876
|
|
|
876
877
|
</details>
|
|
@@ -1086,7 +1087,7 @@ Thanks for RTFM. ☺️
|
|
|
1086
1087
|
[📌gitmoji]: https://gitmoji.dev
|
|
1087
1088
|
[📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
|
|
1088
1089
|
[🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
|
|
1089
|
-
[🧮kloc-img]: https://img.shields.io/badge/KLOC-0.
|
|
1090
|
+
[🧮kloc-img]: https://img.shields.io/badge/KLOC-0.562-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
|
|
1090
1091
|
[🔐security]: https://github.com/ruby-oauth/oauth2/blob/main/SECURITY.md
|
|
1091
1092
|
[🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
|
|
1092
1093
|
[📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
|
|
@@ -1094,7 +1095,7 @@ Thanks for RTFM. ☺️
|
|
|
1094
1095
|
[📄license-ref]: MIT.md
|
|
1095
1096
|
[📄license-img]: https://img.shields.io/badge/License-MIT-259D6C.svg
|
|
1096
1097
|
[📄license-compat]: https://www.apache.org/legal/resolved.html#category-a
|
|
1097
|
-
[📄license-compat-img]: https://img.shields.io/badge/Apache_Compatible:_Category_A
|
|
1098
|
+
[📄license-compat-img]: https://img.shields.io/badge/Apache_Compatible:_Category_A-%E2%9C%93-259D6C.svg?style=flat&logo=Apache
|
|
1098
1099
|
|
|
1099
1100
|
[📄ilo-declaration]: https://www.ilo.org/declaration/lang--en/index.htm
|
|
1100
1101
|
[📄ilo-declaration-img]: https://img.shields.io/badge/ILO_Fundamental_Principles-✓-259D6C.svg?style=flat
|
|
@@ -1114,7 +1115,7 @@ Thanks for RTFM. ☺️
|
|
|
1114
1115
|
| Package | oauth2 |
|
|
1115
1116
|
| Description | 🔐 A Ruby wrapper for the OAuth 2.0 Authorization Framework, including the OAuth 2.1 draft spec, and OpenID Connect (OIDC) |
|
|
1116
1117
|
| Homepage | https://github.com/ruby-oauth/oauth2 |
|
|
1117
|
-
| Source | https://github.com/ruby-oauth/oauth2/tree/v2.0.
|
|
1118
|
+
| Source | https://github.com/ruby-oauth/oauth2/tree/v2.0.23 |
|
|
1118
1119
|
| License | `MIT` |
|
|
1119
1120
|
| Funding | https://github.com/sponsors/pboling, https://issuehunt.io/u/pboling, https://ko-fi.com/pboling, https://liberapay.com/pboling/donate, https://opencollective.com/ruby-oauth, https://patreon.com/galtzo, https://polar.sh/pboling, https://thanks.dev/u/gh/pboling, https://tidelift.com/funding/github/rubygems/oauth2, https://www.buymeacoffee.com/pboling |
|
|
1120
1121
|
<!-- kettle-jem:metadata:end -->
|
data/lib/oauth2/access_token.rb
CHANGED
|
@@ -68,13 +68,7 @@ module OAuth2
|
|
|
68
68
|
end
|
|
69
69
|
# :nocov:
|
|
70
70
|
# TODO: Get rid of this branching logic when dropping Hashie < v3.2
|
|
71
|
-
token =
|
|
72
|
-
warn("snaky_hash and oauth2 will drop support for Hashie v0 in the next major version. Please upgrade to a modern Hashie.")
|
|
73
|
-
# There is a bug in Hashie v0, which is accounts for.
|
|
74
|
-
fresh.delete(t_key) || fresh[t_key] || ""
|
|
75
|
-
else
|
|
76
|
-
fresh.delete(t_key) || ""
|
|
77
|
-
end
|
|
71
|
+
token = extract_token_value(fresh, t_key)
|
|
78
72
|
# :nocov:
|
|
79
73
|
new(client, token, fresh)
|
|
80
74
|
end
|
|
@@ -108,6 +102,17 @@ Custom token_name (#{key}) is not found in (#{hash.keys})
|
|
|
108
102
|
You may need to set `snaky: false`. See inline documentation for more info.
|
|
109
103
|
])
|
|
110
104
|
end
|
|
105
|
+
|
|
106
|
+
# :nocov:
|
|
107
|
+
def extract_token_value(fresh, key)
|
|
108
|
+
token_value = fresh.delete(key)
|
|
109
|
+
return token_value || "" if defined?(Hashie::VERSION)
|
|
110
|
+
|
|
111
|
+
warn("snaky_hash and oauth2 will drop support for Hashie v0 in the next major version. Please upgrade to a modern Hashie.")
|
|
112
|
+
# There is a bug in Hashie v0, which this accounts for.
|
|
113
|
+
token_value || fresh[key] || ""
|
|
114
|
+
end
|
|
115
|
+
# :nocov:
|
|
111
116
|
end
|
|
112
117
|
|
|
113
118
|
# Initialize an AccessToken
|
|
@@ -305,8 +310,8 @@ You may need to set `snaky: false`. See inline documentation for more info.
|
|
|
305
310
|
# TODO: Switch when dropping Ruby < 2.5 support
|
|
306
311
|
# params.transform_keys(&:to_sym) # Ruby 2.5 only
|
|
307
312
|
# Old Ruby transform_keys alternative:
|
|
308
|
-
sheesh = @params.each_with_object({}) { |(
|
|
309
|
-
memo[
|
|
313
|
+
sheesh = @params.each_with_object({}) { |(key, value), memo|
|
|
314
|
+
memo[key.to_sym] = value
|
|
310
315
|
}
|
|
311
316
|
sheesh.merge(hsh)
|
|
312
317
|
end
|
|
@@ -375,6 +380,7 @@ You may need to set `snaky: false`. See inline documentation for more info.
|
|
|
375
380
|
|
|
376
381
|
def configure_authentication!(opts, verb)
|
|
377
382
|
mode_opt = options[:mode]
|
|
383
|
+
param_name = options[:param_name]
|
|
378
384
|
mode =
|
|
379
385
|
if mode_opt.respond_to?(:call)
|
|
380
386
|
mode_opt.call(verb)
|
|
@@ -388,19 +394,19 @@ You may need to set `snaky: false`. See inline documentation for more info.
|
|
|
388
394
|
|
|
389
395
|
case mode
|
|
390
396
|
when :header
|
|
391
|
-
opts[:headers] ||= {}
|
|
392
|
-
|
|
397
|
+
request_headers = opts[:headers] ||= {}
|
|
398
|
+
request_headers.merge!(headers)
|
|
393
399
|
when :query
|
|
394
400
|
# OAuth 2.1 note: Bearer tokens in the query string are omitted from the spec due to security risks.
|
|
395
401
|
# Prefer the default :header mode whenever possible.
|
|
396
|
-
opts[:params] ||= {}
|
|
397
|
-
|
|
402
|
+
request_params = opts[:params] ||= {}
|
|
403
|
+
request_params[param_name] = token
|
|
398
404
|
when :body
|
|
399
|
-
opts[:body] ||= {}
|
|
400
|
-
if
|
|
401
|
-
|
|
405
|
+
request_body = opts[:body] ||= {}
|
|
406
|
+
if request_body.is_a?(Hash)
|
|
407
|
+
request_body[param_name] = token
|
|
402
408
|
else
|
|
403
|
-
opts[:body]
|
|
409
|
+
opts[:body] = "#{request_body}&#{param_name}=#{token}"
|
|
404
410
|
end
|
|
405
411
|
# @todo support for multi-part (file uploads)
|
|
406
412
|
else
|
data/lib/oauth2/client.rb
CHANGED
|
@@ -86,8 +86,9 @@ module OAuth2
|
|
|
86
86
|
@connection ||=
|
|
87
87
|
Faraday.new(site, options[:connection_opts]) do |builder|
|
|
88
88
|
oauth_debug_logging(builder)
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
connection_build = options[:connection_build]
|
|
90
|
+
if connection_build
|
|
91
|
+
connection_build.call(builder)
|
|
91
92
|
else
|
|
92
93
|
builder.request(:url_encoded) # form-encode POST params
|
|
93
94
|
builder.adapter(Faraday.default_adapter) # make requests with Net::HTTP
|
|
@@ -149,9 +150,9 @@ module OAuth2
|
|
|
149
150
|
|
|
150
151
|
case status
|
|
151
152
|
when 301, 302, 303, 307
|
|
152
|
-
req_opts[:redirect_count]
|
|
153
|
-
req_opts[:redirect_count]
|
|
154
|
-
return response if
|
|
153
|
+
redirect_count = (req_opts[:redirect_count] || 0).to_i + 1
|
|
154
|
+
req_opts[:redirect_count] = redirect_count
|
|
155
|
+
return response if redirect_count > options[:max_redirects]
|
|
155
156
|
|
|
156
157
|
if status == 303
|
|
157
158
|
verb = :get
|
|
@@ -159,8 +160,9 @@ module OAuth2
|
|
|
159
160
|
end
|
|
160
161
|
location = response.headers["location"]
|
|
161
162
|
if location
|
|
162
|
-
|
|
163
|
-
|
|
163
|
+
current_location = response.response.env.url
|
|
164
|
+
full_location = resolve_redirect_location(current_location, location)
|
|
165
|
+
request(verb, full_location, sanitize_redirect_options(req_opts, current_location, full_location))
|
|
164
166
|
else
|
|
165
167
|
error = Error.new(response)
|
|
166
168
|
raise(error, "Got #{status} status code, but no Location header was present")
|
|
@@ -337,8 +339,9 @@ module OAuth2
|
|
|
337
339
|
#
|
|
338
340
|
# @return [Hash] the params to add to a request or URL
|
|
339
341
|
def redirection_params
|
|
340
|
-
|
|
341
|
-
|
|
342
|
+
redirect_uri = options[:redirect_uri]
|
|
343
|
+
if redirect_uri
|
|
344
|
+
{"redirect_uri" => redirect_uri}
|
|
342
345
|
else
|
|
343
346
|
{}
|
|
344
347
|
end
|
|
@@ -445,7 +448,7 @@ module OAuth2
|
|
|
445
448
|
url = connection.build_url(url).to_s
|
|
446
449
|
# See: Hash#partition https://bugs.ruby-lang.org/issues/16252
|
|
447
450
|
req_opts, oauth_opts = opts.
|
|
448
|
-
partition { |
|
|
451
|
+
partition { |key, _value| RESERVED_REQ_KEYS.include?(key.to_s) }.
|
|
449
452
|
map(&:to_h)
|
|
450
453
|
|
|
451
454
|
begin
|
|
@@ -453,10 +456,10 @@ module OAuth2
|
|
|
453
456
|
req.params.update(req_opts[:params]) if req_opts[:params]
|
|
454
457
|
yield(req) if block_given?
|
|
455
458
|
end
|
|
456
|
-
rescue Faraday::ConnectionFailed =>
|
|
457
|
-
raise ConnectionError,
|
|
458
|
-
rescue Faraday::TimeoutError =>
|
|
459
|
-
raise TimeoutError,
|
|
459
|
+
rescue Faraday::ConnectionFailed => exception
|
|
460
|
+
raise ConnectionError, exception
|
|
461
|
+
rescue Faraday::TimeoutError => exception
|
|
462
|
+
raise TimeoutError, exception
|
|
460
463
|
end
|
|
461
464
|
|
|
462
465
|
parse = oauth_opts.key?(:parse) ? oauth_opts.delete(:parse) : Response::DEFAULT_OPTIONS[:parse]
|
|
@@ -465,6 +468,49 @@ module OAuth2
|
|
|
465
468
|
Response.new(response, parse: parse, snaky: snaky)
|
|
466
469
|
end
|
|
467
470
|
|
|
471
|
+
def resolve_redirect_location(current_location, location)
|
|
472
|
+
return protocol_relative_redirect_location(current_location, location) if location.respond_to?(:start_with?) && location.start_with?("//")
|
|
473
|
+
|
|
474
|
+
current_location.merge(location)
|
|
475
|
+
end
|
|
476
|
+
|
|
477
|
+
def protocol_relative_redirect_location(current_location, location)
|
|
478
|
+
protocol_relative_location = URI.parse(location)
|
|
479
|
+
authority = +""
|
|
480
|
+
authority << "#{protocol_relative_location.userinfo}@" if protocol_relative_location.userinfo
|
|
481
|
+
authority << protocol_relative_location.host.to_s
|
|
482
|
+
authority << ":#{protocol_relative_location.port}" if protocol_relative_location.port
|
|
483
|
+
|
|
484
|
+
current_location.dup.tap do |safe_location|
|
|
485
|
+
safe_location.path = "///#{authority}#{protocol_relative_location.path}"
|
|
486
|
+
safe_location.query = protocol_relative_location.query if safe_location.respond_to?(:query=)
|
|
487
|
+
safe_location.fragment = protocol_relative_location.fragment if safe_location.respond_to?(:fragment=)
|
|
488
|
+
end
|
|
489
|
+
end
|
|
490
|
+
|
|
491
|
+
def sanitize_redirect_options(req_opts, current_location, next_location)
|
|
492
|
+
return req_opts unless cross_origin_redirect?(current_location, next_location)
|
|
493
|
+
|
|
494
|
+
headers = req_opts[:headers]
|
|
495
|
+
return req_opts unless headers && headers.any? { |key, _value| authorization_header?(key) }
|
|
496
|
+
|
|
497
|
+
safe_opts = req_opts.dup
|
|
498
|
+
safe_headers = headers.dup
|
|
499
|
+
safe_headers.delete_if { |key, _value| authorization_header?(key) }
|
|
500
|
+
safe_opts[:headers] = safe_headers
|
|
501
|
+
safe_opts
|
|
502
|
+
end
|
|
503
|
+
|
|
504
|
+
def authorization_header?(key)
|
|
505
|
+
key.to_s.casecmp("Authorization").zero?
|
|
506
|
+
end
|
|
507
|
+
|
|
508
|
+
def cross_origin_redirect?(current_location, next_location)
|
|
509
|
+
current_location.scheme != next_location.scheme ||
|
|
510
|
+
current_location.host != next_location.host ||
|
|
511
|
+
current_location.port != next_location.port
|
|
512
|
+
end
|
|
513
|
+
|
|
468
514
|
# Returns the authenticator object
|
|
469
515
|
#
|
|
470
516
|
# @return [Authenticator] the initialized Authenticator
|
|
@@ -564,12 +610,13 @@ module OAuth2
|
|
|
564
610
|
|
|
565
611
|
def oauth_debug_logging(builder)
|
|
566
612
|
if OAuth2::OAUTH_DEBUG
|
|
613
|
+
config = OAuth2.config
|
|
567
614
|
builder.response(
|
|
568
615
|
:logger,
|
|
569
616
|
OAuth2::AUTH_SANITIZER::SanitizedLogger.new(
|
|
570
617
|
options[:logger],
|
|
571
|
-
filtered_keys:
|
|
572
|
-
label:
|
|
618
|
+
filtered_keys: config[:filtered_debug_keys],
|
|
619
|
+
label: config[:filtered_label]
|
|
573
620
|
),
|
|
574
621
|
bodies: true
|
|
575
622
|
)
|
data/lib/oauth2/error.rb
CHANGED
|
@@ -20,9 +20,10 @@ module OAuth2
|
|
|
20
20
|
@code = nil
|
|
21
21
|
@description = nil
|
|
22
22
|
if response.respond_to?(:parsed)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
@
|
|
23
|
+
parsed_response = response.parsed
|
|
24
|
+
if parsed_response.is_a?(Hash)
|
|
25
|
+
@code = parsed_response["error"]
|
|
26
|
+
@description = parsed_response["error_description"]
|
|
26
27
|
end
|
|
27
28
|
elsif response.is_a?(Hash)
|
|
28
29
|
@code = response["error"]
|
|
@@ -46,11 +47,12 @@ module OAuth2
|
|
|
46
47
|
# @return [String] Message suitable for StandardError
|
|
47
48
|
def error_message(response_body, opts = {})
|
|
48
49
|
lines = []
|
|
50
|
+
error_description = opts[:error_description]
|
|
49
51
|
|
|
50
|
-
lines <<
|
|
52
|
+
lines << error_description if error_description
|
|
51
53
|
|
|
52
|
-
error_string = if response_body.respond_to?(:encode) &&
|
|
53
|
-
script_encoding =
|
|
54
|
+
error_string = if response_body.respond_to?(:encode) && error_description.respond_to?(:encoding)
|
|
55
|
+
script_encoding = error_description.encoding
|
|
54
56
|
response_body.encode(script_encoding, invalid: :replace, undef: :replace)
|
|
55
57
|
else
|
|
56
58
|
response_body
|
data/lib/oauth2/response.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "json"
|
|
4
|
+
require "set"
|
|
4
5
|
require "multi_xml"
|
|
5
6
|
require "rack"
|
|
6
7
|
|
|
@@ -108,15 +109,16 @@ module OAuth2
|
|
|
108
109
|
def parsed
|
|
109
110
|
return @parsed if defined?(@parsed)
|
|
110
111
|
|
|
112
|
+
response_parser = parser
|
|
111
113
|
@parsed =
|
|
112
|
-
if
|
|
113
|
-
case
|
|
114
|
+
if response_parser.respond_to?(:call)
|
|
115
|
+
case response_parser.arity
|
|
114
116
|
when 0
|
|
115
|
-
|
|
117
|
+
response_parser.call
|
|
116
118
|
when 1
|
|
117
|
-
|
|
119
|
+
response_parser.call(body)
|
|
118
120
|
else
|
|
119
|
-
|
|
121
|
+
response_parser.call(body, response)
|
|
120
122
|
end
|
|
121
123
|
end
|
|
122
124
|
|
|
@@ -132,9 +134,10 @@ module OAuth2
|
|
|
132
134
|
#
|
|
133
135
|
# @return [String, nil] The content type or nil if headers are not present
|
|
134
136
|
def content_type
|
|
135
|
-
|
|
137
|
+
response_headers = response.headers
|
|
138
|
+
return unless response_headers
|
|
136
139
|
|
|
137
|
-
((
|
|
140
|
+
((response_headers.values_at("content-type", "Content-Type").compact.first || "").split(";").first || "").strip.downcase
|
|
138
141
|
end
|
|
139
142
|
|
|
140
143
|
# Determines the parser to be used for the response body
|
|
@@ -154,11 +157,12 @@ module OAuth2
|
|
|
154
157
|
def parser
|
|
155
158
|
return @parser if defined?(@parser)
|
|
156
159
|
|
|
160
|
+
parse_option = options[:parse]
|
|
157
161
|
@parser =
|
|
158
|
-
if
|
|
159
|
-
|
|
160
|
-
elsif
|
|
161
|
-
@@parsers[
|
|
162
|
+
if parse_option.respond_to?(:call)
|
|
163
|
+
parse_option
|
|
164
|
+
elsif parse_option
|
|
165
|
+
@@parsers[parse_option.to_sym]
|
|
162
166
|
end
|
|
163
167
|
|
|
164
168
|
@parser ||= @@parsers[@@content_types[content_type]]
|
|
@@ -171,7 +175,7 @@ end
|
|
|
171
175
|
OAuth2::Response.register_parser(:xml, ["text/xml", "application/rss+xml", "application/rdf+xml", "application/atom+xml", "application/xml"]) do |body|
|
|
172
176
|
next body unless body.respond_to?(:to_str)
|
|
173
177
|
|
|
174
|
-
MultiXml.parse(body)
|
|
178
|
+
(defined?(MultiXML) ? MultiXML : MultiXml).parse(body)
|
|
175
179
|
end
|
|
176
180
|
|
|
177
181
|
# Register JSON parser
|
data/lib/oauth2/version.rb
CHANGED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: oauth2
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.
|
|
4
|
+
version: 2.0.23
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
- Peter Boling
|
|
8
|
-
- Erik Michaels-Ober
|
|
9
|
-
- Michael Bleigh
|
|
7
|
+
- Peter H. Boling
|
|
10
8
|
bindir: exe
|
|
11
9
|
cert_chain:
|
|
12
10
|
- |
|
|
@@ -156,7 +154,7 @@ dependencies:
|
|
|
156
154
|
version: '2.0'
|
|
157
155
|
- - ">="
|
|
158
156
|
- !ruby/object:Gem::Version
|
|
159
|
-
version: 2.0.
|
|
157
|
+
version: 2.0.6
|
|
160
158
|
type: :runtime
|
|
161
159
|
prerelease: false
|
|
162
160
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -166,7 +164,7 @@ dependencies:
|
|
|
166
164
|
version: '2.0'
|
|
167
165
|
- - ">="
|
|
168
166
|
- !ruby/object:Gem::Version
|
|
169
|
-
version: 2.0.
|
|
167
|
+
version: 2.0.6
|
|
170
168
|
- !ruby/object:Gem::Dependency
|
|
171
169
|
name: version_gem
|
|
172
170
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -176,7 +174,7 @@ dependencies:
|
|
|
176
174
|
version: '1.1'
|
|
177
175
|
- - ">="
|
|
178
176
|
- !ruby/object:Gem::Version
|
|
179
|
-
version: 1.1.
|
|
177
|
+
version: 1.1.11
|
|
180
178
|
type: :runtime
|
|
181
179
|
prerelease: false
|
|
182
180
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -186,27 +184,27 @@ dependencies:
|
|
|
186
184
|
version: '1.1'
|
|
187
185
|
- - ">="
|
|
188
186
|
- !ruby/object:Gem::Version
|
|
189
|
-
version: 1.1.
|
|
187
|
+
version: 1.1.11
|
|
190
188
|
- !ruby/object:Gem::Dependency
|
|
191
189
|
name: kettle-dev
|
|
192
190
|
requirement: !ruby/object:Gem::Requirement
|
|
193
191
|
requirements:
|
|
194
192
|
- - "~>"
|
|
195
193
|
- !ruby/object:Gem::Version
|
|
196
|
-
version: '2.
|
|
194
|
+
version: '2.2'
|
|
197
195
|
- - ">="
|
|
198
196
|
- !ruby/object:Gem::Version
|
|
199
|
-
version: 2.
|
|
197
|
+
version: 2.2.5
|
|
200
198
|
type: :development
|
|
201
199
|
prerelease: false
|
|
202
200
|
version_requirements: !ruby/object:Gem::Requirement
|
|
203
201
|
requirements:
|
|
204
202
|
- - "~>"
|
|
205
203
|
- !ruby/object:Gem::Version
|
|
206
|
-
version: '2.
|
|
204
|
+
version: '2.2'
|
|
207
205
|
- - ">="
|
|
208
206
|
- !ruby/object:Gem::Version
|
|
209
|
-
version: 2.
|
|
207
|
+
version: 2.2.5
|
|
210
208
|
- !ruby/object:Gem::Dependency
|
|
211
209
|
name: bundler-audit
|
|
212
210
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -264,7 +262,7 @@ dependencies:
|
|
|
264
262
|
version: '3.1'
|
|
265
263
|
- - ">="
|
|
266
264
|
- !ruby/object:Gem::Version
|
|
267
|
-
version: 3.1.
|
|
265
|
+
version: 3.1.2
|
|
268
266
|
type: :development
|
|
269
267
|
prerelease: false
|
|
270
268
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -274,7 +272,7 @@ dependencies:
|
|
|
274
272
|
version: '3.1'
|
|
275
273
|
- - ">="
|
|
276
274
|
- !ruby/object:Gem::Version
|
|
277
|
-
version: 3.1.
|
|
275
|
+
version: 3.1.2
|
|
278
276
|
- !ruby/object:Gem::Dependency
|
|
279
277
|
name: kettle-test
|
|
280
278
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -284,7 +282,7 @@ dependencies:
|
|
|
284
282
|
version: '2.0'
|
|
285
283
|
- - ">="
|
|
286
284
|
- !ruby/object:Gem::Version
|
|
287
|
-
version: 2.0.
|
|
285
|
+
version: 2.0.5
|
|
288
286
|
type: :development
|
|
289
287
|
prerelease: false
|
|
290
288
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -294,7 +292,7 @@ dependencies:
|
|
|
294
292
|
version: '2.0'
|
|
295
293
|
- - ">="
|
|
296
294
|
- !ruby/object:Gem::Version
|
|
297
|
-
version: 2.0.
|
|
295
|
+
version: 2.0.5
|
|
298
296
|
- !ruby/object:Gem::Dependency
|
|
299
297
|
name: turbo_tests2
|
|
300
298
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -304,7 +302,7 @@ dependencies:
|
|
|
304
302
|
version: '3.1'
|
|
305
303
|
- - ">="
|
|
306
304
|
- !ruby/object:Gem::Version
|
|
307
|
-
version: 3.1.
|
|
305
|
+
version: 3.1.2
|
|
308
306
|
type: :development
|
|
309
307
|
prerelease: false
|
|
310
308
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -314,7 +312,7 @@ dependencies:
|
|
|
314
312
|
version: '3.1'
|
|
315
313
|
- - ">="
|
|
316
314
|
- !ruby/object:Gem::Version
|
|
317
|
-
version: 3.1.
|
|
315
|
+
version: 3.1.2
|
|
318
316
|
- !ruby/object:Gem::Dependency
|
|
319
317
|
name: ruby-progressbar
|
|
320
318
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -447,7 +445,6 @@ description: "\U0001F510 A Ruby wrapper for the OAuth 2.0 Authorization Framewor
|
|
|
447
445
|
including the OAuth 2.1 draft spec, and OpenID Connect (OIDC)"
|
|
448
446
|
email:
|
|
449
447
|
- floss@galtzo.com
|
|
450
|
-
- oauth-ruby@googlegroups.com
|
|
451
448
|
executables: []
|
|
452
449
|
extensions: []
|
|
453
450
|
extra_rdoc_files:
|
|
@@ -502,10 +499,10 @@ licenses:
|
|
|
502
499
|
- MIT
|
|
503
500
|
metadata:
|
|
504
501
|
homepage_uri: https://oauth2.galtzo.com
|
|
505
|
-
source_code_uri: https://github.com/ruby-oauth/oauth2/tree/v2.0.
|
|
506
|
-
changelog_uri: https://github.com/ruby-oauth/oauth2/blob/v2.0.
|
|
502
|
+
source_code_uri: https://github.com/ruby-oauth/oauth2/tree/v2.0.23
|
|
503
|
+
changelog_uri: https://github.com/ruby-oauth/oauth2/blob/v2.0.23/CHANGELOG.md
|
|
507
504
|
bug_tracker_uri: https://github.com/ruby-oauth/oauth2/issues
|
|
508
|
-
documentation_uri: https://www.rubydoc.info/gems/oauth2/2.0.
|
|
505
|
+
documentation_uri: https://www.rubydoc.info/gems/oauth2/2.0.23
|
|
509
506
|
funding_uri: https://github.com/sponsors/pboling
|
|
510
507
|
wiki_uri: https://github.com/ruby-oauth/oauth2/wiki
|
|
511
508
|
news_uri: https://www.railsbling.com/tags/oauth2
|
metadata.gz.sig
CHANGED
|
Binary file
|