oauth2 1.4.7 → 2.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,100 +1,378 @@
1
- # OAuth2
1
+ <p align="center">
2
+ <a href="http://oauth.net/2/" target="_blank" rel="noopener">
3
+ <img src="https://github.com/oauth-xx/oauth2/raw/master/docs/images/logo/oauth2-logo-124px.png?raw=true" alt="OAuth 2.0 Logo by Chris Messina, CC BY-SA 3.0">
4
+ </a>
5
+ <a href="https://www.ruby-lang.org/" target="_blank" rel="noopener">
6
+ <img width="124px" src="https://github.com/oauth-xx/oauth2/raw/master/docs/images/logo/ruby-logo-198px.svg?raw=true" alt="Yukihiro Matsumoto, Ruby Visual Identity Team, CC BY-SA 2.5">
7
+ </a>
8
+ </p>
9
+
10
+ ## What
11
+
12
+ OAuth 2.0 is the industry-standard protocol for authorization.
13
+ OAuth 2.0 focuses on client developer simplicity while providing specific authorization flows for web applications,
14
+ desktop applications, mobile phones, and living room devices.
15
+ This is a RubyGem for implementing OAuth 2.0 clients and servers in Ruby applications.
16
+ See the sibling `oauth` gem for OAuth 1.0 implementations in Ruby.
2
17
 
3
- If you need the readme for a released version of the gem please find it below:
18
+ ---
19
+
20
+ * [OAuth 2.0 Spec][oauth2-spec]
21
+ * [oauth sibling gem][sibling-gem] for OAuth 1.0 implementations in Ruby.
22
+
23
+ [oauth2-spec]: https://oauth.net/2/
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
+
28
+ ## Release Documentation
29
+
30
+ ### Version 2.0.x
31
+
32
+ <details>
33
+ <summary>2.0.x Readmes</summary>
34
+
35
+ | Version | Release Date | Readme |
36
+ |---------|--------------|----------------------------------------------------------|
37
+ | 2.0.0 | Soon | https://github.com/oauth-xx/oauth2/blob/master/README.md |
38
+ </details>
39
+
40
+ ### Older Releases
41
+
42
+ <details>
43
+ <summary>1.4.x Readmes</summary>
44
+
45
+ | Version | Release Date | Readme |
46
+ |---------|--------------|----------------------------------------------------------|
47
+ | 1.4.9 | Feb 20, 2022 | https://github.com/oauth-xx/oauth2/blob/v1.4.9/README.md |
48
+ | 1.4.8 | Feb 18, 2022 | https://github.com/oauth-xx/oauth2/blob/v1.4.8/README.md |
49
+ | 1.4.7 | Mar 19, 2021 | https://github.com/oauth-xx/oauth2/blob/v1.4.7/README.md |
50
+ | 1.4.6 | Mar 19, 2021 | https://github.com/oauth-xx/oauth2/blob/v1.4.6/README.md |
51
+ | 1.4.5 | Mar 18, 2021 | https://github.com/oauth-xx/oauth2/blob/v1.4.5/README.md |
52
+ | 1.4.4 | Feb 12, 2020 | https://github.com/oauth-xx/oauth2/blob/v1.4.4/README.md |
53
+ | 1.4.3 | Jan 29, 2020 | https://github.com/oauth-xx/oauth2/blob/v1.4.3/README.md |
54
+ | 1.4.2 | Oct 1, 2019 | https://github.com/oauth-xx/oauth2/blob/v1.4.2/README.md |
55
+ | 1.4.1 | Oct 13, 2018 | https://github.com/oauth-xx/oauth2/blob/v1.4.1/README.md |
56
+ | 1.4.0 | Jun 9, 2017 | https://github.com/oauth-xx/oauth2/blob/v1.4.0/README.md |
57
+ </details>
58
+
59
+ <details>
60
+ <summary>1.3.x Readmes</summary>
4
61
 
5
62
  | Version | Release Date | Readme |
6
63
  |----------|--------------|----------------------------------------------------------|
7
- | 1.4.7 | Mar 18, 2021 | https://github.com/oauth-xx/oauth2/blob/v1.4.7/README.md |
8
- | 1.4.6 | Mar 18, 2021 | https://github.com/oauth-xx/oauth2/blob/v1.4.6/README.md |
9
- | 1.4.5 | Mar 18, 2021 | https://github.com/oauth-xx/oauth2/blob/v1.4.5/README.md |
10
- | 1.4.4 | Feb 12, 2020 | https://github.com/oauth-xx/oauth2/blob/v1.4.4/README.md |
11
- | 1.4.3 | Jan 29, 2020 | https://github.com/oauth-xx/oauth2/blob/v1.4.3/README.md |
12
- | 1.4.2 | Oct 1, 2019 | https://github.com/oauth-xx/oauth2/blob/v1.4.2/README.md |
13
- | 1.4.1 | Oct 13, 2018 | https://github.com/oauth-xx/oauth2/blob/v1.4.1/README.md |
14
- | 1.4.0 | Jun 9, 2017 | https://github.com/oauth-xx/oauth2/blob/v1.4.0/README.md |
15
64
  | 1.3.1 | Mar 3, 2017 | https://github.com/oauth-xx/oauth2/blob/v1.3.1/README.md |
16
65
  | 1.3.0 | Dec 27, 2016 | https://github.com/oauth-xx/oauth2/blob/v1.3.0/README.md |
66
+ </details>
67
+
68
+ <details>
69
+ <summary>&le;= 1.2.x Readmes (2016 and before)</summary>
70
+
71
+ | Version | Release Date | Readme |
72
+ |----------|--------------|----------------------------------------------------------|
17
73
  | 1.2.0 | Jun 30, 2016 | https://github.com/oauth-xx/oauth2/blob/v1.2.0/README.md |
18
74
  | 1.1.0 | Jan 30, 2016 | https://github.com/oauth-xx/oauth2/blob/v1.1.0/README.md |
19
75
  | 1.0.0 | May 23, 2014 | https://github.com/oauth-xx/oauth2/blob/v1.0.0/README.md |
20
76
  | < 1.0.0 | Find here | https://github.com/oauth-xx/oauth2/tags |
77
+ </details>
78
+
79
+ ## Status
80
+
81
+ <!--
82
+ Numbering rows and badges in each row as a visual "database" lookup,
83
+ as the table is extremely dense, and it can be very difficult to find anything
84
+ Putting one on each row here, to document the emoji that should be used, and for ease of copy/paste.
85
+
86
+ row #s:
87
+ 1️⃣
88
+ 2️⃣
89
+ 3️⃣
90
+ 4️⃣
91
+ 5️⃣
92
+ 6️⃣
93
+ 7️⃣
94
+
95
+ badge #s:
96
+ ⛳️
97
+ 🖇
98
+ 🏘
99
+ 🚎
100
+ 🖐
101
+ 🧮
102
+ 📗
103
+
104
+ appended indicators:
105
+ ♻️ - URL needs to be updated from SASS integration. Find / Replace is insufficient.
106
+ -->
107
+
108
+ | | Project | bundle add oauth2 |
109
+ |:----|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
110
+ | 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] |
111
+ | 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] |
112
+ | 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] |
113
+ | 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] |
114
+ | 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] |
115
+ | 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] |
116
+ | 7️⃣ | spread 💖 | [![Liberapay Patrons][⛳liberapay-img]][⛳liberapay] [![Sponsor Me][🖇sponsor-img]][🖇sponsor] [![Tweet @ Peter][🏘tweet-img]][🏘tweet] [🌏][aboutme] [👼][angelme] [💻][coderme] [🌹][politicme] |
117
+
118
+ <!--
119
+ The link tokens in the following sections should be kept ordered by the row and badge numbering scheme
120
+ -->
121
+
122
+ <!-- 1️⃣ name, license, docs -->
123
+ [⛳️gem]: https://rubygems.org/gems/oauth2
124
+ [⛳️name-img]: https://img.shields.io/badge/name-oauth2-brightgreen.svg?style=flat
125
+ [🖇src-license]: https://opensource.org/licenses/MIT
126
+ [🖇src-license-img]: https://img.shields.io/badge/License-MIT-green.svg
127
+ [🏘fossa]: https://app.fossa.io/projects/git%2Bgithub.com%2Foauth-xx%2Foauth2?ref=badge_shield
128
+ [🏘fossa-img]: https://app.fossa.io/api/projects/git%2Bgithub.com%2Foauth-xx%2Foauth2.svg?type=shield
129
+ [🚎yard]: https://www.rubydoc.info/github/oauth-xx/oauth2
130
+ [🚎yard-img]: https://img.shields.io/badge/documentation-rubydoc-brightgreen.svg?style=flat
131
+ [🖐inch-ci-img]: http://inch-ci.org/github/oauth-xx/oauth2.png
132
+
133
+ <!-- 2️⃣ version & activity -->
134
+ [⛳️version-img]: http://img.shields.io/gem/v/oauth2.svg
135
+ [🖇DL-total-img]: https://img.shields.io/gem/dt/oauth2.svg
136
+ [🏘DL-rank-img]: https://img.shields.io/gem/rt/oauth2.svg
137
+ [🚎src-home]: https://github.com/oauth-xx/oauth2
138
+ [🚎src-home-img]: https://img.shields.io/badge/source-github-brightgreen.svg?style=flat
139
+ [🖐prs-o]: https://github.com/oauth-xx/oauth2/pulls
140
+ [🖐prs-o-img]: https://img.shields.io/github/issues-pr/oauth-xx/oauth2
141
+ [🧮prs-c]: https://github.com/oauth-xx/oauth2/pulls?q=is%3Apr+is%3Aclosed
142
+ [🧮prs-c-img]: https://img.shields.io/github/issues-pr-closed/oauth-xx/oauth2
143
+ [📗next]: https://github.com/oauth-xx/oauth2/milestone/1
144
+ [📗next-img]: https://img.shields.io/github/milestones/progress/oauth-xx/oauth2/1?label=Next%20Version
145
+
146
+ <!-- 3️⃣ maintanence & linting -->
147
+ [⛳cclim-maint]: https://codeclimate.com/github/oauth-xx/oauth2/maintainability
148
+ [⛳cclim-maint-img♻️]: https://api.codeclimate.com/v1/badges/688c612528ff90a46955/maintainability
149
+ [🖇triage-help]: https://www.codetriage.com/oauth-xx/oauth2
150
+ [🖇triage-help-img]: https://www.codetriage.com/oauth-xx/oauth2/badges/users.svg
151
+ [🏘depfu♻️]: https://depfu.com/github/oauth-xx/oauth2?project_id=4445
152
+ [🏘depfu-img♻️]: https://badges.depfu.com/badges/6d34dc1ba682bbdf9ae2a97848241743/count.svg
153
+ [🚎contributors]: https://github.com/oauth-xx/oauth2/graphs/contributors
154
+ [🚎contributors-img]: https://img.shields.io/github/contributors-anon/oauth-xx/oauth2
155
+ [🖐style-wf]: https://github.com/oauth-xx/oauth2/actions/workflows/style.yml
156
+ [🖐style-wf-img]: https://github.com/oauth-xx/oauth2/actions/workflows/style.yml/badge.svg
157
+ [🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
158
+ [🧮kloc-img]: https://img.shields.io/tokei/lines/github.com/oauth-xx/oauth2
159
+
160
+ <!-- 4️⃣ testing -->
161
+ [⛳iss-o]: https://github.com/oauth-xx/oauth2/issues
162
+ [⛳iss-o-img]: https://img.shields.io/github/issues-raw/oauth-xx/oauth2
163
+ [🖇iss-c]: https://github.com/oauth-xx/oauth2/issues?q=is%3Aissue+is%3Aclosed
164
+ [🖇iss-c-img]: https://img.shields.io/github/issues-closed-raw/oauth-xx/oauth2
165
+ [🏘sup-wf]: https://github.com/oauth-xx/oauth2/actions/workflows/supported.yml
166
+ [🏘sup-wf-img]: https://github.com/oauth-xx/oauth2/actions/workflows/supported.yml/badge.svg
167
+ [🚎heads-wf]: https://github.com/oauth-xx/oauth2/actions/workflows/heads.yml
168
+ [🚎heads-wf-img]: https://github.com/oauth-xx/oauth2/actions/workflows/heads.yml/badge.svg
169
+ [🖐uns-wf]: https://github.com/oauth-xx/oauth2/actions/workflows/unsupported.yml
170
+ [🖐uns-wf-img]: https://github.com/oauth-xx/oauth2/actions/workflows/unsupported.yml/badge.svg
171
+ [🧮mac-wf]: https://github.com/oauth-xx/oauth2/actions/workflows/macos.yml
172
+ [🧮mac-wf-img]: https://github.com/oauth-xx/oauth2/actions/workflows/macos.yml/badge.svg
173
+ [📗win-wf]: https://github.com/oauth-xx/oauth2/actions/workflows/windows.yml
174
+ [📗win-wf-img]: https://github.com/oauth-xx/oauth2/actions/workflows/windows.yml/badge.svg
175
+
176
+ <!-- 5️⃣ coverage & security -->
177
+ [⛳cclim-cov]: https://codeclimate.com/github/oauth-xx/oauth2/test_coverage
178
+ [⛳cclim-cov-img♻️]: https://api.codeclimate.com/v1/badges/688c612528ff90a46955/test_coverage
179
+ [🖇codecov-img♻️]: https://codecov.io/gh/oauth-xx/oauth2/branch/master/graph/badge.svg?token=bNqSzNiuo2
180
+ [🖇codecov]: https://codecov.io/gh/oauth-xx/oauth2
181
+ [🏘coveralls]: https://coveralls.io/github/oauth-xx/oauth2?branch=master
182
+ [🏘coveralls-img]: https://coveralls.io/repos/github/oauth-xx/oauth2/badge.svg?branch=master
183
+ [🚎sec-pol]: https://github.com/oauth-xx/oauth2/blob/master/SECURITY.md
184
+ [🚎sec-pol-img]: https://img.shields.io/badge/security-policy-brightgreen.svg?style=flat
185
+ [🖐codeQL]: https://github.com/oauth-xx/oauth2/security/code-scanning
186
+ [🖐codeQL-img]: https://github.com/oauth-xx/oauth2/actions/workflows/codeql-analysis.yml/badge.svg
187
+ [🧮cov-wf]: https://github.com/oauth-xx/oauth2/actions/workflows/coverage.yml
188
+ [🧮cov-wf-img]: https://github.com/oauth-xx/oauth2/actions/workflows/coverage.yml/badge.svg
189
+
190
+ <!-- 6️⃣ resources -->
191
+ [⛳gh-discussions]: https://github.com/oauth-xx/oauth2/discussions
192
+ [⛳gh-discussions-img]: https://img.shields.io/github/discussions/oauth-xx/oauth2
193
+ [🖇codementor]: https://www.codementor.io/peterboling?utm_source=github&utm_medium=button&utm_term=peterboling&utm_campaign=github
194
+ [🖇codementor-img]: https://cdn.codementor.io/badges/get_help_github.svg
195
+ [🏘chat]: https://gitter.im/oauth-xx/oauth2
196
+ [🏘chat-img]: https://img.shields.io/gitter/room/oauth-xx/oauth2.svg
197
+ [🚎blog]: http://www.railsbling.com/tags/oauth2/
198
+ [🚎blog-img]: https://img.shields.io/badge/blog-railsbling-brightgreen.svg?style=flat
199
+ [🖐wiki]: https://github.com/oauth-xx/oauth2/wiki
200
+ [🖐wiki-img]: https://img.shields.io/badge/wiki-examples-brightgreen.svg?style=flat
201
+
202
+ <!-- 7️⃣ spread 💖 -->
203
+ [⛳liberapay-img]: https://img.shields.io/liberapay/patrons/pboling.svg?logo=liberapay
204
+ [⛳liberapay]: https://liberapay.com/pboling/donate
205
+ [🖇sponsor-img]: https://img.shields.io/badge/sponsor-pboling.svg?style=social&logo=github
206
+ [🖇sponsor]: https://github.com/sponsors/pboling
207
+ [🏘tweet-img]: https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow
208
+ [🏘tweet]: http://twitter.com/galtzo
209
+
210
+ <!-- Maintainer Contact Links -->
211
+ [railsbling]: http://www.railsbling.com
212
+ [peterboling]: http://www.peterboling.com
213
+ [aboutme]: https://about.me/peter.boling
214
+ [angelme]: https://angel.co/peter-boling
215
+ [coderme]:http://coderwall.com/pboling
216
+ [politicme]: https://nationalprogressiveparty.org
21
217
 
22
- [![Gem Version](http://img.shields.io/gem/v/oauth2.svg)][gem]
23
- [![Total Downloads](https://img.shields.io/gem/dt/oauth2.svg)][gem]
24
- [![Downloads Today](https://img.shields.io/gem/rt/oauth2.svg)][gem]
25
- [![Build Status](https://travis-ci.org/oauth-xx/oauth2.svg?branch=1-4-stable)][travis]
26
- [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Foauth-xx%2Foauth2%2Fbadge&style=flat)][github-actions]
27
- [![Test Coverage](https://api.codeclimate.com/v1/badges/688c612528ff90a46955/test_coverage)][codeclimate-coverage]
28
- [![Maintainability](https://api.codeclimate.com/v1/badges/688c612528ff90a46955/maintainability)][codeclimate-maintainability]
29
- [![Depfu](https://badges.depfu.com/badges/6d34dc1ba682bbdf9ae2a97848241743/count.svg)][depfu]
30
- [![Open Source Helpers](https://www.codetriage.com/oauth-xx/oauth2/badges/users.svg)][code-triage]
31
- [![Chat](https://img.shields.io/gitter/room/oauth-xx/oauth2.svg)](https://gitter.im/oauth-xx/oauth2)
32
- [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)][source-license]
33
- [![Documentation](http://inch-ci.org/github/oauth-xx/oauth2.png)][inch-ci]
34
-
35
- [gem]: https://rubygems.org/gems/oauth2
36
- [travis]: http://travis-ci.org/oauth-xx/oauth2
37
- [github-actions]: https://actions-badge.atrox.dev/oauth-xx/oauth2/goto
38
- [coveralls]: https://coveralls.io/r/oauth-xx/oauth2
39
- [codeclimate-maintainability]: https://codeclimate.com/github/oauth-xx/oauth2/maintainability
40
- [codeclimate-coverage]: https://codeclimate.com/github/oauth-xx/oauth2/test_coverage
41
- [depfu]: https://depfu.com/github/oauth-xx/oauth2
42
- [source-license]: https://opensource.org/licenses/MIT
43
- [inch-ci]: http://inch-ci.org/github/oauth-xx/oauth2
44
- [code-triage]: https://www.codetriage.com/oauth-xx/oauth2
45
- [fossa1]: https://app.fossa.io/projects/git%2Bgithub.com%2Foauth-xx%2Foauth2?ref=badge_shield
46
-
47
- A Ruby wrapper for the [OAuth 2.0 specification][oauth2-spec].
218
+ ## Installation
48
219
 
49
- [oauth2-spec]: https://oauth.net/2/
220
+ Install the gem and add to the application's Gemfile by executing:
50
221
 
51
- ## Installation
222
+ $ bundle add oauth2
52
223
 
53
- Add this line to your application's Gemfile:
224
+ If bundler is not being used to manage dependencies, install the gem by executing:
54
225
 
55
- ```ruby
56
- gem 'oauth2'
57
- ```
226
+ $ gem install oauth2
58
227
 
59
- And then execute:
228
+ ## OAuth2 for Enterprise
60
229
 
61
- $ bundle
230
+ Available as part of the Tidelift Subscription.
62
231
 
63
- Or install it yourself as:
232
+ 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)
64
233
 
65
- $ gem install oauth2
234
+ ## Security contact information
66
235
 
67
- ## Resources
236
+ To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security).
237
+ Tidelift will coordinate the fix and disclosure.
68
238
 
69
- * [View Source on GitHub][code]
70
- * [Report Issues on GitHub][issues]
71
- * [Read More at the Wiki][wiki]
239
+ For more see [SECURITY.md][🚎sec-pol].
72
240
 
73
- [code]: https://github.com/oauth-xx/oauth2
74
- [issues]: https://github.com/oauth-xx/oauth2/issues
75
- [wiki]: https://wiki.github.com/oauth-xx/oauth2
241
+ ## What is new for v2.0 (unreleased, `master` branch)?
242
+
243
+ - Officially support Ruby versions >= 2.7
244
+ - Unofficially support Ruby versions >= 2.5
245
+ - Incidentally support Ruby versions >= 2.2
246
+ - Drop support for the expired MAC Draft (all versions)
247
+ - Support IETF rfc7523 JWT Bearer Tokens
248
+ - Support IETF rfc7231 Relative Location in Redirect
249
+ - Support IETF rfc6749 Don't set oauth params when nil
250
+ - 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)
251
+ - Support new formats, including from [jsonapi.org](http://jsonapi.org/format/): `application/vdn.api+json`, `application/vnd.collection+json`, `application/hal+json`, `application/problem+json`
252
+ - Adds new option to `OAuth2::Client#get_token`:
253
+ - `:access_token_class` (`AccessToken`); user specified class to use for all calls to `get_token`
254
+ - Adds new option to `OAuth2::AccessToken#initialize`:
255
+ - `:expires_latency` (`nil`); number of seconds by which AccessToken validity will be reduced to offset latency
256
+ - [... A lot more](https://github.com/oauth-xx/oauth2/blob/master/CHANGELOG.md#unreleased)
257
+
258
+ ## Compatibility
259
+
260
+ Targeted ruby compatibility is non-EOL versions of Ruby, currently 2.7, 3.0 and
261
+ 3.1. Compatibility is further distinguished by supported and unsupported versions of Ruby.
262
+ Ruby is limited to 2.2+ for 2.x releases. See `1-4-stable` branch for older rubies.
263
+
264
+ <details>
265
+ <summary>Ruby Engine Compatibility Policy</summary>
266
+
267
+ This gem is tested against MRI, JRuby, and Truffleruby.
268
+ Each of those has varying versions that target a specific version of MRI Ruby.
269
+ This gem should work in the just-listed Ruby engines according to the targeted MRI compatibility in the table below.
270
+ If you would like to add support for additional engines,
271
+ first make sure Github Actions supports the engine,
272
+ then submit a PR to the correct maintenance branch as according to the table below.
273
+ </details>
274
+
275
+ <details>
276
+ <summary>Ruby Version Compatibility Policy</summary>
277
+
278
+ If something doesn't work on one of these interpreters, it's a bug.
279
+
280
+ This library may inadvertently work (or seem to work) on other Ruby
281
+ implementations, however support will only be provided for the versions listed
282
+ above.
283
+
284
+ If you would like this library to support another Ruby version, you may
285
+ volunteer to be a maintainer. Being a maintainer entails making sure all tests
286
+ run and pass on that implementation. When something breaks on your
287
+ implementation, you will be responsible for providing patches in a timely
288
+ fashion. If critical issues for a particular implementation exist at the time
289
+ of a major release, support for that Ruby version may be dropped.
290
+ </details>
291
+
292
+ | | Ruby OAuth 2 Version | Maintenance Branch | Supported Officially | Supported Unofficially | Supported Incidentally |
293
+ |:----|----------------------|--------------------|-------------------------|------------------------|------------------------|
294
+ | 1️⃣ | 2.0.x (unreleased) | `master` | 2.7, 3.0, 3.1 | 2.5, 2.6 | 2.2, 2.3, 2.4 |
295
+ | 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 |
296
+ | 3️⃣ | older | N/A | Best of luck to you! | Please upgrade! | |
297
+
298
+ NOTE: The 1.4 series will only receive critical bug and security updates.
299
+ See [SECURITY.md][🚎sec-pol]
76
300
 
77
301
  ## Usage Examples
78
302
 
303
+ ### `authorize_url` and `token_url` are on site root (Just Works!)
304
+
79
305
  ```ruby
80
306
  require 'oauth2'
81
- client = OAuth2::Client.new('client_id', 'client_secret', :site => 'https://example.org')
307
+ client = OAuth2::Client.new('client_id', 'client_secret', site: 'https://example.org')
308
+ # => #<OAuth2::Client:0x00000001204c8288 @id="client_id", @secret="client_sec...
309
+ client.auth_code.authorize_url(redirect_uri: 'http://localhost:8080/oauth2/callback')
310
+ # => "https://example.org/oauth/authorize?client_id=client_id&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Foauth2%2Fcallback&response_type=code"
82
311
 
83
- client.auth_code.authorize_url(:redirect_uri => 'http://localhost:8080/oauth2/callback')
84
- # => "https://example.org/oauth/authorization?response_type=code&client_id=client_id&redirect_uri=http://localhost:8080/oauth2/callback"
85
-
86
- token = client.auth_code.get_token('authorization_code_value', :redirect_uri => 'http://localhost:8080/oauth2/callback', :headers => {'Authorization' => 'Basic some_password'})
87
- response = token.get('/api/resource', :params => {'query_foo' => 'bar'})
312
+ token = client.auth_code.get_token('authorization_code_value', redirect_uri: 'http://localhost:8080/oauth2/callback', headers: {'Authorization' => 'Basic some_password'})
313
+ response = token.get('/api/resource', params: {'query_foo' => 'bar'})
88
314
  response.class.name
89
315
  # => OAuth2::Response
90
316
  ```
317
+
318
+ ### Relative `authorize_url` and `token_url` (Not on site root, Just Works!)
319
+
320
+ In above example, the default Authorization URL is `oauth/authorize` and default Access Token URL is `oauth/token`, and, as they are missing a leading `/`, both are relative.
321
+
322
+ ```ruby
323
+ client = OAuth2::Client.new('client_id', 'client_secret', site: 'https://example.org/nested/directory/on/your/server')
324
+ # => #<OAuth2::Client:0x00000001204c8288 @id="client_id", @secret="client_sec...
325
+ client.auth_code.authorize_url(redirect_uri: 'http://localhost:8080/oauth2/callback')
326
+ # => "https://example.org/nested/directory/on/your/server/oauth/authorize?client_id=client_id&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Foauth2%2Fcallback&response_type=code"
327
+ ```
328
+
329
+ ### Customize `authorize_url` and `token_url`
330
+
331
+ You can specify custom URLs for authorization and access token, and when using a leading `/` they will _not be relative_, as shown below:
332
+
333
+ ```ruby
334
+ client = OAuth2::Client.new('client_id', 'client_secret',
335
+ site: 'https://example.org/nested/directory/on/your/server',
336
+ authorize_url: '/jaunty/authorize/',
337
+ token_url: '/stirrups/access_token')
338
+ # => #<OAuth2::Client:0x00000001204c8288 @id="client_id", @secret="client_sec...
339
+ client.auth_code.authorize_url(redirect_uri: 'http://localhost:8080/oauth2/callback')
340
+ # => "https://example.org/jaunty/authorize/?client_id=client_id&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Foauth2%2Fcallback&response_type=code"
341
+ client.class.name
342
+ # => OAuth2::Client
343
+ ```
344
+
345
+ <details>
346
+ <summary>Debugging</summary>
347
+
348
+ Set an environment variable, however you would [normally do that](https://github.com/bkeepers/dotenv).
349
+
350
+ ```ruby
351
+ # will log both request and response, including bodies
352
+ ENV['OAUTH_DEBUG'] = 'true'
353
+ ```
354
+
355
+ By default, debug output will go to `$stdout`. This can be overridden when
356
+ initializing your OAuth2::Client.
357
+
358
+ ```ruby
359
+ require 'oauth2'
360
+ client = OAuth2::Client.new(
361
+ 'client_id',
362
+ 'client_secret',
363
+ site: 'https://example.org',
364
+ logger: Logger.new('example.log', 'weekly')
365
+ )
366
+ ```
367
+ </details>
368
+
91
369
  ## OAuth2::Response
92
370
 
93
- The AccessToken methods #get, #post, #put and #delete and the generic #request
371
+ The `AccessToken` methods `#get`, `#post`, `#put` and `#delete` and the generic `#request`
94
372
  will return an instance of the #OAuth2::Response class.
95
373
 
96
- This instance contains a #parsed method that will parse the response body and
97
- return a Hash if the Content-Type is application/x-www-form-urlencoded or if
374
+ This instance contains a `#parsed` method that will parse the response body and
375
+ return a Hash if the `Content-Type` is `application/x-www-form-urlencoded` or if
98
376
  the body is a JSON object. It will return an Array if the body is a JSON
99
377
  array. Otherwise, it will return the original body string.
100
378
 
@@ -104,33 +382,33 @@ respective methods.
104
382
  ## OAuth2::AccessToken
105
383
 
106
384
  If you have an existing Access Token for a user, you can initialize an instance
107
- using various class methods including the standard new, from_hash (if you have
108
- a hash of the values), or from_kvform (if you have an
109
- application/x-www-form-urlencoded encoded string of the values).
385
+ using various class methods including the standard new, `from_hash` (if you have
386
+ a hash of the values), or `from_kvform` (if you have an
387
+ `application/x-www-form-urlencoded` encoded string of the values).
110
388
 
111
389
  ## OAuth2::Error
112
390
 
113
- On 400+ status code responses, an OAuth2::Error will be raised. If it is a
114
- standard OAuth2 error response, the body will be parsed and #code and #description will contain the values provided from the error and
115
- error_description parameters. The #response property of OAuth2::Error will
116
- always contain the OAuth2::Response instance.
391
+ On 400+ status code responses, an `OAuth2::Error` will be raised. If it is a
392
+ standard OAuth2 error response, the body will be parsed and `#code` and `#description` will contain the values provided from the error and
393
+ `error_description` parameters. The `#response` property of `OAuth2::Error` will
394
+ always contain the `OAuth2::Response` instance.
117
395
 
118
- If you do not want an error to be raised, you may use :raise_errors => false
119
- option on initialization of the client. In this case the OAuth2::Response
396
+ If you do not want an error to be raised, you may use `:raise_errors => false`
397
+ option on initialization of the client. In this case the `OAuth2::Response`
120
398
  instance will be returned as usual and on 400+ status code responses, the
121
- Response instance will contain the OAuth2::Error instance.
399
+ Response instance will contain the `OAuth2::Error` instance.
122
400
 
123
401
  ## Authorization Grants
124
402
 
125
403
  Currently the Authorization Code, Implicit, Resource Owner Password Credentials, Client Credentials, and Assertion
126
404
  authentication grant types have helper strategy classes that simplify client
127
- use. They are available via the #auth_code, #implicit, #password, #client_credentials, and #assertion methods respectively.
405
+ use. They are available via the `#auth_code`, `#implicit`, `#password`, `#client_credentials`, and `#assertion` methods respectively.
128
406
 
129
407
  ```ruby
130
- auth_url = client.auth_code.authorize_url(:redirect_uri => 'http://localhost:8080/oauth/callback')
131
- token = client.auth_code.get_token('code_value', :redirect_uri => 'http://localhost:8080/oauth/callback')
408
+ auth_url = client.auth_code.authorize_url(redirect_uri: 'http://localhost:8080/oauth/callback')
409
+ token = client.auth_code.get_token('code_value', redirect_uri: 'http://localhost:8080/oauth/callback')
132
410
 
133
- auth_url = client.implicit.authorize_url(:redirect_uri => 'http://localhost:8080/oauth/callback')
411
+ auth_url = client.implicit.authorize_url(redirect_uri: 'http://localhost:8080/oauth/callback')
134
412
  # get the token params in the callback and
135
413
  token = OAuth2::AccessToken.from_kvform(client, query_string)
136
414
 
@@ -145,59 +423,12 @@ If you want to specify additional headers to be sent out with the
145
423
  request, add a 'headers' hash under 'params':
146
424
 
147
425
  ```ruby
148
- token = client.auth_code.get_token('code_value', :redirect_uri => 'http://localhost:8080/oauth/callback', :headers => {'Some' => 'Header'})
426
+ token = client.auth_code.get_token('code_value', redirect_uri: 'http://localhost:8080/oauth/callback', headers: {'Some' => 'Header'})
149
427
  ```
150
428
 
151
- You can always use the #request method on the OAuth2::Client instance to make
429
+ You can always use the `#request` method on the `OAuth2::Client` instance to make
152
430
  requests for tokens for any Authentication grant type.
153
431
 
154
- ## Supported Ruby Versions
155
-
156
- This library aims to support and is [tested against][travis] the following Ruby
157
- implementations:
158
-
159
- ### Rubies with support ending at Oauth2 1.x
160
-
161
- * Ruby 1.9.3
162
- - [JRuby 1.7][jruby-1.7] (targets MRI v1.9)
163
-
164
- * Ruby 2.0.0
165
- - [JRuby 9.0][jruby-9.0] (targets MRI v2.0)
166
- * Ruby 2.1
167
-
168
- ---
169
-
170
- ### Rubies with continued support past Oauth2 2.x
171
-
172
- * Ruby 2.2 - Support ends with version 2.x series
173
- * Ruby 2.3 - Support ends with version 3.x series
174
- - [JRuby 9.1][jruby-9.1] (targets MRI v2.3)
175
- * Ruby 2.4 - Support ends with version 4.x series
176
- * Ruby 2.5 - Support ends with version 5.x series
177
- - [JRuby 9.2][jruby-9.2] (targets MRI v2.5)
178
- - [truffleruby][truffleruby] (targets MRI 2.5)
179
- * Ruby 2.6 - Support ends with version 6.x series
180
- * Ruby 2.7 - Support ends with version 7.x series
181
-
182
- [jruby-1.7]: https://www.jruby.org/2017/05/11/jruby-1-7-27.html
183
- [jruby-9.0]: https://www.jruby.org/2016/01/26/jruby-9-0-5-0.html
184
- [jruby-9.1]: https://www.jruby.org/2017/05/16/jruby-9-1-9-0.html
185
- [jruby-9.2]: https://www.jruby.org/2018/05/24/jruby-9-2-0-0.html
186
- [truffleruby]: https://github.com/oracle/truffleruby
187
-
188
- If something doesn't work on one of these interpreters, it's a bug.
189
-
190
- This library may inadvertently work (or seem to work) on other Ruby
191
- implementations, however support will only be provided for the versions listed
192
- above.
193
-
194
- If you would like this library to support another Ruby version, you may
195
- volunteer to be a maintainer. Being a maintainer entails making sure all tests
196
- run and pass on that implementation. When something breaks on your
197
- implementation, you will be responsible for providing patches in a timely
198
- fashion. If critical issues for a particular implementation exist at the time
199
- of a major release, support for that Ruby version may be dropped.
200
-
201
432
  ## Versioning
202
433
 
203
434
  This library aims to adhere to [Semantic Versioning 2.0.0][semver].
@@ -213,7 +444,7 @@ dependency on this gem using the [Pessimistic Version Constraint][pvc] with two
213
444
  For example:
214
445
 
215
446
  ```ruby
216
- spec.add_dependency 'oauth2', '~> 1.4'
447
+ spec.add_dependency 'oauth2', '~> 2.0'
217
448
  ```
218
449
 
219
450
  [semver]: http://semver.org/
@@ -221,21 +452,21 @@ spec.add_dependency 'oauth2', '~> 1.4'
221
452
 
222
453
  ## License
223
454
 
224
- [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)][source-license]
455
+ [![License: MIT][🖇src-license-img]][🖇src-license]
225
456
 
226
457
  - Copyright (c) 2011-2013 Michael Bleigh and Intridea, Inc.
227
- - Copyright (c) 2017-2018 [oauth-xx organization][oauth-xx]
458
+ - Copyright (c) 2017-2022 [oauth-xx organization][oauth-xx]
228
459
  - See [LICENSE][license] for details.
229
460
 
230
461
  [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Foauth-xx%2Foauth2.svg?type=large)][fossa2]
231
462
 
232
- [license]: LICENSE
463
+ [license]: https://github.com/oauth-xx/oauth2/blob/master/LICENSE
233
464
  [oauth-xx]: https://github.com/oauth-xx
234
465
  [fossa2]: https://app.fossa.io/projects/git%2Bgithub.com%2Foauth-xx%2Foauth2?ref=badge_large
235
466
 
236
467
  ## Development
237
468
 
238
- After checking out the repo, run `bundle install` to install dependencies. Then, run `rake spec` to run the tests.
469
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
239
470
 
240
471
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
241
472
 
data/SECURITY.md ADDED
@@ -0,0 +1,14 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ | Version | Supported |
6
+ |--------------|-----------|
7
+ | 2.0.<latest> | ✅ |
8
+ | 1.4.<latest> | ✅ |
9
+ | older | ⛔️ |
10
+
11
+ ## Reporting a Vulnerability
12
+
13
+ To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security).
14
+ Tidelift will coordinate the fix and disclosure.