MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / ClusterAuthStreamHook

Method ClusterAuthStreamHook

pkg/component/grpc.go:119–128  ·  view source on GitHub ↗

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.

()

Source from the content-addressed store, hash-verified

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.
119func (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}

Callers 2

TestHooksFunction · 0.80
NewFunction · 0.80

Implementers 1

Componentpkg/component/component.go

Calls 2

WithVerifiedSourceMethod · 0.65
ContextMethod · 0.65

Tested by 1

TestHooksFunction · 0.64