oauth2 1.4.7 → 1.4.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +36 -3
- data/CONTRIBUTING.md +18 -0
- data/LICENSE +1 -1
- data/README.md +301 -116
- data/SECURITY.md +20 -0
- data/lib/oauth2/access_token.rb +4 -2
- data/lib/oauth2/authenticator.rb +3 -1
- data/lib/oauth2/client.rb +91 -56
- data/lib/oauth2/error.rb +3 -1
- data/lib/oauth2/mac_token.rb +19 -19
- data/lib/oauth2/response.rb +2 -0
- data/lib/oauth2/strategy/assertion.rb +3 -1
- data/lib/oauth2/strategy/auth_code.rb +3 -1
- data/lib/oauth2/strategy/base.rb +2 -0
- data/lib/oauth2/strategy/client_credentials.rb +3 -1
- data/lib/oauth2/strategy/implicit.rb +3 -1
- data/lib/oauth2/strategy/password.rb +3 -1
- data/lib/oauth2/version.rb +1 -1
- data/lib/oauth2.rb +2 -0
- metadata +50 -87
- data/spec/helper.rb +0 -37
- data/spec/oauth2/access_token_spec.rb +0 -216
- data/spec/oauth2/authenticator_spec.rb +0 -84
- data/spec/oauth2/client_spec.rb +0 -506
- data/spec/oauth2/mac_token_spec.rb +0 -117
- data/spec/oauth2/response_spec.rb +0 -90
- data/spec/oauth2/strategy/assertion_spec.rb +0 -58
- data/spec/oauth2/strategy/auth_code_spec.rb +0 -107
- data/spec/oauth2/strategy/base_spec.rb +0 -5
- data/spec/oauth2/strategy/client_credentials_spec.rb +0 -69
- data/spec/oauth2/strategy/implicit_spec.rb +0 -26
- data/spec/oauth2/strategy/password_spec.rb +0 -55
- data/spec/oauth2/version_spec.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b117fa1389074159407828a31fc676387c5c5fa0a7be9c4836a139eb4624cdb
|
4
|
+
data.tar.gz: 4589a4cf05d759353585673dd7b042ccc73ed144e5c3e2501c58a35da582c71c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acf8d75b54a65226a5bb782d692a55d2c1f078cf3f5dc2de1553b3dcad4b3e99f4bf638ef9040b90f209ba501b4547b6a087546ecfc2a8babf35ca3800e3bac3
|
7
|
+
data.tar.gz: c3ba6e85735d1ab6dbd5d0c27e40b19d0e9051d15987faba7f34d3c807d43f91e2b109b1104de64980bd75869f417f6025d919ab9dc67940369313ac859ae2b2
|
data/CHANGELOG.md
CHANGED
@@ -3,11 +3,35 @@ All notable changes to this project will be documented in this file.
|
|
3
3
|
|
4
4
|
## unreleased
|
5
5
|
|
6
|
-
|
6
|
+
|
7
|
+
## [1.4.10] - 2022-07-01
|
8
|
+
|
9
|
+
- FIPS Compatibility [#587](https://github.com/oauth-xx/oauth2/pull/587) (@akostadinov)
|
10
|
+
|
11
|
+
## [1.4.9] - 2022-02-20
|
12
|
+
|
13
|
+
- Fixes compatibility with Faraday v2 [#572](https://github.com/oauth-xx/oauth2/issues/572)
|
14
|
+
- Includes supported versions of Faraday in test matrix:
|
15
|
+
- Faraday ~> 2.2.0 with Ruby >= 2.6
|
16
|
+
- Faraday ~> 1.10 with Ruby >= 2.4
|
17
|
+
- Faraday ~> 0.17.3 with Ruby >= 1.9
|
18
|
+
- Add Windows and MacOS to test matrix
|
19
|
+
|
20
|
+
## [1.4.8] - 2022-02-18
|
21
|
+
|
22
|
+
- MFA is now required to push new gem versions (@pboling)
|
23
|
+
- README overhaul w/ new Ruby Version and Engine compatibility policies (@pboling)
|
24
|
+
- [#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
|
+
- Improve Code Coverage tracking (Coveralls, CodeCov, CodeClimate), and enable branch coverage (@pboling)
|
26
|
+
- Add CodeQL, Security Policy, Funding info (@pboling)
|
27
|
+
- Added Ruby 3.1, jruby, jruby-head, truffleruby, truffleruby-head to build matrix (@pboling)
|
28
|
+
- [#543](https://github.com/oauth-xx/oauth2/pull/543) - Support for more modern Open SSL libraries (@pboling)
|
29
|
+
|
30
|
+
## [1.4.7] - 2021-03-19
|
7
31
|
|
8
32
|
- [#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)
|
9
33
|
|
10
|
-
## [1.4.6] - 2021-03-
|
34
|
+
## [1.4.6] - 2021-03-19
|
11
35
|
|
12
36
|
- [#540](https://github.com/oauth-xx/oauth2/pull/540) - Add VERSION constant (@pboling)
|
13
37
|
- [#537](https://github.com/oauth-xx/oauth2/pull/537) - Fix crash in OAuth2::Client#get_token (@anderscarling)
|
@@ -17,6 +41,8 @@ All notable changes to this project will be documented in this file.
|
|
17
41
|
|
18
42
|
- [#535](https://github.com/oauth-xx/oauth2/pull/535) - Compatibility with range of supported Ruby OpenSSL versions, Rubocop updates, Github Actions (@pboling)
|
19
43
|
- [#518](https://github.com/oauth-xx/oauth2/pull/518) - Add extract_access_token option to OAuth2::Client (@jonspalmer)
|
44
|
+
- [#507](https://github.com/oauth-xx/oauth2/pull/507) - Fix camel case content type, response keys (@anvox)
|
45
|
+
- [#500](https://github.com/oauth-xx/oauth2/pull/500) - Fix YARD documentation formatting (@olleolleolle)
|
20
46
|
|
21
47
|
## [1.4.4] - 2020-02-12
|
22
48
|
|
@@ -167,4 +193,11 @@ All notable changes to this project will be documented in this file.
|
|
167
193
|
[1.4.1]: https://github.com/oauth-xx/oauth2/compare/v1.4.0...v1.4.1
|
168
194
|
[1.4.2]: https://github.com/oauth-xx/oauth2/compare/v1.4.1...v1.4.2
|
169
195
|
[1.4.3]: https://github.com/oauth-xx/oauth2/compare/v1.4.2...v1.4.3
|
170
|
-
[
|
196
|
+
[1.4.4]: https://github.com/oauth-xx/oauth2/compare/v1.4.3...v1.4.4
|
197
|
+
[1.4.5]: https://github.com/oauth-xx/oauth2/compare/v1.4.4...v1.4.5
|
198
|
+
[1.4.6]: https://github.com/oauth-xx/oauth2/compare/v1.4.5...v1.4.6
|
199
|
+
[1.4.7]: https://github.com/oauth-xx/oauth2/compare/v1.4.6...v1.4.7
|
200
|
+
[1.4.8]: https://github.com/oauth-xx/oauth2/compare/v1.4.7...v1.4.8
|
201
|
+
[1.4.9]: https://github.com/oauth-xx/oauth2/compare/v1.4.8...v1.4.9
|
202
|
+
[1.4.10]: https://github.com/oauth-xx/oauth2/compare/v1.4.9...v1.4.10
|
203
|
+
[unreleased]: https://github.com/oauth-xx/oauth2/compare/v1.4.10...HEAD
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
## Submitting a Pull Request
|
2
|
+
1. [Fork the repository.][fork]
|
3
|
+
2. [Create a topic branch.][branch]
|
4
|
+
3. Add specs for your unimplemented feature or bug fix.
|
5
|
+
4. Run `bundle exec rake spec`. If your specs pass, return to step 3.
|
6
|
+
5. Implement your feature or bug fix.
|
7
|
+
6. Run `bundle exec rake`. If your specs fail, return to step 5.
|
8
|
+
7. Run `open coverage/index.html`. If your changes are not completely covered
|
9
|
+
by your tests, return to step 3.
|
10
|
+
8. Add documentation for your feature or bug fix.
|
11
|
+
9. Run `bundle exec rake verify_measurements`. If your changes are not 100%
|
12
|
+
documented, go back to step 8.
|
13
|
+
10. Commit and push your changes.
|
14
|
+
11. [Submit a pull request.][pr]
|
15
|
+
|
16
|
+
[fork]: http://help.github.com/fork-a-repo/
|
17
|
+
[branch]: http://learn.github.com/p/branching.html
|
18
|
+
[pr]: http://help.github.com/send-pull-requests/
|
data/LICENSE
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
MIT License
|
2
2
|
|
3
3
|
Copyright (c) 2011 - 2013 Michael Bleigh and Intridea, Inc.
|
4
|
-
Copyright (c) 2017 -
|
4
|
+
Copyright (c) 2017 - 2022 oauth-xx organization, https://github.com/oauth-xx
|
5
5
|
|
6
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
7
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -1,78 +1,285 @@
|
|
1
|
-
|
1
|
+
<p align="center">
|
2
|
+
<a href="http://oauth.net/2/" target="_blank" rel="noopener noreferrer">
|
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 noreferrer">
|
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>
|
2
9
|
|
3
|
-
|
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.
|
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
|
+
---
|
27
|
+
|
28
|
+
* [OAuth 2.0 Spec][oauth2-spec]
|
29
|
+
* [OAuth 1.0 sibling gem][sibling-gem]
|
30
|
+
|
31
|
+
[oauth2-spec]: https://oauth.net/2/
|
32
|
+
[sibling-gem]: https://github.com/oauth-xx/oauth-ruby
|
33
|
+
|
34
|
+
## Release Documentation
|
35
|
+
|
36
|
+
<details>
|
37
|
+
<summary>1.4.x Readmes</summary>
|
38
|
+
|
39
|
+
| Version | Release Date | Readme |
|
40
|
+
|---------|--------------|-----------------------------------------------------------|
|
41
|
+
| 1.4.10 | Jul 1, 2022 | https://github.com/oauth-xx/oauth2/blob/v1.4.10/README.md |
|
42
|
+
| 1.4.9 | Feb 20, 2022 | https://github.com/oauth-xx/oauth2/blob/v1.4.9/README.md |
|
43
|
+
| 1.4.8 | Feb 18, 2022 | https://github.com/oauth-xx/oauth2/blob/v1.4.8/README.md |
|
44
|
+
| 1.4.7 | Mar 19, 2021 | https://github.com/oauth-xx/oauth2/blob/v1.4.7/README.md |
|
45
|
+
| 1.4.6 | Mar 19, 2021 | https://github.com/oauth-xx/oauth2/blob/v1.4.6/README.md |
|
46
|
+
| 1.4.5 | Mar 18, 2021 | https://github.com/oauth-xx/oauth2/blob/v1.4.5/README.md |
|
47
|
+
| 1.4.4 | Feb 12, 2020 | https://github.com/oauth-xx/oauth2/blob/v1.4.4/README.md |
|
48
|
+
| 1.4.3 | Jan 29, 2020 | https://github.com/oauth-xx/oauth2/blob/v1.4.3/README.md |
|
49
|
+
| 1.4.2 | Oct 1, 2019 | https://github.com/oauth-xx/oauth2/blob/v1.4.2/README.md |
|
50
|
+
| 1.4.1 | Oct 13, 2018 | https://github.com/oauth-xx/oauth2/blob/v1.4.1/README.md |
|
51
|
+
| 1.4.0 | Jun 9, 2017 | https://github.com/oauth-xx/oauth2/blob/v1.4.0/README.md |
|
52
|
+
</details>
|
53
|
+
|
54
|
+
<details>
|
55
|
+
<summary>1.3.x Readmes</summary>
|
4
56
|
|
5
57
|
| Version | Release Date | Readme |
|
6
58
|
|----------|--------------|----------------------------------------------------------|
|
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
59
|
| 1.3.1 | Mar 3, 2017 | https://github.com/oauth-xx/oauth2/blob/v1.3.1/README.md |
|
16
60
|
| 1.3.0 | Dec 27, 2016 | https://github.com/oauth-xx/oauth2/blob/v1.3.0/README.md |
|
61
|
+
</details>
|
62
|
+
|
63
|
+
<details>
|
64
|
+
<summary>≤= 1.2.x Readmes (2016 and before)</summary>
|
65
|
+
|
66
|
+
| Version | Release Date | Readme |
|
67
|
+
|----------|--------------|----------------------------------------------------------|
|
17
68
|
| 1.2.0 | Jun 30, 2016 | https://github.com/oauth-xx/oauth2/blob/v1.2.0/README.md |
|
18
69
|
| 1.1.0 | Jan 30, 2016 | https://github.com/oauth-xx/oauth2/blob/v1.1.0/README.md |
|
19
70
|
| 1.0.0 | May 23, 2014 | https://github.com/oauth-xx/oauth2/blob/v1.0.0/README.md |
|
20
71
|
| < 1.0.0 | Find here | https://github.com/oauth-xx/oauth2/tags |
|
72
|
+
</details>
|
73
|
+
|
74
|
+
<!--
|
75
|
+
Numbering rows and badges in each row as a visual "database" lookup,
|
76
|
+
as the table is extremely dense, and it can be very difficult to find anything
|
77
|
+
Putting one on each row here, to document the emoji that should be used, and for ease of copy/paste.
|
78
|
+
|
79
|
+
row #s:
|
80
|
+
1️⃣
|
81
|
+
2️⃣
|
82
|
+
3️⃣
|
83
|
+
4️⃣
|
84
|
+
5️⃣
|
85
|
+
6️⃣
|
86
|
+
7️⃣
|
87
|
+
|
88
|
+
badge #s:
|
89
|
+
⛳️
|
90
|
+
🖇
|
91
|
+
🏘
|
92
|
+
🚎
|
93
|
+
🖐
|
94
|
+
🧮
|
95
|
+
📗
|
96
|
+
-->
|
97
|
+
|
98
|
+
| | Project | oauth2 |
|
99
|
+
|:----|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
100
|
+
| 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
|
+
| 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] |
|
103
|
+
| 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] |
|
105
|
+
| 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
|
+
| 7️⃣ | spread 💖 | [![Liberapay Patrons][⛳liberapay-img]][⛳liberapay] [![Sponsor Me][🖇sponsor-img]][🖇sponsor] [![Tweet @ Peter][🏘tweet-img]][🏘tweet] [🌏][aboutme] [👼][angelme] [💻][coderme] [🌹][politicme] |
|
107
|
+
|
108
|
+
<!--
|
109
|
+
The link tokens in the following sections should be kept ordered by the row and badge numbering scheme
|
110
|
+
-->
|
111
|
+
|
112
|
+
<!-- 1️⃣ name, license, docs -->
|
113
|
+
[⛳️gem]: https://rubygems.org/gems/oauth2
|
114
|
+
[⛳️name-img]: https://img.shields.io/badge/name-oauth2-brightgreen.svg?style=flat
|
115
|
+
[🖇src-license]: https://opensource.org/licenses/MIT
|
116
|
+
[🖇src-license-img]: https://img.shields.io/badge/License-MIT-green.svg
|
117
|
+
[🏘fossa]: https://app.fossa.io/projects/git%2Bgithub.com%2Foauth-xx%2Foauth2?ref=badge_shield
|
118
|
+
[🏘fossa-img]: https://app.fossa.io/api/projects/git%2Bgithub.com%2Foauth-xx%2Foauth2.svg?type=shield
|
119
|
+
[🚎yard]: https://www.rubydoc.info/github/oauth-xx/oauth2
|
120
|
+
[🚎yard-img]: https://img.shields.io/badge/documentation-rubydoc-brightgreen.svg?style=flat
|
121
|
+
[🖐inch-ci-img]: http://inch-ci.org/github/oauth-xx/oauth2.png
|
122
|
+
|
123
|
+
<!-- 2️⃣ version & activity -->
|
124
|
+
[⛳️version-img]: http://img.shields.io/gem/v/oauth2.svg
|
125
|
+
[🖇DL-total-img]: https://img.shields.io/gem/dt/oauth2.svg
|
126
|
+
[🏘DL-rank-img]: https://img.shields.io/gem/rt/oauth2.svg
|
127
|
+
[🚎src-home]: https://github.com/oauth-xx/oauth2
|
128
|
+
[🚎src-home-img]: https://img.shields.io/badge/source-github-brightgreen.svg?style=flat
|
129
|
+
[🖐prs-o]: https://github.com/oauth-xx/oauth2/pulls
|
130
|
+
[🖐prs-o-img]: https://img.shields.io/github/issues-pr/oauth-xx/oauth2
|
131
|
+
[🧮prs-c]: https://github.com/oauth-xx/oauth2/pulls?q=is%3Apr+is%3Aclosed
|
132
|
+
[🧮prs-c-img]: https://img.shields.io/github/issues-pr-closed/oauth-xx/oauth2
|
133
|
+
[📗next]: https://github.com/oauth-xx/oauth2/milestone/1
|
134
|
+
[📗next-img]: https://img.shields.io/github/milestones/progress/oauth-xx/oauth2/1?label=Next%20Version
|
135
|
+
|
136
|
+
<!-- 3️⃣ maintenance & linting -->
|
137
|
+
[⛳cclim-maint]: https://codeclimate.com/github/oauth-xx/oauth2/maintainability
|
138
|
+
[⛳cclim-maint-img]: https://api.codeclimate.com/v1/badges/688c612528ff90a46955/maintainability
|
139
|
+
[🖇triage-help]: https://www.codetriage.com/oauth-xx/oauth2
|
140
|
+
[🖇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
|
143
|
+
[🚎contributors]: https://github.com/oauth-xx/oauth2/graphs/contributors
|
144
|
+
[🚎contributors-img]: https://img.shields.io/github/contributors-anon/oauth-xx/oauth2
|
145
|
+
[🖐style-wf]: https://github.com/oauth-xx/oauth2/actions/workflows/style.yml
|
146
|
+
[🖐style-wf-img]: https://github.com/oauth-xx/oauth2/actions/workflows/style.yml/badge.svg
|
147
|
+
[🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
|
148
|
+
[🧮kloc-img]: https://img.shields.io/tokei/lines/github.com/oauth-xx/oauth2
|
149
|
+
|
150
|
+
<!-- 4️⃣ testing -->
|
151
|
+
[⛳iss-o]: https://github.com/oauth-xx/oauth2/issues
|
152
|
+
[⛳iss-o-img]: https://img.shields.io/github/issues-raw/oauth-xx/oauth2
|
153
|
+
[🖇iss-c]: https://github.com/oauth-xx/oauth2/issues?q=is%3Aissue+is%3Aclosed
|
154
|
+
[🖇iss-c-img]: https://img.shields.io/github/issues-closed-raw/oauth-xx/oauth2
|
155
|
+
[🏘sup-wf]: https://github.com/oauth-xx/oauth2/actions/workflows/supported.yml
|
156
|
+
[🏘sup-wf-img]: https://github.com/oauth-xx/oauth2/actions/workflows/supported.yml/badge.svg
|
157
|
+
[🚎heads-wf]: https://github.com/oauth-xx/oauth2/actions/workflows/heads.yml
|
158
|
+
[🚎heads-wf-img]: https://github.com/oauth-xx/oauth2/actions/workflows/heads.yml/badge.svg
|
159
|
+
[🖐uns-wf]: https://github.com/oauth-xx/oauth2/actions/workflows/unsupported.yml
|
160
|
+
[🖐uns-wf-img]: https://github.com/oauth-xx/oauth2/actions/workflows/unsupported.yml/badge.svg
|
161
|
+
[🧮mac-wf]: https://github.com/oauth-xx/oauth2/actions/workflows/macos.yml
|
162
|
+
[🧮mac-wf-img]: https://github.com/oauth-xx/oauth2/actions/workflows/macos.yml/badge.svg
|
163
|
+
[📗win-wf]: https://github.com/oauth-xx/oauth2/actions/workflows/windows.yml
|
164
|
+
[📗win-wf-img]: https://github.com/oauth-xx/oauth2/actions/workflows/windows.yml/badge.svg
|
165
|
+
|
166
|
+
<!-- 5️⃣ coverage & security -->
|
167
|
+
[⛳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/1-4-stable/graph/badge.svg?token=bNqSzNiuo2
|
170
|
+
[🖇codecov]: https://codecov.io/gh/oauth-xx/oauth2
|
171
|
+
[🏘coveralls]: https://coveralls.io/github/oauth-xx/oauth2?branch=1-4-stable
|
172
|
+
[🏘coveralls-img]: https://coveralls.io/repos/github/oauth-xx/oauth2/badge.svg?branch=1-4-stable
|
173
|
+
[🚎sec-pol]: https://github.com/oauth-xx/oauth2/blob/master/SECURITY.md
|
174
|
+
[🚎sec-pol-img]: https://img.shields.io/badge/security-policy-brightgreen.svg?style=flat
|
175
|
+
[🖐codeQL]: https://github.com/oauth-xx/oauth2/security/code-scanning
|
176
|
+
[🖐codeQL-img]: https://github.com/oauth-xx/oauth2/actions/workflows/codeql-analysis.yml/badge.svg
|
177
|
+
[🧮cov-wf]: https://github.com/oauth-xx/oauth2/actions/workflows/coverage.yml
|
178
|
+
[🧮cov-wf-img]: https://github.com/oauth-xx/oauth2/actions/workflows/coverage.yml/badge.svg
|
179
|
+
|
180
|
+
<!-- 6️⃣ resources -->
|
181
|
+
[⛳gh-discussions]: https://github.com/oauth-xx/oauth2/discussions
|
182
|
+
[⛳gh-discussions-img]: https://img.shields.io/github/discussions/oauth-xx/oauth2
|
183
|
+
[🖇codementor]: https://www.codementor.io/peterboling?utm_source=github&utm_medium=button&utm_term=peterboling&utm_campaign=github
|
184
|
+
[🖇codementor-img]: https://cdn.codementor.io/badges/get_help_github.svg
|
185
|
+
[🏘chat]: https://gitter.im/oauth-xx/oauth2
|
186
|
+
[🏘chat-img]: https://img.shields.io/gitter/room/oauth-xx/oauth2.svg
|
187
|
+
[🚎blog]: http://www.railsbling.com/tags/oauth2/
|
188
|
+
[🚎blog-img]: https://img.shields.io/badge/blog-railsbling-brightgreen.svg?style=flat
|
189
|
+
[🖐wiki]: https://github.com/oauth-xx/oauth2/wiki
|
190
|
+
[🖐wiki-img]: https://img.shields.io/badge/wiki-examples-brightgreen.svg?style=flat
|
191
|
+
|
192
|
+
<!-- 7️⃣ spread 💖 -->
|
193
|
+
[⛳liberapay-img]: https://img.shields.io/liberapay/patrons/pboling.svg?logo=liberapay
|
194
|
+
[⛳liberapay]: https://liberapay.com/pboling/donate
|
195
|
+
[🖇sponsor-img]: https://img.shields.io/badge/sponsor-pboling.svg?style=social&logo=github
|
196
|
+
[🖇sponsor]: https://github.com/sponsors/pboling
|
197
|
+
[🏘tweet-img]: https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow
|
198
|
+
[🏘tweet]: http://twitter.com/galtzo
|
199
|
+
|
200
|
+
<!-- Maintainer Contact Links -->
|
201
|
+
[railsbling]: http://www.railsbling.com
|
202
|
+
[peterboling]: http://www.peterboling.com
|
203
|
+
[aboutme]: https://about.me/peter.boling
|
204
|
+
[angelme]: https://angel.co/peter-boling
|
205
|
+
[coderme]:http://coderwall.com/pboling
|
206
|
+
[politicme]: https://nationalprogressiveparty.org
|
21
207
|
|
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].
|
48
|
-
|
49
|
-
[oauth2-spec]: https://oauth.net/2/
|
50
208
|
|
51
209
|
## Installation
|
52
210
|
|
53
|
-
|
211
|
+
```shell
|
212
|
+
gem install oauth2
|
213
|
+
```
|
214
|
+
|
215
|
+
Or inside a `Gemfile`
|
54
216
|
|
55
217
|
```ruby
|
56
218
|
gem 'oauth2'
|
57
219
|
```
|
220
|
+
And then execute in a shell:
|
221
|
+
```shell
|
222
|
+
bundle
|
223
|
+
```
|
58
224
|
|
59
|
-
|
225
|
+
## OAuth2 for Enterprise
|
60
226
|
|
61
|
-
|
227
|
+
Available as part of the Tidelift Subscription.
|
62
228
|
|
63
|
-
|
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.][tidelift-ref]
|
64
230
|
|
65
|
-
|
231
|
+
[tidelift-ref]: https://tidelift.com/subscription/pkg/rubygems-oauth2?utm_source=rubygems-oauth2&utm_medium=referral&utm_campaign=enterprise
|
66
232
|
|
67
|
-
##
|
233
|
+
## Security contact information
|
234
|
+
|
235
|
+
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security).
|
236
|
+
Tidelift will coordinate the fix and disclosure.
|
237
|
+
|
238
|
+
For more see [SECURITY.md][🚎sec-pol].
|
239
|
+
|
240
|
+
## Compatibility
|
241
|
+
|
242
|
+
Targeted ruby compatibility is 2.7, 3.0 and 3.1. Compatibility is further distinguished by
|
243
|
+
supported and unsupported versions of Ruby.
|
244
|
+
This gem will work with Ruby versions back to 1.9, though it remains unsupported.
|
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).
|
246
|
+
|
247
|
+
<details>
|
248
|
+
<summary>Ruby Engine Compatibility Policy</summary>
|
249
|
+
|
250
|
+
This gem is tested against MRI, JRuby, and Truffleruby.
|
251
|
+
Each of those has varying versions that target a specific version of MRI Ruby.
|
252
|
+
This gem should work in the just-listed Ruby engines according to the targeted MRI compatibility in the table below.
|
253
|
+
If you would like to add support for additional engines,
|
254
|
+
first make sure Github Actions supports the engine,
|
255
|
+
then submit a PR to the correct maintenance branch as according to the table below.
|
256
|
+
</details>
|
257
|
+
|
258
|
+
<details>
|
259
|
+
<summary>Ruby Version Compatibility Policy</summary>
|
260
|
+
|
261
|
+
If something doesn't work on one of these interpreters, it's a bug.
|
262
|
+
|
263
|
+
This library may inadvertently work (or seem to work) on other Ruby
|
264
|
+
implementations, however support will only be provided for the versions listed
|
265
|
+
above.
|
266
|
+
|
267
|
+
If you would like this library to support another Ruby version, you may
|
268
|
+
volunteer to be a maintainer. Being a maintainer entails making sure all tests
|
269
|
+
run and pass on that implementation. When something breaks on your
|
270
|
+
implementation, you will be responsible for providing patches in a timely
|
271
|
+
fashion. If critical issues for a particular implementation exist at the time
|
272
|
+
of a major release, support for that Ruby version may be dropped.
|
273
|
+
</details>
|
68
274
|
|
69
|
-
|
70
|
-
|
71
|
-
|
275
|
+
| | Ruby OAuth2 Version | Maintenance Branch | Supported Officially | Supported Unofficially | Supported Incidentally |
|
276
|
+
|:----|---------------------|--------------------|-------------------------|------------------------|------------------------|
|
277
|
+
| 1️⃣ | 2.0.x | `master` | 2.7, 3.0, 3.1 | 2.5, 2.6 | 2.2, 2.3, 2.4 |
|
278
|
+
| 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 |
|
279
|
+
| 3️⃣ | older | N/A | Best of luck to you! | Please upgrade! | |
|
72
280
|
|
73
|
-
|
74
|
-
[
|
75
|
-
[wiki]: https://wiki.github.com/oauth-xx/oauth2
|
281
|
+
NOTE: The 1.4 series will only receive critical security updates.
|
282
|
+
See [SECURITY.md][🚎sec-pol]
|
76
283
|
|
77
284
|
## Usage Examples
|
78
285
|
|
@@ -88,13 +295,38 @@ response = token.get('/api/resource', :params => {'query_foo' => 'bar'})
|
|
88
295
|
response.class.name
|
89
296
|
# => OAuth2::Response
|
90
297
|
```
|
298
|
+
|
299
|
+
<details>
|
300
|
+
<summary>Debugging</summary>
|
301
|
+
|
302
|
+
Set an environment variable, however you would [normally do that](https://github.com/bkeepers/dotenv).
|
303
|
+
|
304
|
+
```ruby
|
305
|
+
# will log both request and response, including bodies
|
306
|
+
ENV['OAUTH_DEBUG'] = 'true'
|
307
|
+
```
|
308
|
+
|
309
|
+
By default, debug output will go to `$stdout`. This can be overridden when
|
310
|
+
initializing your OAuth2::Client.
|
311
|
+
|
312
|
+
```ruby
|
313
|
+
require 'oauth2'
|
314
|
+
client = OAuth2::Client.new(
|
315
|
+
'client_id',
|
316
|
+
'client_secret',
|
317
|
+
:site => 'https://example.org',
|
318
|
+
:logger => Logger.new('example.log', 'weekly')
|
319
|
+
)
|
320
|
+
```
|
321
|
+
</details>
|
322
|
+
|
91
323
|
## OAuth2::Response
|
92
324
|
|
93
|
-
The AccessToken methods
|
325
|
+
The `AccessToken` methods `#get`, `#post`, `#put` and `#delete` and the generic `#request`
|
94
326
|
will return an instance of the #OAuth2::Response class.
|
95
327
|
|
96
|
-
This instance contains a
|
97
|
-
return a Hash if the Content-Type is application/x-www-form-urlencoded or if
|
328
|
+
This instance contains a `#parsed` method that will parse the response body and
|
329
|
+
return a Hash if the `Content-Type` is `application/x-www-form-urlencoded` or if
|
98
330
|
the body is a JSON object. It will return an Array if the body is a JSON
|
99
331
|
array. Otherwise, it will return the original body string.
|
100
332
|
|
@@ -104,27 +336,27 @@ respective methods.
|
|
104
336
|
## OAuth2::AccessToken
|
105
337
|
|
106
338
|
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).
|
339
|
+
using various class methods including the standard new, `from_hash` (if you have
|
340
|
+
a hash of the values), or `from_kvform` (if you have an
|
341
|
+
`application/x-www-form-urlencoded` encoded string of the values).
|
110
342
|
|
111
343
|
## OAuth2::Error
|
112
344
|
|
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
|
115
|
-
error_description parameters. The
|
116
|
-
always contain the OAuth2::Response instance.
|
345
|
+
On 400+ status code responses, an `OAuth2::Error` will be raised. If it is a
|
346
|
+
standard OAuth2 error response, the body will be parsed and `#code` and `#description` will contain the values provided from the error and
|
347
|
+
`error_description` parameters. The `#response` property of `OAuth2::Error` will
|
348
|
+
always contain the `OAuth2::Response` instance.
|
117
349
|
|
118
|
-
If you do not want an error to be raised, you may use
|
119
|
-
option on initialization of the client. In this case the OAuth2::Response
|
350
|
+
If you do not want an error to be raised, you may use `:raise_errors => false`
|
351
|
+
option on initialization of the client. In this case the `OAuth2::Response`
|
120
352
|
instance will be returned as usual and on 400+ status code responses, the
|
121
|
-
Response instance will contain the OAuth2::Error instance.
|
353
|
+
Response instance will contain the `OAuth2::Error` instance.
|
122
354
|
|
123
355
|
## Authorization Grants
|
124
356
|
|
125
357
|
Currently the Authorization Code, Implicit, Resource Owner Password Credentials, Client Credentials, and Assertion
|
126
358
|
authentication grant types have helper strategy classes that simplify client
|
127
|
-
use.
|
359
|
+
use. They are available via the `#auth_code`, `#implicit`, `#password`, `#client_credentials`, and `#assertion` methods respectively.
|
128
360
|
|
129
361
|
```ruby
|
130
362
|
auth_url = client.auth_code.authorize_url(:redirect_uri => 'http://localhost:8080/oauth/callback')
|
@@ -148,56 +380,9 @@ request, add a 'headers' hash under 'params':
|
|
148
380
|
token = client.auth_code.get_token('code_value', :redirect_uri => 'http://localhost:8080/oauth/callback', :headers => {'Some' => 'Header'})
|
149
381
|
```
|
150
382
|
|
151
|
-
You can always use the
|
383
|
+
You can always use the `#request` method on the `OAuth2::Client` instance to make
|
152
384
|
requests for tokens for any Authentication grant type.
|
153
385
|
|
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
386
|
## Versioning
|
202
387
|
|
203
388
|
This library aims to adhere to [Semantic Versioning 2.0.0][semver].
|
@@ -221,21 +406,21 @@ spec.add_dependency 'oauth2', '~> 1.4'
|
|
221
406
|
|
222
407
|
## License
|
223
408
|
|
224
|
-
[![License: MIT]
|
409
|
+
[![License: MIT][🖇src-license-img]][🖇src-license]
|
225
410
|
|
226
411
|
- Copyright (c) 2011-2013 Michael Bleigh and Intridea, Inc.
|
227
|
-
- Copyright (c) 2017-
|
412
|
+
- Copyright (c) 2017-2022 [oauth-xx organization][oauth-xx]
|
228
413
|
- See [LICENSE][license] for details.
|
229
414
|
|
230
415
|
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Foauth-xx%2Foauth2.svg?type=large)][fossa2]
|
231
416
|
|
232
|
-
[license]: LICENSE
|
417
|
+
[license]: https://github.com/oauth-xx/oauth2/blob/master/LICENSE
|
233
418
|
[oauth-xx]: https://github.com/oauth-xx
|
234
419
|
[fossa2]: https://app.fossa.io/projects/git%2Bgithub.com%2Foauth-xx%2Foauth2?ref=badge_large
|
235
420
|
|
236
421
|
## Development
|
237
422
|
|
238
|
-
After checking out the repo, run `bundle install` to install dependencies. Then, run `rake spec` to run the tests.
|
423
|
+
After checking out the repo, run `bundle install` to install dependencies. Then, run `bundle excec rake spec` to run the tests.
|
239
424
|
|
240
425
|
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
426
|
|
data/SECURITY.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# Security Policy
|
2
|
+
|
3
|
+
## Supported Versions
|
4
|
+
|
5
|
+
| Version | Supported |
|
6
|
+
|----------|------------------------------------|
|
7
|
+
| 2.latest | ✅ |
|
8
|
+
| 1.latest | ✅ (critical security updates only) |
|
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.
|
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)
|
data/lib/oauth2/access_token.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module OAuth2
|
2
4
|
class AccessToken
|
3
5
|
attr_reader :client, :token, :expires_in, :expires_at, :params
|
@@ -38,7 +40,7 @@ module OAuth2
|
|
38
40
|
# @option opts [String] :header_format ('Bearer %s') the string format to use for the Authorization header
|
39
41
|
# @option opts [String] :param_name ('access_token') the parameter name to use for transmission of the
|
40
42
|
# Access Token value in :body or :query transmission mode
|
41
|
-
def initialize(client, token, opts = {})
|
43
|
+
def initialize(client, token, opts = {})
|
42
44
|
@client = client
|
43
45
|
@token = token.to_s
|
44
46
|
opts = opts.dup
|
@@ -151,7 +153,7 @@ module OAuth2
|
|
151
153
|
|
152
154
|
private
|
153
155
|
|
154
|
-
def configure_authentication!(opts)
|
156
|
+
def configure_authentication!(opts)
|
155
157
|
case options[:mode]
|
156
158
|
when :header
|
157
159
|
opts[:headers] ||= {}
|