oauth2 1.4.10 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +76 -30
- data/README.md +120 -74
- data/SECURITY.md +5 -11
- data/lib/oauth2/access_token.rb +28 -19
- data/lib/oauth2/authenticator.rb +9 -4
- data/lib/oauth2/client.rb +76 -60
- data/lib/oauth2/error.rb +27 -18
- data/lib/oauth2/response.rb +61 -19
- data/lib/oauth2/snaky_hash.rb +8 -0
- data/lib/oauth2/strategy/assertion.rb +63 -38
- data/lib/oauth2/strategy/auth_code.rb +12 -1
- data/lib/oauth2/strategy/implicit.rb +7 -0
- data/lib/oauth2/version.rb +1 -59
- data/lib/oauth2.rb +19 -1
- metadata +75 -60
- data/lib/oauth2/mac_token.rb +0 -130
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bd40b127f03fb47d5d897e4dd917ef3530fe06a863ce40485d3e9d02db32bc7
|
4
|
+
data.tar.gz: 331dd1ee11d2e9490372c8c2106ca3492c9e743b066510ba3b111c7c0e8c5834
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33a5d808e3388045e441fb386793cfdd69264af585f0582e044f59a736276dbe3d84c9f98be77cc5d0b9f29c3cc569c61721dfd5816d2654b57f6170213ed8a1
|
7
|
+
data.tar.gz: 9be4ba6cf11c62156b2f25fae2f04fb556166f4cbb7b8997d46af525968519073fcd6380008a2cc45ddb38986e0267becd7dfcc4f8f23560c437a2ce6f3be348
|
data/CHANGELOG.md
CHANGED
@@ -1,16 +1,78 @@
|
|
1
|
-
#
|
1
|
+
# Changelog
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
-
|
4
|
+
The format (since v2) is based on [Keep a Changelog v1](https://keepachangelog.com/en/1.0.0/),
|
5
|
+
and this project adheres to [Semantic Versioning v2](https://semver.org/spec/v2.0.0.html).
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
-
|
7
|
+
## [2.0.0.rc3] - 2022-06-16
|
8
|
+
### Added
|
9
|
+
- [#158](https://github.com/oauth-xx/oauth2/pull/158), [#344](https://github.com/oauth-xx/oauth2/pull/344) - Optionally pass raw response to parsers (@niels)
|
10
|
+
- [#190](https://github.com/oauth-xx/oauth2/pull/190), [#332](https://github.com/oauth-xx/oauth2/pull/332), [#334](https://github.com/oauth-xx/oauth2/pull/334), [#335](https://github.com/oauth-xx/oauth2/pull/335), [#360](https://github.com/oauth-xx/oauth2/pull/360), [#426](https://github.com/oauth-xx/oauth2/pull/426), [#427](https://github.com/oauth-xx/oauth2/pull/427), [#461](https://github.com/oauth-xx/oauth2/pull/461) - Documentation (@josephpage, @pboling, @meganemura, @joshRpowell, @elliotcm)
|
11
|
+
- [#220](https://github.com/oauth-xx/oauth2/pull/220) - Support IETF rfc7523 JWT Bearer Tokens Draft 04+ (@jhmoore)
|
12
|
+
- [#298](https://github.com/oauth-xx/oauth2/pull/298) - Set the response object on the access token on Client#get_token for debugging (@cpetschnig)
|
13
|
+
- [#305](https://github.com/oauth-xx/oauth2/pull/305) - Option: `OAuth2::Client#get_token` - `:access_token_class` (`AccessToken`); user specified class to use for all calls to `get_token` (@styd)
|
14
|
+
- [#346](https://github.com/oauth-xx/oauth2/pull/571) - Modern gem structure (@pboling)
|
15
|
+
- [#351](https://github.com/oauth-xx/oauth2/pull/351) - Support Jruby 9k (@pboling)
|
16
|
+
- [#362](https://github.com/oauth-xx/oauth2/pull/362) - Support SemVer release version scheme (@pboling)
|
17
|
+
- [#363](https://github.com/oauth-xx/oauth2/pull/363) - New method `OAuth2::AccessToken#refresh!` same as old `refresh`, with backwards compatibility alias (@pboling)
|
18
|
+
- [#364](https://github.com/oauth-xx/oauth2/pull/364) - Support `application/hal+json` format (@pboling)
|
19
|
+
- [#365](https://github.com/oauth-xx/oauth2/pull/365) - Support `application/vnd.collection+json` format (@pboling)
|
20
|
+
- [#376](https://github.com/oauth-xx/oauth2/pull/376) - _Documentation_: Example / Test for Google 2-legged JWT (@jhmoore)
|
21
|
+
- [#381](https://github.com/oauth-xx/oauth2/pull/381) - Spec for extra header params on client credentials (@nikz)
|
22
|
+
- [#394](https://github.com/oauth-xx/oauth2/pull/394) - Option: `OAuth2::AccessToken#initialize` - `:expires_latency` (`nil`); number of seconds by which AccessToken validity will be reduced to offset latency (@klippx)
|
23
|
+
- [#412](https://github.com/oauth-xx/oauth2/pull/412) - Support `application/vdn.api+json` format (from jsonapi.org) (@david-christensen)
|
24
|
+
- [#413](https://github.com/oauth-xx/oauth2/pull/413) - _Documentation_: License scan and report (@meganemura)
|
25
|
+
- [#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)
|
26
|
+
- [#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)
|
27
|
+
- [#549](https://github.com/oauth-xx/oauth2/pull/549) - Wrap `Faraday::ConnectionFailed` in `OAuth2::ConnectionFailed` (@nikkypx)
|
28
|
+
- [#550](https://github.com/oauth-xx/oauth2/pull/550) - Raise error if location header not present when redirecting (@stanhu)
|
29
|
+
- [#552](https://github.com/oauth-xx/oauth2/pull/552) - Add missing `version.rb` require (@ahorek)
|
30
|
+
- [#553](https://github.com/oauth-xx/oauth2/pull/553) - Support `application/problem+json` format (@janz93)
|
31
|
+
- [#560](https://github.com/oauth-xx/oauth2/pull/560) - Support IETF rfc6749, section 2.3.1 - don't set auth params when `nil` (@bouk)
|
32
|
+
- [#571](https://github.com/oauth-xx/oauth2/pull/571) - Support Ruby 3.1 (@pboling)
|
33
|
+
- [#575](https://github.com/oauth-xx/oauth2/pull/575) - Support IETF rfc7231, section 7.1.2 - relative location in redirect (@pboling)
|
34
|
+
- [#581](https://github.com/oauth-xx/oauth2/pull/581) - _Documentation_: of breaking changes (@pboling)
|
35
|
+
### Changed
|
36
|
+
- [#191](https://github.com/oauth-xx/oauth2/pull/191) - **BREAKING**: Token is expired if `expired_at` time is `now` (@davestevens)
|
37
|
+
- [#312](https://github.com/oauth-xx/oauth2/pull/312) - **BREAKING**: Set `:basic_auth` as default for `:auth_scheme` instead of `:request_body`. This was default behavior before 1.3.0. (@tetsuya, @wy193777)
|
38
|
+
- [#317](https://github.com/oauth-xx/oauth2/pull/317) - _Dependency_: Upgrade `jwt` to 2.x.x (@travisofthenorth)
|
39
|
+
- [#338](https://github.com/oauth-xx/oauth2/pull/338) - _Dependency_: Switch from `Rack::Utils.escape` to `CGI.escape` (@josephpage)
|
40
|
+
- [#339](https://github.com/oauth-xx/oauth2/pull/339), [#368](https://github.com/oauth-xx/oauth2/pull/368), [#424](https://github.com/oauth-xx/oauth2/pull/424), [#479](https://github.com/oauth-xx/oauth2/pull/479), [#493](https://github.com/oauth-xx/oauth2/pull/493), [#539](https://github.com/oauth-xx/oauth2/pull/539), [#542](https://github.com/oauth-xx/oauth2/pull/542), [#553](https://github.com/oauth-xx/oauth2/pull/553) - CI Updates, code coverage, linting, spelling, type fixes, New VERSION constant (@pboling, @josephpage, @ahorek)
|
41
|
+
- [#410](https://github.com/oauth-xx/oauth2/pull/410) - **BREAKING**: Removed the ability to call .error from an OAuth2::Response object (@jhmoore)
|
42
|
+
- [#414](https://github.com/oauth-xx/oauth2/pull/414) - Use Base64.strict_encode64 instead of custom internal logic (@meganemura)
|
43
|
+
- [#489](https://github.com/oauth-xx/oauth2/pull/489) - **BREAKING**: Default value for option `OAuth2::Client` - `:authorize_url` removed leading slash to work with relative paths by default (`'oauth/authorize'`) (@ghost)
|
44
|
+
- [#489](https://github.com/oauth-xx/oauth2/pull/489) - **BREAKING**: Default value for option `OAuth2::Client` - `:token_url` removed leading slash to work with relative paths by default (`'oauth/token'`) (@ghost)
|
45
|
+
- [#576](https://github.com/oauth-xx/oauth2/pull/576) - **BREAKING**: Stop rescuing parsing errors (@pboling)
|
46
|
+
- [#591](https://github.com/oauth-xx/oauth2/pull/576) - _DEPRECATION_: `OAuth2::Client` - `:extract_access_token` option is deprecated
|
47
|
+
### Fixed
|
48
|
+
- [#158](https://github.com/oauth-xx/oauth2/pull/158), [#344](https://github.com/oauth-xx/oauth2/pull/344) - Handling of errors when using `omniauth-facebook` (@niels)
|
49
|
+
- [#294](https://github.com/oauth-xx/oauth2/pull/294) - Fix: "Unexpected middleware set" issue with Faraday when `OAUTH_DEBUG=true` (@spectator, @gafrom)
|
50
|
+
- [#300](https://github.com/oauth-xx/oauth2/pull/300) - _Documentation_: `Oauth2::Error` - Error codes are strings, not symbols (@NobodysNightmare)
|
51
|
+
- [#318](https://github.com/oauth-xx/oauth2/pull/318), [#326](https://github.com/oauth-xx/oauth2/pull/326), [#343](https://github.com/oauth-xx/oauth2/pull/343), [#347](https://github.com/oauth-xx/oauth2/pull/347), [#397](https://github.com/oauth-xx/oauth2/pull/397), [#464](https://github.com/oauth-xx/oauth2/pull/464), [#561](https://github.com/oauth-xx/oauth2/pull/561), [#565](https://github.com/oauth-xx/oauth2/pull/565) - _Dependency_: Support all versions of `faraday` (see [gemfiles/README.md][gemfiles/readme] for compatibility matrix with Ruby engines & versions) (@pboling, @raimondasv, @zacharywelch, @Fudoshiki, @ryogift, @sj26, @jdelStrother)
|
52
|
+
- [#322](https://github.com/oauth-xx/oauth2/pull/322), [#331](https://github.com/oauth-xx/oauth2/pull/331), [#337](https://github.com/oauth-xx/oauth2/pull/337), [#361](https://github.com/oauth-xx/oauth2/pull/361), [#371](https://github.com/oauth-xx/oauth2/pull/371), [#377](https://github.com/oauth-xx/oauth2/pull/377), [#383](https://github.com/oauth-xx/oauth2/pull/383), [#392](https://github.com/oauth-xx/oauth2/pull/392), [#395](https://github.com/oauth-xx/oauth2/pull/395), [#400](https://github.com/oauth-xx/oauth2/pull/400), [#401](https://github.com/oauth-xx/oauth2/pull/401), [#403](https://github.com/oauth-xx/oauth2/pull/403), [#415](https://github.com/oauth-xx/oauth2/pull/415), [#567](https://github.com/oauth-xx/oauth2/pull/567) - Updated Rubocop, Rubocop plugins and improved code style (@pboling, @bquorning, @lautis, @spectator)
|
53
|
+
- [#328](https://github.com/oauth-xx/oauth2/pull/328) - _Documentation_: Homepage URL is SSL (@amatsuda)
|
54
|
+
- [#339](https://github.com/oauth-xx/oauth2/pull/339), [#479](https://github.com/oauth-xx/oauth2/pull/479) - Update testing infrastructure for all supported Rubies (@pboling and @josephpage)
|
55
|
+
- [#366](https://github.com/oauth-xx/oauth2/pull/366) - **Security**: Fix logging to `$stdout` of request and response bodies via Faraday's logger and `ENV["OAUTH_DEBUG"] == 'true'` (@pboling)
|
56
|
+
- [#380](https://github.com/oauth-xx/oauth2/pull/380) - Fix: Stop attempting to encode non-encodable objects in `Oauth2::Error` (@jhmoore)
|
57
|
+
- [#399](https://github.com/oauth-xx/oauth2/pull/399) - Fix: Stop duplicating `redirect_uri` in `get_token` (@markus)
|
58
|
+
- [#410](https://github.com/oauth-xx/oauth2/pull/410) - Fix: `SystemStackError` caused by circular reference between Error and Response classes (@jhmoore)
|
59
|
+
- [#460](https://github.com/oauth-xx/oauth2/pull/460) - Fix: Stop throwing errors when `raise_errors` is set to `false`; analog of [#524](https://github.com/oauth-xx/oauth2/pull/524) for `1-4-stable` branch (@joaolrpaulo)
|
60
|
+
- [#472](https://github.com/oauth-xx/oauth2/pull/472) - **Security**: Add checks to enforce `client_secret` is *never* passed in authorize_url query params for `implicit` and `auth_code` grant types (@dfockler)
|
61
|
+
- [#482](https://github.com/oauth-xx/oauth2/pull/482) - _Documentation_: Update last of `intridea` links to `oauth-xx` (@pboling)
|
62
|
+
- [#536](https://github.com/oauth-xx/oauth2/pull/536) - **Security**: Compatibility with more (and recent) Ruby OpenSSL versions, Github Actions, Rubocop updated, analogous to [#535](https://github.com/oauth-xx/oauth2/pull/535) on `1-4-stable` branch (@pboling)
|
63
|
+
- [#595](https://github.com/oauth-xx/oauth2/pull/595) - Graceful handling of empty responses from `Client#get_token`, respecting `:raise_errors` config (@stanhu)
|
64
|
+
- [#596](https://github.com/oauth-xx/oauth2/pull/596) - Consistency between `AccessToken#refresh` and `Client#get_token` named arguments (@stanhu)
|
65
|
+
- [#598](https://github.com/oauth-xx/oauth2/pull/598) - Fix unparseable data not raised as error in `Client#get_token`, respecting `:raise_errors` config (@stanhu)
|
66
|
+
### Removed
|
67
|
+
- [#341](https://github.com/oauth-xx/oauth2/pull/341) - Remove Rdoc & Jeweler related files (@josephpage)
|
68
|
+
- [#342](https://github.com/oauth-xx/oauth2/pull/342) - **BREAKING**: Dropped support for Ruby 1.8 (@josephpage)
|
69
|
+
- [#539](https://github.com/oauth-xx/oauth2/pull/539) - Remove reliance on globally included OAuth2 in tests, analog of [#538](https://github.com/oauth-xx/oauth2/pull/538) for 1-4-stable (@anderscarling)
|
70
|
+
- [#566](https://github.com/oauth-xx/oauth2/pull/566) - _Dependency_: Removed `wwtd` (@bquorning)
|
71
|
+
- [#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)
|
72
|
+
- [#590](https://github.com/oauth-xx/oauth2/pull/590) - _Dependency_: Removed `multi_json` (@stanhu)
|
10
73
|
|
11
74
|
## [1.4.9] - 2022-02-20
|
12
|
-
|
13
|
-
- Fixes compatibility with Faraday v2 [#572](https://github.com/oauth-xx/oauth2/issues/572)
|
75
|
+
- Fixes compatibility with Faraday v2 [572](https://github.com/oauth-xx/oauth2/issues/572)
|
14
76
|
- Includes supported versions of Faraday in test matrix:
|
15
77
|
- Faraday ~> 2.2.0 with Ruby >= 2.6
|
16
78
|
- Faraday ~> 1.10 with Ruby >= 2.4
|
@@ -18,9 +80,8 @@ All notable changes to this project will be documented in this file.
|
|
18
80
|
- Add Windows and MacOS to test matrix
|
19
81
|
|
20
82
|
## [1.4.8] - 2022-02-18
|
21
|
-
|
22
83
|
- MFA is now required to push new gem versions (@pboling)
|
23
|
-
- README overhaul w/ new Ruby
|
84
|
+
- README overhaul w/ new Ruby Verion and Engine compatibility policies (@pboling)
|
24
85
|
- [#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)
|
25
86
|
- Improve Code Coverage tracking (Coveralls, CodeCov, CodeClimate), and enable branch coverage (@pboling)
|
26
87
|
- Add CodeQL, Security Policy, Funding info (@pboling)
|
@@ -28,40 +89,33 @@ All notable changes to this project will be documented in this file.
|
|
28
89
|
- [#543](https://github.com/oauth-xx/oauth2/pull/543) - Support for more modern Open SSL libraries (@pboling)
|
29
90
|
|
30
91
|
## [1.4.7] - 2021-03-19
|
31
|
-
|
32
92
|
- [#541](https://github.com/oauth-xx/oauth2/pull/541) - Backport fix to expires_at handling [#533](https://github.com/oauth-xx/oauth2/pull/533) to 1-4-stable branch. (@dobon)
|
33
93
|
|
34
94
|
## [1.4.6] - 2021-03-19
|
35
|
-
|
36
95
|
- [#540](https://github.com/oauth-xx/oauth2/pull/540) - Add VERSION constant (@pboling)
|
37
96
|
- [#537](https://github.com/oauth-xx/oauth2/pull/537) - Fix crash in OAuth2::Client#get_token (@anderscarling)
|
38
|
-
- [#538](https://github.com/oauth-xx/oauth2/pull/538) - Remove reliance on globally included OAuth2 in tests
|
97
|
+
- [#538](https://github.com/oauth-xx/oauth2/pull/538) - Remove reliance on globally included OAuth2 in tests, analogous to [#539](https://github.com/oauth-xx/oauth2/pull/539) on master branch (@anderscarling)
|
39
98
|
|
40
99
|
## [1.4.5] - 2021-03-18
|
41
|
-
|
42
|
-
- [#535](https://github.com/oauth-xx/oauth2/pull/535) - Compatibility with range of supported Ruby OpenSSL versions, Rubocop updates, Github Actions (@pboling)
|
100
|
+
- [#535](https://github.com/oauth-xx/oauth2/pull/535) - Compatibility with range of supported Ruby OpenSSL versions, Rubocop updates, Github Actions, analogous to [#536](https://github.com/oauth-xx/oauth2/pull/536) on master branch (@pboling)
|
43
101
|
- [#518](https://github.com/oauth-xx/oauth2/pull/518) - Add extract_access_token option to OAuth2::Client (@jonspalmer)
|
44
102
|
- [#507](https://github.com/oauth-xx/oauth2/pull/507) - Fix camel case content type, response keys (@anvox)
|
45
103
|
- [#500](https://github.com/oauth-xx/oauth2/pull/500) - Fix YARD documentation formatting (@olleolleolle)
|
46
104
|
|
47
105
|
## [1.4.4] - 2020-02-12
|
48
|
-
|
49
106
|
- [#408](https://github.com/oauth-xx/oauth2/pull/408) - Fixed expires_at for formatted time (@Lomey)
|
50
107
|
|
51
108
|
## [1.4.3] - 2020-01-29
|
52
|
-
|
53
109
|
- [#483](https://github.com/oauth-xx/oauth2/pull/483) - add project metadata to gemspec (@orien)
|
54
110
|
- [#495](https://github.com/oauth-xx/oauth2/pull/495) - support additional types of access token requests (@SteveyblamFreeagent, @thomcorley, @dgholz)
|
55
111
|
- Adds support for private_key_jwt and tls_client_auth
|
56
112
|
- [#433](https://github.com/oauth-xx/oauth2/pull/433) - allow field names with square brackets and numbers in params (@asm256)
|
57
113
|
|
58
114
|
## [1.4.2] - 2019-10-01
|
59
|
-
|
60
115
|
- [#478](https://github.com/oauth-xx/oauth2/pull/478) - support latest version of faraday & fix build (@pboling)
|
61
|
-
-
|
116
|
+
- Officially support Ruby 2.6 and truffleruby
|
62
117
|
|
63
118
|
## [1.4.1] - 2018-10-13
|
64
|
-
|
65
119
|
- [#417](https://github.com/oauth-xx/oauth2/pull/417) - update jwt dependency (@thewoolleyman)
|
66
120
|
- [#419](https://github.com/oauth-xx/oauth2/pull/419) - remove rubocop dependency (temporary, added back in [#423](https://github.com/oauth-xx/oauth2/pull/423)) (@pboling)
|
67
121
|
- [#418](https://github.com/oauth-xx/oauth2/pull/418) - update faraday dependency (@pboling)
|
@@ -88,19 +142,16 @@ All notable changes to this project will be documented in this file.
|
|
88
142
|
[jruby-9.2]: https://www.jruby.org/2018/05/24/jruby-9-2-0-0.html
|
89
143
|
|
90
144
|
## [1.4.0] - 2017-06-09
|
91
|
-
|
92
145
|
- Drop Ruby 1.8.7 support (@sferik)
|
93
146
|
- Fix some RuboCop offenses (@sferik)
|
94
147
|
- _Dependency_: Remove Yardstick (@sferik)
|
95
148
|
- _Dependency_: Upgrade Faraday to 0.12 (@sferik)
|
96
149
|
|
97
150
|
## [1.3.1] - 2017-03-03
|
98
|
-
|
99
151
|
- Add support for Ruby 2.4.0 (@pschambacher)
|
100
152
|
- _Dependency_: Upgrade Faraday to Faraday 0.11 (@mcfiredrill, @rhymes, @pschambacher)
|
101
153
|
|
102
154
|
## [1.3.0] - 2016-12-28
|
103
|
-
|
104
155
|
- Add support for header-based authentication to the `Client` so it can be used across the library (@bjeanes)
|
105
156
|
- Default to header-based authentication when getting a token from an authorisation code (@maletor)
|
106
157
|
- **Breaking**: Allow an `auth_scheme` (`:basic_auth` or `:request_body`) to be set on the client, defaulting to `:request_body` to maintain backwards compatibility (@maletor, @bjeanes)
|
@@ -110,24 +161,20 @@ All notable changes to this project will be documented in this file.
|
|
110
161
|
- Add support for Faraday 0.10 (@rhymes)
|
111
162
|
|
112
163
|
## [1.2.0] - 2016-07-01
|
113
|
-
|
114
164
|
- Properly handle encoding of error responses (so we don't blow up, for example, when Google's response includes a ∞) (@Motoshi-Nishihira)
|
115
165
|
- Make a copy of the options hash in `AccessToken#from_hash` to avoid accidental mutations (@Linuus)
|
116
166
|
- Use `raise` rather than `fail` to throw exceptions (@sferik)
|
117
167
|
|
118
168
|
## [1.1.0] - 2016-01-30
|
119
|
-
|
120
169
|
- Various refactors (eliminating `Hash#merge!` usage in `AccessToken#refresh!`, use `yield` instead of `#call`, freezing mutable objects in constants, replacing constants with class variables) (@sferik)
|
121
170
|
- Add support for Rack 2, and bump various other dependencies (@sferik)
|
122
171
|
|
123
172
|
## [1.0.0] - 2014-07-09
|
124
|
-
|
125
173
|
### Added
|
126
174
|
- Add an implementation of the MAC token spec.
|
127
175
|
|
128
176
|
### Fixed
|
129
177
|
- Fix Base64.strict_encode64 incompatibility with Ruby 1.8.7.
|
130
|
-
|
131
178
|
## [0.5.0] - 2011-07-29
|
132
179
|
|
133
180
|
### Changed
|
@@ -163,7 +210,7 @@ All notable changes to this project will be documented in this file.
|
|
163
210
|
|
164
211
|
## [0.0.4] + [0.0.3] + [0.0.2] + [0.0.1] - 2010-04-22
|
165
212
|
|
166
|
-
|
213
|
+
[Unreleased]: https://github.com/oauth-xx/oauth2/compare/v1.4.9...HEAD
|
167
214
|
[0.0.1]: https://github.com/oauth-xx/oauth2/compare/311d9f4...v0.0.1
|
168
215
|
[0.0.2]: https://github.com/oauth-xx/oauth2/compare/v0.0.1...v0.0.2
|
169
216
|
[0.0.3]: https://github.com/oauth-xx/oauth2/compare/v0.0.2...v0.0.3
|
@@ -199,5 +246,4 @@ All notable changes to this project will be documented in this file.
|
|
199
246
|
[1.4.7]: https://github.com/oauth-xx/oauth2/compare/v1.4.6...v1.4.7
|
200
247
|
[1.4.8]: https://github.com/oauth-xx/oauth2/compare/v1.4.7...v1.4.8
|
201
248
|
[1.4.9]: https://github.com/oauth-xx/oauth2/compare/v1.4.8...v1.4.9
|
202
|
-
[
|
203
|
-
[unreleased]: https://github.com/oauth-xx/oauth2/compare/v1.4.10...HEAD
|
249
|
+
[gemfiles/readme]: gemfiles/README.md
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
<p align="center">
|
2
|
-
<a href="http://oauth.net/2/" target="_blank" rel="noopener
|
2
|
+
<a href="http://oauth.net/2/" target="_blank" rel="noopener">
|
3
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
4
|
</a>
|
5
|
-
<a href="https://www.ruby-lang.org/" target="_blank" rel="noopener
|
5
|
+
<a href="https://www.ruby-lang.org/" target="_blank" rel="noopener">
|
6
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
7
|
</a>
|
8
8
|
</p>
|
@@ -15,40 +15,45 @@ OAuth 2.0 focuses on client developer simplicity while providing specific author
|
|
15
15
|
This is a RubyGem for implementing OAuth 2.0 clients and servers in Ruby applications.
|
16
16
|
See the sibling `oauth` gem for OAuth 1.0 implementations in Ruby.
|
17
17
|
|
18
|
-
⚠️⚠️⚠️ **_WARNING_**: You are viewing the `README` of the
|
19
|
-
[supported-only-for-critical-enterprise-security-issues](#oauth2-for-enterprise) `1-4-stable`
|
20
|
-
branch. Please do not use this, and instead upgrade to version 2! ⚠️⚠️⚠️
|
21
|
-
|
22
|
-
No further releases of 1.x series are planned! [Version 2](https://github.com/oauth-xx/oauth2#what-is-new-for-v20) has *tons* of improvements!
|
23
|
-
|
24
|
-
If you must continue using 1.4.x please consider purchasing an open source security maintenance contract from [Tidelift][tidelift-ref].
|
25
|
-
|
26
18
|
---
|
27
19
|
|
28
20
|
* [OAuth 2.0 Spec][oauth2-spec]
|
29
|
-
* [
|
21
|
+
* [oauth sibling gem][sibling-gem] for OAuth 1.0 implementations in Ruby.
|
30
22
|
|
31
23
|
[oauth2-spec]: https://oauth.net/2/
|
32
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
|
33
27
|
|
34
28
|
## Release Documentation
|
35
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
|
+
|
36
42
|
<details>
|
37
43
|
<summary>1.4.x Readmes</summary>
|
38
44
|
|
39
|
-
| Version | Release Date | Readme
|
40
|
-
|
41
|
-
| 1.4.
|
42
|
-
| 1.4.
|
43
|
-
| 1.4.
|
44
|
-
| 1.4.
|
45
|
-
| 1.4.
|
46
|
-
| 1.4.
|
47
|
-
| 1.4.
|
48
|
-
| 1.4.
|
49
|
-
| 1.4.
|
50
|
-
| 1.4.
|
51
|
-
| 1.4.0 | Jun 9, 2017 | https://github.com/oauth-xx/oauth2/blob/v1.4.0/README.md |
|
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 |
|
52
57
|
</details>
|
53
58
|
|
54
59
|
<details>
|
@@ -71,6 +76,8 @@ If you must continue using 1.4.x please consider purchasing an open source secur
|
|
71
76
|
| < 1.0.0 | Find here | https://github.com/oauth-xx/oauth2/tags |
|
72
77
|
</details>
|
73
78
|
|
79
|
+
## Status
|
80
|
+
|
74
81
|
<!--
|
75
82
|
Numbering rows and badges in each row as a visual "database" lookup,
|
76
83
|
as the table is extremely dense, and it can be very difficult to find anything
|
@@ -93,15 +100,18 @@ badge #s:
|
|
93
100
|
🖐
|
94
101
|
🧮
|
95
102
|
📗
|
103
|
+
|
104
|
+
appended indicators:
|
105
|
+
♻️ - URL needs to be updated from SASS integration. Find / Replace is insufficient.
|
96
106
|
-->
|
97
107
|
|
98
|
-
| | Project | oauth2
|
108
|
+
| | Project | bundle add oauth2 |
|
99
109
|
|:----|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
100
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] |
|
101
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] |
|
102
|
-
| 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]
|
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] |
|
103
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] |
|
104
|
-
| 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]
|
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] |
|
105
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] |
|
106
116
|
| 7️⃣ | spread 💖 | [![Liberapay Patrons][⛳liberapay-img]][⛳liberapay] [![Sponsor Me][🖇sponsor-img]][🖇sponsor] [![Tweet @ Peter][🏘tweet-img]][🏘tweet] [🌏][aboutme] [👼][angelme] [💻][coderme] [🌹][politicme] |
|
107
117
|
|
@@ -133,13 +143,13 @@ The link tokens in the following sections should be kept ordered by the row and
|
|
133
143
|
[📗next]: https://github.com/oauth-xx/oauth2/milestone/1
|
134
144
|
[📗next-img]: https://img.shields.io/github/milestones/progress/oauth-xx/oauth2/1?label=Next%20Version
|
135
145
|
|
136
|
-
<!-- 3️⃣
|
146
|
+
<!-- 3️⃣ maintanence & linting -->
|
137
147
|
[⛳cclim-maint]: https://codeclimate.com/github/oauth-xx/oauth2/maintainability
|
138
|
-
[⛳cclim-maint-img]: https://api.codeclimate.com/v1/badges/688c612528ff90a46955/maintainability
|
148
|
+
[⛳cclim-maint-img♻️]: https://api.codeclimate.com/v1/badges/688c612528ff90a46955/maintainability
|
139
149
|
[🖇triage-help]: https://www.codetriage.com/oauth-xx/oauth2
|
140
150
|
[🖇triage-help-img]: https://www.codetriage.com/oauth-xx/oauth2/badges/users.svg
|
141
|
-
[🏘depfu]: https://depfu.com/github/oauth-xx/oauth2?project_id=4445
|
142
|
-
[🏘depfu-img]: https://badges.depfu.com/badges/6d34dc1ba682bbdf9ae2a97848241743/count.svg
|
151
|
+
[🏘depfu♻️]: https://depfu.com/github/oauth-xx/oauth2?project_id=4445
|
152
|
+
[🏘depfu-img♻️]: https://badges.depfu.com/badges/6d34dc1ba682bbdf9ae2a97848241743/count.svg
|
143
153
|
[🚎contributors]: https://github.com/oauth-xx/oauth2/graphs/contributors
|
144
154
|
[🚎contributors-img]: https://img.shields.io/github/contributors-anon/oauth-xx/oauth2
|
145
155
|
[🖐style-wf]: https://github.com/oauth-xx/oauth2/actions/workflows/style.yml
|
@@ -165,11 +175,11 @@ The link tokens in the following sections should be kept ordered by the row and
|
|
165
175
|
|
166
176
|
<!-- 5️⃣ coverage & security -->
|
167
177
|
[⛳cclim-cov]: https://codeclimate.com/github/oauth-xx/oauth2/test_coverage
|
168
|
-
[⛳cclim-cov-img]: https://api.codeclimate.com/v1/badges/688c612528ff90a46955/test_coverage
|
169
|
-
[🖇codecov-img]: https://codecov.io/gh/oauth-xx/oauth2/branch/
|
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
|
170
180
|
[🖇codecov]: https://codecov.io/gh/oauth-xx/oauth2
|
171
|
-
[🏘coveralls]: https://coveralls.io/github/oauth-xx/oauth2?branch=
|
172
|
-
[🏘coveralls-img]: https://coveralls.io/repos/github/oauth-xx/oauth2/badge.svg?branch=
|
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
|
173
183
|
[🚎sec-pol]: https://github.com/oauth-xx/oauth2/blob/master/SECURITY.md
|
174
184
|
[🚎sec-pol-img]: https://img.shields.io/badge/security-policy-brightgreen.svg?style=flat
|
175
185
|
[🖐codeQL]: https://github.com/oauth-xx/oauth2/security/code-scanning
|
@@ -205,30 +215,21 @@ The link tokens in the following sections should be kept ordered by the row and
|
|
205
215
|
[coderme]:http://coderwall.com/pboling
|
206
216
|
[politicme]: https://nationalprogressiveparty.org
|
207
217
|
|
208
|
-
|
209
218
|
## Installation
|
210
219
|
|
211
|
-
|
212
|
-
gem install oauth2
|
213
|
-
```
|
220
|
+
Install the gem and add to the application's Gemfile by executing:
|
214
221
|
|
215
|
-
|
222
|
+
$ bundle add oauth2
|
216
223
|
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
And then execute in a shell:
|
221
|
-
```shell
|
222
|
-
bundle
|
223
|
-
```
|
224
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
225
|
+
|
226
|
+
$ gem install oauth2
|
224
227
|
|
225
228
|
## OAuth2 for Enterprise
|
226
229
|
|
227
230
|
Available as part of the Tidelift Subscription.
|
228
231
|
|
229
|
-
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.]
|
230
|
-
|
231
|
-
[tidelift-ref]: https://tidelift.com/subscription/pkg/rubygems-oauth2?utm_source=rubygems-oauth2&utm_medium=referral&utm_campaign=enterprise
|
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)
|
232
233
|
|
233
234
|
## Security contact information
|
234
235
|
|
@@ -237,12 +238,28 @@ Tidelift will coordinate the fix and disclosure.
|
|
237
238
|
|
238
239
|
For more see [SECURITY.md][🚎sec-pol].
|
239
240
|
|
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
|
+
|
240
258
|
## Compatibility
|
241
259
|
|
242
|
-
Targeted ruby compatibility is 2.7, 3.0 and
|
243
|
-
supported and unsupported versions of Ruby.
|
244
|
-
|
245
|
-
Ruby is limited to 1.9+ in the gemspec for the 1.4.x series and is be 2.2+ for next major version releases (see `master` branch).
|
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.
|
246
263
|
|
247
264
|
<details>
|
248
265
|
<summary>Ruby Engine Compatibility Policy</summary>
|
@@ -272,30 +289,59 @@ fashion. If critical issues for a particular implementation exist at the time
|
|
272
289
|
of a major release, support for that Ruby version may be dropped.
|
273
290
|
</details>
|
274
291
|
|
275
|
-
| | Ruby
|
276
|
-
|
277
|
-
| 1️⃣ | 2.0.x
|
278
|
-
| 2️⃣ | 1.4.x
|
279
|
-
| 3️⃣ | older
|
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! | |
|
280
297
|
|
281
|
-
NOTE: The 1.4 series will only receive critical security updates.
|
298
|
+
NOTE: The 1.4 series will only receive critical bug and security updates.
|
282
299
|
See [SECURITY.md][🚎sec-pol]
|
283
300
|
|
284
301
|
## Usage Examples
|
285
302
|
|
303
|
+
### `authorize_url` and `token_url` are on site root (Just Works!)
|
304
|
+
|
286
305
|
```ruby
|
287
306
|
require 'oauth2'
|
288
|
-
client = OAuth2::Client.new('client_id', 'client_secret', :
|
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"
|
289
311
|
|
290
|
-
client.auth_code.
|
291
|
-
|
292
|
-
|
293
|
-
token = client.auth_code.get_token('authorization_code_value', :redirect_uri => 'http://localhost:8080/oauth2/callback', :headers => {'Authorization' => 'Basic some_password'})
|
294
|
-
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'})
|
295
314
|
response.class.name
|
296
315
|
# => OAuth2::Response
|
297
316
|
```
|
298
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
|
+
|
299
345
|
<details>
|
300
346
|
<summary>Debugging</summary>
|
301
347
|
|
@@ -314,8 +360,8 @@ require 'oauth2'
|
|
314
360
|
client = OAuth2::Client.new(
|
315
361
|
'client_id',
|
316
362
|
'client_secret',
|
317
|
-
:
|
318
|
-
:
|
363
|
+
site: 'https://example.org',
|
364
|
+
logger: Logger.new('example.log', 'weekly')
|
319
365
|
)
|
320
366
|
```
|
321
367
|
</details>
|
@@ -359,10 +405,10 @@ authentication grant types have helper strategy classes that simplify client
|
|
359
405
|
use. They are available via the `#auth_code`, `#implicit`, `#password`, `#client_credentials`, and `#assertion` methods respectively.
|
360
406
|
|
361
407
|
```ruby
|
362
|
-
auth_url = client.auth_code.authorize_url(:
|
363
|
-
token = client.auth_code.get_token('code_value', :
|
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')
|
364
410
|
|
365
|
-
auth_url = client.implicit.authorize_url(:
|
411
|
+
auth_url = client.implicit.authorize_url(redirect_uri: 'http://localhost:8080/oauth/callback')
|
366
412
|
# get the token params in the callback and
|
367
413
|
token = OAuth2::AccessToken.from_kvform(client, query_string)
|
368
414
|
|
@@ -377,7 +423,7 @@ If you want to specify additional headers to be sent out with the
|
|
377
423
|
request, add a 'headers' hash under 'params':
|
378
424
|
|
379
425
|
```ruby
|
380
|
-
token = client.auth_code.get_token('code_value', :
|
426
|
+
token = client.auth_code.get_token('code_value', redirect_uri: 'http://localhost:8080/oauth/callback', headers: {'Some' => 'Header'})
|
381
427
|
```
|
382
428
|
|
383
429
|
You can always use the `#request` method on the `OAuth2::Client` instance to make
|
@@ -398,7 +444,7 @@ dependency on this gem using the [Pessimistic Version Constraint][pvc] with two
|
|
398
444
|
For example:
|
399
445
|
|
400
446
|
```ruby
|
401
|
-
spec.add_dependency 'oauth2', '~>
|
447
|
+
spec.add_dependency 'oauth2', '~> 2.0'
|
402
448
|
```
|
403
449
|
|
404
450
|
[semver]: http://semver.org/
|
@@ -420,7 +466,7 @@ spec.add_dependency 'oauth2', '~> 1.4'
|
|
420
466
|
|
421
467
|
## Development
|
422
468
|
|
423
|
-
After checking out the repo, run `
|
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.
|
424
470
|
|
425
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).
|
426
472
|
|
data/SECURITY.md
CHANGED
@@ -2,19 +2,13 @@
|
|
2
2
|
|
3
3
|
## Supported Versions
|
4
4
|
|
5
|
-
| Version
|
6
|
-
|
7
|
-
| 2.latest | ✅
|
8
|
-
| 1.latest | ✅
|
9
|
-
| older
|
5
|
+
| Version | Supported |
|
6
|
+
|--------------|-----------|
|
7
|
+
| 2.0.<latest> | ✅ |
|
8
|
+
| 1.4.<latest> | ✅ |
|
9
|
+
| older | ⛔️ |
|
10
10
|
|
11
11
|
## Reporting a Vulnerability
|
12
12
|
|
13
13
|
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security).
|
14
14
|
Tidelift will coordinate the fix and disclosure.
|
15
|
-
|
16
|
-
## OAuth2 for Enterprise
|
17
|
-
|
18
|
-
Available as part of the Tidelift Subscription.
|
19
|
-
|
20
|
-
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&utm_term=repo)
|