oauth2 2.0.1 → 2.0.4

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: 0b2375593530f7a565bfe90a1534e6203bb178428ca3c9670a0dcd728cfa134a
4
- data.tar.gz: 04c8289d5202d2db4f12321fc7acda898a77931c1acee21cd5bdd3a7bcbec96a
3
+ metadata.gz: fc4158398289799f1200f2706539766ebcec6b3be4c861427d9b11fb6f6a8d8f
4
+ data.tar.gz: cd7bec320053ae8d114f9c3f730ce7252872b2fbf0b4c716d5447ac1642b7e7e
5
5
  SHA512:
6
- metadata.gz: 78b0c341b7fa62f31227ca3217fd3db5ad9dd17c54b9a9bca492f6e4f6294f2db63d7a88a221b7d3fb671d646ee7fc85c7bd4808a82536448e7f13611a8a7598
7
- data.tar.gz: 0c2374b9c939fd0c021e25bfa81c23e033af5313e294f18f802431d4c192098ade257c2aeac131a11429525450b786cf894fa7d0cf50f8171395b2ca6ccb8bd0
6
+ metadata.gz: 57f0ddd1d875238c5b98e358cea1114fb09847c01af8231e2d6a6e6c70e928500bd3f2b45c566302f70481d802ff7db6b649105765692f7107542e49edf06e2b
7
+ data.tar.gz: 13e0e6fcf0b7090bd5068c08522fc5ca52b8f719d230e7355334785e9795581c011b437b6eca4897f86d30ef7dd856f924a8a3e5b1488e7c99a7fa595973368b
data/CHANGELOG.md CHANGED
@@ -4,6 +4,24 @@ All notable changes to this project will be documented in this file.
4
4
  The format (since v2) is based on [Keep a Changelog v1](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning v2](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [2.0.4] - 2022-07-01
8
+ ### Fixed
9
+ - [#618](https://github.com/oauth-xx/oauth2/pull/618) - In some scenarios the `snaky` option default value was not applied (@pboling)
10
+
11
+ ## [2.0.3] - 2022-06-28
12
+ ### Added
13
+ - [#611](https://github.com/oauth-xx/oauth2/pull/611) - Proper deprecation warnings for `extract_access_token` argument (@pboling)
14
+ - [#612](https://github.com/oauth-xx/oauth2/pull/612) - Add `snaky: false` option to skip conversion to `OAuth2::SnakyHash` (default: true) (@pboling)
15
+ ### Fixed
16
+ - [#608](https://github.com/oauth-xx/oauth2/pull/608) - Wrap `Faraday::TimeoutError` in `OAuth2::TimeoutError` (@nbibler)
17
+ - [#615](https://github.com/oauth-xx/oauth2/pull/615) - Fix support for requests with blocks, see `Faraday::Connection#run_request` (@pboling)
18
+
19
+ ## [2.0.2] - 2022-06-24
20
+ ### Fixed
21
+ - [#604](https://github.com/oauth-xx/oauth2/pull/604) - Wrap `Faraday::TimeoutError` in `OAuth2::TimeoutError` (@stanhu)
22
+ - [#606](https://github.com/oauth-xx/oauth2/pull/606) - Ruby 2.7 deprecation warning fix: Move `access_token_class` parameter into `Client` constructor (@stanhu)
23
+ - [#607](https://github.com/oauth-xx/oauth2/pull/607) - CHANGELOG correction, reference to `OAuth2::ConnectionError` (@zavan)
24
+
7
25
  ## [2.0.1] - 2022-06-22
8
26
  ### Added
9
27
  - Documentation improvements (@pboling)
@@ -29,7 +47,7 @@ and this project adheres to [Semantic Versioning v2](https://semver.org/spec/v2.
29
47
  - [#413](https://github.com/oauth-xx/oauth2/pull/413) - _Documentation_: License scan and report (@meganemura)
30
48
  - [#442](https://github.com/oauth-xx/oauth2/pull/442) - Option: `OAuth2::Client#initialize` - `:logger` (`::Logger.new($stdout)`) logger to use when OAUTH_DEBUG is enabled (for parity with `1-4-stable` branch) (@rthbound)
31
49
  - [#494](https://github.com/oauth-xx/oauth2/pull/494) - Support [OIDC 1.0 Private Key JWT](https://openid.net/specs/openid-connect-core-1_0.html#ClientAuthentication); based on the OAuth JWT assertion specification [(RFC 7523)](https://tools.ietf.org/html/rfc7523) (@SteveyblamWork)
32
- - [#549](https://github.com/oauth-xx/oauth2/pull/549) - Wrap `Faraday::ConnectionFailed` in `OAuth2::ConnectionFailed` (@nikkypx)
50
+ - [#549](https://github.com/oauth-xx/oauth2/pull/549) - Wrap `Faraday::ConnectionFailed` in `OAuth2::ConnectionError` (@nikkypx)
33
51
  - [#550](https://github.com/oauth-xx/oauth2/pull/550) - Raise error if location header not present when redirecting (@stanhu)
34
52
  - [#552](https://github.com/oauth-xx/oauth2/pull/552) - Add missing `version.rb` require (@ahorek)
35
53
  - [#553](https://github.com/oauth-xx/oauth2/pull/553) - Support `application/problem+json` format (@janz93)
@@ -76,6 +94,9 @@ and this project adheres to [Semantic Versioning v2](https://semver.org/spec/v2.
76
94
  - [#589](https://github.com/oauth-xx/oauth2/pull/589), [#593](https://github.com/oauth-xx/oauth2/pull/593) - Remove support for expired MAC token draft spec (@stanhu)
77
95
  - [#590](https://github.com/oauth-xx/oauth2/pull/590) - _Dependency_: Removed `multi_json` (@stanhu)
78
96
 
97
+ ## [1.4.10] - 2022-07-01
98
+ - FIPS Compatibility [#587](https://github.com/oauth-xx/oauth2/pull/587) (@akostadinov)
99
+
79
100
  ## [1.4.9] - 2022-02-20
80
101
  - Fixes compatibility with Faraday v2 [572](https://github.com/oauth-xx/oauth2/issues/572)
81
102
  - Includes supported versions of Faraday in test matrix:
@@ -86,7 +107,7 @@ and this project adheres to [Semantic Versioning v2](https://semver.org/spec/v2.
86
107
 
87
108
  ## [1.4.8] - 2022-02-18
88
109
  - MFA is now required to push new gem versions (@pboling)
89
- - README overhaul w/ new Ruby Verion and Engine compatibility policies (@pboling)
110
+ - README overhaul w/ new Ruby Version and Engine compatibility policies (@pboling)
90
111
  - [#569](https://github.com/oauth-xx/oauth2/pull/569) Backport fixes ([#561](https://github.com/oauth-xx/oauth2/pull/561) by @ryogift), and add more fixes, to allow faraday 1.x and 2.x (@jrochkind)
91
112
  - Improve Code Coverage tracking (Coveralls, CodeCov, CodeClimate), and enable branch coverage (@pboling)
92
113
  - Add CodeQL, Security Policy, Funding info (@pboling)
@@ -215,7 +236,6 @@ and this project adheres to [Semantic Versioning v2](https://semver.org/spec/v2.
215
236
 
216
237
  ## [0.0.4] + [0.0.3] + [0.0.2] + [0.0.1] - 2010-04-22
217
238
 
218
- [Unreleased]: https://github.com/oauth-xx/oauth2/compare/v2.0.0...HEAD
219
239
  [0.0.1]: https://github.com/oauth-xx/oauth2/compare/311d9f4...v0.0.1
220
240
  [0.0.2]: https://github.com/oauth-xx/oauth2/compare/v0.0.1...v0.0.2
221
241
  [0.0.3]: https://github.com/oauth-xx/oauth2/compare/v0.0.2...v0.0.3
@@ -251,6 +271,11 @@ and this project adheres to [Semantic Versioning v2](https://semver.org/spec/v2.
251
271
  [1.4.7]: https://github.com/oauth-xx/oauth2/compare/v1.4.6...v1.4.7
252
272
  [1.4.8]: https://github.com/oauth-xx/oauth2/compare/v1.4.7...v1.4.8
253
273
  [1.4.9]: https://github.com/oauth-xx/oauth2/compare/v1.4.8...v1.4.9
254
- [2.0.0]: https://github.com/oauth-xx/oauth2/compare/v1.4.9...v2.0.0
274
+ [1.4.10]: https://github.com/oauth-xx/oauth2/compare/v1.4.9...v1.4.10
275
+ [2.0.0]: https://github.com/oauth-xx/oauth2/compare/v1.4.10...v2.0.0
255
276
  [2.0.1]: https://github.com/oauth-xx/oauth2/compare/v2.0.0...v2.0.1
277
+ [2.0.2]: https://github.com/oauth-xx/oauth2/compare/v2.0.1...v2.0.2
278
+ [2.0.3]: https://github.com/oauth-xx/oauth2/compare/v2.0.2...v2.0.3
279
+ [2.0.4]: https://github.com/oauth-xx/oauth2/compare/v2.0.3...v2.0.4
280
+ [Unreleased]: https://github.com/oauth-xx/oauth2/compare/v2.0.4...HEAD
256
281
  [gemfiles/readme]: gemfiles/README.md
data/CONTRIBUTING.md CHANGED
@@ -1,4 +1,12 @@
1
- ## Submitting a Pull Request
1
+ ## Contributing
2
+
3
+ Bug reports and pull requests are welcome on GitHub at [https://github.com/oauth-xx/oauth2][source]
4
+ . This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to
5
+ the [code of conduct][conduct].
6
+
7
+ To submit a patch, please fork the project and create a patch with tests. Once you're happy with it send a pull request!
8
+
9
+ ## Detailed instructions on Submitting a Pull Request
2
10
  1. [Fork the repository.][fork]
3
11
  2. [Create a topic branch.][branch]
4
12
  3. Add specs for your unimplemented feature or bug fix.
@@ -16,3 +24,21 @@
16
24
  [fork]: http://help.github.com/fork-a-repo/
17
25
  [branch]: http://learn.github.com/p/branching.html
18
26
  [pr]: http://help.github.com/send-pull-requests/
27
+
28
+ ## Contributors
29
+
30
+ [![Contributors](https://contrib.rocks/image?repo=oauth-xx/oauth2)][contributors]
31
+
32
+ Made with [contributors-img][contrib-rocks].
33
+
34
+ [comment]: <> (Following links are used by README, CONTRIBUTING)
35
+
36
+ [conduct]: https://github.com/oauth-xx/oauth2/blob/master/CODE_OF_CONDUCT.md
37
+
38
+ [contrib-rocks]: https://contrib.rocks
39
+
40
+ [contributors]: https://github.com/oauth-xx/oauth2/graphs/contributors
41
+
42
+ [comment]: <> (Following links are used by README, CONTRIBUTING, Homepage)
43
+
44
+ [source]: https://github.com/oauth-xx/oauth2/
data/README.md CHANGED
@@ -22,8 +22,6 @@ See the sibling `oauth` gem for OAuth 1.0 implementations in Ruby.
22
22
 
23
23
  [oauth2-spec]: https://oauth.net/2/
24
24
  [sibling-gem]: https://github.com/oauth-xx/oauth-ruby
25
- [next-milestone-pct]: https://github.com/oauth-xx/oauth2/milestone/1
26
- [next-milestone-pct-img]: https://img.shields.io/github/milestones/progress-percent/oauth-xx/oauth2/1
27
25
 
28
26
  ## Release Documentation
29
27
 
@@ -34,7 +32,10 @@ See the sibling `oauth` gem for OAuth 1.0 implementations in Ruby.
34
32
 
35
33
  | Version | Release Date | Readme |
36
34
  |---------|--------------|----------------------------------------------------------|
37
- | 2.0.1 | 2022-06-22 | https://github.com/oauth-xx/oauth2/blob/master/README.md |
35
+ | 2.0.4 | 2022-07-01 | https://github.com/oauth-xx/oauth2/blob/v2.0.4/README.md |
36
+ | 2.0.3 | 2022-06-28 | https://github.com/oauth-xx/oauth2/blob/v2.0.3/README.md |
37
+ | 2.0.2 | 2022-06-24 | https://github.com/oauth-xx/oauth2/blob/v2.0.2/README.md |
38
+ | 2.0.1 | 2022-06-22 | https://github.com/oauth-xx/oauth2/blob/v2.0.1/README.md |
38
39
  | 2.0.0 | 2022-06-21 | https://github.com/oauth-xx/oauth2/blob/v2.0.0/README.md |
39
40
  </details>
40
41
 
@@ -43,18 +44,19 @@ See the sibling `oauth` gem for OAuth 1.0 implementations in Ruby.
43
44
  <details>
44
45
  <summary>1.4.x Readmes</summary>
45
46
 
46
- | Version | Release Date | Readme |
47
- |---------|--------------|----------------------------------------------------------|
48
- | 1.4.9 | Feb 20, 2022 | https://github.com/oauth-xx/oauth2/blob/v1.4.9/README.md |
49
- | 1.4.8 | Feb 18, 2022 | https://github.com/oauth-xx/oauth2/blob/v1.4.8/README.md |
50
- | 1.4.7 | Mar 19, 2021 | https://github.com/oauth-xx/oauth2/blob/v1.4.7/README.md |
51
- | 1.4.6 | Mar 19, 2021 | https://github.com/oauth-xx/oauth2/blob/v1.4.6/README.md |
52
- | 1.4.5 | Mar 18, 2021 | https://github.com/oauth-xx/oauth2/blob/v1.4.5/README.md |
53
- | 1.4.4 | Feb 12, 2020 | https://github.com/oauth-xx/oauth2/blob/v1.4.4/README.md |
54
- | 1.4.3 | Jan 29, 2020 | https://github.com/oauth-xx/oauth2/blob/v1.4.3/README.md |
55
- | 1.4.2 | Oct 1, 2019 | https://github.com/oauth-xx/oauth2/blob/v1.4.2/README.md |
56
- | 1.4.1 | Oct 13, 2018 | https://github.com/oauth-xx/oauth2/blob/v1.4.1/README.md |
57
- | 1.4.0 | Jun 9, 2017 | https://github.com/oauth-xx/oauth2/blob/v1.4.0/README.md |
47
+ | Version | Release Date | Readme |
48
+ |---------|--------------|-----------------------------------------------------------|
49
+ | 1.4.10 | Jul 1, 2022 | https://github.com/oauth-xx/oauth2/blob/v1.4.10/README.md |
50
+ | 1.4.9 | Feb 20, 2022 | https://github.com/oauth-xx/oauth2/blob/v1.4.9/README.md |
51
+ | 1.4.8 | Feb 18, 2022 | https://github.com/oauth-xx/oauth2/blob/v1.4.8/README.md |
52
+ | 1.4.7 | Mar 19, 2021 | https://github.com/oauth-xx/oauth2/blob/v1.4.7/README.md |
53
+ | 1.4.6 | Mar 19, 2021 | https://github.com/oauth-xx/oauth2/blob/v1.4.6/README.md |
54
+ | 1.4.5 | Mar 18, 2021 | https://github.com/oauth-xx/oauth2/blob/v1.4.5/README.md |
55
+ | 1.4.4 | Feb 12, 2020 | https://github.com/oauth-xx/oauth2/blob/v1.4.4/README.md |
56
+ | 1.4.3 | Jan 29, 2020 | https://github.com/oauth-xx/oauth2/blob/v1.4.3/README.md |
57
+ | 1.4.2 | Oct 1, 2019 | https://github.com/oauth-xx/oauth2/blob/v1.4.2/README.md |
58
+ | 1.4.1 | Oct 13, 2018 | https://github.com/oauth-xx/oauth2/blob/v1.4.1/README.md |
59
+ | 1.4.0 | Jun 9, 2017 | https://github.com/oauth-xx/oauth2/blob/v1.4.0/README.md |
58
60
  </details>
59
61
 
60
62
  <details>
@@ -106,15 +108,15 @@ appended indicators:
106
108
  ♻️ - URL needs to be updated from SASS integration. Find / Replace is insufficient.
107
109
  -->
108
110
 
109
- | | Project | bundle add oauth2 |
110
- |:----|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
111
- | 1️⃣ | name, license, docs | [![RubyGems.org][⛳️name-img]][⛳️gem] [![License: MIT][🖇src-license-img]][🖇src-license] [![FOSSA][🏘fossa-img]][🏘fossa] [![RubyDoc.info][🚎yard-img]][🚎yard] [![InchCI][🖐inch-ci-img]][🚎yard] |
112
- | 2️⃣ | version & activity | [![Gem Version][⛳️version-img]][⛳️gem] [![Total Downloads][🖇DL-total-img]][⛳️gem] [![Download Rank][🏘DL-rank-img]][⛳️gem] [![Source Code][🚎src-home-img]][🚎src-home] [![Open PRs][🖐prs-o-img]][🖐prs-o] [![Closed PRs][🧮prs-c-img]][🧮prs-c] [![Next Version][📗next-img]][📗next] |
113
- | 3️⃣ | maintanence & linting | [![Maintainability][⛳cclim-maint-img♻️]][⛳cclim-maint] [![Helpers][🖇triage-help-img]][🖇triage-help] [![Depfu][🏘depfu-img♻️]][🏘depfu♻️] [![Contributors][🚎contributors-img]][🚎contributors] [![Style][🖐style-wf-img]][🖐style-wf] [![Kloc Roll][🧮kloc-img]][🧮kloc] |
114
- | 4️⃣ | testing | [![Open Issues][⛳iss-o-img]][⛳iss-o] [![Closed Issues][🖇iss-c-img]][🖇iss-c] [![Supported][🏘sup-wf-img]][🏘sup-wf] [![Heads][🚎heads-wf-img]][🚎heads-wf] [![Unofficial Support][🖐uns-wf-img]][🖐uns-wf] [![MacOS][🧮mac-wf-img]][🧮mac-wf] [![Windows][📗win-wf-img]][📗win-wf] |
115
- | 5️⃣ | coverage & security | [![CodeClimate][⛳cclim-cov-img♻️]][⛳cclim-cov] [![CodeCov][🖇codecov-img♻️]][🖇codecov] [![Coveralls][🏘coveralls-img]][🏘coveralls] [![Security Policy][🚎sec-pol-img]][🚎sec-pol] [![CodeQL][🖐codeQL-img]][🖐codeQL] [![Code Coverage][🧮cov-wf-img]][🧮cov-wf] |
116
- | 6️⃣ | resources | [![Discussion][⛳gh-discussions-img]][⛳gh-discussions] [![Get help on Codementor][🖇codementor-img]][🖇codementor] [![Chat][🏘chat-img]][🏘chat] [![Blog][🚎blog-img]][🚎blog] [![Blog][🖐wiki-img]][🖐wiki] |
117
- | 7️⃣ | spread 💖 | [![Liberapay Patrons][⛳liberapay-img]][⛳liberapay] [![Sponsor Me][🖇sponsor-img]][🖇sponsor] [![Tweet @ Peter][🏘tweet-img]][🏘tweet] [🌏][aboutme] [👼][angelme] [💻][coderme] [🌹][politicme] |
111
+ | | Project | bundle add oauth2 |
112
+ |:----|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
113
+ | 1️⃣ | name, license, docs | [![RubyGems.org][⛳️name-img]][⛳️gem] [![License: MIT][🖇src-license-img]][🖇src-license] [![FOSSA][🏘fossa-img]][🏘fossa] [![RubyDoc.info][🚎yard-img]][🚎yard] [![InchCI][🖐inch-ci-img]][🚎yard] |
114
+ | 2️⃣ | version & activity | [![Gem Version][⛳️version-img]][⛳️gem] [![Total Downloads][🖇DL-total-img]][⛳️gem] [![Download Rank][🏘DL-rank-img]][⛳️gem] [![Source Code][🚎src-home-img]][🚎src-home] [![Open PRs][🖐prs-o-img]][🖐prs-o] [![Closed PRs][🧮prs-c-img]][🧮prs-c] [![Next Version][📗next-img♻️]][📗next♻️] |
115
+ | 3️⃣ | maintanence & linting | [![Maintainability][⛳cclim-maint-img♻️]][⛳cclim-maint] [![Helpers][🖇triage-help-img]][🖇triage-help] [![Depfu][🏘depfu-img♻️]][🏘depfu♻️] [![Contributors][🚎contributors-img]][🚎contributors] [![Style][🖐style-wf-img]][🖐style-wf] [![Kloc Roll][🧮kloc-img]][🧮kloc] |
116
+ | 4️⃣ | testing | [![Open Issues][⛳iss-o-img]][⛳iss-o] [![Closed Issues][🖇iss-c-img]][🖇iss-c] [![Supported][🏘sup-wf-img]][🏘sup-wf] [![Heads][🚎heads-wf-img]][🚎heads-wf] [![Unofficial Support][🖐uns-wf-img]][🖐uns-wf] [![MacOS][🧮mac-wf-img]][🧮mac-wf] [![Windows][📗win-wf-img]][📗win-wf] |
117
+ | 5️⃣ | coverage & security | [![CodeClimate][⛳cclim-cov-img♻️]][⛳cclim-cov] [![CodeCov][🖇codecov-img♻️]][🖇codecov] [![Coveralls][🏘coveralls-img]][🏘coveralls] [![Security Policy][🚎sec-pol-img]][🚎sec-pol] [![CodeQL][🖐codeQL-img]][🖐codeQL] [![Code Coverage][🧮cov-wf-img]][🧮cov-wf] |
118
+ | 6️⃣ | resources | [![Discussion][⛳gh-discussions-img]][⛳gh-discussions] [![Get help on Codementor][🖇codementor-img]][🖇codementor] [![Chat][🏘chat-img]][🏘chat] [![Blog][🚎blog-img]][🚎blog] [![Blog][🖐wiki-img]][🖐wiki] |
119
+ | 7️⃣ | spread 💖 | [![Liberapay Patrons][⛳liberapay-img]][⛳liberapay] [![Sponsor Me][🖇sponsor-img]][🖇sponsor] [![Tweet @ Peter][🏘tweet-img]][🏘tweet] [🌏][aboutme] [👼][angelme] [💻][coderme] |
118
120
 
119
121
  <!--
120
122
  The link tokens in the following sections should be kept ordered by the row and badge numbering scheme
@@ -141,10 +143,10 @@ The link tokens in the following sections should be kept ordered by the row and
141
143
  [🖐prs-o-img]: https://img.shields.io/github/issues-pr/oauth-xx/oauth2
142
144
  [🧮prs-c]: https://github.com/oauth-xx/oauth2/pulls?q=is%3Apr+is%3Aclosed
143
145
  [🧮prs-c-img]: https://img.shields.io/github/issues-pr-closed/oauth-xx/oauth2
144
- [📗next]: https://github.com/oauth-xx/oauth2/milestone/12
145
- [📗next-img]: https://img.shields.io/github/milestones/progress/oauth-xx/oauth2/12?label=Next%20Version
146
+ [📗next♻️]: https://github.com/oauth-xx/oauth2/milestone/15
147
+ [📗next-img♻️]: https://img.shields.io/github/milestones/progress/oauth-xx/oauth2/15?label=Next%20Version
146
148
 
147
- <!-- 3️⃣ maintanence & linting -->
149
+ <!-- 3️⃣ maintenance & linting -->
148
150
  [⛳cclim-maint]: https://codeclimate.com/github/oauth-xx/oauth2/maintainability
149
151
  [⛳cclim-maint-img♻️]: https://api.codeclimate.com/v1/badges/688c612528ff90a46955/maintainability
150
152
  [🖇triage-help]: https://www.codetriage.com/oauth-xx/oauth2
@@ -214,7 +216,6 @@ The link tokens in the following sections should be kept ordered by the row and
214
216
  [aboutme]: https://about.me/peter.boling
215
217
  [angelme]: https://angel.co/peter-boling
216
218
  [coderme]:http://coderwall.com/pboling
217
- [politicme]: https://nationalprogressiveparty.org
218
219
 
219
220
  ## Installation
220
221
 
@@ -230,7 +231,9 @@ If bundler is not being used to manage dependencies, install the gem by executin
230
231
 
231
232
  Available as part of the Tidelift Subscription.
232
233
 
233
- The maintainers of OAuth2 and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use. [Learn more.](https://tidelift.com/subscription/pkg/rubygems-oauth2?utm_source=rubygems-oauth2&utm_medium=referral&utm_campaign=enterprise)
234
+ The maintainers of OAuth2 and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use. [Learn more.][tidelift-ref]
235
+
236
+ [tidelift-ref]: https://tidelift.com/subscription/pkg/rubygems-oauth2?utm_source=rubygems-oauth2&utm_medium=referral&utm_campaign=enterprise
234
237
 
235
238
  ## Security contact information
236
239
 
@@ -290,13 +293,13 @@ fashion. If critical issues for a particular implementation exist at the time
290
293
  of a major release, support for that Ruby version may be dropped.
291
294
  </details>
292
295
 
293
- | | Ruby OAuth 2 Version | Maintenance Branch | Supported Officially | Supported Unofficially | Supported Incidentally |
294
- |:----|----------------------|--------------------|-------------------------|------------------------|------------------------|
295
- | 1️⃣ | 2.0.x | `master` | 2.7, 3.0, 3.1 | 2.5, 2.6 | 2.2, 2.3, 2.4 |
296
- | 2️⃣ | 1.4.x | `1-4-stable` | 2.5, 2.6, 2.7, 3.0, 3.1 | 2.1, 2.2, 2.3, 2.4 | 1.9, 2.0 |
297
- | 3️⃣ | older | N/A | Best of luck to you! | Please upgrade! | |
296
+ | | Ruby OAuth2 Version | Maintenance Branch | Supported Officially | Supported Unofficially | Supported Incidentally |
297
+ |:----|---------------------|--------------------|-------------------------|------------------------|------------------------|
298
+ | 1️⃣ | 2.0.x | `master` | 2.7, 3.0, 3.1 | 2.5, 2.6 | 2.2, 2.3, 2.4 |
299
+ | 2️⃣ | 1.4.x | `1-4-stable` | 2.5, 2.6, 2.7, 3.0, 3.1 | 2.1, 2.2, 2.3, 2.4 | 1.9, 2.0 |
300
+ | 3️⃣ | older | N/A | Best of luck to you! | Please upgrade! | |
298
301
 
299
- NOTE: The 1.4 series will only receive critical bug and security updates.
302
+ NOTE: The 1.4 series will only receive critical security updates.
300
303
  See [SECURITY.md][🚎sec-pol]
301
304
 
302
305
  ## Usage Examples
@@ -343,6 +346,31 @@ client.class.name
343
346
  # => OAuth2::Client
344
347
  ```
345
348
 
349
+ ### snake_case and indifferent access in Response#parsed
350
+
351
+ ```ruby
352
+ response = access.get('/api/resource', params: {'query_foo' => 'bar'})
353
+ # Even if the actual response is CamelCase. it will be made available as snaky:
354
+ JSON.parse(response.body) # => {"accessToken"=>"aaaaaaaa", "additionalData"=>"additional"}
355
+ response.parsed # => {"access_token"=>"aaaaaaaa", "additional_data"=>"additional"}
356
+ response.parsed.access_token # => "aaaaaaaa"
357
+ response.parsed[:access_token] # => "aaaaaaaa"
358
+ response.parsed.additional_data # => "additional"
359
+ response.parsed[:additional_data] # => "additional"
360
+ response.parsed.class.name # => OAuth2::SnakyHash (subclass of Hashie::Mash::Rash, from `rash_alt` gem)
361
+ ```
362
+
363
+ #### What if I hate snakes and/or indifference?
364
+
365
+ ```ruby
366
+ response = access.get('/api/resource', params: {'query_foo' => 'bar'}, snaky: false)
367
+ JSON.parse(response.body) # => {"accessToken"=>"aaaaaaaa", "additionalData"=>"additional"}
368
+ response.parsed # => {"accessToken"=>"aaaaaaaa", "additionalData"=>"additional"}
369
+ response.parsed['accessToken'] # => "aaaaaaaa"
370
+ response.parsed['additionalData'] # => "additional"
371
+ response.parsed.class.name # => Hash (just, regular old Hash)
372
+ ```
373
+
346
374
  <details>
347
375
  <summary>Debugging</summary>
348
376
 
@@ -373,7 +401,7 @@ The `AccessToken` methods `#get`, `#post`, `#put` and `#delete` and the generic
373
401
  will return an instance of the #OAuth2::Response class.
374
402
 
375
403
  This instance contains a `#parsed` method that will parse the response body and
376
- return a Hash if the `Content-Type` is `application/x-www-form-urlencoded` or if
404
+ return a Hash-like [`OAuth2::SnakyHash`](https://github.com/oauth-xx/oauth2/blob/master/lib/oauth2/snaky_hash.rb) if the `Content-Type` is `application/x-www-form-urlencoded` or if
377
405
  the body is a JSON object. It will return an Array if the body is a JSON
378
406
  array. Otherwise, it will return the original body string.
379
407
 
@@ -421,17 +449,17 @@ access = client.client_credentials.get_token
421
449
  # Client Assertion Strategy
422
450
  # see: https://tools.ietf.org/html/rfc7523
423
451
  claimset = {
424
- :iss => "http://localhost:3001",
425
- :aud => "http://localhost:8080/oauth2/token",
426
- :sub => "me@example.com",
427
- :exp => Time.now.utc.to_i + 3600
452
+ iss: 'http://localhost:3001',
453
+ aud: 'http://localhost:8080/oauth2/token',
454
+ sub: 'me@example.com',
455
+ exp: Time.now.utc.to_i + 3600,
428
456
  }
429
457
  assertion_params = [claimset, 'HS256', 'secret_key']
430
458
  access = client.assertion.get_token(assertion_params)
431
459
 
432
460
  # The `access` (i.e. access token) is then used like so:
433
461
  access.token # actual access_token string, if you need it somewhere
434
- access.get("/api/stuff") # making api calls with access token
462
+ access.get('/api/stuff') # making api calls with access token
435
463
  ```
436
464
 
437
465
  If you want to specify additional headers to be sent out with the
@@ -487,7 +515,15 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
487
515
 
488
516
  ## Contributing
489
517
 
490
- Bug reports and pull requests are welcome on GitHub at https://github.com/oauth-xx/oauth2. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
518
+ See [CONTRIBUTING.md][contributing]
519
+
520
+ [contributing]: https://github.com/oauth-xx/oauth2/blob/main/CONTRIBUTING.md
521
+
522
+ ## Contributors
523
+
524
+ [![Contributors](https://contrib.rocks/image?repo=oauth-xx/oauth2)]("https://github.com/oauth-xx/oauth2/graphs/contributors")
525
+
526
+ Made with [contributors-img](https://contrib.rocks).
491
527
 
492
528
  ## Code of Conduct
493
529
 
data/SECURITY.md CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  ## Supported Versions
4
4
 
5
- | Version | Supported |
6
- |--------------|-----------|
7
- | 2.0.<latest> | ✅ |
8
- | 1.4.<latest> | ✅ |
9
- | older | ⛔️ |
5
+ | Version | Supported |
6
+ |----------|---------------------------|
7
+ | 2.latest | ✅ |
8
+ | 1.latest | ✅ (security updates only) |
9
+ | older | ⛔️ |
10
10
 
11
11
  ## Reporting a Vulnerability
12
12
 
@@ -88,12 +88,12 @@ module OAuth2
88
88
  #
89
89
  # @return [AccessToken] a new AccessToken
90
90
  # @note options should be carried over to the new AccessToken
91
- def refresh(params = {}, access_token_opts = {}, access_token_class: self.class)
91
+ def refresh(params = {}, access_token_opts = {})
92
92
  raise('A refresh_token is not available') unless refresh_token
93
93
 
94
94
  params[:grant_type] = 'refresh_token'
95
95
  params[:refresh_token] = refresh_token
96
- new_token = @client.get_token(params, access_token_opts, access_token_class: access_token_class)
96
+ new_token = @client.get_token(params, access_token_opts)
97
97
  new_token.options = options
98
98
  new_token.refresh_token = refresh_token unless new_token.refresh_token
99
99
  new_token
@@ -114,7 +114,7 @@ module OAuth2
114
114
  # @param [Symbol] verb the HTTP request method
115
115
  # @param [String] path the HTTP URL path of the request
116
116
  # @param [Hash] opts the options to make the request with
117
- # @see Client#request
117
+ # @see Client#request
118
118
  def request(verb, path, opts = {}, &block)
119
119
  configure_authentication!(opts)
120
120
  @client.request(verb, path, opts, &block)
data/lib/oauth2/client.rb CHANGED
@@ -5,9 +5,11 @@ require 'logger'
5
5
 
6
6
  module OAuth2
7
7
  ConnectionError = Class.new(Faraday::ConnectionFailed)
8
+ TimeoutError = Class.new(Faraday::TimeoutError)
9
+
8
10
  # The OAuth2::Client class
9
11
  class Client # rubocop:disable Metrics/ClassLength
10
- RESERVED_PARAM_KEYS = %w[headers parse].freeze
12
+ RESERVED_PARAM_KEYS = %w[body headers params parse snaky].freeze
11
13
 
12
14
  attr_reader :id, :secret, :site
13
15
  attr_accessor :options
@@ -31,6 +33,7 @@ module OAuth2
31
33
  # @option options [Boolean] :raise_errors (true) whether or not to raise an OAuth2::Error on responses with 400+ status codes
32
34
  # @option options [Logger] :logger (::Logger.new($stdout)) which logger to use when OAUTH_DEBUG is enabled
33
35
  # @option options [Proc] :extract_access_token proc that takes the client and the response Hash and extracts the access token from the response (DEPRECATED)
36
+ # @option options [Class] :access_token_class [Class] class of access token for easier subclassing OAuth2::AccessToken, @version 2.0+
34
37
  # @yield [builder] The Faraday connection builder
35
38
  def initialize(client_id, client_secret, options = {}, &block)
36
39
  opts = options.dup
@@ -38,7 +41,7 @@ module OAuth2
38
41
  @secret = client_secret
39
42
  @site = opts.delete(:site)
40
43
  ssl = opts.delete(:ssl)
41
-
44
+ warn('OAuth2::Client#initialize argument `extract_access_token` will be removed in oauth2 v3. Refactor to use `access_token_class`.') if opts[:extract_access_token]
42
45
  @options = {
43
46
  authorize_url: 'oauth/authorize',
44
47
  token_url: 'oauth/token',
@@ -49,6 +52,7 @@ module OAuth2
49
52
  max_redirects: 5,
50
53
  raise_errors: true,
51
54
  logger: ::Logger.new($stdout),
55
+ access_token_class: AccessToken,
52
56
  }.merge(opts)
53
57
  @options[:connection_opts][:ssl] = ssl if ssl
54
58
  end
@@ -104,20 +108,10 @@ module OAuth2
104
108
  # @option opts [Boolean] :raise_errors whether or not to raise an OAuth2::Error on 400+ status
105
109
  # code response for this request. Will default to client option
106
110
  # @option opts [Symbol] :parse @see Response::initialize
107
- # @yield [req] The Faraday request
108
- def request(verb, url, opts = {})
109
- url = connection.build_url(url).to_s
110
-
111
- begin
112
- response = connection.run_request(verb, url, opts[:body], opts[:headers]) do |req|
113
- req.params.update(opts[:params]) if opts[:params]
114
- yield(req) if block_given?
115
- end
116
- rescue Faraday::ConnectionFailed => e
117
- raise ConnectionError, e
118
- end
119
-
120
- response = Response.new(response, parse: opts[:parse])
111
+ # @option opts [true, false] :snaky (true) @see Response::initialize
112
+ # @yield [req] @see Faraday::Connection#run_request
113
+ def request(verb, url, opts = {}, &block)
114
+ response = execute_request(verb, url, opts, &block)
121
115
 
122
116
  case response.status
123
117
  when 301, 302, 303, 307
@@ -153,12 +147,16 @@ module OAuth2
153
147
 
154
148
  # Initializes an AccessToken by making a request to the token endpoint
155
149
  #
156
- # @param params [Hash] a Hash of params for the token endpoint
150
+ # @param params [Hash] a Hash of params for the token endpoint, except:
151
+ # @option params [Symbol] :parse @see Response#initialize
152
+ # @option params [true, false] :snaky (true) @see Response#initialize
157
153
  # @param access_token_opts [Hash] access token options, to pass to the AccessToken object
158
154
  # @param extract_access_token [Proc] proc that extracts the access token from the response (DEPRECATED)
159
- # @param access_token_class [Class] class of access token for easier subclassing OAuth2::AccessToken, @version 2.0+
155
+ # @yield [req] @see Faraday::Connection#run_request
160
156
  # @return [AccessToken] the initialized AccessToken
161
- def get_token(params, access_token_opts = {}, extract_access_token = options[:extract_access_token], access_token_class: AccessToken)
157
+ def get_token(params, access_token_opts = {}, extract_access_token = nil, &block)
158
+ warn('OAuth2::Client#get_token argument `extract_access_token` will be removed in oauth2 v3. Refactor to use `access_token_class` on #initialize.') if extract_access_token
159
+ extract_access_token ||= options[:extract_access_token]
162
160
  params = params.map do |key, value|
163
161
  if RESERVED_PARAM_KEYS.include?(key)
164
162
  [key.to_sym, value]
@@ -167,20 +165,24 @@ module OAuth2
167
165
  end
168
166
  end.to_h
169
167
 
168
+ request_opts = {
169
+ raise_errors: options[:raise_errors],
170
+ parse: params.fetch(:parse, Response::DEFAULT_OPTIONS[:parse]),
171
+ snaky: params.fetch(:snaky, Response::DEFAULT_OPTIONS[:snaky]),
172
+ }
170
173
  params = authenticator.apply(params)
171
- opts = {raise_errors: options[:raise_errors], parse: params.delete(:parse)}
172
174
  headers = params.delete(:headers) || {}
173
175
  if options[:token_method] == :post
174
- opts[:body] = params
175
- opts[:headers] = {'Content-Type' => 'application/x-www-form-urlencoded'}
176
+ request_opts[:body] = params
177
+ request_opts[:headers] = {'Content-Type' => 'application/x-www-form-urlencoded'}
176
178
  else
177
- opts[:params] = params
178
- opts[:headers] = {}
179
+ request_opts[:params] = params
180
+ request_opts[:headers] = {}
179
181
  end
180
- opts[:headers].merge!(headers)
182
+ request_opts[:headers].merge!(headers)
181
183
  http_method = options[:token_method]
182
184
  http_method = :post if http_method == :post_with_query_string
183
- response = request(http_method, token_url, opts)
185
+ response = request(http_method, token_url, request_opts, &block)
184
186
 
185
187
  # In v1.4.x, the deprecated extract_access_token option retrieves the token from the response.
186
188
  # We preserve this behavior here, but a custom access_token_class that implements #from_hash
@@ -188,7 +190,7 @@ module OAuth2
188
190
  if extract_access_token
189
191
  parse_response_with_legacy_extract(response, access_token_opts, extract_access_token)
190
192
  else
191
- parse_response(response, access_token_opts, access_token_class)
193
+ parse_response(response, access_token_opts)
192
194
  end
193
195
  end
194
196
 
@@ -250,6 +252,26 @@ module OAuth2
250
252
 
251
253
  private
252
254
 
255
+ def execute_request(verb, url, opts = {})
256
+ url = connection.build_url(url).to_s
257
+
258
+ begin
259
+ response = connection.run_request(verb, url, opts[:body], opts[:headers]) do |req|
260
+ req.params.update(opts[:params]) if opts[:params]
261
+ yield(req) if block_given?
262
+ end
263
+ rescue Faraday::ConnectionFailed => e
264
+ raise ConnectionError, e
265
+ rescue Faraday::TimeoutError => e
266
+ raise TimeoutError, e
267
+ end
268
+
269
+ parse = opts.fetch(:parse, Response::DEFAULT_OPTIONS[:parse])
270
+ snaky = opts.fetch(:snaky, Response::DEFAULT_OPTIONS[:snaky])
271
+
272
+ Response.new(response, parse: parse, snaky: snaky)
273
+ end
274
+
253
275
  # Returns the authenticator object
254
276
  #
255
277
  # @return [Authenticator] the initialized Authenticator
@@ -270,7 +292,8 @@ module OAuth2
270
292
  nil
271
293
  end
272
294
 
273
- def parse_response(response, access_token_opts, access_token_class)
295
+ def parse_response(response, access_token_opts)
296
+ access_token_class = options[:access_token_class]
274
297
  data = response.parsed
275
298
 
276
299
  unless data.is_a?(Hash) && access_token_class.contains_token?(data)
@@ -7,6 +7,10 @@ require 'rack'
7
7
  module OAuth2
8
8
  # OAuth2::Response class
9
9
  class Response
10
+ DEFAULT_OPTIONS = {
11
+ parse: :automatic,
12
+ snaky: true,
13
+ }.freeze
10
14
  attr_reader :response
11
15
  attr_accessor :options
12
16
 
@@ -39,12 +43,17 @@ module OAuth2
39
43
  # Initializes a Response instance
40
44
  #
41
45
  # @param [Faraday::Response] response The Faraday response instance
42
- # @param [Hash] opts options in which to initialize the instance
43
- # @option opts [Symbol] :parse (:automatic) how to parse the response body. one of :query (for x-www-form-urlencoded),
46
+ # @param [Symbol] parse (:automatic) how to parse the response body. one of :query (for x-www-form-urlencoded),
44
47
  # :json, or :automatic (determined by Content-Type response header)
45
- def initialize(response, opts = {})
48
+ # @param [true, false] snaky (true) Convert @parsed to a snake-case,
49
+ # indifferent-access OAuth2::SnakyHash, which is a subclass of Hashie::Mash::Rash (from rash_alt gem)?
50
+ # @param [Hash] options all other options for initializing the instance
51
+ def initialize(response, parse: :automatic, snaky: true, **options)
46
52
  @response = response
47
- @options = {parse: :automatic}.merge(opts)
53
+ @options = {
54
+ parse: parse,
55
+ snaky: snaky,
56
+ }.merge(options)
48
57
  end
49
58
 
50
59
  # The HTTP response headers
@@ -81,7 +90,7 @@ module OAuth2
81
90
  end
82
91
  end
83
92
 
84
- @parsed = OAuth2::SnakyHash.new(@parsed) if @parsed.is_a?(Hash)
93
+ @parsed = OAuth2::SnakyHash.new(@parsed) if options[:snaky] && @parsed.is_a?(Hash)
85
94
 
86
95
  @parsed
87
96
  end
@@ -125,10 +134,14 @@ module OAuth2
125
134
  end
126
135
 
127
136
  OAuth2::Response.register_parser(:xml, ['text/xml', 'application/rss+xml', 'application/rdf+xml', 'application/atom+xml', 'application/xml']) do |body|
137
+ next body unless body.respond_to?(:to_str)
138
+
128
139
  MultiXml.parse(body)
129
140
  end
130
141
 
131
142
  OAuth2::Response.register_parser(:json, ['application/json', 'text/javascript', 'application/hal+json', 'application/vnd.collection+json', 'application/vnd.api+json', 'application/problem+json']) do |body|
143
+ next body unless body.respond_to?(:to_str)
144
+
132
145
  body = body.dup.force_encoding(::Encoding::ASCII_8BIT) if body.respond_to?(:force_encoding)
133
146
 
134
147
  ::JSON.parse(body)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OAuth2
4
4
  module Version
5
- VERSION = '2.0.1'.freeze
5
+ VERSION = '2.0.4'.freeze
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oauth2
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Boling
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2022-06-22 00:00:00.000000000 Z
13
+ date: 2022-07-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: faraday
@@ -112,14 +112,14 @@ dependencies:
112
112
  requirements:
113
113
  - - "~>"
114
114
  - !ruby/object:Gem::Version
115
- version: '1.0'
115
+ version: '1.1'
116
116
  type: :runtime
117
117
  prerelease: false
118
118
  version_requirements: !ruby/object:Gem::Requirement
119
119
  requirements:
120
120
  - - "~>"
121
121
  - !ruby/object:Gem::Version
122
- version: '1.0'
122
+ version: '1.1'
123
123
  - !ruby/object:Gem::Dependency
124
124
  name: addressable
125
125
  requirement: !ruby/object:Gem::Requirement
@@ -307,13 +307,24 @@ licenses:
307
307
  - MIT
308
308
  metadata:
309
309
  homepage_uri: https://github.com/oauth-xx/oauth2
310
- source_code_uri: https://github.com/oauth-xx/oauth2/tree/v2.0.1
311
- changelog_uri: https://github.com/oauth-xx/oauth2/blob/v2.0.1/CHANGELOG.md
310
+ source_code_uri: https://github.com/oauth-xx/oauth2/tree/v2.0.4
311
+ changelog_uri: https://github.com/oauth-xx/oauth2/blob/v2.0.4/CHANGELOG.md
312
312
  bug_tracker_uri: https://github.com/oauth-xx/oauth2/issues
313
- documentation_uri: https://www.rubydoc.info/gems/oauth2/2.0.1
313
+ documentation_uri: https://www.rubydoc.info/gems/oauth2/2.0.4
314
314
  wiki_uri: https://github.com/oauth-xx/oauth2/wiki
315
315
  rubygems_mfa_required: 'true'
316
- post_install_message:
316
+ post_install_message: |2+
317
+
318
+ You have installed oauth2 version OAuth2::Version, congratulations!
319
+
320
+ There are BREAKING changes, but most will not encounter them, and updating your code should be easy!
321
+
322
+ Please see:
323
+ • https://github.com/oauth-xx/oauth2#what-is-new-for-v20
324
+ • https://github.com/oauth-xx/oauth2/blob/master/CHANGELOG.md
325
+
326
+ Please report issues, and support the project! Thanks, |7eter l-|. l3oling
327
+
317
328
  rdoc_options: []
318
329
  require_paths:
319
330
  - lib