RequireNetID returns an error if the given NetID is not authorized in the context.
(ctx context.Context, netID types.NetID)
| 84 | |
| 85 | // RequireNetID returns an error if the given NetID is not authorized in the context. |
| 86 | func (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. |
| 98 | func (Authorizer) RequireASID(ctx context.Context, id string) error { |