signet 0.14.1 → 0.16.1
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/.yardopts +11 -0
- data/CHANGELOG.md +26 -2
- data/CODE_OF_CONDUCT.md +43 -0
- data/README.md +10 -7
- data/SECURITY.md +7 -0
- data/lib/signet/oauth_1/client.rb +51 -72
- data/lib/signet/oauth_1/credential.rb +3 -11
- data/lib/signet/oauth_1/server.rb +7 -29
- 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 +2 -2
- data/lib/signet/oauth_1.rb +11 -21
- data/lib/signet/oauth_2/client.rb +36 -58
- data/lib/signet/oauth_2.rb +10 -14
- data/lib/signet/version.rb +1 -1
- data/lib/signet.rb +5 -8
- metadata +32 -32
- data/Gemfile +0 -8
- data/Rakefile +0 -112
- data/signet.gemspec +0 -44
- 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
@@ -3,7 +3,7 @@ require "base64"
|
|
3
3
|
require "openssl"
|
4
4
|
require "signet"
|
5
5
|
|
6
|
-
module Signet
|
6
|
+
module Signet # :nodoc:
|
7
7
|
module OAuth1
|
8
8
|
module RSASHA1
|
9
9
|
def self.generate_signature \
|
@@ -11,7 +11,7 @@ module Signet #:nodoc:
|
|
11
11
|
|
12
12
|
|
13
13
|
private_key = OpenSSL::PKey::RSA.new client_credential_secret
|
14
|
-
signature = private_key.sign OpenSSL::Digest
|
14
|
+
signature = private_key.sign OpenSSL::Digest.new("SHA1"), base_string
|
15
15
|
# using strict_encode64 because the encode64 method adds newline characters after ever 60 chars
|
16
16
|
Base64.strict_encode64(signature).strip
|
17
17
|
end
|
data/lib/signet/oauth_1.rb
CHANGED
@@ -3,7 +3,7 @@ require "signet"
|
|
3
3
|
|
4
4
|
require "securerandom"
|
5
5
|
|
6
|
-
module Signet
|
6
|
+
module Signet # :nodoc:
|
7
7
|
module OAuth1
|
8
8
|
OUT_OF_BAND = "oob".freeze
|
9
9
|
|
@@ -49,9 +49,8 @@ module Signet #:nodoc:
|
|
49
49
|
#
|
50
50
|
# @return [String] A random nonce.
|
51
51
|
def self.generate_nonce
|
52
|
-
SecureRandom.random_bytes(16).unpack("H*").join
|
52
|
+
SecureRandom.random_bytes(16).unpack("H*").join
|
53
53
|
end
|
54
|
-
# rubocop:disable Metrics/MethodLength
|
55
54
|
|
56
55
|
##
|
57
56
|
# Processes an options <code>Hash</code> to find a credential key value.
|
@@ -65,7 +64,7 @@ module Signet #:nodoc:
|
|
65
64
|
# @return [String] The credential key value.
|
66
65
|
def self.extract_credential_key_option credential_type, options
|
67
66
|
# Normalize key to String to allow indifferent access.
|
68
|
-
options = options.
|
67
|
+
options = options.to_h.transform_keys(&:to_s)
|
69
68
|
credential_key = "#{credential_type}_credential_key"
|
70
69
|
credential = "#{credential_type}_credential"
|
71
70
|
if options[credential_key]
|
@@ -107,7 +106,7 @@ module Signet #:nodoc:
|
|
107
106
|
# @return [String] The credential secret value.
|
108
107
|
def self.extract_credential_secret_option credential_type, options
|
109
108
|
# Normalize key to String to allow indifferent access.
|
110
|
-
options = options.
|
109
|
+
options = options.to_h.transform_keys(&:to_s)
|
111
110
|
credential_secret = "#{credential_type}_credential_secret"
|
112
111
|
credential = "#{credential_type}_credential"
|
113
112
|
if options[credential_secret]
|
@@ -136,7 +135,6 @@ module Signet #:nodoc:
|
|
136
135
|
end
|
137
136
|
credential_secret
|
138
137
|
end
|
139
|
-
# rubocop:enable Metrics/MethodLength
|
140
138
|
|
141
139
|
##
|
142
140
|
# Normalizes a set of OAuth parameters according to the algorithm given
|
@@ -214,7 +212,7 @@ module Signet #:nodoc:
|
|
214
212
|
realm = realm.gsub '"', '\"'
|
215
213
|
parameter_list.unshift "realm=\"#{realm}\""
|
216
214
|
end
|
217
|
-
"OAuth
|
215
|
+
"OAuth #{parameter_list.join ', '}"
|
218
216
|
end
|
219
217
|
|
220
218
|
##
|
@@ -228,7 +226,7 @@ module Signet #:nodoc:
|
|
228
226
|
when /^OAuth$/i
|
229
227
|
# Other token types may be supported eventually
|
230
228
|
pairs = Signet.parse_auth_param_list(field_value[/^OAuth\s+(.*)$/i, 1])
|
231
|
-
|
229
|
+
(pairs.each_with_object [] do |(k, v), accu|
|
232
230
|
if k != "realm"
|
233
231
|
k = unencode k
|
234
232
|
v = unencode v
|
@@ -274,24 +272,18 @@ module Signet #:nodoc:
|
|
274
272
|
# be a temporary credential secret when obtaining a token credential
|
275
273
|
# for the first time
|
276
274
|
base_string = generate_base_string method, uri, parameters
|
277
|
-
parameters = parameters.
|
275
|
+
parameters = parameters.to_h.transform_keys(&:to_s)
|
278
276
|
signature_method = parameters["oauth_signature_method"]
|
279
277
|
case signature_method
|
280
278
|
when "HMAC-SHA1"
|
281
279
|
require "signet/oauth_1/signature_methods/hmac_sha1"
|
282
|
-
|
283
|
-
base_string, client_credential_secret, token_credential_secret
|
284
|
-
)
|
280
|
+
Signet::OAuth1::HMACSHA1.generate_signature base_string, client_credential_secret, token_credential_secret
|
285
281
|
when "RSA-SHA1"
|
286
282
|
require "signet/oauth_1/signature_methods/rsa_sha1"
|
287
|
-
|
288
|
-
base_string, client_credential_secret, token_credential_secret
|
289
|
-
)
|
283
|
+
Signet::OAuth1::RSASHA1.generate_signature base_string, client_credential_secret, token_credential_secret
|
290
284
|
when "PLAINTEXT"
|
291
285
|
require "signet/oauth_1/signature_methods/plaintext"
|
292
|
-
|
293
|
-
base_string, client_credential_secret, token_credential_secret
|
294
|
-
)
|
286
|
+
Signet::OAuth1::PLAINTEXT.generate_signature base_string, client_credential_secret, token_credential_secret
|
295
287
|
else
|
296
288
|
raise NotImplementedError,
|
297
289
|
"Unsupported signature method: #{signature_method}"
|
@@ -396,7 +388,7 @@ module Signet #:nodoc:
|
|
396
388
|
raise ArgumentError, "Missing :client_credential_key parameter." if client_credential_key.nil?
|
397
389
|
raise ArgumentError, "Missing :temporary_credential_key parameter." if temporary_credential_key.nil?
|
398
390
|
raise ArgumentError, "Missing :verifier parameter." if options[:verifier].nil?
|
399
|
-
|
391
|
+
[
|
400
392
|
["oauth_consumer_key", client_credential_key],
|
401
393
|
["oauth_token", temporary_credential_key],
|
402
394
|
["oauth_signature_method", options[:signature_method]],
|
@@ -405,8 +397,6 @@ module Signet #:nodoc:
|
|
405
397
|
["oauth_verifier", options[:verifier]],
|
406
398
|
["oauth_version", "1.0"]
|
407
399
|
]
|
408
|
-
# No additional parameters allowed here
|
409
|
-
parameters
|
410
400
|
end
|
411
401
|
|
412
402
|
##
|
@@ -110,9 +110,6 @@ module Signet
|
|
110
110
|
@access_type = nil
|
111
111
|
update! options
|
112
112
|
end
|
113
|
-
# rubocop:disable Metrics/AbcSize
|
114
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
115
|
-
# rubocop:disable Metrics/PerceivedComplexity
|
116
113
|
|
117
114
|
##
|
118
115
|
# Updates an OAuth 2.0 client.
|
@@ -202,13 +199,10 @@ module Signet
|
|
202
199
|
self.signing_key = options[:signing_key] if options.key? :signing_key
|
203
200
|
self.extension_parameters = options[:extension_parameters] || {}
|
204
201
|
self.additional_parameters = options[:additional_parameters] || {}
|
205
|
-
self.access_type = options.fetch
|
202
|
+
self.access_type = options.fetch :access_type, :offline
|
206
203
|
update_token! options
|
207
204
|
self
|
208
205
|
end
|
209
|
-
# rubocop:enable Metrics/AbcSize
|
210
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
211
|
-
# rubocop:enable Metrics/PerceivedComplexity
|
212
206
|
|
213
207
|
##
|
214
208
|
# Updates an OAuth 2.0 client.
|
@@ -261,10 +255,6 @@ module Signet
|
|
261
255
|
|
262
256
|
self
|
263
257
|
end
|
264
|
-
# rubocop:disable Metrics/AbcSize
|
265
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
266
|
-
# rubocop:disable Metrics/MethodLength
|
267
|
-
# rubocop:disable Metrics/PerceivedComplexity
|
268
258
|
|
269
259
|
##
|
270
260
|
# Returns the authorization URI that the user should be redirected to.
|
@@ -290,9 +280,7 @@ module Signet
|
|
290
280
|
options[:state] = state unless options[:state]
|
291
281
|
options.merge!(additional_parameters.merge(options[:additional_parameters] || {}))
|
292
282
|
options.delete :additional_parameters
|
293
|
-
options =
|
294
|
-
[key.to_s, option]
|
295
|
-
end]
|
283
|
+
options = options.transform_keys(&:to_s)
|
296
284
|
uri = Addressable::URI.parse(
|
297
285
|
::Signet::OAuth2.generate_authorization_uri(
|
298
286
|
@authorization_uri, options
|
@@ -304,10 +292,6 @@ module Signet
|
|
304
292
|
end
|
305
293
|
uri
|
306
294
|
end
|
307
|
-
# rubocop:enable Metrics/AbcSize
|
308
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
309
|
-
# rubocop:enable Metrics/MethodLength
|
310
|
-
# rubocop:enable Metrics/PerceivedComplexity
|
311
295
|
|
312
296
|
##
|
313
297
|
# Sets the authorization URI for this client.
|
@@ -423,7 +407,7 @@ module Signet
|
|
423
407
|
end
|
424
408
|
@scope = new_scope
|
425
409
|
when String
|
426
|
-
@scope = new_scope.split
|
410
|
+
@scope = new_scope.split
|
427
411
|
when nil
|
428
412
|
@scope = nil
|
429
413
|
else
|
@@ -793,12 +777,12 @@ module Signet
|
|
793
777
|
# @param [String, Integer, nil] new_expires_in
|
794
778
|
# The access token lifetime.
|
795
779
|
def expires_in= new_expires_in
|
796
|
-
if
|
797
|
-
@issued_at = Time.now
|
798
|
-
@expires_at = @issued_at + new_expires_in.to_i
|
799
|
-
else
|
780
|
+
if new_expires_in.nil?
|
800
781
|
@expires_at = nil
|
801
782
|
@issued_at = nil
|
783
|
+
else
|
784
|
+
@issued_at = Time.now
|
785
|
+
@expires_at = @issued_at + new_expires_in.to_i
|
802
786
|
end
|
803
787
|
end
|
804
788
|
|
@@ -896,13 +880,13 @@ module Signet
|
|
896
880
|
end
|
897
881
|
|
898
882
|
def grant_type= new_grant_type
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
883
|
+
@grant_type =
|
884
|
+
case new_grant_type
|
885
|
+
when "authorization_code", "refresh_token", "password", "client_credentials"
|
886
|
+
new_grant_type
|
887
|
+
else
|
888
|
+
Addressable::URI.parse new_grant_type
|
889
|
+
end
|
906
890
|
end
|
907
891
|
|
908
892
|
def to_jwt options = {}
|
@@ -922,8 +906,6 @@ module Signet
|
|
922
906
|
assertion["sub"] = sub unless sub.nil?
|
923
907
|
JWT.encode assertion, signing_key, signing_algorithm
|
924
908
|
end
|
925
|
-
# rubocop:disable Style/MethodDefParentheses
|
926
|
-
# rubocop:disable Metrics/AbcSize
|
927
909
|
|
928
910
|
##
|
929
911
|
# Serialize the client object to JSON.
|
@@ -931,7 +913,7 @@ module Signet
|
|
931
913
|
# @note A serialized client contains sensitive information. Persist or transmit with care.
|
932
914
|
#
|
933
915
|
# @return [String] A serialized JSON representation of the client.
|
934
|
-
def to_json
|
916
|
+
def to_json *_args
|
935
917
|
MultiJson.dump(
|
936
918
|
"authorization_uri" => authorization_uri ? authorization_uri.to_s : nil,
|
937
919
|
"token_credential_uri" => token_credential_uri ? token_credential_uri.to_s : nil,
|
@@ -956,10 +938,6 @@ module Signet
|
|
956
938
|
"extension_parameters" => extension_parameters
|
957
939
|
)
|
958
940
|
end
|
959
|
-
# rubocop:enable Style/MethodDefParentheses
|
960
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
961
|
-
# rubocop:disable Metrics/MethodLength
|
962
|
-
# rubocop:disable Metrics/PerceivedComplexity
|
963
941
|
|
964
942
|
##
|
965
943
|
# Generates a request for token credentials.
|
@@ -994,8 +972,8 @@ module Signet
|
|
994
972
|
end
|
995
973
|
parameters.merge! extension_parameters
|
996
974
|
end
|
997
|
-
parameters["client_id"] = client_id
|
998
|
-
parameters["client_secret"] = client_secret
|
975
|
+
parameters["client_id"] = client_id if !options[:use_basic_auth] && !client_id.nil?
|
976
|
+
parameters["client_secret"] = client_secret if !options[:use_basic_auth] && !client_secret.nil?
|
999
977
|
if options[:scope]
|
1000
978
|
parameters["scope"] = options[:scope]
|
1001
979
|
elsif options[:use_configured_scope] && !scope.nil?
|
@@ -1005,8 +983,6 @@ module Signet
|
|
1005
983
|
additional.each { |k, v| parameters[k.to_s] = v }
|
1006
984
|
parameters
|
1007
985
|
end
|
1008
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
1009
|
-
# rubocop:enable Metrics/PerceivedComplexity
|
1010
986
|
|
1011
987
|
def fetch_access_token options = {}
|
1012
988
|
raise ArgumentError, "Missing token endpoint URI." if token_credential_uri.nil?
|
@@ -1014,10 +990,18 @@ module Signet
|
|
1014
990
|
options = deep_hash_normalize options
|
1015
991
|
|
1016
992
|
client = options[:connection] ||= Faraday.default_connection
|
1017
|
-
url = Addressable::URI.parse
|
993
|
+
url = Addressable::URI.parse token_credential_uri
|
1018
994
|
parameters = generate_access_token_request options
|
1019
995
|
if client.is_a? Faraday::Connection
|
1020
|
-
|
996
|
+
if options[:use_basic_auth]
|
997
|
+
# The Basic Auth middleware usage differs before and after Faraday v2
|
998
|
+
if Gem::Version.new(Faraday::VERSION).segments.first >= 2
|
999
|
+
client.request :authorization, :basic, client_id, client_secret
|
1000
|
+
else
|
1001
|
+
client.request :basic_auth, client_id, client_secret
|
1002
|
+
end
|
1003
|
+
end
|
1004
|
+
response = client.post url.normalize.to_s,
|
1021
1005
|
Addressable::URI.form_encode(parameters),
|
1022
1006
|
"Content-Type" => "application/x-www-form-urlencoded"
|
1023
1007
|
status = response.status.to_i
|
@@ -1025,7 +1009,11 @@ module Signet
|
|
1025
1009
|
content_type = response.headers["Content-type"]
|
1026
1010
|
else
|
1027
1011
|
# Hurley
|
1028
|
-
|
1012
|
+
if options[:use_basic_auth]
|
1013
|
+
url.user = client_id
|
1014
|
+
url.password = client_secret
|
1015
|
+
end
|
1016
|
+
response = client.post url.normalize.to_s, parameters
|
1029
1017
|
status = response.status_code.to_i
|
1030
1018
|
body = response.body
|
1031
1019
|
content_type = response.header[:content_type]
|
@@ -1035,20 +1023,16 @@ module Signet
|
|
1035
1023
|
|
1036
1024
|
message = " Server message:\n#{response.body.to_s.strip}" unless body.to_s.strip.empty?
|
1037
1025
|
if [400, 401, 403].include? status
|
1038
|
-
message = "Authorization failed
|
1039
|
-
raise ::Signet::AuthorizationError.new
|
1040
|
-
message, response: response
|
1041
|
-
)
|
1026
|
+
message = "Authorization failed.#{message}"
|
1027
|
+
raise ::Signet::AuthorizationError.new message, response: response
|
1042
1028
|
elsif status.to_s[0] == "5"
|
1043
|
-
message = "Remote server error
|
1029
|
+
message = "Remote server error.#{message}"
|
1044
1030
|
raise ::Signet::RemoteServerError, message
|
1045
1031
|
else
|
1046
|
-
message = "Unexpected status code: #{response.status}
|
1032
|
+
message = "Unexpected status code: #{response.status}.#{message}"
|
1047
1033
|
raise ::Signet::UnexpectedStatusError, message
|
1048
1034
|
end
|
1049
1035
|
end
|
1050
|
-
# rubocop:enable Metrics/AbcSize
|
1051
|
-
# rubocop:enable Metrics/MethodLength
|
1052
1036
|
|
1053
1037
|
def fetch_access_token! options = {}
|
1054
1038
|
token_hash = fetch_access_token options
|
@@ -1068,9 +1052,6 @@ module Signet
|
|
1068
1052
|
def refresh! options = {}
|
1069
1053
|
fetch_access_token! options
|
1070
1054
|
end
|
1071
|
-
# rubocop:disable Metrics/AbcSize
|
1072
|
-
# rubocop:disable Metrics/MethodLength
|
1073
|
-
# rubocop:disable Metrics/PerceivedComplexity
|
1074
1055
|
|
1075
1056
|
##
|
1076
1057
|
# Generates an authenticated request for protected resources.
|
@@ -1137,9 +1118,6 @@ module Signet
|
|
1137
1118
|
request["Cache-Control"] = "no-store"
|
1138
1119
|
request
|
1139
1120
|
end
|
1140
|
-
# rubocop:enable Metrics/AbcSize
|
1141
|
-
# rubocop:enable Metrics/MethodLength
|
1142
|
-
# rubocop:enable Metrics/PerceivedComplexity
|
1143
1121
|
|
1144
1122
|
##
|
1145
1123
|
# Transmits a request for a protected resource.
|
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
|
#
|
@@ -28,10 +28,10 @@ module Signet #:nodoc:
|
|
28
28
|
case auth_scheme
|
29
29
|
when /^Basic$/i
|
30
30
|
# HTTP Basic is allowed in OAuth 2
|
31
|
-
|
31
|
+
parse_basic_credentials(field_value[/^Basic\s+(.*)$/i, 1])
|
32
32
|
when /^OAuth$/i
|
33
33
|
# Other token types may be supported eventually
|
34
|
-
|
34
|
+
parse_bearer_credentials(field_value[/^OAuth\s+(.*)$/i, 1])
|
35
35
|
else
|
36
36
|
raise ParseError,
|
37
37
|
"Parsing non-OAuth Authorization headers is out of scope."
|
@@ -43,7 +43,7 @@ module Signet #:nodoc:
|
|
43
43
|
case auth_scheme
|
44
44
|
when /^OAuth$/i
|
45
45
|
# Other token types may be supported eventually
|
46
|
-
|
46
|
+
parse_oauth_challenge(field_value[/^OAuth\s+(.*)$/i, 1])
|
47
47
|
else
|
48
48
|
raise ParseError,
|
49
49
|
"Parsing non-OAuth WWW-Authenticate headers is out of scope."
|
@@ -76,9 +76,9 @@ module Signet #:nodoc:
|
|
76
76
|
raise TypeError, "Expected String, got #{body.class}." unless body.is_a? String
|
77
77
|
case content_type
|
78
78
|
when %r{^application/json.*}
|
79
|
-
|
79
|
+
MultiJson.load body
|
80
80
|
when %r{^application/x-www-form-urlencoded.*}
|
81
|
-
|
81
|
+
Hash[Addressable::URI.form_unencode(body)]
|
82
82
|
else
|
83
83
|
raise ArgumentError, "Invalid content type '#{content_type}'"
|
84
84
|
end
|
@@ -100,9 +100,8 @@ module Signet #:nodoc:
|
|
100
100
|
raise ArgumentError,
|
101
101
|
"A client identifier may not contain a ':' character."
|
102
102
|
end
|
103
|
-
|
104
|
-
|
105
|
-
).delete("\n")
|
103
|
+
token = Base64.encode64("#{client_id}:#{client_password}").delete("\n")
|
104
|
+
"Basic #{token}"
|
106
105
|
end
|
107
106
|
|
108
107
|
##
|
@@ -121,11 +120,8 @@ module Signet #:nodoc:
|
|
121
120
|
# TODO: escaping?
|
122
121
|
header = "Bearer #{access_token}"
|
123
122
|
if auth_params && !auth_params.empty?
|
124
|
-
|
125
|
-
|
126
|
-
accu << "#{key}=\"#{value}\""
|
127
|
-
end).join(", ")
|
128
|
-
)
|
123
|
+
additional_headers = auth_params.map { |key, value| "#{key}=\"#{value}\"" }
|
124
|
+
header = ([header] + additional_headers).join ", "
|
129
125
|
end
|
130
126
|
header
|
131
127
|
end
|
data/lib/signet/version.rb
CHANGED
data/lib/signet.rb
CHANGED
@@ -14,9 +14,7 @@
|
|
14
14
|
|
15
15
|
require "signet/version"
|
16
16
|
|
17
|
-
module Signet
|
18
|
-
# rubocop:disable Metrics/AbcSize
|
19
|
-
# rubocop:disable Metrics/MethodLength
|
17
|
+
module Signet # :nodoc:
|
20
18
|
def self.parse_auth_param_list auth_param_string
|
21
19
|
# Production rules from:
|
22
20
|
# http://tools.ietf.org/html/draft-ietf-httpbis-p1-messaging-12
|
@@ -54,11 +52,12 @@ module Signet #:nodoc:
|
|
54
52
|
# Now parse the auth-param pair strings & turn them into key-value pairs.
|
55
53
|
(auth_param_pairs.each_with_object [] do |pair, accu|
|
56
54
|
name, value = pair.split "=", 2
|
57
|
-
|
55
|
+
case value
|
56
|
+
when /^".*"$/
|
58
57
|
value = value.gsub(/^"(.*)"$/, '\1').gsub(/\\(.)/, '\1')
|
59
|
-
|
58
|
+
when /^'.*'$/
|
60
59
|
value = value.gsub(/^'(.*)'$/, '\1').gsub(/\\(.)/, '\1')
|
61
|
-
|
60
|
+
when %r{[()<>@,;:\\"/\[\]?={}]}
|
62
61
|
# Certain special characters are not allowed
|
63
62
|
raise ParseError,
|
64
63
|
"Unexpected characters in auth param " \
|
@@ -68,6 +67,4 @@ module Signet #:nodoc:
|
|
68
67
|
accu << [name, value]
|
69
68
|
end)
|
70
69
|
end
|
71
|
-
# rubocop:enable Metrics/AbcSize
|
72
|
-
# rubocop:enable Metrics/MethodLength
|
73
70
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: signet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.16.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Aman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-02-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: addressable
|
@@ -17,34 +17,34 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '2.
|
20
|
+
version: '2.8'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '2.
|
27
|
+
version: '2.8'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: faraday
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 0.17.
|
34
|
+
version: 0.17.5
|
35
35
|
- - "<"
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: '
|
37
|
+
version: '3.0'
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
41
|
requirements:
|
42
42
|
- - ">="
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
version: 0.17.
|
44
|
+
version: 0.17.5
|
45
45
|
- - "<"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '3.0'
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: jwt
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|
@@ -85,14 +85,14 @@ dependencies:
|
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version:
|
88
|
+
version: 1.25.1
|
89
89
|
type: :development
|
90
90
|
prerelease: false
|
91
91
|
version_requirements: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version:
|
95
|
+
version: 1.25.1
|
96
96
|
- !ruby/object:Gem::Dependency
|
97
97
|
name: kramdown
|
98
98
|
requirement: !ruby/object:Gem::Requirement
|
@@ -127,14 +127,28 @@ dependencies:
|
|
127
127
|
requirements:
|
128
128
|
- - "~>"
|
129
129
|
- !ruby/object:Gem::Version
|
130
|
-
version: '
|
130
|
+
version: '13.0'
|
131
131
|
type: :development
|
132
132
|
prerelease: false
|
133
133
|
version_requirements: !ruby/object:Gem::Requirement
|
134
134
|
requirements:
|
135
135
|
- - "~>"
|
136
136
|
- !ruby/object:Gem::Version
|
137
|
-
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'
|
138
152
|
- !ruby/object:Gem::Dependency
|
139
153
|
name: rspec
|
140
154
|
requirement: !ruby/object:Gem::Requirement
|
@@ -192,11 +206,12 @@ extensions: []
|
|
192
206
|
extra_rdoc_files:
|
193
207
|
- README.md
|
194
208
|
files:
|
209
|
+
- ".yardopts"
|
195
210
|
- CHANGELOG.md
|
196
|
-
-
|
211
|
+
- CODE_OF_CONDUCT.md
|
197
212
|
- LICENSE
|
198
213
|
- README.md
|
199
|
-
-
|
214
|
+
- SECURITY.md
|
200
215
|
- lib/signet.rb
|
201
216
|
- lib/signet/errors.rb
|
202
217
|
- lib/signet/oauth_1.rb
|
@@ -209,26 +224,11 @@ files:
|
|
209
224
|
- lib/signet/oauth_2.rb
|
210
225
|
- lib/signet/oauth_2/client.rb
|
211
226
|
- lib/signet/version.rb
|
212
|
-
- signet.gemspec
|
213
|
-
- spec/signet/oauth_1/client_spec.rb
|
214
|
-
- spec/signet/oauth_1/credential_spec.rb
|
215
|
-
- spec/signet/oauth_1/server_spec.rb
|
216
|
-
- spec/signet/oauth_1/signature_methods/hmac_sha1_spec.rb
|
217
|
-
- spec/signet/oauth_1/signature_methods/plaintext_spec.rb
|
218
|
-
- spec/signet/oauth_1/signature_methods/rsa_sha1_spec.rb
|
219
|
-
- spec/signet/oauth_1_spec.rb
|
220
|
-
- spec/signet/oauth_2/client_spec.rb
|
221
|
-
- spec/signet/oauth_2_spec.rb
|
222
|
-
- spec/signet_spec.rb
|
223
|
-
- spec/spec.opts
|
224
|
-
- spec/spec_helper.rb
|
225
|
-
- spec/spec_helper_spec.rb
|
226
|
-
- website/index.html
|
227
227
|
homepage: https://github.com/googleapis/signet
|
228
228
|
licenses:
|
229
229
|
- Apache-2.0
|
230
230
|
metadata:
|
231
|
-
changelog_uri: https://github.com/googleapis/signet/blob/
|
231
|
+
changelog_uri: https://github.com/googleapis/signet/blob/main/CHANGELOG.md
|
232
232
|
source_code_uri: https://github.com/googleapis/signet
|
233
233
|
bug_tracker_uri: https://github.com/googleapis/signet/issues
|
234
234
|
post_install_message:
|
@@ -241,14 +241,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
241
241
|
requirements:
|
242
242
|
- - ">="
|
243
243
|
- !ruby/object:Gem::Version
|
244
|
-
version: 2.
|
244
|
+
version: '2.5'
|
245
245
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
246
246
|
requirements:
|
247
247
|
- - ">="
|
248
248
|
- !ruby/object:Gem::Version
|
249
249
|
version: 1.3.5
|
250
250
|
requirements: []
|
251
|
-
rubygems_version: 3.
|
251
|
+
rubygems_version: 3.3.5
|
252
252
|
signing_key:
|
253
253
|
specification_version: 4
|
254
254
|
summary: Signet is an OAuth 1.0 / OAuth 2.0 implementation.
|