HI everyone!

I am very new to gRPC and I need to implement a gRPC interceptor that will 
intercept incoming calls from the client before sending it to the user 
facing API Gateway.

For more context:

I implemented an rbac component as a stand-alone in C++ and the goal is to 
have the gRPC interceptor to perform rbac checks on the user making a call 
to some operation. before sending it off for further processing. I need a 
way to get the service name from the grpc call that is coming to that gw 
server and from there call the code passing that as an argument for the 
check. But I don't see an easy way to extract the service name? Here is my 
boilerplate: 

void rbac_interceptor::Intercept(grpc::experimental::InterceptorBatchMethods
* methods)
{
    // This indicates that the current call is a client call and the client 
is about to send initial metadata.
    if (methods->QueryInterceptionHookPoint(
            grpc::experimental::InterceptionHookPoints::
                PRE_SEND_INITIAL_METADATA)) // Note: 
PRE_SEND_INITIAL_METADATA: Occurs before sending initial metadata
                                            // to the other side (client or 
server).
    {
        // Retrieve the initial metadata sent by the client
        auto recieved_initial_metadata{ methods->GetSendInitialMetadata() };
        
    }

    methods->Proceed();
}

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/b94cbd1a-dcd0-4140-8c21-ef1e19102fben%40googlegroups.com.

Reply via email to