signet 0.18.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +1 -1
- data/lib/signet/oauth_1/server.rb +17 -17
- data/lib/signet/oauth_1/signature_methods/hmac_sha1.rb +1 -3
- data/lib/signet/oauth_1/signature_methods/plaintext.rb +1 -3
- data/lib/signet/oauth_1/signature_methods/rsa_sha1.rb +1 -4
- data/lib/signet/oauth_2/client.rb +2 -2
- data/lib/signet/oauth_2.rb +1 -3
- data/lib/signet/version.rb +1 -1
- metadata +7 -114
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1675b044a5f99fc5f04389a81dcadf14f9f5525783d02fdafadd9d40d7e87104
|
4
|
+
data.tar.gz: 7d97c5ad00f374d705e008a58a3612249e9b116a6f4b59de0968a9588f9e2150
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56c95f62c17e1a58c5a71bbfadf0d3a1d02f04f49674b0ecda55a6067e78ba729fa01e18ef505f3dc099cb1960eab85892036d52042720d43a6939c68c0f0544
|
7
|
+
data.tar.gz: 936392e750f79c138812c0e716d6e4cf173a2d368f49a3064d456d0ddc999ad5bf949923a3c75f506b34fec8e072a37a13e2d4a73dbcc94f78c859976de6f9bb
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 0.20.0 (2025-04-30)
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* Updated minimum Ruby version to 3.1 ([#253](https://github.com/googleapis/signet/issues/253))
|
8
|
+
|
9
|
+
### 0.19.0 (2024-02-01)
|
10
|
+
|
11
|
+
#### Features
|
12
|
+
|
13
|
+
* Update minimum Ruby version to 2.7
|
14
|
+
|
3
15
|
### 0.18.0 (2023-09-01)
|
4
16
|
|
5
17
|
#### Features
|
data/README.md
CHANGED
@@ -59,7 +59,7 @@ Be sure `https://rubygems.org` is in your gem sources.
|
|
59
59
|
|
60
60
|
## Supported Ruby Versions
|
61
61
|
|
62
|
-
This library is supported on Ruby
|
62
|
+
This library is supported on Ruby 3.0+.
|
63
63
|
|
64
64
|
Google provides official support for Ruby versions that are actively supported
|
65
65
|
by Ruby Core—that is, Ruby versions that are either in normal maintenance or
|
@@ -75,7 +75,7 @@ module Signet
|
|
75
75
|
nonce =
|
76
76
|
@nonce_timestamp.call nonce, timestamp
|
77
77
|
end
|
78
|
-
nonce
|
78
|
+
!!nonce
|
79
79
|
end
|
80
80
|
|
81
81
|
##
|
@@ -112,9 +112,9 @@ module Signet
|
|
112
112
|
# Call a credential lookup, and cast the result to a proper Credential.
|
113
113
|
#
|
114
114
|
# @param [Proc] credential to call.
|
115
|
-
# @param [String] key provided to the Proc in
|
115
|
+
# @param [String] key provided to the Proc in `credential`
|
116
116
|
# @return [Signet::OAuth1::Credential] credential provided by
|
117
|
-
#
|
117
|
+
# `credential` (if any).
|
118
118
|
def call_credential_lookup credential, key
|
119
119
|
cred = credential.call key if
|
120
120
|
credential.respond_to? :call
|
@@ -134,17 +134,17 @@ module Signet
|
|
134
134
|
#
|
135
135
|
# @param [String] verifier Key provided to the {#verifier} Proc.
|
136
136
|
# @return [Boolean] if the verifier Proc returns anything other than
|
137
|
-
#
|
137
|
+
# `nil` or `false`
|
138
138
|
def find_verifier verifier
|
139
139
|
verified = @verifier.call verifier if @verifier.respond_to? :call
|
140
|
-
verified
|
140
|
+
!!verified
|
141
141
|
end
|
142
142
|
|
143
143
|
##
|
144
144
|
# Validate and normalize the components from an HTTP request.
|
145
145
|
# @overload verify_request_components(options)
|
146
146
|
# @param [Faraday::Request] request A pre-constructed request to verify.
|
147
|
-
# @param [String] method the HTTP method , defaults to
|
147
|
+
# @param [String] method the HTTP method , defaults to `GET`
|
148
148
|
# @param [Addressable::URI, String] uri the URI .
|
149
149
|
# @param [Hash, Array] headers the HTTP headers.
|
150
150
|
# @param [StringIO, String] body The HTTP body.
|
@@ -199,7 +199,7 @@ module Signet
|
|
199
199
|
##
|
200
200
|
# @overload request_realm(options)
|
201
201
|
# @param [Hash] request A pre-constructed request to verify.
|
202
|
-
# @param [String] method the HTTP method , defaults to
|
202
|
+
# @param [String] method the HTTP method , defaults to `GET`
|
203
203
|
# @param [Addressable::URI, String] uri the URI .
|
204
204
|
# @param [Hash, Array] headers the HTTP headers.
|
205
205
|
# @param [StringIO, String] body The HTTP body.
|
@@ -228,16 +228,16 @@ module Signet
|
|
228
228
|
|
229
229
|
##
|
230
230
|
# Authenticates a temporary credential request. If no oauth_callback is
|
231
|
-
# present in the request,
|
231
|
+
# present in the request, `oob` will be returned.
|
232
232
|
#
|
233
233
|
# @overload authenticate_temporary_credential_request(options)
|
234
234
|
# @param [Hash] request The configuration parameters for the request.
|
235
|
-
# @param [String] method the HTTP method , defaults to
|
235
|
+
# @param [String] method the HTTP method , defaults to `GET`
|
236
236
|
# @param [Addressable::URI, String] uri the URI .
|
237
237
|
# @param [Hash, Array] headers the HTTP headers.
|
238
238
|
# @param [StringIO, String] body The HTTP body.
|
239
239
|
# @param [HTTPAdapter] adapter The HTTP adapter(optional).
|
240
|
-
# @return [String] The oauth_callback value, or
|
240
|
+
# @return [String] The oauth_callback value, or `false` if not valid.
|
241
241
|
def authenticate_temporary_credential_request options = {}
|
242
242
|
verifications = {
|
243
243
|
client_credential: lambda { |_x|
|
@@ -279,7 +279,7 @@ module Signet
|
|
279
279
|
method,
|
280
280
|
uri,
|
281
281
|
# Realm isn't used, and will throw the signature off.
|
282
|
-
auth_hash.
|
282
|
+
auth_hash.except("realm").to_a,
|
283
283
|
client_credential_secret,
|
284
284
|
nil
|
285
285
|
)
|
@@ -298,13 +298,13 @@ module Signet
|
|
298
298
|
# Authenticates a token credential request.
|
299
299
|
# @overload authenticate_token_credential_request(options)
|
300
300
|
# @param [Hash] request The configuration parameters for the request.
|
301
|
-
# @param [String] method the HTTP method , defaults to
|
301
|
+
# @param [String] method the HTTP method , defaults to `GET`
|
302
302
|
# @param [Addressable::URI, String] uri the URI .
|
303
303
|
# @param [Hash, Array] headers the HTTP headers.
|
304
304
|
# @param [StringIO, String] body The HTTP body.
|
305
305
|
# @param [HTTPAdapter] adapter The HTTP adapter(optional).
|
306
306
|
# @return [Hash] A hash of credentials and realm for a valid request,
|
307
|
-
# or
|
307
|
+
# or `nil` if not valid.
|
308
308
|
def authenticate_token_credential_request options = {}
|
309
309
|
verifications = {
|
310
310
|
client_credential: lambda { |_x|
|
@@ -353,7 +353,7 @@ module Signet
|
|
353
353
|
method,
|
354
354
|
uri,
|
355
355
|
# Realm isn't used, and will throw the signature off.
|
356
|
-
auth_hash.
|
356
|
+
auth_hash.except("realm").to_a,
|
357
357
|
client_credential.secret,
|
358
358
|
temporary_credential.secret
|
359
359
|
)
|
@@ -368,7 +368,7 @@ module Signet
|
|
368
368
|
# Authenticates a request for a protected resource.
|
369
369
|
# @overload authenticate_resource_request(options)
|
370
370
|
# @param [Hash] request The configuration parameters for the request.
|
371
|
-
# @param [String] method the HTTP method , defaults to
|
371
|
+
# @param [String] method the HTTP method , defaults to `GET`
|
372
372
|
# @param [Addressable::URI, String] uri the URI .
|
373
373
|
# @param [Hash, Array] headers the HTTP headers.
|
374
374
|
# @param [StringIO, String] body The HTTP body.
|
@@ -376,7 +376,7 @@ module Signet
|
|
376
376
|
# @param [HTTPAdapter] adapter The HTTP adapter(optional).
|
377
377
|
#
|
378
378
|
# @return [Hash] A hash of the credentials and realm for a valid request,
|
379
|
-
# or
|
379
|
+
# or `nil` if not valid.
|
380
380
|
def authenticate_resource_request options = {}
|
381
381
|
verifications = {
|
382
382
|
client_credential: lambda do |_x|
|
@@ -468,7 +468,7 @@ module Signet
|
|
468
468
|
method,
|
469
469
|
uri,
|
470
470
|
# Realm isn't used, and will throw the signature off.
|
471
|
-
auth_hash.
|
471
|
+
auth_hash.except("realm").to_a,
|
472
472
|
client_credential_secret,
|
473
473
|
token_credential_secret
|
474
474
|
)
|
@@ -4,9 +4,7 @@ require "signet"
|
|
4
4
|
module Signet # :nodoc:
|
5
5
|
module OAuth1
|
6
6
|
module HMACSHA1
|
7
|
-
def self.generate_signature
|
8
|
-
base_string, client_credential_secret, token_credential_secret
|
9
|
-
|
7
|
+
def self.generate_signature base_string, client_credential_secret, token_credential_secret
|
10
8
|
# Both the client secret and token secret must be escaped
|
11
9
|
client_credential_secret =
|
12
10
|
Signet::OAuth1.encode client_credential_secret
|
@@ -3,9 +3,7 @@ require "signet"
|
|
3
3
|
module Signet # :nodoc:
|
4
4
|
module OAuth1
|
5
5
|
module PLAINTEXT
|
6
|
-
def self.generate_signature
|
7
|
-
_base_string, client_credential_secret, token_credential_secret
|
8
|
-
|
6
|
+
def self.generate_signature _base_string, client_credential_secret, token_credential_secret
|
9
7
|
# Both the client secret and token secret must be escaped
|
10
8
|
client_credential_secret =
|
11
9
|
Signet::OAuth1.encode client_credential_secret
|
@@ -6,10 +6,7 @@ require "signet"
|
|
6
6
|
module Signet # :nodoc:
|
7
7
|
module OAuth1
|
8
8
|
module RSASHA1
|
9
|
-
def self.generate_signature
|
10
|
-
base_string, client_credential_secret, _token_credential_secret
|
11
|
-
|
12
|
-
|
9
|
+
def self.generate_signature base_string, client_credential_secret, _token_credential_secret
|
13
10
|
private_key = OpenSSL::PKey::RSA.new client_credential_secret
|
14
11
|
signature = private_key.sign OpenSSL::Digest.new("SHA1"), base_string
|
15
12
|
# using strict_encode64 because the encode64 method adds newline characters after ever 60 chars
|
@@ -750,10 +750,10 @@ module Signet
|
|
750
750
|
# omitted.
|
751
751
|
#
|
752
752
|
# @return [String] The decoded ID token.
|
753
|
-
def decoded_id_token
|
753
|
+
def decoded_id_token(public_key = nil, options = {}, &)
|
754
754
|
options[:algorithm] ||= signing_algorithm
|
755
755
|
verify = !public_key.nil? || block_given?
|
756
|
-
payload, _header = JWT.decode(id_token, public_key, verify, options, &
|
756
|
+
payload, _header = JWT.decode(id_token, public_key, verify, options, &)
|
757
757
|
raise Signet::UnsafeOperationError, "No ID token audience declared." unless payload.key? "aud"
|
758
758
|
unless Array(payload["aud"]).include?(client_id)
|
759
759
|
raise Signet::UnsafeOperationError,
|
data/lib/signet/oauth_2.rb
CHANGED
@@ -114,9 +114,7 @@ module Signet # :nodoc:
|
|
114
114
|
#
|
115
115
|
# @return [String]
|
116
116
|
# The value for the HTTP Basic Authorization header.
|
117
|
-
def self.generate_bearer_authorization_header
|
118
|
-
access_token, auth_params = nil
|
119
|
-
|
117
|
+
def self.generate_bearer_authorization_header access_token, auth_params = nil
|
120
118
|
# TODO: escaping?
|
121
119
|
header = "Bearer #{access_token}"
|
122
120
|
if auth_params && !auth_params.empty?
|
data/lib/signet/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: signet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
- Steven Bazyl
|
9
|
-
autorequire:
|
7
|
+
- Google LLC
|
10
8
|
bindir: bin
|
11
9
|
cert_chain: []
|
12
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
13
11
|
dependencies:
|
14
12
|
- !ruby/object:Gem::Dependency
|
15
13
|
name: addressable
|
@@ -79,114 +77,11 @@ dependencies:
|
|
79
77
|
- - "~>"
|
80
78
|
- !ruby/object:Gem::Version
|
81
79
|
version: '1.10'
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
|
-
name: google-style
|
84
|
-
requirement: !ruby/object:Gem::Requirement
|
85
|
-
requirements:
|
86
|
-
- - "~>"
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: 1.26.1
|
89
|
-
type: :development
|
90
|
-
prerelease: false
|
91
|
-
version_requirements: !ruby/object:Gem::Requirement
|
92
|
-
requirements:
|
93
|
-
- - "~>"
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: 1.26.1
|
96
|
-
- !ruby/object:Gem::Dependency
|
97
|
-
name: kramdown
|
98
|
-
requirement: !ruby/object:Gem::Requirement
|
99
|
-
requirements:
|
100
|
-
- - "~>"
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: '1.5'
|
103
|
-
type: :development
|
104
|
-
prerelease: false
|
105
|
-
version_requirements: !ruby/object:Gem::Requirement
|
106
|
-
requirements:
|
107
|
-
- - "~>"
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '1.5'
|
110
|
-
- !ruby/object:Gem::Dependency
|
111
|
-
name: launchy
|
112
|
-
requirement: !ruby/object:Gem::Requirement
|
113
|
-
requirements:
|
114
|
-
- - "~>"
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
version: '2.4'
|
117
|
-
type: :development
|
118
|
-
prerelease: false
|
119
|
-
version_requirements: !ruby/object:Gem::Requirement
|
120
|
-
requirements:
|
121
|
-
- - "~>"
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
version: '2.4'
|
124
|
-
- !ruby/object:Gem::Dependency
|
125
|
-
name: rake
|
126
|
-
requirement: !ruby/object:Gem::Requirement
|
127
|
-
requirements:
|
128
|
-
- - "~>"
|
129
|
-
- !ruby/object:Gem::Version
|
130
|
-
version: '13.0'
|
131
|
-
type: :development
|
132
|
-
prerelease: false
|
133
|
-
version_requirements: !ruby/object:Gem::Requirement
|
134
|
-
requirements:
|
135
|
-
- - "~>"
|
136
|
-
- !ruby/object:Gem::Version
|
137
|
-
version: '13.0'
|
138
|
-
- !ruby/object:Gem::Dependency
|
139
|
-
name: redcarpet
|
140
|
-
requirement: !ruby/object:Gem::Requirement
|
141
|
-
requirements:
|
142
|
-
- - "~>"
|
143
|
-
- !ruby/object:Gem::Version
|
144
|
-
version: '3.0'
|
145
|
-
type: :development
|
146
|
-
prerelease: false
|
147
|
-
version_requirements: !ruby/object:Gem::Requirement
|
148
|
-
requirements:
|
149
|
-
- - "~>"
|
150
|
-
- !ruby/object:Gem::Version
|
151
|
-
version: '3.0'
|
152
|
-
- !ruby/object:Gem::Dependency
|
153
|
-
name: rspec
|
154
|
-
requirement: !ruby/object:Gem::Requirement
|
155
|
-
requirements:
|
156
|
-
- - "~>"
|
157
|
-
- !ruby/object:Gem::Version
|
158
|
-
version: '3.1'
|
159
|
-
type: :development
|
160
|
-
prerelease: false
|
161
|
-
version_requirements: !ruby/object:Gem::Requirement
|
162
|
-
requirements:
|
163
|
-
- - "~>"
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
version: '3.1'
|
166
|
-
- !ruby/object:Gem::Dependency
|
167
|
-
name: yard
|
168
|
-
requirement: !ruby/object:Gem::Requirement
|
169
|
-
requirements:
|
170
|
-
- - "~>"
|
171
|
-
- !ruby/object:Gem::Version
|
172
|
-
version: '0.9'
|
173
|
-
- - ">="
|
174
|
-
- !ruby/object:Gem::Version
|
175
|
-
version: 0.9.12
|
176
|
-
type: :development
|
177
|
-
prerelease: false
|
178
|
-
version_requirements: !ruby/object:Gem::Requirement
|
179
|
-
requirements:
|
180
|
-
- - "~>"
|
181
|
-
- !ruby/object:Gem::Version
|
182
|
-
version: '0.9'
|
183
|
-
- - ">="
|
184
|
-
- !ruby/object:Gem::Version
|
185
|
-
version: 0.9.12
|
186
80
|
description: 'Signet is an OAuth 1.0 / OAuth 2.0 implementation.
|
187
81
|
|
188
82
|
'
|
189
|
-
email:
|
83
|
+
email:
|
84
|
+
- googleapis-packages@google.com
|
190
85
|
executables: []
|
191
86
|
extensions: []
|
192
87
|
extra_rdoc_files:
|
@@ -217,7 +112,6 @@ metadata:
|
|
217
112
|
changelog_uri: https://github.com/googleapis/signet/blob/main/CHANGELOG.md
|
218
113
|
source_code_uri: https://github.com/googleapis/signet
|
219
114
|
bug_tracker_uri: https://github.com/googleapis/signet/issues
|
220
|
-
post_install_message:
|
221
115
|
rdoc_options:
|
222
116
|
- "--main"
|
223
117
|
- README.md
|
@@ -227,15 +121,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
227
121
|
requirements:
|
228
122
|
- - ">="
|
229
123
|
- !ruby/object:Gem::Version
|
230
|
-
version: '
|
124
|
+
version: '3.1'
|
231
125
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
232
126
|
requirements:
|
233
127
|
- - ">="
|
234
128
|
- !ruby/object:Gem::Version
|
235
129
|
version: 1.3.5
|
236
130
|
requirements: []
|
237
|
-
rubygems_version: 3.
|
238
|
-
signing_key:
|
131
|
+
rubygems_version: 3.6.8
|
239
132
|
specification_version: 4
|
240
133
|
summary: Signet is an OAuth 1.0 / OAuth 2.0 implementation.
|
241
134
|
test_files: []
|