aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar murgatroid99 <mlumish@google.com>2016-01-05 15:13:08 -0800
committerGravatar murgatroid99 <mlumish@google.com>2016-01-05 15:13:08 -0800
commit00450af7113814d4dd8b5402373d18d53784dfad (patch)
tree65c458b1d7214b67fdb599ad30b170c82c01a407 /src
parenta4d3d2c76bd66c8e4e6e0f379594a9d3dd5a4464 (diff)
Made ruby per-rpc creds interop use auth plugin API
Diffstat (limited to 'src')
-rw-r--r--src/ruby/lib/grpc.rb4
-rwxr-xr-xsrc/ruby/pb/test/client.rb18
2 files changed, 13 insertions, 9 deletions
diff --git a/src/ruby/lib/grpc.rb b/src/ruby/lib/grpc.rb
index 228fbe366c..1671ba3550 100644
--- a/src/ruby/lib/grpc.rb
+++ b/src/ruby/lib/grpc.rb
@@ -1,4 +1,4 @@
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -27,7 +27,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-ssl_roots_path = File.expand_path('../../../etc/roots.pem', __FILE__)
+ssl_roots_path = File.expand_path('../../../../etc/roots.pem', __FILE__)
unless ENV['GRPC_DEFAULT_SSL_ROOTS_FILE_PATH']
ENV['GRPC_DEFAULT_SSL_ROOTS_FILE_PATH'] = ssl_roots_path
end
diff --git a/src/ruby/pb/test/client.rb b/src/ruby/pb/test/client.rb
index 94bfff1260..4e77492ba9 100755
--- a/src/ruby/pb/test/client.rb
+++ b/src/ruby/pb/test/client.rb
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -266,16 +266,20 @@ class NamedTests
def per_rpc_creds
auth_creds = Google::Auth.get_application_default(@args.oauth_scope)
- kw = auth_creds.updater_proc.call({})
+ update_metadata = proc do |md|
+ kw = auth_creds.updater_proc.call({})
- # TODO(jtattermusch): downcase the metadata keys here to make sure
- # they are not rejected by C core. This is a hotfix that should
- # be addressed by introducing auto-downcasing logic.
- kw = Hash[ kw.each_pair.map { |k, v| [k.downcase, v] }]
+ # TODO(mlumish): downcase the metadata keys here to make sure
+ # they are not rejected by C core. This is a hotfix that should
+ # be addressed by introducing auto-downcasing logic.
+ Hash[ kw.each_pair.map { |k, v| [k.downcase, v] }]
+ end
+
+ call_creds = GRPC::Core::CallCredentials.new(update_metadata)
resp = perform_large_unary(fill_username: true,
fill_oauth_scope: true,
- **kw)
+ credentials: call_creds)
json_key = File.read(ENV[AUTH_ENV])
wanted_email = MultiJson.load(json_key)['client_email']
assert("#{__callee__}: bad username") { wanted_email == resp.username }