Example of an authenticated gRPC & grpc-gateway HTTP server, and various client connection examples.
- Install Go 1.23 from https://golang.org/
- Run
make compileto compile the server & client code.
make run-server
-
make run-clientruns a gRPC client that sends a token-authenticated request to the gRPC endpoint. -
make run-client-aliceruns a gRPC client that sends a mTLS request to the gRPC endpoint using Alice's certificate & key. -
make run-client-bobruns a gRPC client that sends a mTLS request to the gRPC endpoint using Bob's certificate & key. It will fail since Bob's certificate is not permitted. -
make run-curlinvokes curl to send a token-authenticated request to the HTTP server. -
make run-curl-aliceinvokes curl to send a mTLS request to the HTTP server using Alice's certificate & key. -
make run-curl-bobinvokes curl to send a mTLS request to the HTTP server using Bob's certificate & key. It will fail since Bob's certificate is not permitted. -
make run-grpcurlinvokes grpcurl to send a token-authenticated request to the gRPC server. -
make run-grpcurl-aliceinvokes grpcurl to send a mTLS request to the gRPC server using Alice's certificate & key. -
make run-grpcurl-bobinvokes grpcurl to send a mTLS request to the gRPC server using Bob's certificate & key. It will fail since Bob's certificate is not permitted.
Run make genproto from the root of this project's directory.