MCPcopy Index your code
hub / github.com/perkeep/perkeep / authTokenHeaderMatches

Function authTokenHeaderMatches

pkg/auth/auth.go:363–373  ·  view source on GitHub ↗
(req *http.Request)

Source from the content-addressed store, hash-verified

361var uiTokenPattern = regexp.MustCompile(`^Token ([a-zA-Z0-9]+)`)
362
363func authTokenHeaderMatches(req *http.Request) bool {
364 authHeader := req.Header.Get("Authorization")
365 if authHeader == "" {
366 return false
367 }
368 matches := uiTokenPattern.FindStringSubmatch(authHeader)
369 if len(matches) != 2 {
370 return false
371 }
372 return matches[1] == Token()
373}
374
375func websocketTokenMatches(req *http.Request) bool {
376 return req.Method == "GET" &&

Callers 3

AllowedAccessMethod · 0.85
AllowedAccessMethod · 0.85
AllowedAccessMethod · 0.85

Calls 2

TokenFunction · 0.85
GetMethod · 0.65

Tested by

no test coverage detected