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

Function canSkipCSRFCheck

pkg/webmiddleware/csrf.go:75–85  ·  view source on GitHub ↗
(r *http.Request)

Source from the content-addressed store, hash-verified

73}
74
75func canSkipCSRFCheck(r *http.Request) bool {
76 authVal := r.Header.Get("Authorization")
77 if !strings.HasPrefix(authVal, "Bearer ") {
78 return true // Unauthenticated requests don't need CSRF protection.
79 }
80 _, _, _, err := auth.SplitToken(strings.TrimPrefix(authVal, "Bearer "))
81 if err != nil {
82 return true // Unsupported Bearer tokens don't need CSRF protection.
83 }
84 return false
85}

Callers 1

CSRFFunction · 0.85

Calls 4

SplitTokenFunction · 0.92
TrimPrefixMethod · 0.80
GetMethod · 0.65
HasPrefixMethod · 0.45

Tested by

no test coverage detected