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

Function WithForwardedAuth

pkg/rpcmetadata/request.go:40–47  ·  view source on GitHub ↗

WithForwardedAuth returns a grpc.CallOption with authentication from the incoming context ctx.

(ctx context.Context, allowInsecure bool)

Source from the content-addressed store, hash-verified

38
39// WithForwardedAuth returns a grpc.CallOption with authentication from the incoming context ctx.
40func WithForwardedAuth(ctx context.Context, allowInsecure bool) (grpc.CallOption, error) {
41 md := FromIncomingContext(ctx)
42 if md.AuthType == "" || md.AuthValue == "" {
43 return nil, errUnauthenticated.New()
44 }
45 md.AllowInsecure = allowInsecure
46 return grpc.PerRPCCredentials(md), nil
47}
48
49const requestIDKey = "x-request-id"
50

Callers 15

GetTemplateMethod · 0.92
GetInfoByGatewayEUIMethod · 0.92
ClaimMethod · 0.92
getEndDevicesMethod · 0.92
callOptFromContextMethod · 0.92
createAPIKeysMethod · 0.92
deleteAPIKeysMethod · 0.92
AuthInfoMethod · 0.92
ApplicationRightsMethod · 0.92
ClientRightsMethod · 0.92
GatewayRightsMethod · 0.92
OrganizationRightsMethod · 0.92

Calls 2

FromIncomingContextFunction · 0.85
NewMethod · 0.65

Tested by 1

TestRequestMetadataFunction · 0.68