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

Function authTokenID

pkg/ratelimit/resource.go:52–61  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

50const unauthenticated = "unauthenticated"
51
52func authTokenID(ctx context.Context) string {
53 if authValue := rpcmetadata.FromIncomingContext(ctx).AuthValue; authValue != "" {
54 _, id, _, err := auth.SplitToken(authValue)
55 if err != nil {
56 return unauthenticated
57 }
58 return id
59 }
60 return unauthenticated
61}
62
63var pathTemplate = func(r *http.Request) (string, bool) {
64 route := mux.CurrentRoute(r)

Callers 3

httpRequestResourceFunction · 0.85
grpcMethodResourceFunction · 0.85
grpcStreamAcceptResourceFunction · 0.85

Calls 2

FromIncomingContextFunction · 0.92
SplitTokenFunction · 0.92

Tested by

no test coverage detected