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

Function Authorized

pkg/auth/cluster/cluster.go:81–90  ·  view source on GitHub ↗

Authorized returns whether the context has been identified as a cluster call. It panics if it does not inherit from `NewContext`.

(ctx context.Context)

Source from the content-addressed store, hash-verified

79// Authorized returns whether the context has been identified as a cluster call.
80// It panics if it does not inherit from `NewContext`.
81func Authorized(ctx context.Context) error {
82 ok, isStored := ctx.Value(clusterAuthKey).(bool)
83 if !isStored {
84 panic("call source not verified; did you register the cluster authentication hook for this call?")
85 }
86 if ok {
87 return nil
88 }
89 return ctx.Value(clusterAuthFailureKey).(error)
90}

Callers 3

TestAuthorizedFunction · 0.92
TestVerifyFunction · 0.92
ExampleAuthorizedFunction · 0.92

Calls 1

ValueMethod · 0.45

Tested by 3

TestAuthorizedFunction · 0.74
TestVerifyFunction · 0.74
ExampleAuthorizedFunction · 0.74