class Authzed::GrpcUtil::BearerToken
Constants
- AUTHORIZATION_HEADER
- SCHEMA
Attributes
token[R]
Public Class Methods
new(token:)
click to toggle source
# File lib/grpcutil/bearer_token.rb, line 12 def initialize(token:) @token = token end
Public Instance Methods
bidi_streamer(requests: nil, call: nil, method: nil, metadata: nil) { || ... }
click to toggle source
Intercept a BiDi streaming call
@param [Enumerable] requests @param [GRPC::ActiveCall] call @param [String] method @param [Hash] metadata
# File lib/grpcutil/bearer_token.rb, line 63 def bidi_streamer(requests: nil, call: nil, method: nil, metadata: nil) metadata[AUTHORIZATION_HEADER] = bearer_token_header yield end
client_streamer(requests: nil, call: nil, method: nil, metadata: nil) { || ... }
click to toggle source
Intercept a client streaming call
@param [Enumerable] requests @param [GRPC::ActiveCall] call @param [String] method @param [Hash] metadata
# File lib/grpcutil/bearer_token.rb, line 37 def client_streamer(requests: nil, call: nil, method: nil, metadata: nil) metadata[AUTHORIZATION_HEADER] = bearer_token_header yield end
request_response(request: nil, call: nil, method: nil, metadata: nil) { || ... }
click to toggle source
Intercept a unary request response call
@param [Object] request @param [GRPC::ActiveCall] call @param [String] method @param [Hash] metadata
# File lib/grpcutil/bearer_token.rb, line 24 def request_response(request: nil, call: nil, method: nil, metadata: nil) metadata[AUTHORIZATION_HEADER] = bearer_token_header yield end
server_streamer(request: nil, call: nil, method: nil, metadata: nil) { || ... }
click to toggle source
Intercept a server streaming call
@param [Object] request @param [GRPC::ActiveCall] call @param [String] method @param [Hash] metadata
# File lib/grpcutil/bearer_token.rb, line 50 def server_streamer(request: nil, call: nil, method: nil, metadata: nil) metadata[AUTHORIZATION_HEADER] = bearer_token_header yield end
Private Instance Methods
bearer_token_header()
click to toggle source
# File lib/grpcutil/bearer_token.rb, line 70 def bearer_token_header "#{SCHEMA} #{token}" end