Class: SslTestService

Inherits:
Object show all
Includes:
GRPC::GenericService
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/grpc-1.50.0-x86_64-linux/src/ruby/spec/client_auth_spec.rb

Overview

a test service that checks the cert of its peer

Instance Method Summary collapse

Methods included from GRPC::GenericService

included, underscore

Instance Method Details

#a_bidi_rpc(requests, call) ⇒ Object



71
72
73
74
75
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/grpc-1.50.0-x86_64-linux/src/ruby/spec/client_auth_spec.rb', line 71

def a_bidi_rpc(requests, call)
  check_peer_cert(call)
  requests.each { |r| GRPC.logger.info(r) }
  [EchoMsg.new, EchoMsg.new]
end

#a_client_streaming_rpc(call) ⇒ Object



60
61
62
63
64
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/grpc-1.50.0-x86_64-linux/src/ruby/spec/client_auth_spec.rb', line 60

def a_client_streaming_rpc(call)
  check_peer_cert(call)
  call.each_remote_read.each { |r| GRPC.logger.info(r) }
  EchoMsg.new
end

#a_server_streaming_rpc(_, call) ⇒ Object



66
67
68
69
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/grpc-1.50.0-x86_64-linux/src/ruby/spec/client_auth_spec.rb', line 66

def a_server_streaming_rpc(_, call)
  check_peer_cert(call)
  [EchoMsg.new, EchoMsg.new]
end

#an_rpc(req, call) ⇒ Object



55
56
57
58
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/grpc-1.50.0-x86_64-linux/src/ruby/spec/client_auth_spec.rb', line 55

def an_rpc(req, call)
  check_peer_cert(call)
  req
end

#check_peer_cert(call) ⇒ Object



50
51
52
53
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/grpc-1.50.0-x86_64-linux/src/ruby/spec/client_auth_spec.rb', line 50

def check_peer_cert(call)
  error_msg = "want:\n#{client_cert}\n\ngot:\n#{call.peer_cert}"
  fail(error_msg) unless call.peer_cert == client_cert
end