class StatelyDB::Common::Auth::Interceptor
GRPC interceptor to authenticate against Stately and append bearer tokens to outgoing requests
def add_jwt_to_grpc_request(metadata:)
- Api: - private
Returns:
-
(void)-
Parameters:
-
metadata(Hash) -- The metadata hash
def add_jwt_to_grpc_request(metadata:) metadata["authorization"] = "Bearer #{@token_provider.get_token}" end
def bidi_streamer(requests:, call:, method:, metadata:) # rubocop:disable Lint/UnusedMethodArgument
- Api: - private
Returns:
-
(Enumerator)- The response enumerator
Parameters:
-
metadata(Hash) -- The metadata hash -
method(Symbol) -- The method being called -
call(::GRPC::ActiveCall) -- The active call object -
requests(Enumerable) -- The list of requests
def bidi_streamer(requests:, call:, method:, metadata:) # rubocop:disable Lint/UnusedMethodArgument add_jwt_to_grpc_request(metadata:) yield end
def client_streamer(requests:, call:, method:, metadata:) # rubocop:disable Lint/UnusedMethodArgument
- Api: - private
Returns:
-
(Enumerator)- The response enumerator
Parameters:
-
metadata(Hash) -- The metadata hash -
method(Symbol) -- The method being called -
call(::GRPC::ActiveCall) -- The active call object -
requests(Enumerable) -- The list of requests
def client_streamer(requests:, call:, method:, metadata:) # rubocop:disable Lint/UnusedMethodArgument add_jwt_to_grpc_request(metadata:) yield end
def initialize(
-
token_provider(StatelyDB::Common::Auth::TokenProvider) -- The token provider to use for authentication
def initialize( token_provider: AuthTokenProvider.new ) super() @token_provider = token_provider end
def request_response(request:, call:, method:, metadata:) # rubocop:disable Lint/UnusedMethodArgument
- Api: - private
Returns:
-
(Object)- The response object
Parameters:
-
metadata(Hash) -- The metadata hash -
method(Symbol) -- The method being called -
call(::GRPC::ActiveCall) -- The active call object -
request(Object) -- The request object
def request_response(request:, call:, method:, metadata:) # rubocop:disable Lint/UnusedMethodArgument add_jwt_to_grpc_request(metadata:) yield end
def server_streamer(request:, call:, method:, metadata:) # rubocop:disable Lint/UnusedMethodArgument
- Api: - private
Returns:
-
(Enumerator)- The response enumerator
Parameters:
-
metadata(Hash) -- The metadata hash -
method(Symbol) -- The method being called -
call(::GRPC::ActiveCall) -- The active call object -
request(Object) -- The request object
def server_streamer(request:, call:, method:, metadata:) # rubocop:disable Lint/UnusedMethodArgument add_jwt_to_grpc_request(metadata:) yield end