oauth 0.6.1 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +30 -1
- data/CONTRIBUTING.md +1 -1
- data/LICENSE +2 -1
- data/README.md +25 -22
- data/SECURITY.md +10 -5
- data/lib/oauth/cli/sign_command.rb +1 -3
- data/lib/oauth/client/em_http.rb +1 -3
- data/lib/oauth/consumer.rb +49 -54
- data/lib/oauth/request_proxy/action_controller_request.rb +3 -24
- data/lib/oauth/request_proxy/base.rb +1 -1
- data/lib/oauth/request_proxy/net_http.rb +1 -3
- data/lib/oauth/signature/base.rb +1 -3
- data/lib/oauth/version.rb +1 -1
- data/lib/oauth.rb +1 -0
- metadata +30 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6209290a96231a2cca740d8fbfec7831e97f7b2b848997ebae0ea1a130a48a3d
|
4
|
+
data.tar.gz: 34689bed290728cb8e628bce2fd781fbec783b2dca832267093a228ef247e8ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1725bcd2a976993bba7a2b61da4b24dd2b5086dfd01da52724f21dac2e87f7fff9ca595c479716aeec8a490c3ad16bc4a308a93edfb6c9cc957afbd4f0805cd
|
7
|
+
data.tar.gz: 516b1f0823a5f8a294e5b27fa0eda305af35c77bfaf448dd17144f1d67f9d6f6ea2807b77827c62e3a583ad92f7b8a586e3812e518b06687ac05cc5e6649dc17
|
data/CHANGELOG.md
CHANGED
@@ -13,6 +13,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
13
13
|
|
14
14
|
### Removed
|
15
15
|
|
16
|
+
## [1.0.1] 2022-08-29
|
17
|
+
### Changed
|
18
|
+
* `OAuth::Comsumer#options` hash is now handled by `snaky_hash`, which was extracted from `oauth2`
|
19
|
+
* symbolized keys, dot-access and snake-case are now normalized
|
20
|
+
|
21
|
+
## [1.0.0] 2022-08-23
|
22
|
+
### Changed
|
23
|
+
* Dropped support for Ruby < 2.7
|
24
|
+
* Dropped support for Rails < 6
|
25
|
+
|
26
|
+
### Added
|
27
|
+
* New EOL Policy
|
28
|
+
* Non-commercial support for the oldest version of Ruby (which itself is going EOL) will be dropped each year in April
|
29
|
+
|
30
|
+
## [0.6.2] 2022-08-29
|
31
|
+
### Changed
|
32
|
+
* `OAuth::Comsumer#options` hash is now handled by `snaky_hash`, which was extracted from `oauth2`
|
33
|
+
* symbolized keys, dot-access and snake-case are now normalized
|
34
|
+
|
16
35
|
## [0.6.1] 2022-08-23
|
17
36
|
### Changed
|
18
37
|
* Fixed documentation in SECURITY.md
|
@@ -35,6 +54,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
35
54
|
### Removed
|
36
55
|
* Ruby 2.0, 2.1, 2.2, and 2.3 are no longer valid install targets
|
37
56
|
|
57
|
+
## [0.5.14] 2022-08-29
|
58
|
+
The "hopeful last 0.5.x" Release
|
59
|
+
|
60
|
+
### Fixed
|
61
|
+
* More typos fixed
|
62
|
+
|
38
63
|
## [0.5.13] 2022-08-23
|
39
64
|
The "I think I caught 'em all!" Release
|
40
65
|
|
@@ -431,9 +456,13 @@ but please have a look at the unit tests.
|
|
431
456
|
* Moved all non-Rails functionality from the Rails plugin:
|
432
457
|
http://code.google.com/p/oauth-plugin/
|
433
458
|
|
434
|
-
[Unreleased]: https://github.com/oauth-xx/oauth-ruby/compare/
|
459
|
+
[Unreleased]: https://github.com/oauth-xx/oauth-ruby/compare/v1.0.1...main
|
460
|
+
[1.0.1]: https://github.com/oauth-xx/oauth-ruby/releases/tag/v1.0.1
|
461
|
+
[1.0.0]: https://github.com/oauth-xx/oauth-ruby/releases/tag/v1.0.0
|
462
|
+
[0.6.2]: https://github.com/oauth-xx/oauth-ruby/releases/tag/v0.6.2
|
435
463
|
[0.6.1]: https://github.com/oauth-xx/oauth-ruby/releases/tag/v0.6.1
|
436
464
|
[0.6.0]: https://github.com/oauth-xx/oauth-ruby/releases/tag/v0.6.0
|
465
|
+
[0.5.14]: https://github.com/oauth-xx/oauth-ruby/releases/tag/v0.5.14
|
437
466
|
[0.5.13]: https://github.com/oauth-xx/oauth-ruby/releases/tag/v0.5.13
|
438
467
|
[0.5.12]: https://github.com/oauth-xx/oauth-ruby/releases/tag/v0.5.12
|
439
468
|
[0.5.11]: https://github.com/oauth-xx/oauth-ruby/releases/tag/v0.5.11
|
data/CONTRIBUTING.md
CHANGED
@@ -17,7 +17,7 @@ Made with [contributors-img][contrib-rocks].
|
|
17
17
|
[comment]: <> (Following links are used by README, CONTRIBUTING, Homepage)
|
18
18
|
|
19
19
|
[conduct]: https://github.com/oauth-xx/oauth-ruby/blob/main/CODE_OF_CONDUCT.md
|
20
|
-
[contributing]: https://github.com/oauth-xx/oauth-ruby/blob/main/CONTRIBUTING.md
|
21
20
|
[contributors]: https://github.com/oauth-xx/oauth-ruby/graphs/contributors
|
22
21
|
[mailinglist]: http://groups.google.com/group/oauth-ruby
|
23
22
|
[source]: https://github.com/oauth-xx/oauth-ruby/
|
23
|
+
[contrib-rocks]: https://contrib.rocks
|
data/LICENSE
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2007-2012, 2016-2017
|
3
|
+
Copyright (c) 2007-2012, 2016-2017 Blaine Cook, Larry Halff, Pelle Braendgaard
|
4
|
+
Copyright (c) 2020-2022 Peter Boling
|
4
5
|
|
5
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
7
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -20,11 +20,17 @@ See the sibling `oauth2` gem for OAuth 2.0 implementations in Ruby.
|
|
20
20
|
[oauth1-spec]: http://oauth.net/core/1.0/
|
21
21
|
[sibling-gem]: https://github.com/oauth-xx/oauth-ruby
|
22
22
|
|
23
|
-
**
|
23
|
+
**New EOL Policy**
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
Versions 1.0.x will be EOL no later than April, 2025.
|
26
|
+
Versions 0.6.x will be EOL no later than April, 2024.
|
27
|
+
Versions 0.5.x will be EOL no later than April, 2023.
|
28
|
+
|
29
|
+
This will facilitate dropping support for old, dead, and crusty versions of Ruby.
|
30
|
+
|
31
|
+
Non-commercial support for the oldest version of Ruby (which itself is going EOL) will be dropped each year in April.
|
32
|
+
|
33
|
+
Please upgrade to version 1.0. The only breaking change in 1.0 is dropping old Rubies.
|
28
34
|
|
29
35
|
## Status
|
30
36
|
|
@@ -57,10 +63,10 @@ appended indicators:
|
|
57
63
|
|
58
64
|
| | Project | bundle add oauth |
|
59
65
|
|:----|-----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
60
|
-
| 1️⃣ | name, license, docs | [![RubyGems.org][⛳️name-img]][⛳️gem] [![License: MIT][🖇src-license-img]][🖇src-license] [![
|
66
|
+
| 1️⃣ | name, license, docs | [![RubyGems.org][⛳️name-img]][⛳️gem] [![License: MIT][🖇src-license-img]][🖇src-license] [![RubyDoc.info][🚎yard-img]][🚎yard] |
|
61
67
|
| 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]--> |
|
62
68
|
| 3️⃣ | maintenance & 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] |
|
63
|
-
| 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] [![
|
69
|
+
| 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] [![MacOS][🧮mac-wf-img]][🧮mac-wf] [![Windows][📗win-wf-img]][📗win-wf] |
|
64
70
|
| 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] |
|
65
71
|
| 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] |
|
66
72
|
| 7️⃣ | spread 💖 | [![Liberapay Patrons][⛳liberapay-img]][⛳liberapay] [![Sponsor Me][🖇sponsor-img]][🖇sponsor] [![Tweet @ Peter][🏘tweet-img]][🏘tweet] [🌏][aboutme] [👼][angelme] [💻][coderme] |
|
@@ -74,11 +80,8 @@ The link tokens in the following sections should be kept ordered by the row and
|
|
74
80
|
[⛳️name-img]: https://img.shields.io/badge/name-oauth-brightgreen.svg?style=flat
|
75
81
|
[🖇src-license]: https://opensource.org/licenses/MIT
|
76
82
|
[🖇src-license-img]: https://img.shields.io/badge/License-MIT-green.svg
|
77
|
-
[🏘fossa]: https://app.fossa.io/projects/git%2Bgithub.com%2Foauth-xx%2Foauth-ruby?ref=badge_shield
|
78
|
-
[🏘fossa-img]: https://app.fossa.io/api/projects/git%2Bgithub.com%2Foauth-xx%2Foauth-ruby.svg?type=shield
|
79
83
|
[🚎yard]: https://www.rubydoc.info/github/oauth-xx/oauth-ruby
|
80
84
|
[🚎yard-img]: https://img.shields.io/badge/documentation-rubydoc-brightgreen.svg?style=flat
|
81
|
-
[🖐inch-ci-img]: http://inch-ci.org/github/oauth-xx/oauth-ruby.png
|
82
85
|
|
83
86
|
<!-- 2️⃣ version & activity -->
|
84
87
|
[⛳️version-img]: http://img.shields.io/gem/v/oauth.svg
|
@@ -116,8 +119,6 @@ The link tokens in the following sections should be kept ordered by the row and
|
|
116
119
|
[🏘sup-wf-img]: https://github.com/oauth-xx/oauth-ruby/actions/workflows/supported.yml/badge.svg
|
117
120
|
[🚎heads-wf]: https://github.com/oauth-xx/oauth-ruby/actions/workflows/heads.yml
|
118
121
|
[🚎heads-wf-img]: https://github.com/oauth-xx/oauth-ruby/actions/workflows/heads.yml/badge.svg
|
119
|
-
[🖐uns-wf]: https://github.com/oauth-xx/oauth-ruby/actions/workflows/unsupported.yml
|
120
|
-
[🖐uns-wf-img]: https://github.com/oauth-xx/oauth-ruby/actions/workflows/unsupported.yml/badge.svg
|
121
122
|
[🧮mac-wf]: https://github.com/oauth-xx/oauth-ruby/actions/workflows/macos.yml
|
122
123
|
[🧮mac-wf-img]: https://github.com/oauth-xx/oauth-ruby/actions/workflows/macos.yml/badge.svg
|
123
124
|
[📗win-wf]: https://github.com/oauth-xx/oauth-ruby/actions/workflows/windows.yml
|
@@ -187,12 +188,12 @@ For more see [SECURITY.md][🚎sec-pol].
|
|
187
188
|
## Compatibility
|
188
189
|
|
189
190
|
Targeted ruby compatibility is non-EOL versions of Ruby, currently 2.7, 3.0, and
|
190
|
-
3.1. Ruby is limited to 2.
|
191
|
+
3.1. Ruby is limited to 2.7+ in the gemspec, and this will change with minor version bumps,
|
191
192
|
while the gem is still in 0.x, in accordance with the SemVer spec.
|
192
193
|
|
193
|
-
The `main` branch now targets 1.0.x releases.
|
194
|
-
See `v0.6-maintenance` branch for Ruby >= 2.4.
|
195
|
-
See `v0.5-maintenance` branch for Ruby >= 2.0.
|
194
|
+
The `main` branch now targets 1.0.x releases, for Ruby >= 2.7.
|
195
|
+
See `v0.6-maintenance` (EOL April, 2024) branch for Ruby >= 2.4.
|
196
|
+
See `v0.5-maintenance` (EOL April, 2023) branch for Ruby >= 2.0.
|
196
197
|
|
197
198
|
NOTE: No further releases of version < 1.0.x are anticipated.
|
198
199
|
|
@@ -224,12 +225,12 @@ fashion. If critical issues for a particular implementation exist at the time
|
|
224
225
|
of a major release, support for that Ruby version may be dropped.
|
225
226
|
</details>
|
226
227
|
|
227
|
-
| | Ruby OAuth Version | Maintenance Branch | 🚂 Compatibility | Official 💎 | Unofficial 💎 | Incidental 💎 |
|
228
|
-
|
229
|
-
| 1️⃣ | 1.0.x | `main` | Rails 6, 7 | 2.7, 3.0, 3.1 | sorry, not sorry | nope |
|
230
|
-
| 2️⃣ | 0.6.x | `v0.6-maintenance` | Rails 5, 6, 7 | 2.7, 3.0, 3.1 | 2.5, 2.6 | 2.4 |
|
231
|
-
| 3️⃣ | 0.5.x | `v0.5-maintenance` | Rails 2, 3, 4, 5, 6, 7 | 2.7, 3.0, 3.1 | 2.1, 2.2, 2.3, 2.4, 2.5, 2.6 | 2.0 |
|
232
|
-
| 4️⃣ | older | N/A | | Best of luck to you! | Please upgrade! | noop |
|
228
|
+
| | Ruby OAuth Version | Maintenance Branch | EOL | 🚂 Compatibility | Official 💎 | Unofficial 💎 | Incidental 💎 |
|
229
|
+
|:----|--------------------|--------------------|-----------|------------------------|----------------------|------------------------------|---------------|
|
230
|
+
| 1️⃣ | 1.0.x | `main` | | Rails 6, 7 | 2.7, 3.0, 3.1 | sorry, not sorry | nope |
|
231
|
+
| 2️⃣ | 0.6.x | `v0.6-maintenance` | 04/2024 | Rails 5, 6, 7 | 2.7, 3.0, 3.1 | 2.5, 2.6 | 2.4 |
|
232
|
+
| 3️⃣ | 0.5.x | `v0.5-maintenance` | 04/2023 | Rails 2, 3, 4, 5, 6, 7 | 2.7, 3.0, 3.1 | 2.1, 2.2, 2.3, 2.4, 2.5, 2.6 | 2.0 |
|
233
|
+
| 4️⃣ | older | N/A | yesterday | | Best of luck to you! | Please upgrade! | noop |
|
233
234
|
|
234
235
|
NOTE: Once 1.0 is released, the 0.x series will only receive critical bug and security updates.
|
235
236
|
See [SECURITY.md][🚎sec-pol]
|
@@ -319,6 +320,8 @@ See [CONTRIBUTING.md][contributing]
|
|
319
320
|
|
320
321
|
Made with [contributors-img][contrib-rocks].
|
321
322
|
|
323
|
+
[contrib-rocks]: https://contrib.rocks
|
324
|
+
|
322
325
|
## Versioning
|
323
326
|
|
324
327
|
This library aims to adhere to [Semantic Versioning 2.0.0][semver]. Violations of this scheme should be reported as
|
@@ -332,7 +335,7 @@ the [Pessimistic Version Constraint][pvc] with two digits of precision.
|
|
332
335
|
For example:
|
333
336
|
|
334
337
|
```ruby
|
335
|
-
spec.add_dependency "oauth", "~>
|
338
|
+
spec.add_dependency "oauth", "~> 1.0"
|
336
339
|
```
|
337
340
|
|
338
341
|
## License
|
data/SECURITY.md
CHANGED
@@ -2,11 +2,16 @@
|
|
2
2
|
|
3
3
|
## Supported Versions
|
4
4
|
|
5
|
-
| Version | Supported |
|
6
|
-
|
7
|
-
| 0.
|
8
|
-
| 0.
|
9
|
-
|
|
5
|
+
| Version | Supported | EOL |
|
6
|
+
|---------|--------------------|---------|
|
7
|
+
| 1.0.x | :white_check_mark: | 04/2025 |
|
8
|
+
| 0.6.x | :white_check_mark: | 04/2024 |
|
9
|
+
| 0.5.x | :white_check_mark: | 04/2023 |
|
10
|
+
| <= 0.5 | :x: | :x: |
|
11
|
+
|
12
|
+
### EOL Policy
|
13
|
+
|
14
|
+
Non-commercial support for the oldest version of Ruby (which itself is going EOL) will be dropped each year in April.
|
10
15
|
|
11
16
|
## Reporting a Vulnerability
|
12
17
|
|
@@ -45,9 +45,7 @@ module OAuth
|
|
45
45
|
def puts_verbose_request(request)
|
46
46
|
puts "Method: #{request.method}"
|
47
47
|
puts "URI: #{request.uri}"
|
48
|
-
unless options[:xmpp]
|
49
|
-
puts "Normalized params: #{request.normalized_parameters}"
|
50
|
-
end
|
48
|
+
puts "Normalized params: #{request.normalized_parameters}" unless options[:xmpp]
|
51
49
|
puts "Signature base string: #{request.signature_base_string}"
|
52
50
|
|
53
51
|
if xmpp?
|
data/lib/oauth/client/em_http.rb
CHANGED
@@ -84,9 +84,7 @@ module EventMachine
|
|
84
84
|
else
|
85
85
|
query.to_s
|
86
86
|
end
|
87
|
-
unless uri_query.to_s.empty?
|
88
|
-
combined_query = [combined_query, uri_query].reject(&:empty?).join("&")
|
89
|
-
end
|
87
|
+
combined_query = [combined_query, uri_query].reject(&:empty?).join("&") unless uri_query.to_s.empty?
|
90
88
|
combined_query.to_s.empty? ? path : "#{path}?#{combined_query}"
|
91
89
|
end
|
92
90
|
|
data/lib/oauth/consumer.rb
CHANGED
@@ -30,47 +30,49 @@ module OAuth
|
|
30
30
|
end
|
31
31
|
CA_FILE = nil unless defined?(CA_FILE)
|
32
32
|
|
33
|
-
@@default_options =
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
33
|
+
@@default_options = SnakyHash::SymbolKeyed.new(
|
34
|
+
{
|
35
|
+
# Signature method used by server. Defaults to HMAC-SHA1
|
36
|
+
signature_method: "HMAC-SHA1",
|
37
|
+
|
38
|
+
# default paths on site. These are the same as the defaults set up by the generators
|
39
|
+
request_token_path: "/oauth/request_token",
|
40
|
+
authenticate_path: "/oauth/authenticate",
|
41
|
+
authorize_path: "/oauth/authorize",
|
42
|
+
access_token_path: "/oauth/access_token",
|
43
|
+
|
44
|
+
proxy: nil,
|
45
|
+
# How do we send the oauth values to the server see
|
46
|
+
# https://oauth.net/core/1.0/#consumer_req_param for more info
|
47
|
+
#
|
48
|
+
# Possible values:
|
49
|
+
#
|
50
|
+
# :header - via the Authorize header (Default) ( option 1. in spec)
|
51
|
+
# :body - url form encoded in body of POST request ( option 2. in spec)
|
52
|
+
# :query_string - via the query part of the url ( option 3. in spec)
|
53
|
+
scheme: :header,
|
54
|
+
|
55
|
+
# Default http method used for OAuth Token Requests (defaults to :post)
|
56
|
+
http_method: :post,
|
57
|
+
|
58
|
+
# Add a custom ca_file for consumer
|
59
|
+
# :ca_file => '/etc/certs.pem'
|
60
|
+
|
61
|
+
# Possible values:
|
62
|
+
#
|
63
|
+
# nil, false - no debug output
|
64
|
+
# true - uses $stdout
|
65
|
+
# some_value - uses some_value
|
66
|
+
debug_output: nil,
|
67
|
+
|
68
|
+
# Defaults to producing a body_hash as part of the signature but
|
69
|
+
# can be disabled since it's not officially part of the OAuth 1.0
|
70
|
+
# spec. Possible values are true and false
|
71
|
+
body_hash_enabled: true,
|
72
|
+
|
73
|
+
oauth_version: "1.0"
|
74
|
+
}
|
75
|
+
)
|
74
76
|
|
75
77
|
attr_accessor :options, :key, :secret
|
76
78
|
attr_writer :site, :http
|
@@ -103,7 +105,8 @@ module OAuth
|
|
103
105
|
@secret = consumer_secret
|
104
106
|
|
105
107
|
# ensure that keys are symbols
|
106
|
-
|
108
|
+
snaky_options = SnakyHash::SymbolKeyed.new(options)
|
109
|
+
@options = @@default_options.merge(snaky_options)
|
107
110
|
end
|
108
111
|
|
109
112
|
# The default http method
|
@@ -159,9 +162,7 @@ module OAuth
|
|
159
162
|
def get_request_token(request_options = {}, *arguments, &block)
|
160
163
|
# if oauth_callback wasn't provided, it is assumed that oauth_verifiers
|
161
164
|
# will be exchanged out of band
|
162
|
-
unless request_options[:exclude_callback]
|
163
|
-
request_options[:oauth_callback] ||= OAuth::OUT_OF_BAND
|
164
|
-
end
|
165
|
+
request_options[:oauth_callback] ||= OAuth::OUT_OF_BAND unless request_options[:exclude_callback]
|
165
166
|
|
166
167
|
response = if block
|
167
168
|
token_request(
|
@@ -386,13 +387,9 @@ module OAuth
|
|
386
387
|
end
|
387
388
|
|
388
389
|
http_object.read_timeout = http_object.open_timeout = @options[:timeout] || 60
|
389
|
-
if @options[:open_timeout]
|
390
|
-
http_object.open_timeout = @options[:open_timeout]
|
391
|
-
end
|
390
|
+
http_object.open_timeout = @options[:open_timeout] if @options[:open_timeout]
|
392
391
|
http_object.ssl_version = @options[:ssl_version] if @options[:ssl_version]
|
393
|
-
if @options[:ssl_client_cert]
|
394
|
-
http_object.cert = @options[:ssl_client_cert]
|
395
|
-
end
|
392
|
+
http_object.cert = @options[:ssl_client_cert] if @options[:ssl_client_cert]
|
396
393
|
http_object.key = @options[:ssl_client_key] if @options[:ssl_client_key]
|
397
394
|
http_object.set_debug_output(debug_output) if debug_output
|
398
395
|
|
@@ -409,9 +406,7 @@ module OAuth
|
|
409
406
|
# only add if the site host matches the current http object's host
|
410
407
|
# (in case we've specified a full url for token requests)
|
411
408
|
uri = URI.parse(site)
|
412
|
-
if uri.path && uri.path != "/" && uri.host == http.address
|
413
|
-
path = uri.path + path
|
414
|
-
end
|
409
|
+
path = uri.path + path if uri.path && uri.path != "/" && uri.host == http.address
|
415
410
|
|
416
411
|
headers = arguments.first.is_a?(Hash) ? arguments.shift : {}
|
417
412
|
|
@@ -1,36 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "active_support"
|
4
|
-
require "active_support/version"
|
5
4
|
require "action_controller"
|
6
5
|
require "uri"
|
7
6
|
|
8
|
-
|
9
|
-
# rails 2.x
|
10
|
-
require "action_controller/request"
|
11
|
-
unless ActionController::Request::HTTP_METHODS.include?("patch")
|
12
|
-
ActionController::Request::HTTP_METHODS << "patch"
|
13
|
-
ActionController::Request::HTTP_METHOD_LOOKUP["PATCH"] = :patch
|
14
|
-
ActionController::Request::HTTP_METHOD_LOOKUP["patch"] = :patch
|
15
|
-
end
|
16
|
-
|
17
|
-
elsif Gem::Version.new(ActiveSupport::VERSION::STRING) < Gem::Version.new("4")
|
18
|
-
# rails 3.x
|
19
|
-
require "action_dispatch/http/request"
|
20
|
-
unless ActionDispatch::Request::HTTP_METHODS.include?("patch")
|
21
|
-
ActionDispatch::Request::HTTP_METHODS << "patch"
|
22
|
-
ActionDispatch::Request::HTTP_METHOD_LOOKUP["PATCH"] = :patch
|
23
|
-
ActionDispatch::Request::HTTP_METHOD_LOOKUP["patch"] = :patch
|
24
|
-
end
|
25
|
-
|
26
|
-
else # rails 4.x and later - already has patch
|
27
|
-
require "action_dispatch/http/request"
|
28
|
-
end
|
7
|
+
require "action_dispatch/http/request"
|
29
8
|
|
30
9
|
module OAuth
|
31
10
|
module RequestProxy
|
32
11
|
class ActionControllerRequest < OAuth::RequestProxy::Base
|
33
|
-
proxies(
|
12
|
+
proxies(::ActionDispatch::Request)
|
34
13
|
|
35
14
|
def method
|
36
15
|
request.method.to_s.upcase
|
@@ -50,7 +29,7 @@ module OAuth
|
|
50
29
|
end
|
51
30
|
end
|
52
31
|
|
53
|
-
# Override from OAuth::RequestProxy::Base to avoid
|
32
|
+
# Override from OAuth::RequestProxy::Base to avoid round-trip
|
54
33
|
# conversion to Hash or Array and thus preserve the original
|
55
34
|
# parameter names
|
56
35
|
def parameters_for_signature
|
@@ -69,9 +69,7 @@ module OAuth
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def auth_header_params
|
72
|
-
unless request["Authorization"] && request["Authorization"][0, 5] == "OAuth"
|
73
|
-
return nil
|
74
|
-
end
|
72
|
+
return nil unless request["Authorization"] && request["Authorization"][0, 5] == "OAuth"
|
75
73
|
|
76
74
|
request["Authorization"]
|
77
75
|
end
|
data/lib/oauth/signature/base.rb
CHANGED
@@ -31,9 +31,7 @@ module OAuth
|
|
31
31
|
@consumer_secret = options[:consumer].secret if options[:consumer]
|
32
32
|
|
33
33
|
# presence of :consumer_secret option will override any Consumer that's provided
|
34
|
-
if options[:consumer_secret]
|
35
|
-
@consumer_secret = options[:consumer_secret]
|
36
|
-
end
|
34
|
+
@consumer_secret = options[:consumer_secret] if options[:consumer_secret]
|
37
35
|
|
38
36
|
## token secret was determined beforehand
|
39
37
|
|
data/lib/oauth/version.rb
CHANGED
data/lib/oauth.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pelle Braendgaard
|
@@ -16,8 +16,22 @@ authors:
|
|
16
16
|
autorequire:
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
|
-
date: 2022-08-
|
19
|
+
date: 2022-08-29 00:00:00.000000000 Z
|
20
20
|
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: snaky_hash
|
23
|
+
requirement: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '2.0'
|
28
|
+
type: :runtime
|
29
|
+
prerelease: false
|
30
|
+
version_requirements: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '2.0'
|
21
35
|
- !ruby/object:Gem::Dependency
|
22
36
|
name: version_gem
|
23
37
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,14 +164,14 @@ dependencies:
|
|
150
164
|
requirements:
|
151
165
|
- - "~>"
|
152
166
|
- !ruby/object:Gem::Version
|
153
|
-
version: '
|
167
|
+
version: '18.0'
|
154
168
|
type: :development
|
155
169
|
prerelease: false
|
156
170
|
version_requirements: !ruby/object:Gem::Requirement
|
157
171
|
requirements:
|
158
172
|
- - "~>"
|
159
173
|
- !ruby/object:Gem::Version
|
160
|
-
version: '
|
174
|
+
version: '18.0'
|
161
175
|
- !ruby/object:Gem::Dependency
|
162
176
|
name: typhoeus
|
163
177
|
requirement: !ruby/object:Gem::Requirement
|
@@ -178,14 +192,14 @@ dependencies:
|
|
178
192
|
requirements:
|
179
193
|
- - "<="
|
180
194
|
- !ruby/object:Gem::Version
|
181
|
-
version: 3.
|
195
|
+
version: 3.19.0
|
182
196
|
type: :development
|
183
197
|
prerelease: false
|
184
198
|
version_requirements: !ruby/object:Gem::Requirement
|
185
199
|
requirements:
|
186
200
|
- - "<="
|
187
201
|
- !ruby/object:Gem::Version
|
188
|
-
version: 3.
|
202
|
+
version: 3.19.0
|
189
203
|
description:
|
190
204
|
email: oauth-ruby@googlegroups.com
|
191
205
|
executables:
|
@@ -254,23 +268,23 @@ licenses:
|
|
254
268
|
- MIT
|
255
269
|
metadata:
|
256
270
|
homepage_uri: https://github.com/oauth-xx/oauth-ruby
|
257
|
-
source_code_uri: https://github.com/oauth-xx/oauth-ruby/tree/
|
258
|
-
changelog_uri: https://github.com/oauth-xx/oauth-ruby/blob/
|
271
|
+
source_code_uri: https://github.com/oauth-xx/oauth-ruby/tree/v1.0.1
|
272
|
+
changelog_uri: https://github.com/oauth-xx/oauth-ruby/blob/v1.0.1/CHANGELOG.md
|
259
273
|
bug_tracker_uri: https://github.com/oauth-xx/oauth-ruby/issues
|
260
|
-
documentation_uri: https://www.rubydoc.info/gems/oauth/0.
|
274
|
+
documentation_uri: https://www.rubydoc.info/gems/oauth/1.0.1
|
261
275
|
wiki_uri: https://github.com/oauth-xx/oauth-ruby/wiki
|
262
276
|
rubygems_mfa_required: 'true'
|
263
277
|
post_install_message: |2
|
264
278
|
|
265
|
-
You have installed oauth version 0.
|
279
|
+
You have installed oauth version 1.0.1, congratulations!
|
266
280
|
|
267
|
-
Non-commercial support for the
|
268
|
-
The only breaking change will be dropped support for Ruby 2.
|
281
|
+
Non-commercial support for the 1.x series will end by April, 2025. Please make a plan to upgrade to the next version prior to that date.
|
282
|
+
The only breaking change will be dropped support for Ruby 2.7 and any other versions which will also have reached EOL by then.
|
269
283
|
|
270
284
|
Please see:
|
271
|
-
• https://github.com/oauth-xx/oauth/blob/main/SECURITY.md
|
285
|
+
• https://github.com/oauth-xx/oauth-ruby/blob/main/SECURITY.md
|
272
286
|
|
273
|
-
Note also that I, and this project,
|
287
|
+
Note also that I am, and this project is, in the process of leaving Github.
|
274
288
|
I wrote about some of the reasons here:
|
275
289
|
• https://dev.to/galtzo/im-leaving-github-50ba
|
276
290
|
|
@@ -293,14 +307,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
293
307
|
requirements:
|
294
308
|
- - ">="
|
295
309
|
- !ruby/object:Gem::Version
|
296
|
-
version: '2.
|
310
|
+
version: '2.7'
|
297
311
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
298
312
|
requirements:
|
299
313
|
- - ">="
|
300
314
|
- !ruby/object:Gem::Version
|
301
315
|
version: '0'
|
302
316
|
requirements: []
|
303
|
-
rubygems_version: 3.3.
|
317
|
+
rubygems_version: 3.3.21
|
304
318
|
signing_key:
|
305
319
|
specification_version: 4
|
306
320
|
summary: OAuth Core Ruby implementation
|