Class: KubeMQ::Interceptors::AuthInterceptor Private
- Inherits:
-
GRPC::ClientInterceptor
- Object
- GRPC::ClientInterceptor
- KubeMQ::Interceptors::AuthInterceptor
- Defined in:
- lib/kubemq/interceptors/auth_interceptor.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
gRPC client interceptor that injects a bearer authentication token into outbound request metadata.
Skips injection for Ping RPCs (which do not require authentication) and when no token is configured.
Instance Method Summary collapse
-
#bidi_streamer(requests:, call:, method:, metadata:, &block) ⇒ Enumerator
private
Bidirectional response stream.
-
#client_streamer(requests:, call:, method:, metadata:, &block) ⇒ Object
private
The RPC response.
-
#initialize(auth_token) ⇒ AuthInterceptor
constructor
private
A new instance of AuthInterceptor.
-
#request_response(request:, call:, method:, metadata:, &block) ⇒ Object
private
The RPC response.
-
#server_streamer(request:, call:, method:, metadata:, &block) ⇒ Enumerator
private
Server response stream.
Constructor Details
#initialize(auth_token) ⇒ AuthInterceptor
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of AuthInterceptor.
19 20 21 22 |
# File 'lib/kubemq/interceptors/auth_interceptor.rb', line 19 def initialize(auth_token) super() @auth_token = auth_token end |
Instance Method Details
#bidi_streamer(requests:, call:, method:, metadata:, &block) ⇒ Enumerator
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns bidirectional response stream.
59 60 61 62 |
# File 'lib/kubemq/interceptors/auth_interceptor.rb', line 59 def bidi_streamer(requests:, call:, method:, metadata:, &block) inject_auth!(, method) block.call(requests, call, method, ) end |
#client_streamer(requests:, call:, method:, metadata:, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the RPC response.
49 50 51 52 |
# File 'lib/kubemq/interceptors/auth_interceptor.rb', line 49 def client_streamer(requests:, call:, method:, metadata:, &block) inject_auth!(, method) block.call(requests, call, method, ) end |
#request_response(request:, call:, method:, metadata:, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the RPC response.
29 30 31 32 |
# File 'lib/kubemq/interceptors/auth_interceptor.rb', line 29 def request_response(request:, call:, method:, metadata:, &block) inject_auth!(, method) block.call(request, call, method, ) end |
#server_streamer(request:, call:, method:, metadata:, &block) ⇒ Enumerator
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns server response stream.
39 40 41 42 |
# File 'lib/kubemq/interceptors/auth_interceptor.rb', line 39 def server_streamer(request:, call:, method:, metadata:, &block) inject_auth!(, method) block.call(request, call, method, ) end |