signet 0.15.0 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +11 -0
- data/CHANGELOG.md +63 -45
- data/CODE_OF_CONDUCT.md +43 -0
- data/SECURITY.md +7 -0
- data/lib/signet/oauth_1/client.rb +1 -1
- data/lib/signet/oauth_1/credential.rb +1 -1
- data/lib/signet/oauth_1/server.rb +3 -3
- data/lib/signet/oauth_1/signature_methods/hmac_sha1.rb +1 -1
- data/lib/signet/oauth_1/signature_methods/plaintext.rb +1 -1
- data/lib/signet/oauth_1/signature_methods/rsa_sha1.rb +1 -1
- data/lib/signet/oauth_1.rb +1 -1
- data/lib/signet/oauth_2/client.rb +25 -12
- data/lib/signet/oauth_2.rb +2 -2
- data/lib/signet/version.rb +1 -1
- data/lib/signet.rb +1 -1
- metadata +25 -39
- data/Gemfile +0 -8
- data/Rakefile +0 -112
- data/signet.gemspec +0 -45
- data/spec/signet/oauth_1/client_spec.rb +0 -810
- data/spec/signet/oauth_1/credential_spec.rb +0 -169
- data/spec/signet/oauth_1/server_spec.rb +0 -839
- data/spec/signet/oauth_1/signature_methods/hmac_sha1_spec.rb +0 -61
- data/spec/signet/oauth_1/signature_methods/plaintext_spec.rb +0 -61
- data/spec/signet/oauth_1/signature_methods/rsa_sha1_spec.rb +0 -126
- data/spec/signet/oauth_1_spec.rb +0 -1036
- data/spec/signet/oauth_2/client_spec.rb +0 -1254
- data/spec/signet/oauth_2_spec.rb +0 -194
- data/spec/signet_spec.rb +0 -78
- data/spec/spec.opts +0 -2
- data/spec/spec_helper.rb +0 -10
- data/spec/spec_helper_spec.rb +0 -17
- data/website/index.html +0 -95
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13bd869943add17b04e66089d5c1a5d34a8d6053c55fb4dc389bc9e3a83c36ae
|
4
|
+
data.tar.gz: 17a0094e4ef483d07ea945155956d81a06423a8d57abc725d326b49c2cb62171
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6817470226e95dd4535bb7316b98c2b95d6ef70a8b9a1466656018fc9e642a02901390e0b40562e7ac7ea3a6acfefdb07d3317c6879453bb23ca07090bd9643
|
7
|
+
data.tar.gz: d49ad82ef1cbf8fab14b74370f07e3567c3f2594045e3cf82ec5f72f69f93ebe47954bff340fe7c472fb31f6269bbe012fec8e24f369167e59a519bfc02ff13b
|
data/.yardopts
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,67 +1,85 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
-
|
3
|
+
### 0.17.0 (2022-06-23)
|
4
4
|
|
5
|
+
* Updated minimum Ruby version to 2.6
|
5
6
|
|
6
|
-
###
|
7
|
+
### 0.16.1 (2022-02-24)
|
7
8
|
|
8
|
-
|
9
|
+
#### Bug Fixes
|
9
10
|
|
10
|
-
|
11
|
+
* Support Faraday 2
|
12
|
+
|
13
|
+
### 0.16.0 (2021-09-03)
|
14
|
+
|
15
|
+
#### Features
|
16
|
+
|
17
|
+
* Support for fetching an access token with basic auth
|
18
|
+
|
19
|
+
#### Bug Fixes
|
20
|
+
|
21
|
+
* Remove extraneous files from the gem
|
22
|
+
* Require addressable 2.8 to remediate vulnerability
|
23
|
+
|
24
|
+
### 0.15.0 (2021-03-04)
|
25
|
+
|
26
|
+
* Drop support for Ruby 2.4 and add support for Ruby 3.0
|
27
|
+
|
28
|
+
### 0.14.1 / 2021-01-27
|
11
29
|
|
12
30
|
* Fix OAuth1 signature with duplicate query param names
|
13
31
|
|
14
|
-
|
32
|
+
### 0.14.0 / 2020-03-31
|
15
33
|
|
16
34
|
* Support for fetching ID tokens from google oauth2 endpoint.
|
17
35
|
|
18
|
-
|
36
|
+
### 0.13.2 / 2020-03-25
|
19
37
|
|
20
38
|
Rerelease of 0.13.1.
|
21
39
|
|
22
|
-
|
40
|
+
### 0.13.1 / 2020-03-24
|
23
41
|
|
24
42
|
* Update github url
|
25
43
|
|
26
|
-
|
44
|
+
### 0.13.0 / 2020-02-24
|
27
45
|
|
28
46
|
* Support Faraday 1.x
|
29
47
|
|
30
|
-
|
48
|
+
### 0.12.0 / 2019-10-08
|
31
49
|
|
32
50
|
* This version now requires Ruby 2.4.
|
33
51
|
* Support array values of the "aud" field.
|
34
52
|
* Normalize the version constant to match related gems.
|
35
53
|
|
36
|
-
|
54
|
+
### 0.11.0 / 2018-10-08
|
37
55
|
|
38
56
|
* Add constant time comparison for oauth signatures.
|
39
57
|
|
40
|
-
|
58
|
+
### 0.10.0 / 2018-09-21
|
41
59
|
|
42
60
|
* Add UnexpectedStatusError class for http status errors that are not handled.
|
43
61
|
|
44
|
-
|
62
|
+
### 0.9.2 / 2018-09-12
|
45
63
|
|
46
64
|
* Update issued_at correctly when it is set simultaneously with expires_in.
|
47
65
|
|
48
|
-
|
66
|
+
### 0.9.1 / 2018-08-29
|
49
67
|
|
50
68
|
* Warn on EOL ruby versions.
|
51
69
|
* Fix DateTime normalization.
|
52
70
|
|
53
|
-
|
71
|
+
### 0.9.0 / 2018-08-20
|
54
72
|
|
55
73
|
* Add RemoteServerError class for 5xx level errors.
|
56
74
|
* Allow to_json to be called with arguments
|
57
75
|
* Expires_in now sets and reflects current expires_at value
|
58
76
|
* Expires_within(0) now returns false when expires_at is nil.
|
59
77
|
|
60
|
-
|
78
|
+
### 0.8.1 / 2017-10-13
|
61
79
|
|
62
80
|
* Restore support for Ruby 1.9.3
|
63
81
|
|
64
|
-
|
82
|
+
### 0.8.0 / 2017-10-12
|
65
83
|
|
66
84
|
* Ensure the "expires_at" attribute is recalculated on refresh (chutzimir)
|
67
85
|
* Fix warnings on Ruby 2.4 (koic)
|
@@ -69,20 +87,20 @@ Rerelease of 0.13.1.
|
|
69
87
|
* Provide signature verification algorithm for compatibility with ruby-jwt 2.0 (jurriaan)
|
70
88
|
* Signet::OAuth2::Client#decoded_id_token can take a keyfinder block (mvastola)
|
71
89
|
|
72
|
-
|
90
|
+
### 0.7.3 / 2016-06-20
|
73
91
|
|
74
92
|
* Fix timestamp parsing on 32-bit systems
|
75
93
|
* Fix expiration check when issue/expiry times are nil
|
76
94
|
|
77
|
-
|
95
|
+
### 0.7.2 / 2015-12-21
|
78
96
|
|
79
97
|
* Don't assume Faraday form encoding middleware is present
|
80
98
|
|
81
|
-
|
99
|
+
### 0.7.1 / 2015-12-17
|
82
100
|
|
83
101
|
* Fix an issue with date parsing
|
84
102
|
|
85
|
-
|
103
|
+
### 0.7 / 2015-12-06
|
86
104
|
|
87
105
|
* No longer overwrite SSL environment variables.
|
88
106
|
* Tighten up date & URL (de)serialization for OAuth2 client
|
@@ -91,7 +109,7 @@ Rerelease of 0.13.1.
|
|
91
109
|
* Add expires_within(sec) method to oauth2 client to facilitate proactive
|
92
110
|
refreshes
|
93
111
|
|
94
|
-
|
112
|
+
### 0.6.1 / 2015-06-08
|
95
113
|
|
96
114
|
* Fix language warnings for unused & shadowed variables ((@blowmage)[])
|
97
115
|
* Update SSL cert path for OSX ((@gambaroff)[])
|
@@ -99,14 +117,14 @@ Rerelease of 0.13.1.
|
|
99
117
|
* Fix incorrect parameter name in OAuth2 client docs ((@samuelreh)[])
|
100
118
|
* Fix symbolization of URL parameter keys ((@swifthand)[])
|
101
119
|
|
102
|
-
|
120
|
+
### 0.6.0 / 2014-12-05
|
103
121
|
|
104
122
|
* Drop support for ruby versions < 1.9.3
|
105
123
|
* Update gem dependencies and lock down versions tighter
|
106
124
|
* Allow form encoded responses when exchanging OAuth 2 authorization codes
|
107
125
|
* Normalize options keys for indifferent access
|
108
126
|
|
109
|
-
|
127
|
+
### 0.5.1 / 2014-06-08
|
110
128
|
|
111
129
|
* Allow Hash objects to be used to initialize authorization URI
|
112
130
|
* Added PLAINTEXT and RSA-SHA1 signature methods to OAuth 1 support
|
@@ -114,53 +132,53 @@ Rerelease of 0.13.1.
|
|
114
132
|
* The `approval_prompt` option no longer defaults to `:force`
|
115
133
|
* The `approval_prompt` and `prompt` are now mutually exclusive.
|
116
134
|
|
117
|
-
|
135
|
+
### 0.5.0 / 2013-05-31
|
118
136
|
|
119
137
|
* Switched to faraday 0.9.0
|
120
138
|
* Added `expires_at` option
|
121
139
|
|
122
|
-
|
140
|
+
### 0.4.5
|
123
141
|
|
124
142
|
* Minor documentation fixes
|
125
143
|
* Allow postmessage as a valid redirect_uri in OAuth 2
|
126
144
|
|
127
|
-
|
145
|
+
### 0.4.4
|
128
146
|
|
129
147
|
* Add support for assertion profile
|
130
148
|
|
131
|
-
|
149
|
+
### 0.4.3
|
132
150
|
|
133
151
|
* Added method to clear credentials
|
134
152
|
|
135
|
-
|
153
|
+
### 0.4.2
|
136
154
|
|
137
155
|
* Backwards compatibility for MultiJson
|
138
156
|
|
139
|
-
|
157
|
+
### 0.4.1
|
140
158
|
|
141
159
|
* Updated Launchy dependency
|
142
160
|
|
143
|
-
|
161
|
+
### 0.4.0
|
144
162
|
|
145
163
|
* Added OAuth 1 server implementation
|
146
164
|
* Updated Faraday dependency
|
147
165
|
|
148
|
-
|
166
|
+
### 0.3.4
|
149
167
|
|
150
168
|
* Attempts to auto-detect CA cert location
|
151
169
|
|
152
|
-
|
170
|
+
### 0.3.3
|
153
171
|
|
154
172
|
* Request objects no longer recreated during processing
|
155
173
|
* Faraday middleware now supported
|
156
174
|
* Streamed requests now supported
|
157
175
|
* Fixed assertion profiles; client ID/secret omission no longer an error
|
158
176
|
|
159
|
-
|
177
|
+
### 0.3.2
|
160
178
|
|
161
179
|
* Added audience security check for ID tokens
|
162
180
|
|
163
|
-
|
181
|
+
### 0.3.1
|
164
182
|
|
165
183
|
* Fixed a warning while determining grant type
|
166
184
|
* Removed requirement that a connection be supplied when authorizing requests
|
@@ -168,52 +186,52 @@ Rerelease of 0.13.1.
|
|
168
186
|
* Fixed some documentation stuff around markdown formatting
|
169
187
|
* Added support for Google Code wiki format output when generating docs
|
170
188
|
|
171
|
-
|
189
|
+
### 0.3.0
|
172
190
|
|
173
191
|
* Replaced httpadapter gem dependency with faraday
|
174
192
|
* Replaced json gem dependency with multi_json
|
175
193
|
* Updated to OAuth 2.0 draft 22
|
176
194
|
* Complete test coverage
|
177
195
|
|
178
|
-
|
196
|
+
### 0.2.4
|
179
197
|
|
180
198
|
* Updated to incorporate changes to the Google OAuth endpoints
|
181
199
|
|
182
|
-
|
200
|
+
### 0.2.3
|
183
201
|
|
184
202
|
* Added support for JWT-formatted ID tokens.
|
185
203
|
* Added :issued_at option to #update_token! method.
|
186
204
|
|
187
|
-
|
205
|
+
### 0.2.2
|
188
206
|
|
189
207
|
* Lowered requirements for json gem
|
190
208
|
|
191
|
-
|
209
|
+
### 0.2.1
|
192
210
|
|
193
211
|
* Updated to keep in sync with the new httpadapter changes
|
194
212
|
|
195
|
-
|
213
|
+
### 0.2.0
|
196
214
|
|
197
215
|
* Added support for OAuth 2.0 draft 10
|
198
216
|
|
199
|
-
|
217
|
+
### 0.1.4
|
200
218
|
|
201
219
|
* Added support for a two-legged authorization flow
|
202
220
|
|
203
|
-
|
221
|
+
### 0.1.3
|
204
222
|
|
205
223
|
* Fixed issue with headers passed in as a Hash
|
206
224
|
* Fixed incompatibilities with Ruby 1.8.6
|
207
225
|
|
208
|
-
|
226
|
+
### 0.1.2
|
209
227
|
|
210
228
|
* Fixed bug with overzealous normalization
|
211
229
|
|
212
|
-
|
230
|
+
### 0.1.1
|
213
231
|
|
214
232
|
* Fixed bug with missing StringIO require
|
215
233
|
* Fixed issue with dependency on unreleased features of addressable
|
216
234
|
|
217
|
-
|
235
|
+
### 0.1.0
|
218
236
|
|
219
237
|
* Initial release
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project,
|
4
|
+
and in the interest of fostering an open and welcoming community,
|
5
|
+
we pledge to respect all people who contribute through reporting issues,
|
6
|
+
posting feature requests, updating documentation,
|
7
|
+
submitting pull requests or patches, and other activities.
|
8
|
+
|
9
|
+
We are committed to making participation in this project
|
10
|
+
a harassment-free experience for everyone,
|
11
|
+
regardless of level of experience, gender, gender identity and expression,
|
12
|
+
sexual orientation, disability, personal appearance,
|
13
|
+
body size, race, ethnicity, age, religion, or nationality.
|
14
|
+
|
15
|
+
Examples of unacceptable behavior by participants include:
|
16
|
+
|
17
|
+
* The use of sexualized language or imagery
|
18
|
+
* Personal attacks
|
19
|
+
* Trolling or insulting/derogatory comments
|
20
|
+
* Public or private harassment
|
21
|
+
* Publishing other's private information,
|
22
|
+
such as physical or electronic
|
23
|
+
addresses, without explicit permission
|
24
|
+
* Other unethical or unprofessional conduct.
|
25
|
+
|
26
|
+
Project maintainers have the right and responsibility to remove, edit, or reject
|
27
|
+
comments, commits, code, wiki edits, issues, and other contributions
|
28
|
+
that are not aligned to this Code of Conduct.
|
29
|
+
By adopting this Code of Conduct,
|
30
|
+
project maintainers commit themselves to fairly and consistently
|
31
|
+
applying these principles to every aspect of managing this project.
|
32
|
+
Project maintainers who do not follow or enforce the Code of Conduct
|
33
|
+
may be permanently removed from the project team.
|
34
|
+
|
35
|
+
This code of conduct applies both within project spaces and in public spaces
|
36
|
+
when an individual is representing the project or its community.
|
37
|
+
|
38
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior
|
39
|
+
may be reported by opening an issue
|
40
|
+
or contacting one or more of the project maintainers.
|
41
|
+
|
42
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0,
|
43
|
+
available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)
|
data/SECURITY.md
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
# Security Policy
|
2
|
+
|
3
|
+
To report a security issue, please use [g.co/vulnz](https://g.co/vulnz).
|
4
|
+
|
5
|
+
The Google Security Team will respond within 5 working days of your report on g.co/vulnz.
|
6
|
+
|
7
|
+
We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue.
|
@@ -926,7 +926,7 @@ module Signet
|
|
926
926
|
|
927
927
|
content_type = request["Content-Type"].to_s
|
928
928
|
content_type = content_type.split(";", 2).first if content_type.index ";"
|
929
|
-
if request.
|
929
|
+
if request.http_method == :post && content_type == "application/x-www-form-urlencoded"
|
930
930
|
# Serializes the body in case a hash/array was passed. Noop if already string like
|
931
931
|
encoder = Faraday::Request::UrlEncoded.new(->(_env) {})
|
932
932
|
encoder.call env
|
@@ -152,12 +152,12 @@ module Signet
|
|
152
152
|
# @return [Hash] normalized request components
|
153
153
|
def verify_request_components options = {}
|
154
154
|
if options[:request]
|
155
|
-
if options[:request].is_a?
|
155
|
+
if options[:request].is_a? Faraday::Request
|
156
156
|
request = options[:request]
|
157
157
|
elsif options[:adapter]
|
158
158
|
request = options[:adapter].adapt_request options[:request]
|
159
159
|
end
|
160
|
-
method = request.
|
160
|
+
method = request.http_method
|
161
161
|
uri = request.path
|
162
162
|
headers = request.headers
|
163
163
|
body = request.body
|
@@ -458,7 +458,7 @@ module Signet
|
|
458
458
|
# can't have been signed correctly(5849#3.4.1.3)
|
459
459
|
unless post_parameters.sort == auth_hash.reject { |k, _v| k.index "oauth_" }.to_a.sort
|
460
460
|
raise MalformedAuthorizationError, "Request is of type application/x-www-form-urlencoded " \
|
461
|
-
|
461
|
+
"but Authentication header did not include form values"
|
462
462
|
end
|
463
463
|
end
|
464
464
|
|
data/lib/signet/oauth_1.rb
CHANGED
@@ -20,6 +20,7 @@ require "signet/errors"
|
|
20
20
|
require "signet/oauth_2"
|
21
21
|
require "jwt"
|
22
22
|
require "date"
|
23
|
+
require "time"
|
23
24
|
|
24
25
|
module Signet
|
25
26
|
module OAuth2
|
@@ -880,13 +881,13 @@ module Signet
|
|
880
881
|
end
|
881
882
|
|
882
883
|
def grant_type= new_grant_type
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
884
|
+
@grant_type =
|
885
|
+
case new_grant_type
|
886
|
+
when "authorization_code", "refresh_token", "password", "client_credentials"
|
887
|
+
new_grant_type
|
888
|
+
else
|
889
|
+
Addressable::URI.parse new_grant_type
|
890
|
+
end
|
890
891
|
end
|
891
892
|
|
892
893
|
def to_jwt options = {}
|
@@ -972,8 +973,8 @@ module Signet
|
|
972
973
|
end
|
973
974
|
parameters.merge! extension_parameters
|
974
975
|
end
|
975
|
-
parameters["client_id"] = client_id
|
976
|
-
parameters["client_secret"] = client_secret
|
976
|
+
parameters["client_id"] = client_id if !options[:use_basic_auth] && !client_id.nil?
|
977
|
+
parameters["client_secret"] = client_secret if !options[:use_basic_auth] && !client_secret.nil?
|
977
978
|
if options[:scope]
|
978
979
|
parameters["scope"] = options[:scope]
|
979
980
|
elsif options[:use_configured_scope] && !scope.nil?
|
@@ -990,10 +991,18 @@ module Signet
|
|
990
991
|
options = deep_hash_normalize options
|
991
992
|
|
992
993
|
client = options[:connection] ||= Faraday.default_connection
|
993
|
-
url = Addressable::URI.parse
|
994
|
+
url = Addressable::URI.parse token_credential_uri
|
994
995
|
parameters = generate_access_token_request options
|
995
996
|
if client.is_a? Faraday::Connection
|
996
|
-
|
997
|
+
if options[:use_basic_auth]
|
998
|
+
# The Basic Auth middleware usage differs before and after Faraday v2
|
999
|
+
if Gem::Version.new(Faraday::VERSION).segments.first >= 2
|
1000
|
+
client.request :authorization, :basic, client_id, client_secret
|
1001
|
+
else
|
1002
|
+
client.request :basic_auth, client_id, client_secret
|
1003
|
+
end
|
1004
|
+
end
|
1005
|
+
response = client.post url.normalize.to_s,
|
997
1006
|
Addressable::URI.form_encode(parameters),
|
998
1007
|
"Content-Type" => "application/x-www-form-urlencoded"
|
999
1008
|
status = response.status.to_i
|
@@ -1001,7 +1010,11 @@ module Signet
|
|
1001
1010
|
content_type = response.headers["Content-type"]
|
1002
1011
|
else
|
1003
1012
|
# Hurley
|
1004
|
-
|
1013
|
+
if options[:use_basic_auth]
|
1014
|
+
url.user = client_id
|
1015
|
+
url.password = client_secret
|
1016
|
+
end
|
1017
|
+
response = client.post url.normalize.to_s, parameters
|
1005
1018
|
status = response.status_code.to_i
|
1006
1019
|
body = response.body
|
1007
1020
|
content_type = response.header[:content_type]
|
data/lib/signet/oauth_2.rb
CHANGED
@@ -16,7 +16,7 @@ require "base64"
|
|
16
16
|
require "signet"
|
17
17
|
require "multi_json"
|
18
18
|
|
19
|
-
module Signet
|
19
|
+
module Signet # :nodoc:
|
20
20
|
##
|
21
21
|
# An implementation of http://tools.ietf.org/html/draft-ietf-oauth-v2-10
|
22
22
|
#
|
@@ -78,7 +78,7 @@ module Signet #:nodoc:
|
|
78
78
|
when %r{^application/json.*}
|
79
79
|
MultiJson.load body
|
80
80
|
when %r{^application/x-www-form-urlencoded.*}
|
81
|
-
|
81
|
+
Addressable::URI.form_unencode(body).to_h
|
82
82
|
else
|
83
83
|
raise ArgumentError, "Invalid content type '#{content_type}'"
|
84
84
|
end
|
data/lib/signet/version.rb
CHANGED
data/lib/signet.rb
CHANGED