ClusterAuthStreamHook ensuring the caller of an RPC is part of the cluster. If a call can't be identified as coming from the cluster, it will be discarded.
()
| 117 | // ClusterAuthStreamHook ensuring the caller of an RPC is part of the cluster. |
| 118 | // If a call can't be identified as coming from the cluster, it will be discarded. |
| 119 | func (c *Component) ClusterAuthStreamHook() hooks.StreamHandlerMiddleware { |
| 120 | return func(hdl grpc.StreamHandler) grpc.StreamHandler { |
| 121 | return func(srv any, stream grpc.ServerStream) error { |
| 122 | wrapped := grpc_middleware.WrapServerStream(stream) |
| 123 | ctx := c.cluster.WithVerifiedSource(stream.Context()) |
| 124 | wrapped.WrappedContext = ctx |
| 125 | return hdl(srv, wrapped) |
| 126 | } |
| 127 | } |
| 128 | } |