commit
0b1dbb67fe
|
@ -490,7 +490,7 @@ module Google
|
||||||
else
|
else
|
||||||
check_cached_certs = lambda do
|
check_cached_certs = lambda do
|
||||||
valid = false
|
valid = false
|
||||||
for key, cert in @certificates
|
for _key, cert in @certificates
|
||||||
begin
|
begin
|
||||||
self.authorization.decoded_id_token(cert.public_key)
|
self.authorization.decoded_id_token(cert.public_key)
|
||||||
valid = true
|
valid = true
|
||||||
|
|
|
@ -31,8 +31,8 @@ module Google
|
||||||
#
|
#
|
||||||
# @return [OpenSSL::PKey] The private key for signing assertions.
|
# @return [OpenSSL::PKey] The private key for signing assertions.
|
||||||
def self.load_from_pkcs12(keyfile, passphrase)
|
def self.load_from_pkcs12(keyfile, passphrase)
|
||||||
load_key(keyfile, passphrase) do |content, passphrase|
|
load_key(keyfile, passphrase) do |content, pass_phrase|
|
||||||
OpenSSL::PKCS12.new(content, passphrase).key
|
OpenSSL::PKCS12.new(content, pass_phrase).key
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -49,8 +49,8 @@ module Google
|
||||||
# @return [OpenSSL::PKey] The private key for signing assertions.
|
# @return [OpenSSL::PKey] The private key for signing assertions.
|
||||||
#
|
#
|
||||||
def self.load_from_pem(keyfile, passphrase)
|
def self.load_from_pem(keyfile, passphrase)
|
||||||
load_key(keyfile, passphrase) do | content, passphrase|
|
load_key(keyfile, passphrase) do | content, pass_phrase|
|
||||||
OpenSSL::PKey::RSA.new(content, passphrase)
|
OpenSSL::PKey::RSA.new(content, pass_phrase)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ module Google
|
||||||
# @params [Object] Storage object
|
# @params [Object] Storage object
|
||||||
def initialize(store)
|
def initialize(store)
|
||||||
@store= store
|
@store= store
|
||||||
|
@authorization = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
|
@ -87,6 +87,7 @@ module Google
|
||||||
# block to be called when result ready
|
# block to be called when result ready
|
||||||
def initialize(options = {}, &block)
|
def initialize(options = {}, &block)
|
||||||
@calls = []
|
@calls = []
|
||||||
|
@global_callback = nil
|
||||||
@global_callback = block if block_given?
|
@global_callback = block if block_given?
|
||||||
@last_auto_id = 0
|
@last_auto_id = 0
|
||||||
|
|
||||||
|
@ -165,7 +166,7 @@ module Google
|
||||||
if @calls.nil? || @calls.empty?
|
if @calls.nil? || @calls.empty?
|
||||||
raise BatchError, 'Cannot make an empty batch request'
|
raise BatchError, 'Cannot make an empty batch request'
|
||||||
end
|
end
|
||||||
parts = @calls.map {|(call_id, call, callback)| serialize_call(call_id, call)}
|
parts = @calls.map {|(call_id, call, _callback)| serialize_call(call_id, call)}
|
||||||
build_multipart(parts, 'multipart/mixed', BATCH_BOUNDARY)
|
build_multipart(parts, 'multipart/mixed', BATCH_BOUNDARY)
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
@ -224,7 +225,7 @@ module Google
|
||||||
raise BatchError, 'Invalid value for Content-ID: "%s"' % header
|
raise BatchError, 'Invalid value for Content-ID: "%s"' % header
|
||||||
end
|
end
|
||||||
|
|
||||||
base, call_id = header[1...-1].split('+')
|
_base, call_id = header[1...-1].split('+')
|
||||||
return Addressable::URI.unencode(call_id)
|
return Addressable::URI.unencode(call_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -268,7 +269,7 @@ module Google
|
||||||
def deserialize_call_response(call_response)
|
def deserialize_call_response(call_response)
|
||||||
outer_headers, outer_body = split_headers_and_body(call_response)
|
outer_headers, outer_body = split_headers_and_body(call_response)
|
||||||
status_line, payload = outer_body.split("\n", 2)
|
status_line, payload = outer_body.split("\n", 2)
|
||||||
protocol, status, reason = status_line.split(' ', 3)
|
_protocol, status, _reason = status_line.split(' ', 3)
|
||||||
|
|
||||||
headers, body = split_headers_and_body(payload)
|
headers, body = split_headers_and_body(payload)
|
||||||
content_id = find_header('Content-ID', outer_headers)
|
content_id = find_header('Content-ID', outer_headers)
|
||||||
|
|
|
@ -244,7 +244,7 @@ module Google
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
request_env = http_request.to_env(connection)
|
http_request.to_env(connection)
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
|
@ -124,7 +124,7 @@ module Google
|
||||||
# Read the entire cache file from disk.
|
# Read the entire cache file from disk.
|
||||||
# Will avoid reading if there have been no changes.
|
# Will avoid reading if there have been no changes.
|
||||||
def read_file
|
def read_file
|
||||||
if !File.exists? @file_path
|
if !File.exist? @file_path
|
||||||
@cache = nil
|
@cache = nil
|
||||||
else
|
else
|
||||||
# Check for changes after our last read or write.
|
# Check for changes after our last read or write.
|
||||||
|
|
Loading…
Reference in New Issue