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

Method RequireNetID

pkg/interop/server_authz.go:86–95  ·  view source on GitHub ↗

RequireNetID returns an error if the given NetID is not authorized in the context.

(ctx context.Context, netID types.NetID)

Source from the content-addressed store, hash-verified

84
85// RequireNetID returns an error if the given NetID is not authorized in the context.
86func (Authorizer) RequireNetID(ctx context.Context, netID types.NetID) error {
87 nsAuthInfo, ok := NetworkServerAuthInfoFromContext(ctx)
88 if !ok {
89 return errCallerNotAuthorized.WithAttributes("target", netID.String())
90 }
91 if !nsAuthInfo.NetID.Equal(netID) {
92 return errCallerNotAuthorized.WithAttributes("target", netID.String())
93 }
94 return nil
95}
96
97// RequireASID returns an error if the given AS-ID is not authorized in the context.
98func (Authorizer) RequireASID(ctx context.Context, id string) error {

Callers 1

TestServerFunction · 0.95

Implementers 3

clusterAuthorizerpkg/joinserver/authorizer.go
applicationRightsAuthorizerpkg/joinserver/authorizer.go
Authorizerpkg/interop/server_authz.go

Calls 4

StringMethod · 0.65
EqualMethod · 0.65
WithAttributesMethod · 0.45

Tested by 1

TestServerFunction · 0.76