oauth2 1.4.2 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +17 -0
- data/CHANGELOG.md +8 -0
- data/README.md +24 -2
- data/gemfiles/ruby_2.7.gemfile +9 -0
- data/lib/oauth2/authenticator.rb +10 -0
- data/lib/oauth2/client.rb +3 -2
- data/lib/oauth2/version.rb +1 -1
- data/oauth2.gemspec +8 -0
- metadata +10 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d268c85a1429a82d674a4acab6c89cd9b3b64044c2629ce321f5a0aba9f0f1e9
|
4
|
+
data.tar.gz: 9aa05cb486902e77eadcb801cfc36febb48707cda62ae76899398876cbe312d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9684210662ed503a26ba29ee7f0049afcd1ff3c185fe008c0b78cf3a5822dc10f2010b7d38ac7bde7eea479e3f7e3828b329c8bbecf54c3da3d2280be00dcd7
|
7
|
+
data.tar.gz: 8e9e3503c15112cada5c355e28f1ab5068b302768e5ad2fad4204e574712bccf0387edda4d410fb3fb67c25d3850b1e1d032a342e0ace183871efded3115061d
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.0
|
data/.travis.yml
CHANGED
@@ -19,10 +19,23 @@ before_install:
|
|
19
19
|
gem install --no-document bundler "bundler:>=2.0"
|
20
20
|
fi
|
21
21
|
|
22
|
+
before_script:
|
23
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
24
|
+
- chmod +x ./cc-test-reporter
|
25
|
+
- ./cc-test-reporter before-build
|
26
|
+
|
27
|
+
after_script:
|
28
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
29
|
+
|
22
30
|
bundler_args: --no-deployment --jobs 3 --retry 3
|
23
31
|
|
24
32
|
cache: bundler
|
25
33
|
|
34
|
+
env:
|
35
|
+
global:
|
36
|
+
- JRUBY_OPTS="$JRUBY_OPTS -Xcli.debug=true --debug"
|
37
|
+
- CC_TEST_REPORTER_ID=29caf9cf27d27ae609c088feb9d4ba34460f7a39251f2e8615c9a16f3075530e
|
38
|
+
|
26
39
|
language: ruby
|
27
40
|
|
28
41
|
matrix:
|
@@ -31,6 +44,8 @@ matrix:
|
|
31
44
|
- rvm: ruby-head
|
32
45
|
- rvm: truffleruby
|
33
46
|
- rvm: jruby-9.0
|
47
|
+
- rvm: jruby-9.1 # jruby-9.1 often fails to download, thus failing the build.
|
48
|
+
- rvm: jruby-9.2 # jruby-9.2 often fails to download, thus failing the build.
|
34
49
|
fast_finish: true
|
35
50
|
include:
|
36
51
|
# - rvm: jruby-1.7 # targets MRI v1.9
|
@@ -60,6 +75,8 @@ matrix:
|
|
60
75
|
gemfile: gemfiles/ruby_2.5.gemfile
|
61
76
|
- rvm: 2.6
|
62
77
|
gemfile: gemfiles/ruby_2.6.gemfile
|
78
|
+
- rvm: 2.7
|
79
|
+
gemfile: gemfiles/ruby_2.7.gemfile
|
63
80
|
- rvm: jruby-head
|
64
81
|
gemfile: gemfiles/jruby_head.gemfile
|
65
82
|
- rvm: ruby-head
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
|
6
6
|
- no changes yet
|
7
7
|
|
8
|
+
## [1.4.3] - 2020-01-29
|
9
|
+
|
10
|
+
- [#483](https://github.com/oauth-xx/oauth2/pull/483) - add project metadata to gemspec (@orien)
|
11
|
+
- [#495](https://github.com/oauth-xx/oauth2/pull/495) - support additional types of access token requests (@SteveyblamFreeagent, @thomcorley, @dgholz)
|
12
|
+
- Adds support for private_key_jwt and tls_client_auth
|
13
|
+
|
8
14
|
## [1.4.2] - 2019-10-01
|
9
15
|
|
10
16
|
- [#478](https://github.com/oauth-xx/oauth2/pull/478) - support latest version of faraday & fix build (@pboling)
|
@@ -141,4 +147,6 @@ All notable changes to this project will be documented in this file.
|
|
141
147
|
[1.3.1]: https://github.com/oauth-xx/oauth2/compare/v1.3.0...v1.3.1
|
142
148
|
[1.4.0]: https://github.com/oauth-xx/oauth2/compare/v1.3.1...v1.4.0
|
143
149
|
[1.4.1]: https://github.com/oauth-xx/oauth2/compare/v1.4.0...v1.4.1
|
150
|
+
[1.4.2]: https://github.com/oauth-xx/oauth2/compare/v1.4.1...v1.4.2
|
151
|
+
[1.4.3]: https://github.com/oauth-xx/oauth2/compare/v1.4.2...v1.4.3
|
144
152
|
[unreleased]: https://github.com/oauth-xx/oauth2/compare/v1.4.1...HEAD
|
data/README.md
CHANGED
@@ -1,10 +1,25 @@
|
|
1
1
|
# OAuth2
|
2
2
|
|
3
|
+
If you need the readme for a released version of the gem please find it below:
|
4
|
+
|
5
|
+
| Version | Release Date | Readme |
|
6
|
+
|----------|--------------|----------------------------------------------------------|
|
7
|
+
| 1.4.3 | Jan 29, 2020 | https://github.com/oauth-xx/oauth2/blob/v1.4.3/README.md |
|
8
|
+
| 1.4.2 | Oct 1, 2019 | https://github.com/oauth-xx/oauth2/blob/v1.4.2/README.md |
|
9
|
+
| 1.4.1 | Oct 13, 2018 | https://github.com/oauth-xx/oauth2/blob/v1.4.1/README.md |
|
10
|
+
| 1.4.0 | Jun 9, 2017 | https://github.com/oauth-xx/oauth2/blob/v1.4.0/README.md |
|
11
|
+
| 1.3.1 | Mar 3, 2017 | https://github.com/oauth-xx/oauth2/blob/v1.3.1/README.md |
|
12
|
+
| 1.3.0 | Dec 27, 2016 | https://github.com/oauth-xx/oauth2/blob/v1.3.0/README.md |
|
13
|
+
| 1.2.0 | Jun 30, 2016 | https://github.com/oauth-xx/oauth2/blob/v1.2.0/README.md |
|
14
|
+
| 1.1.0 | Jan 30, 2016 | https://github.com/oauth-xx/oauth2/blob/v1.1.0/README.md |
|
15
|
+
| 1.0.0 | May 23, 2014 | https://github.com/oauth-xx/oauth2/blob/v1.0.0/README.md |
|
16
|
+
| < 1.0.0 | Find here | https://github.com/oauth-xx/oauth2/tags |
|
17
|
+
|
3
18
|
[![Gem Version](http://img.shields.io/gem/v/oauth2.svg)][gem]
|
4
19
|
[![Total Downloads](https://img.shields.io/gem/dt/oauth2.svg)][gem]
|
5
20
|
[![Downloads Today](https://img.shields.io/gem/rt/oauth2.svg)][gem]
|
6
21
|
[![Build Status](https://travis-ci.org/oauth-xx/oauth2.svg?branch=1-4-stable)][travis]
|
7
|
-
[![Coverage
|
22
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/688c612528ff90a46955/test_coverage)][codeclimate-coverage]
|
8
23
|
[![Maintainability](https://api.codeclimate.com/v1/badges/688c612528ff90a46955/maintainability)][codeclimate-maintainability]
|
9
24
|
[![Depfu](https://badges.depfu.com/badges/6d34dc1ba682bbdf9ae2a97848241743/count.svg)][depfu]
|
10
25
|
[![Open Source Helpers](https://www.codetriage.com/oauth-xx/oauth2/badges/users.svg)][code-triage]
|
@@ -16,10 +31,12 @@
|
|
16
31
|
[travis]: http://travis-ci.org/oauth-xx/oauth2
|
17
32
|
[coveralls]: https://coveralls.io/r/oauth-xx/oauth2
|
18
33
|
[codeclimate-maintainability]: https://codeclimate.com/github/oauth-xx/oauth2/maintainability
|
34
|
+
[codeclimate-coverage]: https://codeclimate.com/github/oauth-xx/oauth2/test_coverage
|
19
35
|
[depfu]: https://depfu.com/github/oauth-xx/oauth2
|
20
36
|
[source-license]: https://opensource.org/licenses/MIT
|
21
37
|
[inch-ci]: http://inch-ci.org/github/oauth-xx/oauth2
|
22
38
|
[code-triage]: https://www.codetriage.com/oauth-xx/oauth2
|
39
|
+
[fossa1]: https://app.fossa.io/projects/git%2Bgithub.com%2Foauth-xx%2Foauth2?ref=badge_shield
|
23
40
|
|
24
41
|
A Ruby wrapper for the [OAuth 2.0 specification][oauth2-spec].
|
25
42
|
|
@@ -49,7 +66,7 @@ Or install it yourself as:
|
|
49
66
|
|
50
67
|
[code]: https://github.com/oauth-xx/oauth2
|
51
68
|
[issues]: https://github.com/oauth-xx/oauth2/issues
|
52
|
-
[wiki]: https://github.com/oauth-xx/oauth2
|
69
|
+
[wiki]: https://wiki.github.com/oauth-xx/oauth2
|
53
70
|
|
54
71
|
## Usage Examples
|
55
72
|
|
@@ -66,6 +83,7 @@ response.class.name
|
|
66
83
|
# => OAuth2::Response
|
67
84
|
```
|
68
85
|
## OAuth2::Response
|
86
|
+
|
69
87
|
The AccessToken methods #get, #post, #put and #delete and the generic #request
|
70
88
|
will return an instance of the #OAuth2::Response class.
|
71
89
|
|
@@ -78,12 +96,14 @@ The original response body, headers, and status can be accessed via their
|
|
78
96
|
respective methods.
|
79
97
|
|
80
98
|
## OAuth2::AccessToken
|
99
|
+
|
81
100
|
If you have an existing Access Token for a user, you can initialize an instance
|
82
101
|
using various class methods including the standard new, from_hash (if you have
|
83
102
|
a hash of the values), or from_kvform (if you have an
|
84
103
|
application/x-www-form-urlencoded encoded string of the values).
|
85
104
|
|
86
105
|
## OAuth2::Error
|
106
|
+
|
87
107
|
On 400+ status code responses, an OAuth2::Error will be raised. If it is a
|
88
108
|
standard OAuth2 error response, the body will be parsed and #code and #description will contain the values provided from the error and
|
89
109
|
error_description parameters. The #response property of OAuth2::Error will
|
@@ -95,6 +115,7 @@ instance will be returned as usual and on 400+ status code responses, the
|
|
95
115
|
Response instance will contain the OAuth2::Error instance.
|
96
116
|
|
97
117
|
## Authorization Grants
|
118
|
+
|
98
119
|
Currently the Authorization Code, Implicit, Resource Owner Password Credentials, Client Credentials, and Assertion
|
99
120
|
authentication grant types have helper strategy classes that simplify client
|
100
121
|
use. They are available via the #auth_code, #implicit, #password, #client_credentials, and #assertion methods respectively.
|
@@ -150,6 +171,7 @@ implementations:
|
|
150
171
|
- [JRuby 9.2][jruby-9.2] (targets MRI v2.5)
|
151
172
|
- [truffleruby][truffleruby] (targets MRI 2.5)
|
152
173
|
* Ruby 2.6 - Support ends with version 6.x series
|
174
|
+
* Ruby 2.7 - Support ends with version 7.x series
|
153
175
|
|
154
176
|
[jruby-1.7]: https://www.jruby.org/2017/05/11/jruby-1-7-27.html
|
155
177
|
[jruby-9.0]: https://www.jruby.org/2016/01/26/jruby-9-0-5-0.html
|
data/lib/oauth2/authenticator.rb
CHANGED
@@ -25,6 +25,10 @@ module OAuth2
|
|
25
25
|
apply_basic_auth(params)
|
26
26
|
when :request_body
|
27
27
|
apply_params_auth(params)
|
28
|
+
when :tls_client_auth
|
29
|
+
apply_client_id(params)
|
30
|
+
when :private_key_jwt
|
31
|
+
params
|
28
32
|
else
|
29
33
|
raise NotImplementedError
|
30
34
|
end
|
@@ -42,6 +46,12 @@ module OAuth2
|
|
42
46
|
{'client_id' => id, 'client_secret' => secret}.merge(params)
|
43
47
|
end
|
44
48
|
|
49
|
+
# When using schemes that don't require the client_secret to be passed i.e TLS Client Auth,
|
50
|
+
# we don't want to send the secret
|
51
|
+
def apply_client_id(params)
|
52
|
+
{ 'client_id' => id }.merge(params)
|
53
|
+
end
|
54
|
+
|
45
55
|
# Adds an `Authorization` header with Basic Auth credentials if and only if
|
46
56
|
# it is not already set in the params.
|
47
57
|
def apply_basic_auth(params)
|
data/lib/oauth2/client.rb
CHANGED
@@ -94,9 +94,10 @@ module OAuth2
|
|
94
94
|
def request(verb, url, opts = {}) # rubocop:disable CyclomaticComplexity, MethodLength, Metrics/AbcSize
|
95
95
|
connection.response :logger, ::Logger.new($stdout) if ENV['OAUTH_DEBUG'] == 'true'
|
96
96
|
|
97
|
-
url = connection.build_url(url
|
97
|
+
url = connection.build_url(url).to_s
|
98
98
|
|
99
99
|
response = connection.run_request(verb, url, opts[:body], opts[:headers]) do |req|
|
100
|
+
req.params.update(opts[:params]) if opts[:params]
|
100
101
|
yield(req) if block_given?
|
101
102
|
end
|
102
103
|
response = Response.new(response, :parse => opts[:parse])
|
@@ -130,7 +131,7 @@ module OAuth2
|
|
130
131
|
# @param [Hash] params a Hash of params for the token endpoint
|
131
132
|
# @param [Hash] access token options, to pass to the AccessToken object
|
132
133
|
# @param [Class] class of access token for easier subclassing OAuth2::AccessToken
|
133
|
-
# @return [AccessToken] the
|
134
|
+
# @return [AccessToken] the initialized AccessToken
|
134
135
|
def get_token(params, access_token_opts = {}, access_token_class = AccessToken) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
135
136
|
params = Authenticator.new(id, secret, options[:auth_scheme]).apply(params)
|
136
137
|
opts = {:raise_errors => options[:raise_errors], :parse => params.delete(:parse)}
|
data/lib/oauth2/version.rb
CHANGED
data/oauth2.gemspec
CHANGED
@@ -22,6 +22,14 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.summary = 'A Ruby wrapper for the OAuth 2.0 protocol.'
|
23
23
|
spec.version = OAuth2::Version
|
24
24
|
|
25
|
+
spec.metadata = {
|
26
|
+
'bug_tracker_uri' => 'https://github.com/oauth-xx/oauth2/issues',
|
27
|
+
'changelog_uri' => "https://github.com/oauth-xx/oauth2/blob/v#{spec.version}/CHANGELOG.md",
|
28
|
+
'documentation_uri' => "https://www.rubydoc.info/gems/oauth2/#{spec.version}",
|
29
|
+
'source_code_uri' => "https://github.com/oauth-xx/oauth2/tree/v#{spec.version}",
|
30
|
+
'wiki_uri' => 'https://github.com/oauth-xx/oauth2/wiki'
|
31
|
+
}
|
32
|
+
|
25
33
|
spec.require_paths = %w[lib]
|
26
34
|
spec.bindir = 'exe'
|
27
35
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oauth2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Boling
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2020-01-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: faraday
|
@@ -311,6 +311,7 @@ files:
|
|
311
311
|
- gemfiles/ruby_2.4.gemfile
|
312
312
|
- gemfiles/ruby_2.5.gemfile
|
313
313
|
- gemfiles/ruby_2.6.gemfile
|
314
|
+
- gemfiles/ruby_2.7.gemfile
|
314
315
|
- gemfiles/ruby_head.gemfile
|
315
316
|
- gemfiles/truffleruby.gemfile
|
316
317
|
- lib/oauth2.rb
|
@@ -331,7 +332,12 @@ files:
|
|
331
332
|
homepage: https://github.com/oauth-xx/oauth2
|
332
333
|
licenses:
|
333
334
|
- MIT
|
334
|
-
metadata:
|
335
|
+
metadata:
|
336
|
+
bug_tracker_uri: https://github.com/oauth-xx/oauth2/issues
|
337
|
+
changelog_uri: https://github.com/oauth-xx/oauth2/blob/v1.4.3/CHANGELOG.md
|
338
|
+
documentation_uri: https://www.rubydoc.info/gems/oauth2/1.4.3
|
339
|
+
source_code_uri: https://github.com/oauth-xx/oauth2/tree/v1.4.3
|
340
|
+
wiki_uri: https://github.com/oauth-xx/oauth2/wiki
|
335
341
|
post_install_message:
|
336
342
|
rdoc_options: []
|
337
343
|
require_paths:
|
@@ -347,7 +353,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
347
353
|
- !ruby/object:Gem::Version
|
348
354
|
version: 1.3.5
|
349
355
|
requirements: []
|
350
|
-
rubygems_version: 3.
|
356
|
+
rubygems_version: 3.1.2
|
351
357
|
signing_key:
|
352
358
|
specification_version: 4
|
353
359
|
summary: A Ruby wrapper for the OAuth 2.0 protocol.
|