diff options
author | murgatroid99 <mlumish@google.com> | 2015-12-04 14:36:52 -0800 |
---|---|---|
committer | murgatroid99 <mlumish@google.com> | 2015-12-04 14:36:52 -0800 |
commit | cfa26e1ce7f65f70801cada2f2573437915d5fb8 (patch) | |
tree | cdb0701294660a2fa14175c85253cb0bb4d99a52 /src/ruby/pb/test | |
parent | 9946f2b80a9dcc01fece8b9ddae4c80a77647b9d (diff) |
Plumb CallCredentials through Ruby code, replacing metadata_updater functionality
Diffstat (limited to 'src/ruby/pb/test')
-rwxr-xr-x | src/ruby/pb/test/client.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ruby/pb/test/client.rb b/src/ruby/pb/test/client.rb index 30550d6cc0..198b0395f8 100755 --- a/src/ruby/pb/test/client.rb +++ b/src/ruby/pb/test/client.rb @@ -132,7 +132,8 @@ def create_stub(opts) if wants_creds.include?(opts.test_case) unless opts.oauth_scope.nil? auth_creds = Google::Auth.get_application_default(opts.oauth_scope) - stub_opts[:update_metadata] = auth_creds.updater_proc + call_creds = GRPC::Core::CallCredentials.new(auth_creds.updater_proc) + stub_opts[:creds] = stub_opts[:creds].compose call_creds end end @@ -141,12 +142,14 @@ def create_stub(opts) kw = auth_creds.updater_proc.call({}) # gives as an auth token # use a metadata update proc that just adds the auth token. - stub_opts[:update_metadata] = proc { |md| md.merge(kw) } + call_creds = GRPC::Core::CallCredentials.new(proc { |md| md.merge(kw) }) + stub_opts[:creds] = stub_opts[:creds].compose call_creds end if opts.test_case == 'jwt_token_creds' # don't use a scope auth_creds = Google::Auth.get_application_default - stub_opts[:update_metadata] = auth_creds.updater_proc + call_creds = GRPC::Core::CallCredentials.new(auth_creds.updater_proc) + stub_opts[:creds] = stub_opts[:creds].compose call_creds end GRPC.logger.info("... connecting securely to #{address}") |